import React from 'react'; 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 { useModal } from 'App/components/Modal'; import UserSessionsModal from 'Shared/UserSessionsModal'; import { observer } from 'mobx-react-lite'; import SessionInfoItem from '../../SessionInfoItem'; import { useTranslation } from 'react-i18next'; function UserCard({ className, width, height }) { const { t } = useTranslation(); const { settingsStore, sessionStore } = useStore(); const session = sessionStore.current; const { timezone } = settingsStore.sessionSettings; const { userBrowser, userDevice, userCountry, userBrowserVersion, userOs, userOsVersion, startedAt, userId, userAnonymousId, userNumericHash, userDisplayName, userDeviceType, revId, } = session; const hasUserDetails = !!userId || !!userAnonymousId; const getDimension = (width, height) => width && height ? (
{width || 'x'} {' '} {height || 'x'}
) : ( {t('Resolution N/A')} ); const avatarbgSize = '38px'; return (
{formatTimeOrDate(startedAt, timezone)} · {countries[userCountry]} · {userBrowser},{userOs},{userDevice} · (
} label={countries[userCountry]} value={ {formatTimeOrDate(startedAt)} } /> {revId && ( )}
)} > {t('More')}
); } export default observer(UserCard); // inner component function UserName({ name, userId, hash }) { const { showModal } = useModal(); const onClick = () => { showModal(, { right: true, }); }; return
{}}>{name}
; }