From 38a308ce5b15b83f41e2646e50c2bfa7584ca3ab Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 20 Feb 2018 19:52:28 -0800 Subject: Move translate to redux --- packages/website/ts/pages/landing/landing.tsx | 205 +++++++++++++++----------- 1 file changed, 115 insertions(+), 90 deletions(-) (limited to 'packages/website/ts/pages') diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 76ea2e1bd..a7f90f169 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -5,7 +5,8 @@ import DocumentTitle = require('react-document-title'); import { Link } from 'react-router-dom'; import { Footer } from 'ts/components/footer'; import { TopBar } from 'ts/components/top_bar/top_bar'; -import { Deco, Key, ScreenWidths, WebsitePaths } from 'ts/types'; +import { Dispatcher } from 'ts/redux/dispatcher'; +import { Deco, Key, Language, ScreenWidths, WebsitePaths } from 'ts/types'; import { colors } from 'ts/utils/colors'; import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; @@ -158,6 +159,7 @@ const relayerProjects: Project[] = [ export interface LandingProps { location: Location; translate: Translate; + dispatcher: Dispatcher; } interface LandingState { @@ -166,13 +168,11 @@ interface LandingState { export class Landing extends React.Component { private _throttledScreenWidthUpdate: () => void; - private _translate: Translate; constructor(props: LandingProps) { super(props); this.state = { screenWidth: utils.getScreenWidth(), }; - this._translate = new Translate(); this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT); } public componentDidMount() { @@ -191,12 +191,12 @@ export class Landing extends React.Component { location={this.props.location} isNightVersion={true} style={{ backgroundColor: colors.heroGrey, position: 'relative' }} - translate={this._translate} + translate={this.props.translate} /> {this._renderHero()} {this._renderProjects( relayersAndDappProjects, - this._translate.get(Key.ProjectsHeader, Deco.Upper), + this.props.translate.get(Key.ProjectsHeader, Deco.Upper), colors.projectsGrey, false, )} @@ -204,7 +204,7 @@ export class Landing extends React.Component { {this._renderProtocolSection()} {this._renderProjects( relayerProjects, - this._translate.get(Key.RelayersHeader, Deco.Upper), + this.props.translate.get(Key.RelayersHeader, Deco.Upper), colors.heroGrey, true, )} @@ -212,7 +212,7 @@ export class Landing extends React.Component { {this._renderBuildingBlocksSection()} {this._renderUseCases()} {this._renderCallToAction()} -