* 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
147 lines
5.6 KiB
JavaScript
147 lines
5.6 KiB
JavaScript
import React from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { List } from 'immutable';
|
|
import { countries } from 'App/constants';
|
|
import { useStore } from 'App/mstore';
|
|
import { browserIcon, osIcon, deviceTypeIcon } from 'App/iconNames';
|
|
import { formatTimeOrDate } from 'App/date';
|
|
import { Avatar, TextEllipsis, CountryFlag, Icon, Tooltip, Popover } from 'UI';
|
|
import cn from 'classnames';
|
|
import { withRequest } from 'HOCs';
|
|
import SessionInfoItem from 'Components/Session_/SessionInfoItem';
|
|
import { useModal } from 'App/components/Modal';
|
|
import UserSessionsModal from 'Shared/UserSessionsModal';
|
|
import { IFRAME } from 'App/constants/storageKeys';
|
|
import { capitalize } from "App/utils";
|
|
|
|
function UserCard({ className, request, session, width, height, similarSessions, loading }) {
|
|
const { settingsStore } = useStore();
|
|
const { timezone } = settingsStore.sessionSettings;
|
|
|
|
const {
|
|
userBrowser,
|
|
userDevice,
|
|
userCountry,
|
|
userCity,
|
|
userState,
|
|
userBrowserVersion,
|
|
userOs,
|
|
userOsVersion,
|
|
startedAt,
|
|
userId,
|
|
userAnonymousId,
|
|
userNumericHash,
|
|
userDisplayName,
|
|
userDeviceType,
|
|
revId,
|
|
} = session;
|
|
|
|
const hasUserDetails = !!userId || !!userAnonymousId;
|
|
|
|
const getDimension = (width, height) => {
|
|
return width && height ? (
|
|
<div className="flex items-center">
|
|
{width || 'x'} <Icon name="close" size="12" className="mx-1" /> {height || 'x'}
|
|
</div>
|
|
) : (
|
|
<span className="">Resolution N/A</span>
|
|
);
|
|
};
|
|
|
|
const avatarbgSize = '38px';
|
|
|
|
const safeOs = userOs === 'IOS' ? 'iOS' : userOs;
|
|
return (
|
|
<div className={cn('bg-white flex items-center w-full', className)}>
|
|
<div className="flex items-center">
|
|
<Avatar iconSize="23" width={avatarbgSize} height={avatarbgSize} seed={userNumericHash} />
|
|
<div className="ml-3 overflow-hidden leading-tight">
|
|
<TextEllipsis
|
|
noHint
|
|
className={cn('font-medium', { 'color-teal cursor-pointer': hasUserDetails })}
|
|
// onClick={hasUserDetails ? showSimilarSessions : undefined}
|
|
>
|
|
<UserName name={userDisplayName} userId={userId} hash={userNumericHash} />
|
|
</TextEllipsis>
|
|
|
|
<div className="text-sm color-gray-medium flex items-center">
|
|
<span style={{ whiteSpace: 'nowrap' }}>
|
|
<Tooltip
|
|
title={`${formatTimeOrDate(startedAt, timezone, true)} ${timezone.label}`}
|
|
className="w-fit !block"
|
|
>
|
|
{formatTimeOrDate(startedAt, timezone)}
|
|
</Tooltip>
|
|
</span>
|
|
<span className="mx-1 font-bold text-xl">·</span>
|
|
{userCity && <span className="mr-1">{userCity},</span>}
|
|
<span>{countries[userCountry]}</span>
|
|
<span className="mx-1 font-bold text-xl">·</span>
|
|
<span>
|
|
{userBrowser ? `${capitalize(userBrowser)}, ` : ''}
|
|
{`${/ios/i.test(userOs) ? 'iOS ' : capitalize(userOs) + ','} `}
|
|
{capitalize(userDevice)}
|
|
</span>
|
|
<span className="mx-1 font-bold text-xl">·</span>
|
|
<Popover
|
|
render={() => (
|
|
<div className="text-left bg-white rounded">
|
|
<SessionInfoItem
|
|
comp={<CountryFlag country={userCountry} height={11} />}
|
|
label={countries[userCountry]}
|
|
value={
|
|
<span style={{ whiteSpace: 'nowrap' }}>
|
|
{
|
|
<>
|
|
{userCity && <span className="mr-1">{userCity},</span>}
|
|
{userState && <span className="mr-1">{userState}</span>}
|
|
</>
|
|
}
|
|
</span>
|
|
}
|
|
/>
|
|
{userBrowser &&
|
|
<SessionInfoItem
|
|
icon={browserIcon(userBrowser)}
|
|
label={userBrowser}
|
|
value={`v${userBrowserVersion}`}
|
|
/>
|
|
}
|
|
<SessionInfoItem icon={osIcon(userOs)} label={safeOs} value={userOsVersion} />
|
|
<SessionInfoItem
|
|
icon={deviceTypeIcon(userDeviceType)}
|
|
label={userDeviceType}
|
|
value={getDimension(width, height)}
|
|
isLast={!revId}
|
|
/>
|
|
{revId && <SessionInfoItem icon="info" label="Rev ID:" value={revId} isLast />}
|
|
</div>
|
|
)}
|
|
>
|
|
<span className="link">More</span>
|
|
</Popover>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const component = React.memo(connect((state) => ({ session: state.getIn(['sessions', 'current']) }))(UserCard));
|
|
|
|
export default withRequest({
|
|
initialData: List(),
|
|
endpoint: '/metadata/session_search',
|
|
dataWrapper: (data) => Object.values(data),
|
|
dataName: 'similarSessions',
|
|
})(component);
|
|
|
|
// inner component
|
|
function UserName({ name, userId, hash }) {
|
|
const hasIframe = localStorage.getItem(IFRAME) === 'true';
|
|
const { showModal } = useModal();
|
|
const onClick = () => {
|
|
showModal(<UserSessionsModal userId={userId} hash={hash} name={name} />, { right: true, width: 700 });
|
|
};
|
|
return <div onClick={userId && !hasIframe ? onClick : () => {}}>{name}</div>;
|
|
}
|