From 53e495cf335d3c6b44361627288db252aae1f4ad Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 28 Jan 2016 16:16:39 -0300 Subject: PLT-7: Refactoring frontend (chunk 4) --- web/react/pages/find_team.jsx | 59 +++++++++++++++++++++++++++++++++++++---- web/react/pages/signup_team.jsx | 2 +- 2 files changed, 55 insertions(+), 6 deletions(-) (limited to 'web/react/pages') diff --git a/web/react/pages/find_team.jsx b/web/react/pages/find_team.jsx index c4653fd77..ee2cf0de1 100644 --- a/web/react/pages/find_team.jsx +++ b/web/react/pages/find_team.jsx @@ -2,12 +2,61 @@ // See License.txt for license information. import FindTeam from '../components/find_team.jsx'; +import * as Client from '../utils/client.jsx'; -function setupFindTeamPage() { +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_find_team_page = function setup(props) { ReactDOM.render( - , + , document.getElementById('find-team') ); -} - -global.window.setup_find_team_page = setupFindTeamPage; +}; \ No newline at end of file diff --git a/web/react/pages/signup_team.jsx b/web/react/pages/signup_team.jsx index 8f4f86a7c..c80b65580 100644 --- a/web/react/pages/signup_team.jsx +++ b/web/react/pages/signup_team.jsx @@ -60,7 +60,7 @@ global.window.setup_signup_team_page = function setup(props) { for (var prop in props) { if (props.hasOwnProperty(prop)) { - if (prop !== 'Title') { + if (prop !== 'Title' && prop !== 'Locale' && prop !== 'Info') { teams.push({name: prop, display_name: props[prop]}); } } -- cgit v1.2.3-1-g7c22