From 056fdec301de69e235313c0e27aadf8c769f8082 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Sun, 24 Jan 2016 20:48:31 -0600 Subject: PLT-7 client side infra for loc --- web/react/pages/claim_account.jsx | 71 +++++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 11 deletions(-) (limited to 'web/react/pages/claim_account.jsx') diff --git a/web/react/pages/claim_account.jsx b/web/react/pages/claim_account.jsx index bca203d96..7c6af73ca 100644 --- a/web/react/pages/claim_account.jsx +++ b/web/react/pages/claim_account.jsx @@ -2,18 +2,67 @@ // See License.txt for license information. import ClaimAccount from '../components/claim/claim_account.jsx'; +import * as Client from '../utils/client.jsx'; -function setupClaimAccountPage(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 + }; + } + + componentWillMount() { + Client.getTranslations( + this.props.map.Locale, + (data) => { + this.setState({ + translations: data, + loaded: true + }); + }, + () => { + this.setState({ + loaded: true + }); + } + ); + } + + render() { + if (!this.state.loaded) { + return
; + } + + return ( + + + + ); + } +} + +global.window.setup_claim_account_page = function setup(props) { ReactDOM.render( - , + , document.getElementById('claim') ); -} - -global.window.setup_claim_account_page = setupClaimAccountPage; +}; \ No newline at end of file -- cgit v1.2.3-1-g7c22