From 093dfd6c7fe893d6ab8981b917a87bd563eb58a3 Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Fri, 30 Jun 2017 18:18:04 -0700 Subject: Reverting tutorial fix (#6812) --- webapp/components/needs_team/needs_team.jsx | 10 ++++++++++ webapp/routes/route_team.jsx | 12 ++++++++++++ 2 files changed, 22 insertions(+) (limited to 'webapp') diff --git a/webapp/components/needs_team/needs_team.jsx b/webapp/components/needs_team/needs_team.jsx index ba3200b43..e86e4fb11 100644 --- a/webapp/components/needs_team/needs_team.jsx +++ b/webapp/components/needs_team/needs_team.jsx @@ -6,6 +6,7 @@ import PropTypes from 'prop-types'; import $ from 'jquery'; +import {browserHistory} from 'react-router/es6'; import * as Utils from 'utils/utils.jsx'; import TeamStore from 'stores/team_store.jsx'; import UserStore from 'stores/user_store.jsx'; @@ -17,6 +18,7 @@ import {startPeriodicSync, stopPeriodicSync} from 'actions/websocket_actions.jsx import {loadProfilesForSidebar} from 'actions/user_actions.jsx'; import Constants from 'utils/constants.jsx'; +const TutorialSteps = Constants.TutorialSteps; const Preferences = Constants.Preferences; import AnnouncementBar from 'components/announcement_bar'; @@ -100,6 +102,14 @@ export default class NeedsTeam extends React.Component { } } + componentWillMount() { + // Go to tutorial if we are first arriving + const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 999); + if (tutorialStep <= TutorialSteps.INTRO_SCREENS) { + browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/tutorial'); + } + } + componentDidMount() { TeamStore.addChangeListener(this.onTeamChanged); PreferenceStore.addChangeListener(this.onPreferencesChanged); diff --git a/webapp/routes/route_team.jsx b/webapp/routes/route_team.jsx index 69dd517a0..59cf6d673 100644 --- a/webapp/routes/route_team.jsx +++ b/webapp/routes/route_team.jsx @@ -328,6 +328,18 @@ export default { (comarr) => callback(null, {team_sidebar: comarr[0].default, sidebar: comarr[1].default, center: comarr[2].default}) ); } + }, + { + path: 'tutorial', + getComponents: (location, callback) => { + Promise.all([ + System.import('components/team_sidebar'), + System.import('components/sidebar.jsx'), + System.import('components/tutorial/tutorial_view.jsx') + ]).then( + (comarr) => callback(null, {team_sidebar: comarr[0].default, sidebar: comarr[1].default, center: comarr[2].default}) + ); + } } ] } -- cgit v1.2.3-1-g7c22