import { TYPES } from 'Types/session/event'; import React, { useMemo } from 'react'; import { observer } from 'mobx-react-lite'; import { useStore } from 'App/mstore'; import UxtEvent from 'Components/Session_/EventsBlock/UxtEvent'; import { Icon, TextEllipsis } from 'UI'; import cn from 'classnames'; import Event from './Event'; import NoteEvent from './NoteEvent'; import stl from './eventGroupWrapper.module.css'; import { useTranslation } from 'react-i18next'; function EventGroupWrapper(props) { const { userStore } = useStore(); const currentUserId = userStore.account.id; const onEventClick = (e) => props.onEventClick(e, props.event); const onCheckboxClick = (e) => props.onCheckboxClick(e, props.event); const { event, isLastEvent, isLastInGroup, isSelected, isCurrent, isSearched, isEditing, showSelection, isFirst, presentInSearch, isNote, isTabChange, isIncident, filterOutNote, } = props; const { t } = useTranslation(); const isLocation = event.type === TYPES.LOCATION; const isUxtEvent = event.type === TYPES.UXT_EVENT; const whiteBg = (isLastInGroup && event.type !== TYPES.LOCATION) || (!isLastEvent && event.type !== TYPES.LOCATION); const safeRef = String(event.referrer || ''); const returnEvt = () => { if (isUxtEvent) { return ; } if (isNote) { return ( ); } if (isIncident) { return ( ) } if (isLocation) { return ( ); } if (isTabChange) { return ( ); } return ( ); }; const shadowColor = useMemo(() => { if (isSearched) { return '#F0A930'; } if (props.isPrev) { return '#A7BFFF'; } if (props.isCurrent) { return '#394EFF'; } return 'transparent'; }, [isSearched, props.isPrev, props.isCurrent]); return ( <>
{props.isCurrent ? (
) : null} {isFirst && isLocation && event.referrer && (
{t('Referrer:')}{' '} {safeRef}
)} {returnEvt()}
{isLastInGroup && !isTabChange && (
)} ); } function TabChange({ from, to, activeUrl, onClick }) { if (!from) { return null; } return (
{from} {to}
{activeUrl}
); }; function Incident({ label, onClick }: { label: string; onClick: () => void }) { const { t } = useTranslation(); return (
{t('Incident')} {label}
); }; export default observer(EventGroupWrapper);