import React from 'react'; import cn from 'classnames'; import { TextEllipsis } from 'UI'; import withToggle from 'HOCs/withToggle'; import { TYPES } from 'Types/session/event'; import Event from './Event' import stl from './eventGroupWrapper.module.css'; // TODO: incapsulate toggler in LocationEvent @withToggle("showLoadInfo", "toggleLoadInfo") class EventGroupWrapper extends React.PureComponent { toggleLoadInfo = (e) => { e.stopPropagation(); this.props.toggleLoadInfo(); } componentDidUpdate(prevProps) { if (prevProps.showLoadInfo !== this.props.showLoadInfo || prevProps.query !== this.props.query) { 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, } = this.props; const isLocation = event.type === TYPES.LOCATION; const whiteBg = isLastInGroup && event.type !== TYPES.LOCATION || (!isLastEvent && event.type !== TYPES.LOCATION) return (
{ isFirst && isLocation && event.referrer &&
Referrer: { event.referrer }
} { isLocation ? : }
) } } export default EventGroupWrapper