From 41e6005586a89b7a609fa1543a4c19581738f9bd Mon Sep 17 00:00:00 2001 From: Krit Date: Tue, 8 Mar 2016 20:29:10 +0700 Subject: [PATCH 01/10] init react-router v2 --- dashboard/Dashboard.js | 104 +++++++++++++++++++++-------------------- dashboard/history.js | 8 ++-- package.json | 2 +- 3 files changed, 59 insertions(+), 55 deletions(-) diff --git a/dashboard/Dashboard.js b/dashboard/Dashboard.js index 3868f0abc1..d51487ca1d 100644 --- a/dashboard/Dashboard.js +++ b/dashboard/Dashboard.js @@ -196,64 +196,66 @@ class Dashboard extends React.Component { } - return - - - + return ( + + + + - - - + + + - //In progress features. Change false to true to work on this feature. - + //In progress features. Change false to true to work on this feature. + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - + + + + + + + + - - - - - - + + + + + + ) } } diff --git a/dashboard/history.js b/dashboard/history.js index 79223afa4b..ef4cb19a1f 100644 --- a/dashboard/history.js +++ b/dashboard/history.js @@ -5,7 +5,9 @@ * This source code is licensed under the license found in the LICENSE file in * the root directory of this source tree. */ -import createBrowserHistory from 'history/lib/createBrowserHistory'; -let history = createBrowserHistory(); -export default history; \ No newline at end of file +import { browserHistory } from 'react-router' +//import createBrowserHistory from 'history/lib/createBrowserHistory'; +//let history = createBrowserHistory(); + +export default browserHistory; \ No newline at end of file diff --git a/package.json b/package.json index ea42984598..6638ce812e 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "react-dnd": "~2.0.2", "react-dnd-html5-backend": "~2.0.0", "react-dom": "^0.14.0", - "react-router": "1.0.0-rc1" + "react-router": "2.0.0" }, "devDependencies": { "babel-core": "~5.8.12", From f6de57f9e24018c9cc2d3e21741f377383adae20 Mon Sep 17 00:00:00 2001 From: Krit Date: Tue, 8 Mar 2016 20:44:59 +0700 Subject: [PATCH 02/10] change pushState to push and replaceState to replace --- src/components/Sidebar/AppsSelector.react.js | 2 +- src/dashboard/AppData.react.js | 2 +- src/dashboard/AppSelector.react.js | 4 ++-- src/dashboard/Apps/AppsIndex.react.js | 2 +- src/dashboard/Data/Browser/Browser.react.js | 10 +++++----- src/dashboard/Data/CloudCode/CloudCode.react.js | 2 +- src/dashboard/Data/Jobs/JobEdit.react.js | 2 +- src/dashboard/Data/Jobs/Jobs.react.js | 4 ++-- src/dashboard/Push/PushAudiencesIndex.react.js | 2 +- src/dashboard/Push/PushDetails.react.js | 2 +- src/dashboard/Push/PushIndex.react.js | 4 ++-- src/dashboard/Push/PushNew.react.js | 4 ++-- src/dashboard/Settings/GeneralSettings.react.js | 6 +++--- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/components/Sidebar/AppsSelector.react.js b/src/components/Sidebar/AppsSelector.react.js index 5b2d295902..45f82c148d 100644 --- a/src/components/Sidebar/AppsSelector.react.js +++ b/src/components/Sidebar/AppsSelector.react.js @@ -59,7 +59,7 @@ export default class AppsSelector extends React.Component { if (sections[0] === '') { sections.shift(); } - history.pushState(null, `/apps/${value}/${sections[2]}`); + history.push(null, `/apps/${value}/${sections[2]}`); } }); } diff --git a/src/dashboard/AppData.react.js b/src/dashboard/AppData.react.js index 851a1ba568..080486566d 100644 --- a/src/dashboard/AppData.react.js +++ b/src/dashboard/AppData.react.js @@ -38,7 +38,7 @@ let AppData = React.createClass({ if (current) { current.setParseKeys(); } else { - history.replaceState(null, '/apps'); + history.replace('/apps'); return
; } return ( diff --git a/src/dashboard/AppSelector.react.js b/src/dashboard/AppSelector.react.js index bc2a23eac5..d4d3fe7a84 100644 --- a/src/dashboard/AppSelector.react.js +++ b/src/dashboard/AppSelector.react.js @@ -26,11 +26,11 @@ export default class AppSelector extends React.Component { handleConfirm() { let newPath = location.pathname.replace(/\/_(\/|$)/, '/' + this.state.slug + '/'); - history.pushState(null, newPath); + history.push(newPath); } handleCancel() { - history.pushState(null, '/apps'); + history.push('/apps'); } render() { diff --git a/src/dashboard/Apps/AppsIndex.react.js b/src/dashboard/Apps/AppsIndex.react.js index 9e20e99c5f..5a67e2ff42 100644 --- a/src/dashboard/Apps/AppsIndex.react.js +++ b/src/dashboard/Apps/AppsIndex.react.js @@ -64,7 +64,7 @@ let AppCard = ({ app, icon, }) => { - let canBrowse = app.serverInfo.error ? null : () => history.pushState(null, html`/apps/${app.slug}/browser`); + let canBrowse = app.serverInfo.error ? null : () => history.push(html`/apps/${app.slug}/browser`); let versionMessage = app.serverInfo.error ?
Server not reachable: {app.serverInfo.error.toString()}
:
Server version: {app.serverInfo.parseServerVersion || 'unknown'}
; diff --git a/src/dashboard/Data/Browser/Browser.react.js b/src/dashboard/Data/Browser/Browser.react.js index c31dcf027e..87ab6278b1 100644 --- a/src/dashboard/Data/Browser/Browser.react.js +++ b/src/dashboard/Data/Browser/Browser.react.js @@ -130,7 +130,7 @@ export default class Browser extends DashboardView { } return a.toUpperCase() < b.toUpperCase() ? -1 : 1; }); - history.replaceState(null, this.context.generatePath('browser/' + classes[0])); + history.replace(this.context.generatePath('browser/' + classes[0])); } } @@ -164,7 +164,7 @@ export default class Browser extends DashboardView { createClass(className) { this.props.schema.dispatch(ActionTypes.CREATE_CLASS, { className }).then(() => { this.state.counts[className] = 0; - history.pushState(null, this.context.generatePath('browser/' + className)); + history.push(this.context.generatePath('browser/' + className)); }).always(() => { this.setState({ showCreateClassDialog: false }); }); @@ -174,7 +174,7 @@ export default class Browser extends DashboardView { this.props.schema.dispatch(ActionTypes.DROP_CLASS, { className }).then(() => { this.setState({showDropClassDialog: false }); delete this.state.counts[className]; - history.pushState(null, this.context.generatePath('browser')); + history.push(this.context.generatePath('browser')); }, (error) => { let msg = typeof error === 'string' ? error : error.message; if (msg) { @@ -308,7 +308,7 @@ export default class Browser extends DashboardView { let _filters = JSON.stringify(filters.toJSON()); let url = `browser/${source}` + (filters.size === 0 ? '' : `?filters=${encodeURIComponent(_filters)}`); // filters param change is making the fetch call - history.pushState(null, this.context.generatePath(url)); + history.push(this.context.generatePath(url)); } updateOrdering(ordering) { @@ -332,7 +332,7 @@ export default class Browser extends DashboardView { constraint: 'eq', compareTo: id }]); - history.pushState(null, this.context.generatePath(`browser/${className}?filters=${encodeURIComponent(filters)}`)); + history.push(this.context.generatePath(`browser/${className}?filters=${encodeURIComponent(filters)}`)); } updateRow(row, attr, value) { diff --git a/src/dashboard/Data/CloudCode/CloudCode.react.js b/src/dashboard/Data/CloudCode/CloudCode.react.js index b989ad2e75..388953c5b8 100644 --- a/src/dashboard/Data/CloudCode/CloudCode.react.js +++ b/src/dashboard/Data/CloudCode/CloudCode.react.js @@ -54,7 +54,7 @@ export default class CloudCode extends DashboardView { if (!fileName || release.files[fileName] === undefined) { // Means we're still in /cloud_code/. Let's redirect to /cloud_code/main.js - history.replaceState(null, this.context.generatePath('cloud_code/main.js')) + history.replace(this.context.generatePath('cloud_code/main.js')) } else { // Means we can load /cloud_code/ app.getSource(fileName).then( diff --git a/src/dashboard/Data/Jobs/JobEdit.react.js b/src/dashboard/Data/Jobs/JobEdit.react.js index 37c49ce051..c7e705b485 100644 --- a/src/dashboard/Data/Jobs/JobEdit.react.js +++ b/src/dashboard/Data/Jobs/JobEdit.react.js @@ -53,7 +53,7 @@ class JobEdit extends React.Component { let promise = this.props.params.jobId ? this.props.jobs.dispatch(ActionTypes.EDIT, { jobId: this.props.params.jobId, updates: schedule }) : this.props.jobs.dispatch(ActionTypes.CREATE, { schedule }); - promise.then(() => {history.pushState(null, this.context.generatePath('jobs/scheduled'))}); + promise.then(() => {history.push(this.context.generatePath('jobs/scheduled'))}); return promise; } diff --git a/src/dashboard/Data/Jobs/Jobs.react.js b/src/dashboard/Data/Jobs/Jobs.react.js index 04f6e268d7..eb150f1c31 100644 --- a/src/dashboard/Data/Jobs/Jobs.react.js +++ b/src/dashboard/Data/Jobs/Jobs.react.js @@ -92,11 +92,11 @@ export default class Jobs extends TableView { } navigateToNew() { - history.pushState(null, this.context.generatePath('jobs/new')); + history.push(this.context.generatePath('jobs/new')); } navigateToJob(jobId) { - history.pushState(null, this.context.generatePath(`jobs/edit/${jobId}`)) + history.push(this.context.generatePath(`jobs/edit/${jobId}`)) } renderSidebar() { diff --git a/src/dashboard/Push/PushAudiencesIndex.react.js b/src/dashboard/Push/PushAudiencesIndex.react.js index 521bbf447f..29d77a244d 100644 --- a/src/dashboard/Push/PushAudiencesIndex.react.js +++ b/src/dashboard/Push/PushAudiencesIndex.react.js @@ -113,7 +113,7 @@ export default class PushAudiencesIndex extends DashboardView { } handleSendPush(objectId) { - history.pushState(null, this.context.generatePath(`push/new?audienceId=${objectId}`)); + history.push(this.context.generatePath(`push/new?audienceId=${objectId}`)); } renderRow(audience) { diff --git a/src/dashboard/Push/PushDetails.react.js b/src/dashboard/Push/PushDetails.react.js index c129cb6a10..b8e92e5c6d 100644 --- a/src/dashboard/Push/PushDetails.react.js +++ b/src/dashboard/Push/PushDetails.react.js @@ -562,7 +562,7 @@ export default class PushDetails extends DashboardView { if (error) { promise.reject({ error }); } else { - history.pushState(null, this.context.generatePath('push/activity')); + history.push(this.context.generatePath('push/activity')); } }, (error) => { promise.reject({ error }); diff --git a/src/dashboard/Push/PushIndex.react.js b/src/dashboard/Push/PushIndex.react.js index 7e9adda398..79a05594dc 100644 --- a/src/dashboard/Push/PushIndex.react.js +++ b/src/dashboard/Push/PushIndex.react.js @@ -281,11 +281,11 @@ export default class PushIndex extends DashboardView { } navigateToNew() { - history.pushState(null, this.context.generatePath('push/new')); + history.push(this.context.generatePath('push/new')); } navigateToDetails(objectId) { - history.pushState(null, this.context.generatePath(`push/${objectId}`)); + history.push(this.context.generatePath(`push/${objectId}`)); } handleShowMore(page) { diff --git a/src/dashboard/Push/PushNew.react.js b/src/dashboard/Push/PushNew.react.js index 09cb5e77e4..57d844d09a 100644 --- a/src/dashboard/Push/PushNew.react.js +++ b/src/dashboard/Push/PushNew.react.js @@ -188,7 +188,7 @@ export default class PushNew extends DashboardView { promise.reject({ error }); } else { //TODO: global success message banner for passing successful creation - store should also be cleared - history.pushState(null, this.context.generatePath('push/activity')); + history.push(this.context.generatePath('push/activity')); } }, (error) => { promise.reject(error); @@ -663,7 +663,7 @@ export default class PushNew extends DashboardView {
- +
diff --git a/src/dashboard/Settings/GeneralSettings.react.js b/src/dashboard/Settings/GeneralSettings.react.js index e19d38211c..b131d15177 100644 --- a/src/dashboard/Settings/GeneralSettings.react.js +++ b/src/dashboard/Settings/GeneralSettings.react.js @@ -228,7 +228,7 @@ let ManageAppFields = ({ description='View your migration progress.' />} input={ history.pushState(null, '/apps/' + appSlug + '/migration')} + onClick={() => history.push('/apps/' + appSlug + '/migration')} value='View progress' />} /> } else { migrateAppField = [ history.pushState(null, '/apps/' + this.context.currentApp.slug + '/migration')} + onSuccess={() => history.push('/apps/' + this.context.currentApp.slug + '/migration')} clearFields={() => this.setState({ migrationMongoURL: '', migrationWarnings: [], @@ -538,7 +538,7 @@ export default class GeneralSettings extends DashboardView { inProgressText={'Deleting\u2026'} enabled={this.state.password.length > 0} onSubmit={() => AppsManager.deleteApp(this.context.currentApp.slug, this.state.password)} - onSuccess={result => history.pushState(null, '/apps')} + onSuccess={result => history.push('/apps')} onClose={() => this.setState({showDeleteAppModal: false})} clearFields={() => this.setState({password: ''})}> {passwordField} From ff1c7e06687e8d6ad12f3e9198818728f815f7d9 Mon Sep 17 00:00:00 2001 From: Krit Date: Tue, 8 Mar 2016 20:58:51 +0700 Subject: [PATCH 03/10] update Link react-router to v2 style --- src/dashboard/Push/PushDetails.react.js | 2 +- src/dashboard/Settings/GeneralSettings.react.js | 2 +- src/dashboard/history.js | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/dashboard/Push/PushDetails.react.js b/src/dashboard/Push/PushDetails.react.js index b8e92e5c6d..14bfdf45f3 100644 --- a/src/dashboard/Push/PushDetails.react.js +++ b/src/dashboard/Push/PushDetails.react.js @@ -465,7 +465,7 @@ export default class PushDetails extends DashboardView { prevLaunchGroup = (
- This push is the Launch Group for a previous experiment. + This push is the Launch Group for a previous experiment.
); diff --git a/src/dashboard/Settings/GeneralSettings.react.js b/src/dashboard/Settings/GeneralSettings.react.js index b131d15177..5daa1b6b3b 100644 --- a/src/dashboard/Settings/GeneralSettings.react.js +++ b/src/dashboard/Settings/GeneralSettings.react.js @@ -308,7 +308,7 @@ let ManageAppFields = ({ {cloneAppMessage ? -
{cloneAppMessage} Check out the progress on your apps page!
+
{cloneAppMessage} Check out the progress on your apps page!
: null} {!isCollaborator ? Date: Tue, 8 Mar 2016 21:10:02 +0700 Subject: [PATCH 04/10] add \n at the end of file, revert Dashboard.js to its original --- src/dashboard/Dashboard.js | 170 ++++++++++++++++++------------------- src/dashboard/history.js | 2 +- 2 files changed, 85 insertions(+), 87 deletions(-) diff --git a/src/dashboard/Dashboard.js b/src/dashboard/Dashboard.js index d51487ca1d..73cd507ca6 100644 --- a/src/dashboard/Dashboard.js +++ b/src/dashboard/Dashboard.js @@ -67,16 +67,16 @@ let Empty = React.createClass({ }); const AppsIndexPage = () => ( - - - - ); + + + +); const AccountSettingsPage = () => ( - - - - ); + + + +); const PARSE_DOT_COM_SERVER_INFO = { features: { @@ -137,32 +137,32 @@ class Dashboard extends React.Component { {}, { useMasterKey: true } ).then(serverInfo => { - app.serverInfo = serverInfo; - return app; - }, error => { - if (error.code === 100) { - app.serverInfo = { - error: 'unable to connect to server', - enabledFeatures: {}, - parseServerVersion: "unknown" + app.serverInfo = serverInfo; + return app; + }, error => { + if (error.code === 100) { + app.serverInfo = { + error: 'unable to connect to server', + enabledFeatures: {}, + parseServerVersion: "unknown" + } + return Parse.Promise.as(app); + } else if (error.code === 107) { + app.serverInfo = { + error: 'server version too low', + enabledFeatures: {}, + parseServerVersion: "unknown" + } + return Parse.Promise.as(app); + } else { + app.serverInfo = { + error: 'unknown error', + enabledFeatures: {}, + parseServerVersion: "unknown" + } + return Parse.Promise.as(app); } - return Parse.Promise.as(app); - } else if (error.code === 107) { - app.serverInfo = { - error: 'server version too low', - enabledFeatures: {}, - parseServerVersion: "unknown" - } - return Parse.Promise.as(app); - } else { - app.serverInfo = { - error: 'unknown error', - enabledFeatures: {}, - parseServerVersion: "unknown" - } - return Parse.Promise.as(app); - } - }); + }); } }); return Parse.Promise.when(appInfoPromises); @@ -196,66 +196,64 @@ class Dashboard extends React.Component {
} - return ( - - - - - - - - + return + + + - //In progress features. Change false to true to work on this feature. - + + + - - - - - - - - - - - - - - - - - - - - + //In progress features. Change false to true to work on this feature. + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - + + + + + + + + - - - ) + + + + + + } } diff --git a/src/dashboard/history.js b/src/dashboard/history.js index b9ed800635..028b4afc50 100644 --- a/src/dashboard/history.js +++ b/src/dashboard/history.js @@ -9,4 +9,4 @@ // Use the singleton history in react-router v2 import { browserHistory } from 'react-router' -export default browserHistory; \ No newline at end of file +export default browserHistory; From f9e4d68a3a48380fe9c50b62dfe688f88dc1627d Mon Sep 17 00:00:00 2001 From: Krit Date: Tue, 8 Mar 2016 21:19:36 +0700 Subject: [PATCH 05/10] fix indent problem by replace file from github/master (problem was my IDE indent system) --- src/dashboard/Dashboard.js | 66 +++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/dashboard/Dashboard.js b/src/dashboard/Dashboard.js index 73cd507ca6..3868f0abc1 100644 --- a/src/dashboard/Dashboard.js +++ b/src/dashboard/Dashboard.js @@ -67,16 +67,16 @@ let Empty = React.createClass({ }); const AppsIndexPage = () => ( - - - -); + + + + ); const AccountSettingsPage = () => ( - - - -); + + + + ); const PARSE_DOT_COM_SERVER_INFO = { features: { @@ -137,32 +137,32 @@ class Dashboard extends React.Component { {}, { useMasterKey: true } ).then(serverInfo => { - app.serverInfo = serverInfo; - return app; - }, error => { - if (error.code === 100) { - app.serverInfo = { - error: 'unable to connect to server', - enabledFeatures: {}, - parseServerVersion: "unknown" - } - return Parse.Promise.as(app); - } else if (error.code === 107) { - app.serverInfo = { - error: 'server version too low', - enabledFeatures: {}, - parseServerVersion: "unknown" - } - return Parse.Promise.as(app); - } else { - app.serverInfo = { - error: 'unknown error', - enabledFeatures: {}, - parseServerVersion: "unknown" - } - return Parse.Promise.as(app); + app.serverInfo = serverInfo; + return app; + }, error => { + if (error.code === 100) { + app.serverInfo = { + error: 'unable to connect to server', + enabledFeatures: {}, + parseServerVersion: "unknown" } - }); + return Parse.Promise.as(app); + } else if (error.code === 107) { + app.serverInfo = { + error: 'server version too low', + enabledFeatures: {}, + parseServerVersion: "unknown" + } + return Parse.Promise.as(app); + } else { + app.serverInfo = { + error: 'unknown error', + enabledFeatures: {}, + parseServerVersion: "unknown" + } + return Parse.Promise.as(app); + } + }); } }); return Parse.Promise.when(appInfoPromises); From e8db69b01dcf60b5a1f62314760b1937a76ff9ad Mon Sep 17 00:00:00 2001 From: Krit Date: Tue, 8 Mar 2016 21:25:28 +0700 Subject: [PATCH 06/10] update Link style in Component dir --- src/components/CategoryList/CategoryList.react.js | 2 +- src/components/FileTree/FileTree.react.js | 2 +- src/components/Sidebar/AppsMenu.react.js | 2 +- src/components/Sidebar/SidebarHeader.react.js | 2 +- src/components/Sidebar/SidebarSection.react.js | 2 +- src/components/Sidebar/SidebarSubItem.react.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/CategoryList/CategoryList.react.js b/src/components/CategoryList/CategoryList.react.js index 10977477cd..9851e10a3d 100644 --- a/src/components/CategoryList/CategoryList.react.js +++ b/src/components/CategoryList/CategoryList.react.js @@ -61,7 +61,7 @@ export default class CategoryList extends React.Component { (this.props.linkPrefix || '') + (c.link || id) ); return ( - + {count} {c.name} diff --git a/src/components/FileTree/FileTree.react.js b/src/components/FileTree/FileTree.react.js index 93c6aa4293..bd6e9a987f 100644 --- a/src/components/FileTree/FileTree.react.js +++ b/src/components/FileTree/FileTree.react.js @@ -74,7 +74,7 @@ export default class FileTree extends React.Component { + to={{ pathname: this.props.linkPrefix + path }}> {f} ); diff --git a/src/components/Sidebar/AppsMenu.react.js b/src/components/Sidebar/AppsMenu.react.js index 359c7d1a20..7568c39a79 100644 --- a/src/components/Sidebar/AppsMenu.react.js +++ b/src/components/Sidebar/AppsMenu.react.js @@ -23,7 +23,7 @@ let AppsMenu = ({ apps, current, height, onSelect }) => ( return null; } return ( - + {app.name} diff --git a/src/components/Sidebar/SidebarHeader.react.js b/src/components/Sidebar/SidebarHeader.react.js index 82bbc6d3a4..bb34dad113 100644 --- a/src/components/Sidebar/SidebarHeader.react.js +++ b/src/components/Sidebar/SidebarHeader.react.js @@ -13,7 +13,7 @@ import styles from 'components/Sidebar/Sidebar.scss'; let SidebarHeader = ({}) =>
- + diff --git a/src/components/Sidebar/SidebarSection.react.js b/src/components/Sidebar/SidebarSection.react.js index 8b65940d08..4071f9ed1b 100644 --- a/src/components/Sidebar/SidebarSection.react.js +++ b/src/components/Sidebar/SidebarSection.react.js @@ -23,7 +23,7 @@ let SidebarSection = ({ active, children, name, link, icon, style }) => {
{active ?
{iconContent}{name}
: - {iconContent}{name}} + {iconContent}{name}} {children ?
{children}
: null}
diff --git a/src/components/Sidebar/SidebarSubItem.react.js b/src/components/Sidebar/SidebarSubItem.react.js index 9216535614..776e270ccd 100644 --- a/src/components/Sidebar/SidebarSubItem.react.js +++ b/src/components/Sidebar/SidebarSubItem.react.js @@ -28,7 +28,7 @@ let SidebarSubItem = ({ active, name, action, link, children }) => {
+ to={{ pathname: link }}> {name}
From 6264acb634396bc76f868efee8203bfeee549034 Mon Sep 17 00:00:00 2001 From: Krit Date: Wed, 9 Mar 2016 01:12:16 +0700 Subject: [PATCH 07/10] - Add router as contextTypes of Popover.react as react-router Link need router as context - Change AppsMenu.react from stateless to React.Component to get contextTypes --- src/components/Popover/Popover.react.js | 6 ++- src/components/Sidebar/AppsMenu.react.js | 49 ++++++++++++++---------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/components/Popover/Popover.react.js b/src/components/Popover/Popover.react.js index ac2c4c2e2b..ec8b76ac99 100644 --- a/src/components/Popover/Popover.react.js +++ b/src/components/Popover/Popover.react.js @@ -22,7 +22,8 @@ class ContextProxy extends React.Component { } ContextProxy.childContextTypes = { - history: React.PropTypes.object + history: React.PropTypes.object, + router: React.PropTypes.object }; export default class Popover extends React.Component { @@ -93,5 +94,6 @@ export default class Popover extends React.Component { } Popover.contextTypes = { - history: React.PropTypes.object + history: React.PropTypes.object, + router: React.PropTypes.object }; diff --git a/src/components/Sidebar/AppsMenu.react.js b/src/components/Sidebar/AppsMenu.react.js index 7568c39a79..c89d68e408 100644 --- a/src/components/Sidebar/AppsMenu.react.js +++ b/src/components/Sidebar/AppsMenu.react.js @@ -8,28 +8,35 @@ import AppBadge from 'components/AppBadge/AppBadge.react'; import html from 'lib/htmlString'; import { Link } from 'react-router'; -import React from 'react'; +import React from 'react'; import styles from 'components/Sidebar/Sidebar.scss'; import { unselectable } from 'stylesheets/base.scss'; -let AppsMenu = ({ apps, current, height, onSelect }) => ( -
-
- {current.name} -
-
All Apps
- {apps.map((app) => { - if (app.slug === current.slug) { - return null; - } - return ( - - {app.name} - - - ); - })} -
-); +export default class AppsMenu extends React.Component { + render() { + const { apps, current, height, onSelect } = this.props; + return ( +
+
+ {current.name} +
+
All Apps
+ {apps.map((app) => { + if (app.slug === current.slug) { + return null; + } + return ( + + {app.name} + + + ); + })} +
+ ); + } +} -export default AppsMenu; +AppsMenu.contextTypes = { + router: React.PropTypes.object +}; \ No newline at end of file From 81b227127a5b515b2657fbc5b80c34fa652b1808 Mon Sep 17 00:00:00 2001 From: Krit Date: Wed, 9 Mar 2016 01:13:01 +0700 Subject: [PATCH 08/10] fix indent of AppsMenu --- src/components/Sidebar/AppsMenu.react.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Sidebar/AppsMenu.react.js b/src/components/Sidebar/AppsMenu.react.js index c89d68e408..23fa3cff12 100644 --- a/src/components/Sidebar/AppsMenu.react.js +++ b/src/components/Sidebar/AppsMenu.react.js @@ -8,7 +8,7 @@ import AppBadge from 'components/AppBadge/AppBadge.react'; import html from 'lib/htmlString'; import { Link } from 'react-router'; -import React from 'react'; +import React from 'react'; import styles from 'components/Sidebar/Sidebar.scss'; import { unselectable } from 'stylesheets/base.scss'; From b2d308ccb05fd1d0b2111be6333a782d9e604f80 Mon Sep 17 00:00:00 2001 From: Krit Date: Wed, 9 Mar 2016 01:13:53 +0700 Subject: [PATCH 09/10] Add missing trailing \n --- src/components/Sidebar/AppsMenu.react.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Sidebar/AppsMenu.react.js b/src/components/Sidebar/AppsMenu.react.js index 23fa3cff12..3d88905b9a 100644 --- a/src/components/Sidebar/AppsMenu.react.js +++ b/src/components/Sidebar/AppsMenu.react.js @@ -39,4 +39,4 @@ export default class AppsMenu extends React.Component { AppsMenu.contextTypes = { router: React.PropTypes.object -}; \ No newline at end of file +}; From 6b04790e2989b7ba44c1819351574515548e83ee Mon Sep 17 00:00:00 2001 From: Krit Date: Wed, 9 Mar 2016 10:25:13 +0700 Subject: [PATCH 10/10] revert AppsMenu.react back to stateless component --- src/components/Sidebar/AppsMenu.react.js | 47 ++++++++++-------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/src/components/Sidebar/AppsMenu.react.js b/src/components/Sidebar/AppsMenu.react.js index 3d88905b9a..359c7d1a20 100644 --- a/src/components/Sidebar/AppsMenu.react.js +++ b/src/components/Sidebar/AppsMenu.react.js @@ -12,31 +12,24 @@ import React from 'react'; import styles from 'components/Sidebar/Sidebar.scss'; import { unselectable } from 'stylesheets/base.scss'; -export default class AppsMenu extends React.Component { - render() { - const { apps, current, height, onSelect } = this.props; - return ( -
-
- {current.name} -
-
All Apps
- {apps.map((app) => { - if (app.slug === current.slug) { - return null; - } - return ( - - {app.name} - - - ); - })} -
- ); - } -} +let AppsMenu = ({ apps, current, height, onSelect }) => ( +
+
+ {current.name} +
+
All Apps
+ {apps.map((app) => { + if (app.slug === current.slug) { + return null; + } + return ( + + {app.name} + + + ); + })} +
+); -AppsMenu.contextTypes = { - router: React.PropTypes.object -}; +export default AppsMenu;