import UxtEvent from "Components/Session_/EventsBlock/UxtEvent"; import React from 'react'; import { connect } from 'react-redux'; import { TextEllipsis, Icon } from 'UI'; import withToggle from 'HOCs/withToggle'; import { TYPES } from 'Types/session/event'; import Event from './Event'; import stl from './eventGroupWrapper.module.css'; import NoteEvent from './NoteEvent'; // TODO: incapsulate toggler in LocationEvent @withToggle('showLoadInfo', 'toggleLoadInfo') @connect( (state) => ({ members: state.getIn(['members', 'list']), currentUserId: state.getIn(['user', 'account', 'id']) }), ) class EventGroupWrapper extends React.Component { toggleLoadInfo = (e) => { e.stopPropagation(); this.props.toggleLoadInfo(); }; componentDidUpdate(prevProps) { if ( prevProps.showLoadInfo !== this.props.showLoadInfo || prevProps.query !== this.props.query || prevProps.event.timestamp !== this.props.event.timestamp || prevProps.isNote !== this.props.isNote ) { this.props.mesureHeight(); } } componentDidMount() { this.props.toggleLoadInfo(this.props.isFirst); this.props.mesureHeight(); } onEventClick = (e) => this.props.onEventClick(e, this.props.event); onCheckboxClick = (e) => this.props.onCheckboxClick(e, this.props.event); render() { const { event, isLastEvent, isLastInGroup, isSelected, isCurrent, isEditing, showSelection, showLoadInfo, isFirst, presentInSearch, isNote, isTabChange, filterOutNote, } = this.props; 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 (isLocation) { return ( ) } if (isTabChange) { return ( ) } return ( ) } const shadowColor = this.props.isPrev ? '#A7BFFF' : this.props.isCurrent ? '#394EFF' : 'transparent' return ( <>
{this.props.isCurrent ? (
) : null} {isFirst && isLocation && event.referrer && (
Referrer: {safeRef}
)} {returnEvt()}
{(isLastInGroup && !isTabChange) &&
} ); } } function TabChange({ from, to, activeUrl, onClick }) { if (!from) { return null; } return (
{from} {to}
{activeUrl}
) } export default React.memo(EventGroupWrapper);