From c1ef27fc9bc9a1abc5207f772c51eade28943127 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 14 Nov 2024 12:14:14 +0100 Subject: [PATCH] change(ui): check for mobile project and hide live sessions and skip button --- .../Player/MobilePlayer/MobileControls.tsx | 1 - .../Controls/components/PlayerControls.tsx | 22 ++++++++++--------- frontend/app/layout/SideMenu.tsx | 10 ++++----- frontend/app/mstore/projectsStore.ts | 2 +- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/frontend/app/components/Session/Player/MobilePlayer/MobileControls.tsx b/frontend/app/components/Session/Player/MobilePlayer/MobileControls.tsx index 7aa775733..78f9d47d4 100644 --- a/frontend/app/components/Session/Player/MobilePlayer/MobileControls.tsx +++ b/frontend/app/components/Session/Player/MobilePlayer/MobileControls.tsx @@ -119,7 +119,6 @@ function Controls(props: any) { backTenSeconds={backTenSeconds} forthTenSeconds={forthTenSeconds} toggleSpeed={(speedIndex) => player.toggleSpeed(speedIndex)} - toggleSkip={() => player.toggleSkip()} playButton={ void; forthTenSeconds: () => void; toggleSpeed: (speedIndex: number) => void; - toggleSkip: () => void; + toggleSkip?: () => void; sessionTz?: string; } @@ -80,15 +80,17 @@ function PlayerControls(props: Props) { disabled={disabled} speed={speed} /> - + {toggleSkip && ( + + )} ); diff --git a/frontend/app/layout/SideMenu.tsx b/frontend/app/layout/SideMenu.tsx index 212ca4455..9c7c64834 100644 --- a/frontend/app/layout/SideMenu.tsx +++ b/frontend/app/layout/SideMenu.tsx @@ -47,7 +47,7 @@ interface Props extends RouteComponentProps { function SideMenu(props: Props) { const { - location, + location } = props; const isPreferencesActive = location.pathname.includes('/client/'); @@ -58,7 +58,8 @@ function SideMenu(props: Props) { const modules = account.settings?.modules ?? []; const isAdmin = account.admin || account.superAdmin; const isEnterprise = account.edition === 'ee'; - const siteId = projectsStore.siteId + const siteId = projectsStore.siteId; + const isMobile = projectsStore.isMobile; const [isModalVisible, setIsModalVisible] = React.useState(false); @@ -114,8 +115,7 @@ function SideMenu(props: Props) { item.key === MENU.FEATURE_FLAGS && modules.includes(MODULES.FEATURE_FLAGS), item.key === MENU.NOTES && modules.includes(MODULES.NOTES), - item.key === MENU.LIVE_SESSIONS && - modules.includes(MODULES.ASSIST), + item.key === MENU.LIVE_SESSIONS && (modules.includes(MODULES.ASSIST) || isMobile), item.key === MENU.SESSIONS && modules.includes(MODULES.OFFLINE_RECORDINGS), item.key === MENU.ALERTS && modules.includes(MODULES.ALERTS), @@ -135,7 +135,7 @@ function SideMenu(props: Props) { hidden: allItemsHidden }; }); - }, [isAdmin, isEnterprise, isPreferencesActive, modules, spotOnly]); + }, [isAdmin, isEnterprise, isPreferencesActive, modules, spotOnly, siteId]); React.useEffect(() => { const currentLocation = location.pathname; diff --git a/frontend/app/mstore/projectsStore.ts b/frontend/app/mstore/projectsStore.ts index c9e1703b2..c30e1f862 100644 --- a/frontend/app/mstore/projectsStore.ts +++ b/frontend/app/mstore/projectsStore.ts @@ -19,7 +19,7 @@ export default class ProjectsStore { } get isMobile() { - return this.instance ? ['ios', 'android'].includes(this.instance.platform) : false; + return this.active ? ['ios', 'android'].includes(this.active.platform) : false; } getSiteId = () => {