diff options
author | =Corey Hulen <corey@hulen.com> | 2016-01-24 20:48:31 -0600 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-01-24 20:48:31 -0600 |
commit | 056fdec301de69e235313c0e27aadf8c769f8082 (patch) | |
tree | 1312503989c58cd1db6d8c763f0159e6132f9f54 /web/react/pages/signup_team.jsx | |
parent | 1dfd8c78c99e3d1556b6845b76c457d16c3dcf94 (diff) | |
download | chat-056fdec301de69e235313c0e27aadf8c769f8082.tar.gz chat-056fdec301de69e235313c0e27aadf8c769f8082.tar.bz2 chat-056fdec301de69e235313c0e27aadf8c769f8082.zip |
PLT-7 client side infra for loc
Diffstat (limited to 'web/react/pages/signup_team.jsx')
-rw-r--r-- | web/react/pages/signup_team.jsx | 63 |
1 files changed, 58 insertions, 5 deletions
diff --git a/web/react/pages/signup_team.jsx b/web/react/pages/signup_team.jsx index 08ea45000..8f4f86a7c 100644 --- a/web/react/pages/signup_team.jsx +++ b/web/react/pages/signup_team.jsx @@ -2,8 +2,60 @@ // See License.txt for license information. import SignupTeam from '../components/signup_team.jsx'; +import * as Client from '../utils/client.jsx'; -function setupSignupTeamPage(props) { +var IntlProvider = ReactIntl.IntlProvider; + +class Root extends React.Component { + constructor() { + super(); + this.state = { + translations: null, + loaded: false + }; + } + + static propTypes() { + return { + map: React.PropTypes.object.isRequired, + teams: React.PropTypes.object.isRequired + }; + } + + componentWillMount() { + Client.getTranslations( + this.props.map.Locale, + (data) => { + this.setState({ + translations: data, + loaded: true + }); + }, + () => { + this.setState({ + loaded: true + }); + } + ); + } + + render() { + if (!this.state.loaded) { + return <div></div>; + } + + return ( + <IntlProvider + locale={this.props.map.Locale} + messages={this.state.translations} + > + <SignupTeam teams={this.props.teams} /> + </IntlProvider> + ); + } +} + +global.window.setup_signup_team_page = function setup(props) { var teams = []; for (var prop in props) { @@ -15,9 +67,10 @@ function setupSignupTeamPage(props) { } ReactDOM.render( - <SignupTeam teams={teams} />, + <Root + map={props} + teams={teams} + />, document.getElementById('signup-team') ); -} - -global.window.setup_signup_team_page = setupSignupTeamPage; +};
\ No newline at end of file |