Skip to content

Commit

Permalink
change(ui): fullView param to restrict to player content
Browse files Browse the repository at this point in the history
  • Loading branch information
shekarsiri committed Apr 8, 2024
1 parent 80a9c41 commit de402d4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion frontend/app/components/Session/LivePlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function LivePlayer({
useEffect(() => {
const queryParams = new URLSearchParams(window.location.search);
if (
(queryParams.has('fullScreen') && queryParams.get('fullScreen') === 'true') ||
(queryParams.has('fullScreen') && queryParams.get('fullScreen') === 'true') || (queryParams.has('fullView') && queryParams.get('fullView') === 'true') ||
location.pathname.includes('multiview')
) {
setFullView(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import { observer } from 'mobx-react-lite';
import cn from 'classnames';
import styles from 'Components/Session_/session.module.css';
Expand All @@ -22,13 +22,19 @@ interface IProps {

function PlayerContent({ session, fullscreen, activeTab, setActiveTab }: IProps) {
const { store } = React.useContext(PlayerContext)
const [fullView, setFullView] = React.useState(false)

const {
error,
} = store.get()

const hasError = !!error

useEffect(() => {
const isFullView = new URLSearchParams(location.search).get('fullview')
setFullView(isFullView === 'true');
}, [session.sessionId]);

const sessionDays = countDaysFrom(session.startedAt);
return (
<div className="relative">
Expand Down Expand Up @@ -60,7 +66,7 @@ function PlayerContent({ session, fullscreen, activeTab, setActiveTab }: IProps)
style={activeTab && !fullscreen ? { maxWidth: 'calc(100% - 270px)' } : undefined}
>
<div className={cn(styles.session, 'relative')} data-fullscreen={fullscreen}>
<PlayerBlock setActiveTab={setActiveTab} activeTab={activeTab} />
<PlayerBlock setActiveTab={setActiveTab} activeTab={activeTab} fullView={fullView} />
</div>
</div>
{!fullscreen && activeTab !== '' ? (
Expand Down
36 changes: 22 additions & 14 deletions frontend/app/components/Session/WebPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import { toast } from 'react-toastify';
const TABS = {
EVENTS: 'Activity',
CLICKMAP: 'Click Map',
INSPECTOR: 'Tag',
INSPECTOR: 'Tag'
};
const UXTTABS = {
EVENTS: TABS.EVENTS
}
};

let playerInst: IPlayerContext['player'] | undefined;

Expand All @@ -36,6 +36,7 @@ function WebPlayer(props: any) {
// @ts-ignore
const [contextValue, setContextValue] = useState<IPlayerContext>(defaultContextValue);
const params: { sessionId: string } = useParams();
const [fullView, setFullView] = useState(false);

useEffect(() => {
playerInst = undefined;
Expand Down Expand Up @@ -115,15 +116,20 @@ function WebPlayer(props: any) {

useEffect(() => {
if (uxtestingStore.isUxt()) {
setActiveTab('EVENTS')
setActiveTab('EVENTS');
}
}, [uxtestingStore.isUxt()])
}, [uxtestingStore.isUxt()]);

const onNoteClose = () => {
setNoteItem(undefined);
contextValue.player.play();
};

useEffect(() => {
const isFullView = new URLSearchParams(location.search).get('fullview')
setFullView(isFullView === 'true');
}, [session.sessionId]);

if (!session.sessionId)
return (
<Loader
Expand All @@ -133,20 +139,22 @@ function WebPlayer(props: any) {
top: '50%',
left: '50%',
transform: 'translateX(-50%)',
height: 75,
height: 75
}}
/>
);

return (
<PlayerContext.Provider value={contextValue}>
<PlayerBlockHeader
// @ts-ignore TODO?
activeTab={activeTab}
setActiveTab={setActiveTab}
tabs={uxtestingStore.isUxt() ? UXTTABS : TABS}
fullscreen={fullscreen}
/>
{!fullView && (
<PlayerBlockHeader
// @ts-ignore TODO?
activeTab={activeTab}
setActiveTab={setActiveTab}
tabs={uxtestingStore.isUxt() ? UXTTABS : TABS}
fullscreen={fullscreen}
/>
)}
{/* @ts-ignore */}
{contextValue.player ? (
<PlayerContent
Expand Down Expand Up @@ -178,11 +186,11 @@ export default connect(
fullscreen: state.getIn(['components', 'player', 'fullscreen']),
showEvents: state.get('showEvents'),
members: state.getIn(['members', 'list']),
startedAt: state.getIn(['sessions', 'current']).startedAt || 0,
startedAt: state.getIn(['sessions', 'current']).startedAt || 0
}),
{
toggleFullscreen,
closeBottomBlock,
fetchList,
fetchList
}
)(withLocationHandlers()(observer(WebPlayer)));

0 comments on commit de402d4

Please sign in to comment.