* start moving ui to redux tlk * remove unused reducer * changes for gdpr and site types * ui: migrating duck/roles to mobx * ui: drop unreferenced types * ui: drop unreferenced types * ui: move player slice reducer to mobx family * ui: move assignments to issueReportingStore.ts * remove issues store * some fixes after issues store * remove errors reducer, drop old components * finish removing errors reducer * start moving integrations state to mobx * change(ui): funnel duck cleanup * change(ui): custom fields * change(ui): customMetrics cleanup * change(ui): customMetrics cleanup * change(ui): duck/filters minor cleanup * change(ui): duck/filters cleanup * change(ui): duck/customMetrics cleanup and upgrades * fix integrations service, fix babel config to >.25 + not ie * refactoring integrations reducers etc WIP * finish removing integrations state * some fixes for integrated check * start of projects refactoring * move api and "few" files to new project store * new batch for site -> projects * fix setid context * move all critical components, drop site duck * remove all duck/site refs, remove old components * fixup for SessionTags.tsx, remove duck/sources (?) * move session store * init sessionstore outside of context * fix userfilter * replace simple actions for session store * sessions sotre * Rtm temp (#2597) * change(ui): duck/search wip * change(ui): duck/search wip * change(ui): duck/search wip * change(ui): duck/searchLive wip * change(ui): duck/searchLive wip * change(ui): duck/searchLive wip * change(ui): duck/searchLive wip * change(ui): search states * change(ui): search states * change(ui): search states * change(ui): fix savedSearch store * change(ui): fix savedSearch store * some fixes for session connector * change(ui): fix savedSearch store * change(ui): fix searchLive * change(ui): fix searchLive * fixes for session replay * change(ui): bookmark fetch * last components for sessions * add fetchautoplaylist * finish session reducer, remove deleted reducers * change(ui): fix the search fetch * change(ui): fix the search fetch * fix integrations call ctx * ensure ctx for sessionstore * fix(ui): checking for latest sessions path * start removing user reducer * removing user reducer pt2... * finish user store * remove rand log * fix crashes * tinkering workflow file for tracker test * making sure prefetched sessions work properly * fix conflict * fix router redirects during loading --------- Co-authored-by: Shekar Siri <sshekarsiri@gmail.com>
175 lines
4.3 KiB
JavaScript
175 lines
4.3 KiB
JavaScript
import { TYPES } from 'Types/session/event';
|
|
import React 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 Event from './Event';
|
|
import NoteEvent from './NoteEvent';
|
|
import stl from './eventGroupWrapper.module.css';
|
|
|
|
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,
|
|
isEditing,
|
|
showSelection,
|
|
isFirst,
|
|
presentInSearch,
|
|
isNote,
|
|
isTabChange,
|
|
filterOutNote,
|
|
} = 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 <UxtEvent event={event} />;
|
|
}
|
|
if (isNote) {
|
|
return (
|
|
<NoteEvent
|
|
note={event}
|
|
filterOutNote={filterOutNote}
|
|
noEdit={currentUserId !== event.userId}
|
|
/>
|
|
);
|
|
}
|
|
if (isLocation) {
|
|
return (
|
|
<Event
|
|
extended={isFirst}
|
|
key={event.key}
|
|
event={event}
|
|
onClick={onEventClick}
|
|
selected={isSelected}
|
|
showLoadInfo={showLoadInfo}
|
|
isCurrent={isCurrent}
|
|
presentInSearch={presentInSearch}
|
|
isLastInGroup={isLastInGroup}
|
|
whiteBg={true}
|
|
/>
|
|
);
|
|
}
|
|
if (isTabChange) {
|
|
return (
|
|
<TabChange
|
|
onClick={onEventClick}
|
|
from={event.fromTab}
|
|
to={event.toTab}
|
|
activeUrl={event.activeUrl}
|
|
/>
|
|
);
|
|
}
|
|
return (
|
|
<Event
|
|
key={event.key}
|
|
event={event}
|
|
onClick={onEventClick}
|
|
onCheckboxClick={onCheckboxClick}
|
|
selected={isSelected}
|
|
isCurrent={isCurrent}
|
|
showSelection={showSelection}
|
|
overlayed={isEditing}
|
|
presentInSearch={presentInSearch}
|
|
isLastInGroup={isLastInGroup}
|
|
whiteBg={whiteBg}
|
|
/>
|
|
);
|
|
};
|
|
|
|
const shadowColor = props.isPrev
|
|
? '#A7BFFF'
|
|
: props.isCurrent
|
|
? '#394EFF'
|
|
: 'transparent';
|
|
return (
|
|
<>
|
|
<div>
|
|
<div
|
|
style={{
|
|
position: 'absolute',
|
|
left: 0,
|
|
top: 0,
|
|
width: 1.5,
|
|
height: '100%',
|
|
backgroundColor: shadowColor,
|
|
zIndex: 98,
|
|
}}
|
|
/>
|
|
{props.isCurrent ? (
|
|
<div
|
|
style={{
|
|
position: 'absolute',
|
|
top: '50%',
|
|
left: -10,
|
|
width: 10,
|
|
height: 10,
|
|
transform: 'rotate(45deg) translate(0, -50%)',
|
|
background: '#394EFF',
|
|
zIndex: 99,
|
|
borderRadius: '.15rem',
|
|
}}
|
|
/>
|
|
) : null}
|
|
{isFirst && isLocation && event.referrer && (
|
|
<TextEllipsis>
|
|
<div className={stl.referrer}>
|
|
Referrer: <span className={stl.url}>{safeRef}</span>
|
|
</div>
|
|
</TextEllipsis>
|
|
)}
|
|
{returnEvt()}
|
|
</div>
|
|
{isLastInGroup && !isTabChange && (
|
|
<div className="border-color-gray-light-shade" />
|
|
)}
|
|
</>
|
|
);
|
|
}
|
|
|
|
function TabChange({ from, to, activeUrl, onClick }) {
|
|
if (!from) {
|
|
return null;
|
|
}
|
|
return (
|
|
<div
|
|
onClick={onClick}
|
|
className={
|
|
'cursor-pointer bg-gray-lightest w-full py-2 border-b hover:bg-active-blue'
|
|
}
|
|
>
|
|
<div className={'flex items-center gap-2 px-4'}>
|
|
<span style={{ fontWeight: 500 }}>{from}</span>
|
|
<Icon name={'arrow-right-short'} size={18} color={'gray-dark'} />
|
|
<span style={{ fontWeight: 500 }}>{to}</span>
|
|
</div>
|
|
<div
|
|
className={
|
|
'break-words mt-1 px-4 text-sm font-normal color-gray-medium whitespace-nowrap'
|
|
}
|
|
>
|
|
{activeUrl}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default observer(EventGroupWrapper);
|