fix(ui) - onboarding redirect
This commit is contained in:
parent
3d719e6ecd
commit
2b26fd6e60
4 changed files with 17 additions and 6 deletions
|
|
@ -20,7 +20,7 @@ import Signup from './components/Signup/Signup';
|
|||
import { fetchTenants } from 'Duck/user';
|
||||
import { setSessionPath } from 'Duck/sessions';
|
||||
import { ModalProvider } from './components/Modal';
|
||||
import { GLOBAL_DESTINATION_PATH } from 'App/constants/storageKeys';
|
||||
import { GLOBAL_DESTINATION_PATH, GLOBAL_HAS_NO_RECORDINGS } from 'App/constants/storageKeys';
|
||||
import SupportCallout from 'Shared/SupportCallout';
|
||||
|
||||
const Login = lazy(() => import('Components/Login/Login'));
|
||||
|
|
@ -171,6 +171,7 @@ class Router extends React.Component {
|
|||
const siteIdList = sites.map(({ id }) => id).toJS();
|
||||
const hideHeader = (location.pathname && location.pathname.includes('/session/')) || location.pathname.includes('/assist/');
|
||||
const isPlayer = isRoute(SESSION_PATH, location.pathname) || isRoute(LIVE_SESSION_PATH, location.pathname);
|
||||
const redirectToOnboarding = !onboarding && localStorage.getItem(GLOBAL_HAS_NO_RECORDINGS) === 'true'
|
||||
|
||||
return isLoggedIn ? (
|
||||
<ModalProvider>
|
||||
|
|
@ -196,7 +197,7 @@ class Router extends React.Component {
|
|||
return <Redirect to={CLIENT_PATH} />;
|
||||
}}
|
||||
/>
|
||||
{onboarding && <Redirect to={withSiteId(ONBOARDING_REDIRECT_PATH, siteId)} />}
|
||||
{redirectToOnboarding && <Redirect to={withSiteId(ONBOARDING_REDIRECT_PATH, siteId)} />}
|
||||
|
||||
{/* DASHBOARD and Metrics */}
|
||||
<Route exact strict path={withSiteId(ALERTS_PATH, siteIdList)} component={Dashboard} />
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ const OnboardingNavButton = (props) => {
|
|||
}
|
||||
|
||||
const onDone = () => {
|
||||
props.setOnboarding(false);
|
||||
props.setOnboarding(true);
|
||||
history.push(sessions());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@ export const SKIP_TO_ISSUE = "__$session-skipToIssue$__"
|
|||
export const TIMEZONE = "__$session-timezone$__"
|
||||
export const DURATION_FILTER = "__$session-durationFilter$__"
|
||||
export const SESSION_FILTER = "__$session-filter$__"
|
||||
export const GLOBAL_DESTINATION_PATH = "__$global-destinationPath$__"
|
||||
export const GLOBAL_DESTINATION_PATH = "__$global-destinationPath$__"
|
||||
export const GLOBAL_HAS_NO_RECORDINGS = "__$global-hasNoRecordings$__"
|
||||
|
|
@ -20,6 +20,7 @@ import {
|
|||
} from './funcTools/crud';
|
||||
import { createRequestReducer } from './funcTools/request';
|
||||
import { Map, List, fromJS } from "immutable";
|
||||
import { GLOBAL_HAS_NO_RECORDINGS } from 'App/constants/storageKeys';
|
||||
|
||||
const SITE_ID_STORAGE_KEY = "__$user-siteId$__";
|
||||
const storedSiteId = localStorage.getItem(SITE_ID_STORAGE_KEY);
|
||||
|
|
@ -69,9 +70,17 @@ const reducer = (state = initialState, action = {}) => {
|
|||
? storedSiteId
|
||||
: action.data[0].projectId;
|
||||
}
|
||||
return state.set('list', List(action.data.map(Site)))
|
||||
const list = List(action.data.map(Site));
|
||||
const hasRecordings = list.some(s => s.recorded);
|
||||
if (!hasRecordings) {
|
||||
localStorage.setItem(GLOBAL_HAS_NO_RECORDINGS, true)
|
||||
} else {
|
||||
localStorage.removeItem(GLOBAL_HAS_NO_RECORDINGS)
|
||||
}
|
||||
|
||||
return state.set('list', list)
|
||||
.set('siteId', siteId)
|
||||
.set('active', List(action.data.map(Site)).find(s => s.id === parseInt(siteId)));
|
||||
.set('active', list.find(s => s.id === parseInt(siteId)));
|
||||
case SET_SITE_ID:
|
||||
localStorage.setItem(SITE_ID_STORAGE_KEY, action.siteId)
|
||||
const site = state.get('list').find(s => s.id === action.siteId);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue