* fix(ui): fix up mobile recordings display * fix(ui): some messages * fix(ui): some messages * fix(player): fix msg generation for ios messages * feat(player): add generic mmanager interface for ios player impl * feat(player): mobile player and message manager; touch manager; videoplayer * feat(player): add iphone shells, add log panel, * feat(player): detect ios sessions and inject correct player * feat(player): move screen mapper to utils * feat(player): events panel for mobile, map shell sizes to device type data, * feat(player): added network tab to mobile player; unify network message (ios and web) * feat(player): resize canvas up to phone screen size, fix capitalize util * feat(player): some general changes to support mobile events and network entries * feat(player): remove swipes from timeline * feat(player): more stuff for list walker * fix(ui): performance tab, mobile project typings and form * fix(ui):some ui touches for ios replayer shell * fix(ui): more fixes for ui, new onboarding screen for mobile projects * feat(ui): mobile overview panel (xray) * feat(ui): fixes for phone shell and tap events * fix(tracker): change phone shells and sizes * fix(tracker): fix border on replay screen * feat(ui): use crashes from db to show in session * feat(ui): use event name for xray * feat(ui): some overall ui fixes * feat(ui): IOS -> iOS * feat(ui): change tags to ant d * fix(ui): fast fix * fix(ui): fix for capitalizer * fix(ui): fix for browser display * fix(ui): fix for note popup * fix(ui): change exceptions display * fix(ui): add click rage to ios xray * fix(ui): some icons and resizing * fix(ui): fix ios context menu overlay, fix console logs creation for ios * feat(ui): added icons * feat(ui): performance warnings * feat(ui): performance warnings * feat(ui): different styles * feat(ui): rm debug true * feat(ui): fix warnings display * feat(ui): some styles for animation * feat(ui): add some animations to warnings * feat(ui): move perf warnings to performance graph * feat(ui): hide/show warns dynamically * feat(ui): new mobile touch animation * fix(tracker): update msg for ios * fix(ui): taprage fixes * fix(ui): regenerate icons and messages * fix(ui): fix msgs * fix(backend): fix events gen * fix(backend): fix userid msg
140 lines
4 KiB
TypeScript
140 lines
4 KiB
TypeScript
|
|
import React from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { withRouter } from 'react-router-dom';
|
|
import {
|
|
sessions as sessionsRoute,
|
|
liveSession as liveSessionRoute,
|
|
withSiteId,
|
|
} from 'App/routes';
|
|
import { BackLink, Link } from 'UI';
|
|
import { toggleFavorite, setSessionPath } from 'Duck/sessions';
|
|
import cn from 'classnames';
|
|
import SessionMetaList from 'Shared/SessionItem/SessionMetaList';
|
|
import UserCard from '../ReplayPlayer/EventsBlock/UserCard';
|
|
import Tabs from 'Components/Session/Tabs';
|
|
import { PlayerContext } from 'App/components/Session/playerContext';
|
|
import { observer } from 'mobx-react-lite';
|
|
import stl from '../ReplayPlayer/playerBlockHeader.module.css';
|
|
import { fetchListActive as fetchMetadata } from 'Duck/customField';
|
|
import { IFRAME } from 'App/constants/storageKeys';
|
|
|
|
const SESSIONS_ROUTE = sessionsRoute();
|
|
|
|
// TODO props
|
|
function PlayerBlockHeader(props: any) {
|
|
const [hideBack, setHideBack] = React.useState(false);
|
|
const { player, store } = React.useContext(PlayerContext);
|
|
|
|
const playerState = store?.get?.() || { width: 0, height: 0, showEvents: false }
|
|
const { width = 0, height = 0, showEvents = false } = playerState
|
|
|
|
const {
|
|
session,
|
|
fullscreen,
|
|
metaList,
|
|
siteId,
|
|
setActiveTab,
|
|
activeTab,
|
|
history,
|
|
sessionPath,
|
|
fetchMetadata,
|
|
} = props;
|
|
|
|
React.useEffect(() => {
|
|
const iframe = localStorage.getItem(IFRAME) || false;
|
|
setHideBack(!!iframe && iframe === 'true');
|
|
|
|
if (metaList.size === 0) fetchMetadata();
|
|
}, []);
|
|
|
|
const backHandler = () => {
|
|
if (
|
|
sessionPath.pathname === history.location.pathname ||
|
|
sessionPath.pathname.includes('/session/')
|
|
) {
|
|
history.push(withSiteId(SESSIONS_ROUTE, siteId));
|
|
} else {
|
|
history.push(
|
|
sessionPath ? sessionPath.pathname + sessionPath.search : withSiteId(SESSIONS_ROUTE, siteId)
|
|
);
|
|
}
|
|
};
|
|
|
|
const { metadata } = session;
|
|
let _metaList = Object.keys(metadata || {})
|
|
.filter((i) => metaList.includes(i))
|
|
.map((key) => {
|
|
const value = metadata[key];
|
|
return { label: key, value };
|
|
});
|
|
|
|
const TABS = [props.tabs.EVENTS].map((tab) => ({
|
|
text: tab,
|
|
key: tab,
|
|
}));
|
|
|
|
return (
|
|
<div className={cn(stl.header, 'flex justify-between', { hidden: fullscreen })}>
|
|
<div className="flex w-full items-center">
|
|
{!hideBack && (
|
|
<div
|
|
className="flex items-center h-full cursor-pointer group"
|
|
onClick={backHandler}
|
|
>
|
|
{/* @ts-ignore TODO */}
|
|
<BackLink label="Back" className="h-full ml-2" />
|
|
<div className={stl.divider} />
|
|
</div>
|
|
)}
|
|
<UserCard className="" width={width} height={height} />
|
|
|
|
<div className={cn('ml-auto flex items-center h-full')}>
|
|
{_metaList.length > 0 && (
|
|
<div className="border-l h-full flex items-center px-2">
|
|
<SessionMetaList className="" metaList={_metaList} maxLength={2} />
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
<div className="relative border-l" style={{ minWidth: '270px' }}>
|
|
<Tabs
|
|
tabs={TABS}
|
|
active={activeTab}
|
|
onClick={(tab) => {
|
|
if (activeTab === tab) {
|
|
setActiveTab('');
|
|
player.toggleEvents();
|
|
} else {
|
|
setActiveTab(tab);
|
|
!showEvents && player.toggleEvents();
|
|
}
|
|
}}
|
|
border={false}
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const PlayerHeaderCont = connect(
|
|
(state: any) => {
|
|
const session = state.getIn(['sessions', 'current']);
|
|
|
|
return {
|
|
session,
|
|
sessionPath: state.getIn(['sessions', 'sessionPath']),
|
|
local: state.getIn(['sessions', 'timezone']),
|
|
funnelRef: state.getIn(['funnels', 'navRef']),
|
|
siteId: state.getIn(['site', 'siteId']),
|
|
metaList: state.getIn(['customFields', 'list']).map((i: any) => i.key),
|
|
};
|
|
},
|
|
{
|
|
toggleFavorite,
|
|
setSessionPath,
|
|
fetchMetadata,
|
|
}
|
|
)(observer(PlayerBlockHeader));
|
|
|
|
export default withRouter(PlayerHeaderCont);
|