import { connectPlayer, Controls } from 'App/player'; import React, { useEffect } from 'react'; import BottomBlock from '../BottomBlock'; import EventRow from './components/EventRow'; import { TYPES } from 'Types/session/event'; import { Icon } from 'UI'; import { Tooltip } from 'react-tippy'; import stl from './overviewPanel.module.css'; interface Props { resourceList: any[]; exceptionsList: any[]; eventsList: any[]; endTime: number; } function OverviewPanel(props: Props) { const { resourceList, exceptionsList, eventsList, endTime } = props; const clickRageList = React.useMemo(() => { return eventsList.filter((item: any) => item.type === TYPES.CLICKRAGE); }, [eventsList]); const containerRef = React.useRef(null); const innerRef = React.createRef(); const scale = 100 / endTime; const createEventClickHandler = (pointer: any) => (e: any) => { console.log('here...'); e.stopPropagation(); Controls.jump(pointer.time); // props.setTimelinePointer(pointer); }; let width = 100; const SPEED = 5; const onWheel = (e: any) => { e.preventDefault(); e.stopPropagation(); // console.log('e', e) // horizontal if (e.deltaX != '-0') { // e.preventDefault(); console.log('e.deltaX', e.deltaX); } // Vertical if (e.deltaY != '-0') { console.log('e.deltaY', e.deltaY); // e.preventDefault(); const delta = e.deltaY; if (delta > 0) { width += SPEED; } else { width -= SPEED; } if (width < 100) { width = 100; } if (innerRef.current) { innerRef.current.style.width = width + '%'; if (containerRef.current) { containerRef.current.style.left = (100 - width) / 2 + '%'; } } } }; useEffect(() => { if (containerRef.current) { containerRef.current.addEventListener('wheel', onWheel, { passive: false }); } return () => { if (containerRef.current) { containerRef.current.removeEventListener('wheel', onWheel); } }; }, []); const renderNetworkElement = (item: any) => { return ( {item.success ? 'Slow resource: ' : 'Missing resource:'}
{item.name} } delay={0} position="top" >
); }; const renderClickRageElement = (item: any) => { return ( {'Click Rage'}
} delay={0} position="top" >
); }; const renderExceptionElement = (item: any) => { return ( {'Exception'}
{item.message} } delay={0} position="top" >
); }; return ( Overview
); } export default connectPlayer((state: any) => ({ resourceList: state.resourceList.filter((r: any) => r.isRed() || r.isYellow()), exceptionsList: state.exceptionsList, eventsList: state.eventList, endTime: state.endTime, }))(OverviewPanel); const VerticalPointerLine = connectPlayer((state: any) => ({ time: state.time, scale: 100 / state.endTime, }))(({ time, scale }: any) => { const left = time * scale; return
; });