openreplay/frontend/app/components/Session/Player/ClipPlayer/UserCard.tsx
Delirium 2cd96b0df0
Highlight UI (#2951)
* ui: start highlight ui

* ui: tag items

* ui: connecting highlights to notes api...

* Highlight feature refinements (#2948)

* ui: move clips player to foss, connect notes api to hl

* ui: tune note/hl editing, prevent zoom slider body from jumping around

* ui: safe check for tag

* ui: fix thumbnail gen

* ui: fix thumbnail gen

* ui: make player modal wider, add shadow

* ui: custom warn barge for clips

* ui: swap icon for note event wrapper

* ui: rm other, fix cancel

* ui: moving around creation modal

* ui: bg tint

* ui: rm disabled for text btn

* ui: fix ownership sorting

* ui: close player on bg click

* ui: fix query, fix min distance for default range

* ui: move hl list header out of list comp

* ui: spot list header segmented size

* Various improvements in highlights (#2955)

* ui: update hl in hlPanel comp

* ui: rm debug

* ui: fix icons file

---------

Co-authored-by: Sudheer Salavadi <connect.uxmaster@gmail.com>
2025-01-24 09:59:54 +01:00

73 lines
2.6 KiB
TypeScript

import React from 'react';
import {countries} from 'App/constants';
import {useStore} from 'App/mstore';
import {formatTimeOrDate} from 'App/date';
import {Avatar, TextEllipsis, Tooltip} from 'UI';
import cn from 'classnames';
import {capitalize} from 'App/utils';
import {observer} from 'mobx-react-lite';
import Session from 'Types/session';
interface Props {
session: Session;
className?: string;
width?: number;
height?: number;
}
const UserCard: React.FC<Props> = ({session, className, width, height}) => {
const {settingsStore} = useStore();
const {timezone} = settingsStore.sessionSettings;
const {
userBrowser,
userDevice,
userCountry,
userCity,
userOs,
startedAt,
userNumericHash,
userDisplayName,
} = session;
const avatarBgSize = '38px';
return (
<div className={cn('bg-white flex items-center w-full', className)} style={{width, height}}>
<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="font-medium">
{userDisplayName}
</TextEllipsis>
<div className="text-sm text-gray-500 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">&#183;</span>
{userCity && <span className="mr-1">{userCity},</span>}
<span>{countries[userCountry]}</span>
<span className="mx-1 font-bold text-xl">&#183;</span>
<span>
{userBrowser && `${capitalize(userBrowser)}, `}
{`${/ios/i.test(userOs) ? 'iOS' : capitalize(userOs)}, `}
{capitalize(userDevice)}
</span>
</div>
</div>
</div>
</div>
);
};
export default observer(UserCard);