import React, { useEffect } from 'react'; import { observer } from 'mobx-react-lite'; import cn from 'classnames'; import styles from 'Components/Session_/session.module.css'; import { countDaysFrom } from 'App/date'; import RightBlock from 'Components/Session/RightBlock'; import { PlayerContext } from 'Components/Session/playerContext'; import Session from 'Types/session' import PlayerBlock from './PlayerBlock'; interface IProps { fullscreen: boolean; activeTab: string; setActiveTab: (tab: string) => void; session: Session } 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 (
{hasError ? (
{sessionDays > 2 ? 'Session not found.' : 'This session is still being processed.'}
{sessionDays > 2 ? 'Please check your data retention policy.' : 'Please check it again in a few minutes.'}
{error ?
{error}
: null}
) : (
{!fullscreen && activeTab !== '' ? ( ) : null}
)}
); } export default observer(PlayerContent);