📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Merge branch 'main' into improvement/profiles-sessions-ui
Blue Mouse0ec64d5429ce
diff --cc web/app/pages/Project/tabs/Profiles/ProfileDetails.tsxindex 64809ad8d,e609832de..da6459c5b--- a/web/app/pages/Project/tabs/Profiles/ProfileDetails.tsx+++ b/web/app/pages/Project/tabs/Profiles/ProfileDetails.tsx@@@ -4,33 -4,31 +4,34 @@@ import utc from 'dayjs/plugin/utcimport _capitalize from 'lodash/capitalize'import _isEmpty from 'lodash/isEmpty'import {+ ArrowSquareOutIcon,+ CaretDownIcon,ClockIcon,- CalendarDotsIcon,- FileTextIcon,- MonitorIcon,+ CurrencyDollarIcon,+ CursorClickIcon,DeviceMobileIcon,DeviceTabletIcon,+ FileTextIcon,GlobeIcon,- CurrencyDollarIcon,+ MonitorIcon,+ SignInIcon,UserListIcon,- CursorClickIcon,+ WarningIcon,} from '@phosphor-icons/react'-import { useMemo } from 'react'+import { useMemo, useState } from 'react'+import type { ReactNode } from 'react'import { useTranslation } from 'react-i18next'-import {- BROWSER_LOGO_MAP,- OS_LOGO_MAP,- OS_LOGO_MAP_DARK,-} from '~/lib/constants'-import {- ProfileDetails as ProfileDetailsType,- Session,-} from '~/lib/models/Project'+import { PROJECT_TABS } from '~/lib/constants'+import { ProfileDetails as ProfileDetailsType } from '~/lib/models/Project'+import { BackButton } from '~/pages/Project/View/components/BackButton'+import { useViewProjectContext } from '~/pages/Project/View/ViewProject'+import { useCurrentProject } from '~/providers/CurrentProjectProvider'import { useTheme } from '~/providers/ThemeProvider'+import Button from '~/ui/Button'+import Flag from '~/ui/Flag'+ import InfiniteScrollTrigger from '~/ui/InfiniteScrollTrigger'+import PulsatingCircle from '~/ui/icons/PulsatingCircle'import Loader from '~/ui/Loader'import { Text } from '~/ui/Text'import Tooltip from '~/ui/Tooltip'@@@ -740,276 -565,24 +741,271 @@@ export const ProfileDetails = (</Text>) : (<>- <Sessions- sessions={sessions}- timeFormat={timeFormat}- hideNewReturnBadge- hideUserDetails- currency={currency}- />+ <div>+ {sessions.map((session, index) => (+ <ProfileSessionFlow+ key={session.psid}+ session={session}+ index={index}+ timeFormat={timeFormat}+ websiteUrl={websiteUrl}+ />+ ))}+ </div>- {canLoadMoreSessions ? (- <div className='px-4 pt-4'>- <Button- onClick={onLoadMoreSessions}- disabled={!!sessionsLoading}- loading={!!sessionsLoading}- className='w-full'- >- {t('project.loadMore')}- </Button>- </div>- ) : null}+ <InfiniteScrollTrigger+ hasMore={canLoadMoreSessions}+ isLoading={!!sessionsLoading}+ onLoadMore={onLoadMoreSessions}+ disabled={!!sessionsLoading}+ className='mt-2'+ /></>)}- </div>+ </section></div>++ <aside className='order-2 mb-1 lg:sticky lg:top-14 lg:mb-0 lg:self-start'>+ <div className='space-y-3 rounded-lg border border-gray-200 bg-white px-4 py-4 lg:min-h-[calc(100dvh-3.5rem)] dark:border-slate-800/60 dark:bg-slate-900/25'>+ <div className='pb-1'>+ <div className='flex items-start gap-3'>+ <div className='relative mt-2 shrink-0'>+ <ProfileAvatar profileId={details.profileId} size={42} />+ </div>+ <div className='min-w-0 flex-1'>+ <div className='mb-0.5 flex min-w-0 items-center gap-2'>+ <Text+ as='h2'+ size='lg'+ weight='bold'+ colour='primary'+ truncate+ className='min-w-0'+ >+ {displayName}+ </Text>+ {statusNode}+ </div>+ <Text+ size='xs'+ colour='secondary'+ code+ truncate+ className='block min-w-0'+ >+ {details.profileId}+ </Text>++ <div className='mt-2 space-y-1'>+ <div className='flex items-center gap-1'>+ <Text+ as='span'+ colour='primary'+ className='flex h-6 items-center justify-center'+ >+ {details.cc ? (+ <Flag+ className='rounded-xs'+ country={details.cc}+ size={16}+ alt=''+ aria-hidden='true'+ />+ ) : (+ <GlobeIcon className='size-4' />+ )}+ </Text>+ <Text+ as='span'+ size='sm'+ weight='medium'+ colour='primary'+ truncate+ title={locationSummary}+ >+ {locationSummary}+ </Text>+ </div>++ <div className='flex min-h-6 min-w-0 items-center'>+ {visibleProfilePlatformParts.map(+ ({ key, label, tooltip, icon }, index) => (+ <span+ key={key}+ className='flex min-w-0 items-center gap-1'+ >+ {index > 0 ? (+ <Text+ as='span'+ size='sm'+ weight='medium'+ colour='primary'+ className='shrink-0'+ >+ ,+ </Text>+ ) : null}+ {icon ? (+ <Tooltip+ asChild+ text={+ <Text size='xs' colour='inherit'>+ {tooltip}+ </Text>+ }+ ariaLabel={tooltip}+ tooltipNode={+ <Text+ as='button'+ type='button'+ size='sm'+ weight='medium'+ colour='primary'+ truncate+ className='inline-flex max-w-full min-w-0 cursor-default items-center gap-1 rounded-sm bg-transparent p-0 outline-none focus-visible:ring-2 focus-visible:ring-slate-900 dark:focus-visible:ring-slate-300'+ >+ <span className='flex size-4 shrink-0 items-center justify-center'>+ {icon}+ </span>+ <span className='min-w-0 truncate'>+ {label}+ </span>+ </Text>+ }+ disableHoverableContent+ />+ ) : (+ <Text+ as='span'+ size='sm'+ weight='medium'+ colour='primary'+ truncate+ >+ {label}+ </Text>+ )}+ </span>+ ),+ )}+ </div>+ </div>+ </div>+ </div>+ </div>++ <PanelSection title={t('common.details')}>+ <div>+ <InfoRow+ label={t('project.firstSeen')}+ value={+ <>+ <SignInIcon className='h-4 w-4' />+ {firstSeen}+ </>+ }+ />+ <InfoRow+ label={t('project.lastSeen')}+ value={+ <>+ <SignInIcon className='h-4 w-4 rotate-180' />+ {lastSeen}+ </>+ }+ />+ <InfoRow+ label={t('project.avgDuration')}+ value={+ <>+ <ClockIcon className='h-4 w-4' />+ {avgDurationStr}+ </>+ }+ />+ <InfoRow+ label={t('project.sessions')}+ value={+ <>+ <UserListIcon className='h-4 w-4' />+ {details.sessionsCount || 0}+ </>+ }+ />+ <InfoRow+ label={t('dashboard.pageviews')}+ value={+ <>+ <FileTextIcon className='h-4 w-4' />+ {details.pageviewsCount || 0}+ </>+ }+ />+ <InfoRow+ label={t('dashboard.events')}+ value={+ <>+ <CursorClickIcon className='h-4 w-4' />+ {details.eventsCount || 0}+ </>+ }+ />+ <InfoRow+ label={t('dashboard.errors')}+ value={+ <>+ <WarningIcon className='h-4 w-4 text-red-500' />+ {details.errorsCount || 0}+ </>+ }+ />+ {details.totalRevenue !== undefined &&+ details.totalRevenue > 0 ? (+ <InfoRow+ label={t('dashboard.revenue')}+ value={+ <>+ <CurrencyDollarIcon className='h-4 w-4 text-emerald-500' />+ {new Intl.NumberFormat(language || 'en-US', {+ style: 'currency',+ currency: revenueCurrency,+ minimumFractionDigits: 2,+ }).format(details.totalRevenue)}+ </>+ }+ />+ ) : null}+ </div>+ </PanelSection>++ <PanelSection title={t('project.locationAndDevice')}>+ <div>+ <InfoRow+ label={t('project.mapping.lc')}+ value={+ details.lc ? getLocaleDisplayName(details.lc, language) : '-'+ }+ />+ <InfoRow+ label={t('project.mapping.dv')}+ value={+ details.dv ? (+ <>+ <DeviceIcon device={details.dv} />+ {_capitalize(details.dv)}+ </>+ ) : (+ '-'+ )+ }+ />+ </div>+ </PanelSection>++ <PanelSection title={t('project.activityCalendar')}>+ <ActivityCalendar data={details.activityCalendar || []} />+ </PanelSection>+ </div>+ </aside></div>)}