From 056fdec301de69e235313c0e27aadf8c769f8082 Mon Sep 17 00:00:00 2001
From: =Corey Hulen <corey@hulen.com>
Date: Sun, 24 Jan 2016 20:48:31 -0600
Subject: PLT-7 client side infra for loc

---
 web/react/pages/signup_team.jsx | 63 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 58 insertions(+), 5 deletions(-)

(limited to 'web/react/pages/signup_team.jsx')

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
-- 
cgit v1.2.3-1-g7c22

