import SummaryBlock from 'Components/Session/Player/ReplayPlayer/SummaryBlock'; import { SummaryButton } from 'Components/Session_/Player/Controls/Controls'; import React, { useEffect } from 'react'; import { toggleBottomBlock } from 'Duck/components/player'; import BottomBlock from '../BottomBlock'; import EventRow from './components/EventRow'; import { connect } from 'react-redux'; import TimelineScale from './components/TimelineScale'; import FeatureSelection, { HELP_MESSAGE } from './components/FeatureSelection/FeatureSelection'; import TimelinePointer from './components/TimelinePointer'; import VerticalPointerLine from './components/VerticalPointerLine'; import cn from 'classnames'; import OverviewPanelContainer from './components/OverviewPanelContainer'; import { NoContent, Icon } from 'UI'; import { observer } from 'mobx-react-lite'; import { MobilePlayerContext, PlayerContext } from 'App/components/Session/playerContext'; import { useStore } from 'App/mstore'; function MobileOverviewPanelCont({ issuesList, sessionId, }: { issuesList: Record[]; sessionId: string; }) { const { aiSummaryStore } = useStore(); const { store, player } = React.useContext(MobilePlayerContext); const [dataLoaded, setDataLoaded] = React.useState(false); const [selectedFeatures, setSelectedFeatures] = React.useState([ 'PERFORMANCE', 'FRUSTRATIONS', 'ERRORS', 'NETWORK', ]); const { endTime, eventList: eventsList, frustrationsList, exceptionsList, fetchList, performanceChartData, performanceList, } = store.get(); const fetchPresented = fetchList.length > 0; const resources = { NETWORK: fetchList.filter((r: any) => r.status >= 400 || r.isRed || r.isYellow), ERRORS: exceptionsList, EVENTS: eventsList, PERFORMANCE: performanceChartData, FRUSTRATIONS: frustrationsList, }; useEffect(() => { if (dataLoaded) { return; } if ( exceptionsList.length > 0 || eventsList.length > 0 || issuesList.length > 0 || performanceChartData.length > 0 || frustrationsList.length > 0 ) { setDataLoaded(true); } }, [issuesList, exceptionsList, eventsList, performanceChartData, frustrationsList]); React.useEffect(() => { player.scale(); }, [selectedFeatures]); const originStr = window.env.ORIGIN || window.location.origin; const isSaas = /app\.openreplay\.com/.test(originStr); return ( aiSummaryStore.setToggleSummary(!aiSummaryStore.toggleSummary)} summaryChecked={aiSummaryStore.toggleSummary} /> ); } function WebOverviewPanelCont({ sessionId }: { sessionId: string }) { const { aiSummaryStore } = useStore(); const { store } = React.useContext(PlayerContext); const [selectedFeatures, setSelectedFeatures] = React.useState([ 'PERFORMANCE', 'FRUSTRATIONS', 'ERRORS', 'NETWORK', ]); const { endTime, currentTab, tabStates } = store.get(); const stackEventList = tabStates[currentTab]?.stackList || []; const frustrationsList = tabStates[currentTab]?.frustrationsList || []; const exceptionsList = tabStates[currentTab]?.exceptionsList || []; const resourceListUnmap = tabStates[currentTab]?.resourceList || []; const fetchList = tabStates[currentTab]?.fetchList || []; const graphqlList = tabStates[currentTab]?.graphqlList || []; const performanceChartData = tabStates[currentTab]?.performanceChartData || []; const fetchPresented = fetchList.length > 0; const resourceList = resourceListUnmap .filter((r: any) => r.isRed || r.isYellow) // @ts-ignore .concat(fetchList.filter((i: any) => parseInt(i.status) >= 400)) // @ts-ignore .concat(graphqlList.filter((i: any) => parseInt(i.status) >= 400)) .filter((i: any) => i.type === 'fetch'); const resources: any = React.useMemo(() => { return { NETWORK: resourceList, ERRORS: exceptionsList, EVENTS: stackEventList, PERFORMANCE: performanceChartData, FRUSTRATIONS: frustrationsList, }; }, [tabStates, currentTab]); const originStr = window.env.ORIGIN || window.location.origin; const isSaas = /app\.openreplay\.com/.test(originStr); return ( aiSummaryStore.setToggleSummary(!aiSummaryStore.toggleSummary)} summaryChecked={aiSummaryStore.toggleSummary} sessionId={sessionId} /> ); } function PanelComponent({ selectedFeatures, endTime, resources, fetchPresented, setSelectedFeatures, isMobile, performanceList, showSummary, toggleSummary, summaryChecked, sessionId, }: any) { return (
X-Ray {showSummary ? ( ) : null}
{summaryChecked ? : null}
Select a debug option to visualize on timeline.
} > {selectedFeatures.map((feature: any, index: number) => (
( )} endTime={endTime} message={HELP_MESSAGE[feature]} /> {isMobile && feature === 'PERFORMANCE' ? (
(
)} endTime={endTime} />
) : null}
))}
); } export const OverviewPanel = connect( (state: Record) => ({ issuesList: state.getIn(['sessions', 'current']).issues, sessionId: state.getIn(['sessions', 'current']).sessionId, }), { toggleBottomBlock, } )(observer(WebOverviewPanelCont)); export const MobileOverviewPanel = connect( (state: Record) => ({ issuesList: state.getIn(['sessions', 'current']).issues, sessionId: state.getIn(['sessions', 'current']).sessionId, }), { toggleBottomBlock, } )(observer(MobileOverviewPanelCont));