Skip to content

📈 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!

Redesign UI improvements

Blue Mouse40ae568de6d2
diff --git a/web/app/pages/Project/View/Panels.tsx b/web/app/pages/Project/View/Panels.tsx
index 9712dbad9..d39644774 100644
--- a/web/app/pages/Project/View/Panels.tsx
+++ b/web/app/pages/Project/View/Panels.tsx
@@ -95,7 +95,7 @@ const PanelContainer = ({
return (
<div
className={cx(
- 'overflow-hidden rounded-lg border border-gray-300 bg-white px-4 pb-3 dark:border-slate-800/60 dark:bg-slate-800/25',
+ 'overflow-hidden rounded-lg border border-gray-200 bg-white px-4 pb-3 dark:border-slate-800/60 dark:bg-slate-800/25',
hideHeader ? 'pt-3' : 'pt-5',
{
'col-span-full sm:col-span-2': type === 'metadata' || type === 'customEvents',
@@ -135,7 +135,7 @@ const PanelContainer = ({
'border-slate-900 text-slate-900 dark:border-gray-50 dark:text-gray-50': dropdownTabs.some(
(t) => t.id === activeTabId,
),
- 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-300 dark:hover:text-gray-300':
+ 'border-transparent text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':
!dropdownTabs.some((t) => t.id === activeTabId),
},
)}
@@ -158,7 +158,7 @@ const PanelContainer = ({
{
'border-slate-900 text-slate-900 dark:border-gray-50 dark:text-gray-50':
activeTabId === tab.id,
- 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-300 dark:hover:text-gray-300':
+ 'border-transparent text-gray-500 hover:border-gray-200 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-200 dark:hover:text-gray-300':
activeTabId !== tab.id,
},
)}
@@ -176,7 +176,7 @@ const PanelContainer = ({
{onDetailsClick ? (
<div className='mt-2 flex items-center justify-center'>
<Button
- className='max-w-max border border-transparent bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200 hover:dark:bg-slate-700'
+ className='max-w-max border border-transparent bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-200 hover:bg-gray-50 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200 hover:dark:bg-slate-700'
type='button'
onClick={onDetailsClick}
>
@@ -653,7 +653,7 @@ const CustomEvents = ({ customs, chartData, filters, getCustomEventMetadata, get
>
<td className='flex items-center py-1 text-left'>
<button
- className='peer z-10 -m-1 ml-1 rounded-md border border-transparent p-1 transition-colors hover:border-gray-300 hover:bg-white hover:dark:border-slate-700/80 dark:hover:bg-slate-800 focus:dark:ring-gray-200'
+ className='peer z-10 -m-1 ml-1 rounded-md border border-transparent p-1 transition-colors hover:border-gray-200 hover:bg-white hover:dark:border-slate-700/80 dark:hover:bg-slate-800 focus:dark:ring-gray-200'
type='button'
onClick={toggleDetails(ev)}
>
@@ -1471,7 +1471,7 @@ const DetailsTable = ({
placeholder={t('project.search')}
value={search}
onChange={(e) => setSearch(e.target.value)}
- className='w-full rounded-md border border-gray-300 bg-white px-2 py-1 text-sm text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:outline-none dark:border-slate-700 dark:bg-slate-800 dark:text-gray-50'
+ className='w-full rounded-md border border-gray-200 bg-white px-2 py-1 text-sm text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:outline-none dark:border-slate-700 dark:bg-slate-800 dark:text-gray-50'
/>
</div>
<div ref={parentRef} className='max-h-[500px] overflow-y-auto'>
@@ -2098,7 +2098,7 @@ const MetadataPanel = ({ metadata }: MetadataPanelProps) => {
<div className='flex w-18 justify-between'>
<Button
className={cx(
- 'border border-gray-300 px-1.5 py-0.5 font-light text-gray-500 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200',
+ 'border border-gray-200 px-1.5 py-0.5 font-light text-gray-500 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200',
{
'cursor-not-allowed opacity-50': !canGoPrev(),
'hover:bg-gray-100 hover:dark:bg-slate-700': canGoPrev(),
@@ -2113,7 +2113,7 @@ const MetadataPanel = ({ metadata }: MetadataPanelProps) => {
</Button>
<Button
className={cx(
- 'border border-gray-300 px-1.5 py-0.5 font-light text-gray-500 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200',
+ 'border border-gray-200 px-1.5 py-0.5 font-light text-gray-500 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200',
{
'cursor-not-allowed opacity-50': !canGoNext(),
'hover:bg-gray-100 hover:dark:bg-slate-700': canGoNext(),
diff --git a/web/app/pages/Project/View/ViewProject.tsx b/web/app/pages/Project/View/ViewProject.tsx
index b7a1cc7c6..87897c422 100644
--- a/web/app/pages/Project/View/ViewProject.tsx
+++ b/web/app/pages/Project/View/ViewProject.tsx
@@ -10,7 +10,6 @@ import {
SunIcon,
BugIcon,
GaugeIcon,
- UsersIcon,
UserIcon,
BellRingIcon,
ChartNoAxesColumnIcon,
@@ -22,6 +21,7 @@ import {
SparklesIcon,
FlagIcon,
FlaskConicalIcon,
+ FileUser,
} from 'lucide-react'
import React, { useState, useEffect, useMemo, useRef, useCallback, createContext, useContext, lazy } from 'react'
import { useHotkeys } from 'react-hotkeys-hook'
@@ -539,7 +539,7 @@ const ViewProjectContent = () => {
{
id: PROJECT_TABS.sessions,
label: t('dashboard.sessions'),
- icon: UsersIcon,
+ icon: FileUser,
},
{
id: PROJECT_TABS.errors,
diff --git a/web/app/pages/Project/View/components/ProjectSidebar.tsx b/web/app/pages/Project/View/components/ProjectSidebar.tsx
index 988027c29..ab17cd2b4 100644
--- a/web/app/pages/Project/View/components/ProjectSidebar.tsx
+++ b/web/app/pages/Project/View/components/ProjectSidebar.tsx
@@ -66,26 +66,10 @@ interface ProjectSidebarProps {
dataLoading?: boolean
searchParams: URLSearchParams
allowedToManage?: boolean
- // Mobile-specific props
isMobileOpen?: boolean
onMobileClose?: () => void
}
-const TAB_HINT_KEYS: Record<string, string> = {
- ai: 'dashboard.askAiHint',
- traffic: 'dashboard.trafficHint',
- performance: 'dashboard.performanceHint',
- funnels: 'dashboard.funnelsHint',
- alerts: 'dashboard.alertsHint',
- profiles: 'dashboard.profilesHint',
- sessions: 'dashboard.sessionsHint',
- errors: 'dashboard.errorsHint',
- goals: 'dashboard.goalsHint',
- experiments: 'dashboard.experimentsHint',
- featureFlags: 'dashboard.featureFlagsHint',
- captcha: 'dashboard.captchaHint',
-}
-
const CollapsibleGroup: React.FC<{
group: TabGroup
activeTab: ProjectTabKey
@@ -96,7 +80,6 @@ const CollapsibleGroup: React.FC<{
isCollapsed?: boolean
onMobileClose?: () => void
}> = ({ group, activeTab, onTabChange, projectId, dataLoading, searchParams, isCollapsed, onMobileClose }) => {
- const { t } = useTranslation('common')
const [isExpanded, setIsExpanded] = useState(true)
const hasActiveTab = useMemo(() => {
@@ -109,7 +92,6 @@ const CollapsibleGroup: React.FC<{
}
}, [hasActiveTab]) // eslint-disable-line react-hooks/exhaustive-deps
- // When collapsed, render tabs without group header
if (isCollapsed) {
return (
<div className='mb-1'>
@@ -215,32 +197,23 @@ const CollapsibleGroup: React.FC<{
? routes.project_settings.replace(':id', projectId)
: { search: newSearchParams.toString() }
- const hintKey = TAB_HINT_KEYS[tab.id]
- const hintText = hintKey ? t(hintKey) : undefined
-
return (
- <Tooltip
+ <Link
key={tab.id}
- text={hintText}
- delay={750}
- tooltipNode={
- <Link
- to={tabUrl}
- onClick={handleClick}
- className={cn('group flex items-center gap-1.5 rounded-md px-2.5 py-2 transition-colors', {
- 'bg-gray-100 dark:bg-slate-800': isCurrent,
- 'hover:bg-gray-100 dark:hover:bg-slate-800/60': !isCurrent,
- 'cursor-wait': dataLoading && tab.id !== 'settings',
- })}
- aria-current={isCurrent ? 'page' : undefined}
- >
- <TabIcon className={cn('size-4 shrink-0', iconColorClass)} strokeWidth={1.5} aria-hidden='true' />
- <Text as='span' size='sm' weight='medium' truncate className='max-w-full'>
- {tab.label}
- </Text>
- </Link>
- }
- />
+ to={tabUrl}
+ onClick={handleClick}
+ className={cn('group flex items-center gap-1.5 rounded-md px-2.5 py-2 transition-colors', {
+ 'bg-gray-100 dark:bg-slate-800': isCurrent,
+ 'hover:bg-gray-100 dark:hover:bg-slate-800/60': !isCurrent,
+ 'cursor-wait': dataLoading && tab.id !== 'settings',
+ })}
+ aria-current={isCurrent ? 'page' : undefined}
+ >
+ <TabIcon className={cn('size-4 shrink-0', iconColorClass)} strokeWidth={1.5} aria-hidden='true' />
+ <Text as='span' size='sm' weight='medium' truncate className='max-w-full'>
+ {tab.label}
+ </Text>
+ </Link>
)
})}
</nav>
@@ -299,7 +272,9 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
if (isMobileOpen) {
document.addEventListener('keydown', handleEscape)
- document.body.style.overflow = 'hidden'
+ requestAnimationFrame(() => {
+ document.body.style.overflow = 'hidden'
+ })
}
return () => {
@@ -369,14 +344,18 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
const sidebarContent = (
<aside
className={cn(
- 'sticky top-2 flex shrink-0 flex-col self-start overflow-hidden rounded-lg border border-gray-300 bg-white transition-all duration-300 ease-in-out dark:border-slate-800/60 dark:bg-slate-800/25',
- isMobileOpen ? 'h-screen w-64' : isScrolled ? 'h-[calc(100vh-1.5rem)]' : 'h-[calc(100vh-60px-1rem)]',
- isCollapsed && !isMobileOpen ? 'w-14' : 'w-56',
+ 'sticky top-2 flex shrink-0 flex-col self-start overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-slate-800/60 dark:bg-slate-800/25',
+ isMobileOpen
+ ? 'h-screen w-64'
+ : cn(
+ 'transition-[width,height] duration-300 ease-in-out',
+ isScrolled ? 'h-[calc(100vh-1.5rem)]' : 'h-[calc(100vh-60px-1rem)]',
+ isCollapsed ? 'w-14' : 'w-56',
+ ),
className,
)}
>
- {/* Project name at the top */}
- <div className='sticky top-0 z-10 flex items-center justify-between border-b border-gray-300 bg-white px-4 py-2 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='sticky top-0 z-10 flex items-center justify-between border-b border-gray-200 bg-white px-4 py-2 dark:border-slate-800/60 dark:bg-slate-800/25'>
{isCollapsed && !isMobileOpen ? (
<Tooltip
text={projectName}
@@ -397,7 +376,6 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
}
/>
)}
- {/* Close button for mobile */}
{isMobileOpen ? (
<button
type='button'
@@ -410,9 +388,7 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
) : null}
</div>
- {/* Tabs area */}
<div className='flex-1 overflow-y-auto px-2 py-3'>
- {/* Ask AI - standalone tab above groups */}
{askAiTab ? (
<div className='mb-1'>
{(() => {
@@ -459,29 +435,22 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
}
return (
- <Tooltip
- text={t('dashboard.askAiHint')}
- delay={750}
- className='w-full'
- tooltipNode={
- <Link
- to={{ search: newSearchParams.toString() }}
- onClick={handleClick}
- className={cn('group flex items-center gap-2 rounded-md px-2.5 py-2 transition-colors', {
- 'bg-linear-to-r from-violet-500/10 to-purple-500/10 dark:from-violet-500/20 dark:to-purple-500/20':
- isCurrent,
- 'hover:bg-gray-100 dark:hover:bg-slate-800/60': !isCurrent,
- 'cursor-wait': dataLoading,
- })}
- aria-current={isCurrent ? 'page' : undefined}
- >
- <TabIcon className={cn('size-4 shrink-0', iconColorClass)} strokeWidth={1.5} aria-hidden='true' />
- <Text as='span' size='sm' weight='medium' truncate className='max-w-full'>
- {askAiTab.label}
- </Text>
- </Link>
- }
- />
+ <Link
+ to={{ search: newSearchParams.toString() }}
+ onClick={handleClick}
+ className={cn('group flex items-center gap-2 rounded-md px-2.5 py-2 transition-colors', {
+ 'bg-linear-to-r from-violet-500/10 to-purple-500/10 dark:from-violet-500/20 dark:to-purple-500/20':
+ isCurrent,
+ 'hover:bg-gray-100 dark:hover:bg-slate-800/60': !isCurrent,
+ 'cursor-wait': dataLoading,
+ })}
+ aria-current={isCurrent ? 'page' : undefined}
+ >
+ <TabIcon className={cn('size-4 shrink-0', iconColorClass)} strokeWidth={1.5} aria-hidden='true' />
+ <Text as='span' size='sm' weight='medium' truncate className='max-w-full'>
+ {askAiTab.label}
+ </Text>
+ </Link>
)
})()}
</div>
@@ -502,9 +471,7 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
))}
</div>
- {/* Bottom section: Collapse button + Settings */}
- <div className='sticky bottom-0 flex flex-col gap-0.5 border-t border-gray-300 bg-white px-2 py-2 dark:border-slate-800/60 dark:bg-slate-800/25'>
- {/* Collapse/Expand button - hide on mobile */}
+ <div className='sticky bottom-0 flex flex-col gap-0.5 border-t border-gray-200 bg-white px-2 py-2 dark:border-slate-800/60 dark:bg-slate-800/25'>
{!isMobileOpen ? (
<button
type='button'
@@ -527,7 +494,6 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
</button>
) : null}
- {/* Settings - always show if user is allowed to manage */}
{allowedToManage ? (
<Link
to={routes.project_settings.replace(':id', projectId)}
@@ -551,23 +517,18 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
</aside>
)
- // Mobile: render with overlay
if (isMobileOpen) {
return (
<div className='fixed inset-0 z-50 md:hidden'>
- {/* Overlay */}
- <div className='absolute inset-0 bg-black/50 transition-opacity' onClick={onMobileClose} aria-hidden='true' />
- {/* Sidebar panel */}
+ <div className='animate-fade-in absolute inset-0 bg-black/50' onClick={onMobileClose} aria-hidden='true' />
<div className='animate-slide-in-left relative h-full w-fit'>{sidebarContent}</div>
</div>
)
}
- // Desktop: render normally
return sidebarContent
}
-// Mobile trigger button component
interface MobileSidebarTriggerProps {
onClick: () => void
activeTabLabel?: string
@@ -581,7 +542,7 @@ export const MobileSidebarTrigger: React.FC<MobileSidebarTriggerProps> = ({ onCl
<button
type='button'
onClick={onClick}
- className='flex items-center justify-center rounded-md border border-gray-300 bg-white p-2 text-gray-700 shadow-sm transition-colors hover:bg-gray-50 dark:border-slate-700 dark:bg-slate-800 dark:text-gray-200 dark:hover:bg-slate-700'
+ className='flex items-center justify-center rounded-md border border-gray-300 p-2 text-gray-700 transition-all ring-inset hover:bg-white focus:z-10 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:border-slate-700/80 dark:text-gray-200 dark:hover:bg-slate-800 focus:dark:ring-gray-200'
aria-label={t('common.openMenu')}
>
<MenuIcon className='h-5 w-5' strokeWidth={1.5} />
diff --git a/web/app/pages/Project/tabs/Alerts/ProjectAlertsView.tsx b/web/app/pages/Project/tabs/Alerts/ProjectAlertsView.tsx
index b6d63bd0e..fa91fc04e 100644
--- a/web/app/pages/Project/tabs/Alerts/ProjectAlertsView.tsx
+++ b/web/app/pages/Project/tabs/Alerts/ProjectAlertsView.tsx
@@ -14,7 +14,7 @@ import {
EyeIcon,
MousePointerClickIcon,
UsersIcon,
- AlertCircleIcon,
+ BugIcon,
FileTextIcon,
BellOffIcon,
} from 'lucide-react'
@@ -73,7 +73,7 @@ const METRIC_ICON_MAPPING: Record<
[QUERY_METRIC.UNIQUE_PAGE_VIEWS]: { icon: EyeIcon, className: 'text-indigo-500' },
[QUERY_METRIC.ONLINE_USERS]: { icon: UsersIcon, className: 'text-sky-500' },
[QUERY_METRIC.CUSTOM_EVENTS]: { icon: MousePointerClickIcon, className: 'text-green-500' },
- [QUERY_METRIC.ERRORS]: { icon: AlertCircleIcon, className: 'text-red-500' },
+ [QUERY_METRIC.ERRORS]: { icon: BugIcon, className: 'text-red-500' },
}
interface AlertRowProps {
@@ -116,7 +116,7 @@ const AlertRow = ({
<>
<li
onClick={() => openAlert(id)}
- className='group relative mb-3 cursor-pointer overflow-hidden rounded-xl border border-gray-200 bg-gray-50 transition-colors hover:bg-gray-100 dark:border-slate-800/25 dark:bg-slate-800/70 dark:hover:bg-slate-700/60'
+ className='group relative mb-3 cursor-pointer overflow-hidden rounded-lg border border-gray-200 bg-gray-50 transition-colors hover:bg-gray-100 dark:border-slate-800/25 dark:bg-slate-800/70 dark:hover:bg-slate-700/60'
>
<div className='flex items-center justify-between gap-4 px-4 py-3 sm:px-5'>
{/* Left section: Icon + Name + Badge */}
@@ -384,7 +384,7 @@ const ProjectAlerts = () => {
// Show signup prompt for non-owners or unauthenticated users
if (!canManageAlerts) {
return (
- <div className='mt-5 rounded-xl bg-gray-700 p-5'>
+ <div className='mt-5 rounded-lg bg-gray-700 p-5'>
<div className='flex items-center text-gray-50'>
<BellRingIcon className='mr-2 h-8 w-8' strokeWidth={1.5} />
<p className='text-3xl font-bold'>{t('dashboard.alerts')}</p>
@@ -420,7 +420,7 @@ const ProjectAlerts = () => {
{isLoading && !_isEmpty(alerts) ? <LoadingBar /> : null}
<div className='mt-4'>
{_isEmpty(alerts) ? (
- <div className='mt-5 rounded-xl bg-gray-700 p-5'>
+ <div className='mt-5 rounded-lg bg-gray-700 p-5'>
<div className='flex items-center text-gray-50'>
<BellRingIcon className='mr-2 h-8 w-8' strokeWidth={1.5} />
<p className='text-3xl font-bold'>{t('dashboard.alerts')}</p>
diff --git a/web/app/pages/Project/tabs/AskAI/AskAIView.tsx b/web/app/pages/Project/tabs/AskAI/AskAIView.tsx
index c58bc8aa2..8a912fc20 100644
--- a/web/app/pages/Project/tabs/AskAI/AskAIView.tsx
+++ b/web/app/pages/Project/tabs/AskAI/AskAIView.tsx
@@ -283,7 +283,7 @@ const ThoughtProcess = ({
onClick={onToggle}
className='group flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300'
>
- <span className='flex h-5 w-5 items-center justify-center rounded-full border border-gray-300 dark:border-gray-600'>
+ <span className='flex h-5 w-5 items-center justify-center rounded-full border border-gray-200 dark:border-gray-600'>
{isActivelyThinking ? (
<Loader2Icon className='h-3 w-3 animate-spin' />
) : (
@@ -311,7 +311,6 @@ const ThoughtProcess = ({
)
}
-// Compact tool call badge (PostHog style)
const ToolCallBadge = ({ toolName, isLoading = false }: { toolName: string; isLoading?: boolean }) => {
const { label, icon: Icon } = getToolInfo(toolName)
@@ -369,7 +368,6 @@ const AssistantMessage = ({ message, isStreaming }: { message: Message; isStream
return (
<div className='group'>
- {/* Show reasoning/thinking in collapsible section */}
<ThoughtProcess
reasoning={message.reasoning}
isStreaming={isStreaming}
@@ -377,7 +375,6 @@ const AssistantMessage = ({ message, isStreaming }: { message: Message; isStream
isExpanded={isThoughtExpanded}
onToggle={handleToggle}
/>
- {/* Show tool calls as compact badges (PostHog style) */}
{message.toolCalls && message.toolCalls.length > 0 ? (
<div className='mb-3 flex flex-wrap gap-2'>
{_map(message.toolCalls, (call, idx) => (
@@ -407,7 +404,7 @@ const ScrollToBottomButton = ({ isAtBottom, scrollToBottom }: { isAtBottom: bool
<button
type='button'
onClick={scrollToBottom}
- className='absolute bottom-4 left-1/2 z-10 flex h-8 w-8 -translate-x-1/2 items-center justify-center rounded-full border border-gray-300 bg-white text-gray-700 transition-all hover:bg-gray-50 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200 hover:dark:bg-slate-700'
+ className='absolute bottom-4 left-1/2 z-10 flex h-8 w-8 -translate-x-1/2 items-center justify-center rounded-full border border-gray-200 bg-white text-gray-700 transition-all hover:bg-gray-50 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200 hover:dark:bg-slate-700'
aria-label='Scroll to bottom'
>
<ArrowDownIcon className='h-4 w-4' />
@@ -785,7 +782,7 @@ const AskAIView = ({ projectId }: AskAIViewProps) => {
<button
type='button'
onClick={handleNewChat}
- className='flex items-center gap-2 rounded-md border border-transparent px-3 py-1.5 text-sm font-medium text-gray-600 transition-colors hover:border-gray-300 hover:bg-white hover:text-gray-900 dark:text-gray-400 hover:dark:border-slate-700/80 dark:hover:bg-slate-800 dark:hover:text-white'
+ className='flex items-center gap-2 rounded-md border border-transparent px-3 py-1.5 text-sm font-medium text-gray-600 transition-colors hover:border-gray-200 hover:bg-white hover:text-gray-900 dark:text-gray-400 hover:dark:border-slate-700/80 dark:hover:bg-slate-800 dark:hover:text-white'
aria-label={t('askAi.newChat')}
>
<ArrowLeftIcon className='h-4 w-4' />
@@ -793,7 +790,7 @@ const AskAIView = ({ projectId }: AskAIViewProps) => {
<button
type='button'
onClick={handleCopyLink}
- className='flex items-center gap-2 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 dark:border-slate-700 dark:bg-slate-800 dark:text-gray-200 dark:hover:bg-slate-700'
+ className='flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 dark:border-slate-700 dark:bg-slate-800 dark:text-gray-200 dark:hover:bg-slate-700'
>
<LinkIcon className='h-4 w-4' />
<span>{t('askAi.copyLink')}</span>
@@ -852,7 +849,7 @@ const AskAIView = ({ projectId }: AskAIViewProps) => {
key={idx}
type='button'
onClick={() => handleQuickAction(prompt)}
- className='relative rounded-md border border-gray-300 bg-gray-50 p-2 transition-colors ring-inset hover:bg-white focus:z-10 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:border-slate-700/80 dark:bg-slate-900 dark:hover:bg-slate-800 focus:dark:ring-gray-200'
+ className='relative rounded-md border border-gray-200 bg-gray-50 p-2 transition-colors ring-inset hover:bg-white focus:z-10 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:border-slate-700/80 dark:bg-slate-900 dark:hover:bg-slate-800 focus:dark:ring-gray-200'
>
<Text as='span' size='sm'>
{prompt}
@@ -863,7 +860,7 @@ const AskAIView = ({ projectId }: AskAIViewProps) => {
{/* Input Area (centered for empty state) */}
<div className='w-full max-w-2xl'>
- <div className='rounded-lg border border-gray-300 bg-white dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='rounded-lg border border-gray-200 bg-white dark:border-slate-800/60 dark:bg-slate-800/25'>
<form onSubmit={handleSubmit} className='relative'>
<textarea
ref={inputRef}
@@ -889,7 +886,7 @@ const AskAIView = ({ projectId }: AskAIViewProps) => {
<button
type='submit'
disabled={!input.trim() || isLoading}
- className='flex h-7 w-7 items-center justify-center rounded-lg border border-gray-300 bg-white text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200 hover:dark:bg-slate-700'
+ className='flex h-7 w-7 items-center justify-center rounded-lg border border-gray-200 bg-white text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200 hover:dark:bg-slate-700'
>
<SendIcon className='h-3.5 w-3.5' />
</button>
@@ -924,9 +921,9 @@ const AskAIView = ({ projectId }: AskAIViewProps) => {
{/* Input Area (only shown when chat has messages) */}
{!isEmpty ? (
- <div className='border-t border-gray-300 bg-gray-50 px-4 py-4 dark:border-slate-800/60 dark:bg-slate-900'>
+ <div className='border-t border-gray-200 bg-gray-50 px-4 py-4 dark:border-slate-800/60 dark:bg-slate-900'>
<div className='mx-auto max-w-3xl'>
- <div className='rounded-lg border border-gray-300 bg-white dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='rounded-lg border border-gray-200 bg-white dark:border-slate-800/60 dark:bg-slate-800/25'>
<form onSubmit={handleSubmit} className='relative'>
<textarea
ref={inputRef}
@@ -964,7 +961,7 @@ const AskAIView = ({ projectId }: AskAIViewProps) => {
<button
type='submit'
disabled={!input.trim()}
- className='flex h-7 w-7 items-center justify-center rounded-lg border border-gray-300 bg-white text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200 hover:dark:bg-slate-700'
+ className='flex h-7 w-7 items-center justify-center rounded-lg border border-gray-200 bg-white text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200 hover:dark:bg-slate-700'
>
<SendIcon className='h-3.5 w-3.5' />
</button>
@@ -1031,7 +1028,7 @@ const AskAIView = ({ projectId }: AskAIViewProps) => {
{_map(allChats, (chat) => (
<div
key={chat.id}
- className='flex items-center justify-between rounded-lg border border-gray-300 bg-white px-4 py-3 transition-colors hover:bg-gray-50 dark:border-slate-800/60 dark:bg-slate-800/25 hover:dark:bg-slate-700'
+ className='flex items-center justify-between rounded-lg border border-gray-200 bg-white px-4 py-3 transition-colors hover:bg-gray-50 dark:border-slate-800/60 dark:bg-slate-800/25 hover:dark:bg-slate-700'
>
<button
type='button'
@@ -1066,7 +1063,7 @@ const AskAIView = ({ projectId }: AskAIViewProps) => {
type='button'
onClick={() => loadAllChats(allChats.length)}
disabled={isLoadingChats}
- className='flex w-full items-center justify-center gap-2 rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:opacity-50 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200 hover:dark:bg-slate-700'
+ className='flex w-full items-center justify-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:opacity-50 dark:border-slate-800/50 dark:bg-slate-800 dark:text-gray-200 hover:dark:bg-slate-700'
>
{isLoadingChats ? <Loader2Icon className='h-4 w-4 animate-spin' /> : null}
Load more
diff --git a/web/app/pages/Project/tabs/Captcha/CaptchaChart.tsx b/web/app/pages/Project/tabs/Captcha/CaptchaChart.tsx
index 828cbaa22..909242770 100644
--- a/web/app/pages/Project/tabs/Captcha/CaptchaChart.tsx
+++ b/web/app/pages/Project/tabs/Captcha/CaptchaChart.tsx
@@ -43,7 +43,7 @@ export const CaptchaChart = ({
}
return (
- <div className='overflow-hidden rounded-lg border border-gray-300 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='overflow-hidden rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-800/25'>
<MainChart
chartId='captcha-chart'
options={options}
diff --git a/web/app/pages/Project/tabs/Captcha/CaptchaView.tsx b/web/app/pages/Project/tabs/Captcha/CaptchaView.tsx
index 8ba0a0c22..265a1a8fb 100644
--- a/web/app/pages/Project/tabs/Captcha/CaptchaView.tsx
+++ b/web/app/pages/Project/tabs/Captcha/CaptchaView.tsx
@@ -18,8 +18,6 @@ import LoadingBar from '~/ui/LoadingBar'
import CCRow from '../../View/components/CCRow'
import DashboardHeader from '../../View/components/DashboardHeader'
import Filters from '../../View/components/Filters'
-import NoEvents from '../../View/components/NoEvents'
-import WaitingForAnEvent from '../../View/components/WaitingForAnEvent'
import { Filter } from '../../View/interfaces/traffic'
import { Panel } from '../../View/Panels'
import { parseFilters } from '../../View/utils/filters'
@@ -27,6 +25,8 @@ import { ViewProjectContext } from '../../View/ViewProject'
import { deviceIconMapping } from '../../View/ViewProject.helpers'
import { CaptchaChart } from './CaptchaChart'
+import NoCaptchaEvents from './NoCaptchaEvents'
+import WaitingForCaptchaEvent from './WaitingForCaptchaEvent'
const PANELS_ORDER = ['cc', 'br', 'os', 'dv']
@@ -38,7 +38,7 @@ const panelIconMapping: Record<string, React.ReactNode> = {
os: <MonitorCog className={iconClassName} strokeWidth={1.5} />,
}
-const typeNameMapping = (t: any) => ({
+export const captchaTypeNameMapping = (t: any) => ({
cc: t('project.mapping.cc'),
dv: t('project.mapping.dv'),
br: t('project.mapping.br'),
@@ -79,7 +79,7 @@ const CaptchaView = ({ projectId }: CaptchaViewProps) => {
return parseFilters(searchParams)
}, [searchParams])
- const tnMapping = typeNameMapping(t)
+ const tnMapping = captchaTypeNameMapping(t)
const [ref] = useSize() as any
const getFormatDate = (date: Date) => {
@@ -178,7 +178,7 @@ const CaptchaView = ({ projectId }: CaptchaViewProps) => {
// Show waiting state if project has no captcha data yet
if (!_isEmpty(project) && !project?.isCaptchaDataExists) {
- return <WaitingForAnEvent />
+ return <WaitingForCaptchaEvent />
}
// Show Loader only on initial load (no existing data)
@@ -187,7 +187,7 @@ const CaptchaView = ({ projectId }: CaptchaViewProps) => {
}
if (isPanelsDataEmpty && !dataLoading) {
- return <NoEvents filters={filters} />
+ return <NoCaptchaEvents filters={filters} />
}
return (
diff --git a/web/app/pages/Project/tabs/Captcha/NoCaptchaEvents.tsx b/web/app/pages/Project/tabs/Captcha/NoCaptchaEvents.tsx
new file mode 100644
index 000000000..7121a992b
--- /dev/null
+++ b/web/app/pages/Project/tabs/Captcha/NoCaptchaEvents.tsx
@@ -0,0 +1,48 @@
+import { FunnelIcon, CalendarDaysIcon } from '@heroicons/react/24/outline'
+import _isEmpty from 'lodash/isEmpty'
+import { memo } from 'react'
+import { useTranslation } from 'react-i18next'
+
+import { Text } from '~/ui/Text'
+
+import Filters from '../../View/components/Filters'
+import { Filter } from '../../View/interfaces/traffic'
+
+import { captchaTypeNameMapping } from './CaptchaView'
+
+interface NoCaptchaEventsProps {
+ filters: Filter[]
+}
+
+const NoCaptchaEvents = ({ filters }: NoCaptchaEventsProps) => {
+ const { t } = useTranslation('common')
+ const tnMapping = captchaTypeNameMapping(t)
+ const hasFilters = !_isEmpty(filters)
+
+ return (
+ <>
+ {hasFilters ? (
+ <div className='mt-4'>
+ <Filters tnMapping={tnMapping} />
+ </div>
+ ) : null}
+ <div className='mx-auto w-full max-w-2xl py-16 text-center'>
+ <div className='mx-auto mb-6 flex size-14 items-center justify-center rounded-xl bg-gray-100 dark:bg-slate-800'>
+ {hasFilters ? (
+ <FunnelIcon className='size-7 text-gray-400 dark:text-slate-500' />
+ ) : (
+ <CalendarDaysIcon className='size-7 text-gray-400 dark:text-slate-500' />
+ )}
+ </div>
+ <Text as='h3' size='xl' weight='medium' className='tracking-tight'>
+ {t('project.noEvTitle')}
+ </Text>
+ <Text as='p' size='sm' colour='secondary' className='mx-auto mt-2 max-w-md'>
+ {hasFilters ? t('project.noEventsFiltersDesc') : t('project.noEvContent')}
+ </Text>
+ </div>
+ </>
+ )
+}
+
+export default memo(NoCaptchaEvents)
diff --git a/web/app/pages/Project/tabs/Captcha/WaitingForCaptchaEvent.tsx b/web/app/pages/Project/tabs/Captcha/WaitingForCaptchaEvent.tsx
new file mode 100644
index 000000000..5cb02fa8b
--- /dev/null
+++ b/web/app/pages/Project/tabs/Captcha/WaitingForCaptchaEvent.tsx
@@ -0,0 +1,53 @@
+import { useTranslation, Trans } from 'react-i18next'
+import { Link } from 'react-router'
+
+import PulsatingCircle from '~/ui/icons/PulsatingCircle'
+import { Text } from '~/ui/Text'
+import routes from '~/utils/routes'
+
+const TROUBLESHOOTING_URL = 'https://docs.swetrix.com/troubleshooting'
+const CAPTCHA_INTEGRATION_GUIDE_URL = 'https://docs.swetrix.com/captcha/client-side-usage'
+
+const WaitingForCaptchaEvent = () => {
+ const { t } = useTranslation('common')
+
+ return (
+ <div className='mx-auto w-full max-w-2xl py-16 text-center'>
+ <div className='mx-auto mb-6 flex size-14 items-center justify-center rounded-xl bg-gray-100 dark:bg-slate-800'>
+ <PulsatingCircle type='giant' />
+ </div>
+ <Text as='h3' size='xl' weight='medium' className='tracking-tight'>
+ {t('project.waitingCaptcha.title')}
+ </Text>
+ <Text as='p' size='sm' colour='secondary' className='mx-auto mt-2 max-w-md whitespace-pre-line'>
+ <Trans
+ t={t}
+ i18nKey='project.waitingCaptcha.desc'
+ components={{
+ turl: (
+ <a
+ href={TROUBLESHOOTING_URL}
+ className='font-medium text-indigo-600 hover:underline dark:text-indigo-400'
+ target='_blank'
+ rel='noreferrer noopener'
+ />
+ ),
+ guideurl: (
+ <a
+ href={CAPTCHA_INTEGRATION_GUIDE_URL}
+ className='font-medium text-indigo-600 hover:underline dark:text-indigo-400'
+ target='_blank'
+ rel='noreferrer noopener'
+ />
+ ),
+ curl: (
+ <Link to={routes.contact} className='font-medium text-indigo-600 hover:underline dark:text-indigo-400' />
+ ),
+ }}
+ />
+ </Text>
+ </div>
+ )
+}
+
+export default WaitingForCaptchaEvent
diff --git a/web/app/pages/Project/tabs/Errors/ErrorChart.tsx b/web/app/pages/Project/tabs/Errors/ErrorChart.tsx
index 81a9163e0..9399a9a28 100644
--- a/web/app/pages/Project/tabs/Errors/ErrorChart.tsx
+++ b/web/app/pages/Project/tabs/Errors/ErrorChart.tsx
@@ -53,7 +53,7 @@ export const ErrorChart = ({
)
return (
- <div className='overflow-hidden rounded-lg border border-gray-300 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='overflow-hidden rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-800/25'>
<MainChart
chartId='error-chart'
options={options}
diff --git a/web/app/pages/Project/tabs/Errors/ErrorDetails.tsx b/web/app/pages/Project/tabs/Errors/ErrorDetails.tsx
index 557f786af..b073469be 100644
--- a/web/app/pages/Project/tabs/Errors/ErrorDetails.tsx
+++ b/web/app/pages/Project/tabs/Errors/ErrorDetails.tsx
@@ -27,26 +27,29 @@ interface ErrorDetailsProps {
projectPassword?: string
}
-// Info Row (matches UserDetails / SessionDetailView style)
const InfoRow = ({ label, value }: { label: React.ReactNode; value: React.ReactNode }) => (
<div className='flex items-center justify-between gap-3 border-b border-gray-100 py-2 last:border-0 dark:border-slate-700/50'>
- <span className='shrink-0 text-sm text-gray-600 dark:text-gray-400'>{label}</span>
- <span className='min-w-0 truncate text-right text-sm font-medium text-gray-900 dark:text-white'>{value}</span>
+ <Text size='sm' colour='muted' className='shrink-0'>
+ {label}
+ </Text>
+ <Text size='sm' weight='medium' colour='primary' className='min-w-0 text-right' truncate>
+ {value}
+ </Text>
</div>
)
-// Stat Item Component
const StatItem = ({ icon, label, value }: { icon: React.ReactNode; label: string; value: string | number }) => (
<div>
- <div className='mb-0.5 flex items-center gap-1.5 text-[10px] font-medium tracking-wide text-gray-600 uppercase dark:text-gray-400'>
+ <Text size='xxs' weight='medium' colour='muted' className='mb-0.5 flex items-center gap-1.5 uppercase'>
{icon}
{label}
- </div>
- <div className='text-lg font-semibold text-gray-900 dark:text-white'>{value}</div>
+ </Text>
+ <Text size='lg' weight='semibold' colour='primary'>
+ {value}
+ </Text>
</div>
)
-// Browser Icon Component
const BrowserIcon = ({ browser }: { browser: string | null }) => {
if (!browser) return null
@@ -57,7 +60,6 @@ const BrowserIcon = ({ browser }: { browser: string | null }) => {
return <img src={logoUrl} className='h-4 w-4' alt='' />
}
-// OS Icon Component
const OSIcon = ({ os, theme }: { os: string | null; theme: string }) => {
if (!os) return null
@@ -72,7 +74,6 @@ const OSIcon = ({ os, theme }: { os: string | null; theme: string }) => {
return <img src={`/${logoPath}`} className='h-4 w-4' alt='' />
}
-// Affected Session Row
interface SessionRowProps {
session: ErrorAffectedSession
}
@@ -92,7 +93,8 @@ const SessionRow = ({ session }: SessionRowProps) => {
const params = new URLSearchParams(location.search)
params.delete('eid')
params.set('psid', session.psid)
- const sessionUrl = `?${params.toString()}&tab=sessions`
+ params.set('tab', 'sessions')
+ const sessionUrl = `?${params.toString()}`
return (
<Link
@@ -139,7 +141,6 @@ export const ErrorDetails = ({
const [isCopiedEid, setIsCopiedEid] = useState(false)
const [isCopiedFile, setIsCopiedFile] = useState(false)
- // Affected sessions state
const [sessions, setSessions] = useState<ErrorAffectedSession[]>([])
const [sessionsLoading, setSessionsLoading] = useState<boolean | null>(null)
const [sessionsTotal, setSessionsTotal] = useState(0)
@@ -184,7 +185,6 @@ export const ErrorDetails = ({
return `${details.filename}${details.lineno ? `:${details.lineno}` : ''}${details.colno ? `:${details.colno}` : ''}`
}, [details.filename, details.lineno, details.colno])
- // Keep stack trace collapsed by default, but auto-expand very small stacks
useEffect(() => {
const shouldExpand = stackTraceLines.length > 0 && stackTraceLines.length <= 8
setIsStackTraceExpanded(shouldExpand)
@@ -270,7 +270,6 @@ export const ErrorDetails = ({
[id, details.eid, timeBucket, period, from, to, projectPassword, sessionsLoading, sessionsSkip],
)
- // Load sessions on mount
useEffect(() => {
setSessions([])
setSessionsSkip(0)
@@ -315,7 +314,6 @@ export const ErrorDetails = ({
return <p className='block text-slate-800 dark:text-slate-300'>{line}</p>
}
- // Truncate error message for display
const errorTitle = details.message ? `${details.name}: ${details.message}` : details.name
const shouldTruncate = errorTitle.length > 120
const displayTitle = shouldTruncate ? `${errorTitle.slice(0, 120)}...` : errorTitle
@@ -326,8 +324,7 @@ export const ErrorDetails = ({
return (
<div className='space-y-6'>
- {/* Header (matches UserDetails vibe) */}
- <div className='flex items-start gap-4'>
+ <div className='flex items-start gap-3'>
<div className='flex size-14 shrink-0 items-center justify-center rounded-xl bg-red-100 dark:bg-red-900/30'>
<BugIcon className='size-7 text-red-600 dark:text-red-400' strokeWidth={1.5} />
</div>
@@ -358,12 +355,9 @@ export const ErrorDetails = ({
</div>
</div>
- {/* Main Content - Two Column Layout (matches UserDetails / SessionDetailView) */}
- <div className='flex flex-col gap-5 lg:flex-row'>
- {/* Left Column - Summary */}
- <div className='space-y-4 lg:w-[380px]'>
- {/* Stats Card */}
- <div className='rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='flex flex-col gap-3 lg:flex-row'>
+ <div className='space-y-3 lg:w-[380px]'>
+ <div className='rounded-lg border border-gray-200 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
<div className='grid grid-cols-2 gap-y-5 sm:grid-cols-3 lg:grid-cols-2'>
<StatItem
icon={<HashIcon className='h-3.5 w-3.5' />}
@@ -383,11 +377,10 @@ export const ErrorDetails = ({
</div>
</div>
- {/* Metadata Card */}
- <div className='rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
- <h3 className='mb-3 text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
+ <div className='rounded-lg border border-gray-200 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <Text as='h3' size='xs' weight='semibold' colour='primary' className='mb-2 uppercase' tracking='wide'>
{t('project.metadata')}
- </h3>
+ </Text>
<div>
{details.filename ? (
<InfoRow
@@ -453,15 +446,13 @@ export const ErrorDetails = ({
</div>
</div>
- {/* Right Column - Stack Trace & Affected Sessions */}
- <div className='flex-1 space-y-4'>
- {/* Stack Trace */}
+ <div className='flex-1 space-y-3'>
{details.stackTrace ? (
- <div className='rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='rounded-lg border border-gray-200 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
<div className='mb-3 flex items-center justify-between gap-3'>
- <h3 className='text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
+ <Text as='h3' size='xs' weight='semibold' colour='primary' className='mb-2 uppercase' tracking='wide'>
{t('project.stackTraceXFrames', { x: stackTraceLines.length })}
- </h3>
+ </Text>
<div className='flex items-center gap-2'>
<button
type='button'
@@ -529,11 +520,10 @@ export const ErrorDetails = ({
</div>
) : null}
- {/* Affected Sessions */}
- <div className='rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
- <h3 className='mb-3 text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
+ <div className='rounded-lg border border-gray-200 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <Text as='h3' size='xs' weight='semibold' colour='primary' className='mb-2 uppercase' tracking='wide'>
{t('project.affectedSessionsList')} {sessionsTotal > 0 ? `(${sessionsTotal})` : ''}
- </h3>
+ </Text>
{sessionsLoading && sessions.length === 0 ? (
<Loader />
diff --git a/web/app/pages/Project/tabs/Errors/NoErrorDetails.tsx b/web/app/pages/Project/tabs/Errors/NoErrorDetails.tsx
index e383d2eac..8637822dd 100644
--- a/web/app/pages/Project/tabs/Errors/NoErrorDetails.tsx
+++ b/web/app/pages/Project/tabs/Errors/NoErrorDetails.tsx
@@ -1,28 +1,18 @@
import { BugIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
-import { Text } from '~/ui/Text'
-
const NoErrorDetails = () => {
const { t } = useTranslation('common')
return (
- <div className='px-4 py-16 sm:px-6 sm:py-24 md:grid md:place-items-center lg:px-8'>
- <div className='mx-auto max-w-max'>
- <main className='sm:flex'>
- <BugIcon className='mb-2 -ml-1.5 h-12 w-12 sm:m-0 sm:h-20 sm:w-20' />
- <div className='sm:ml-6'>
- <div className='sm:border-l sm:border-gray-200 sm:pl-6'>
- <Text as='h1' size='4xl' weight='bold' className='sm:text-5xl'>
- {t('project.noErrorDetails')}
- </Text>
- <Text as='p' size='base' colour='secondary' className='mt-1 max-w-prose whitespace-pre-line'>
- {t('project.noErrorDesc')}
- </Text>
- </div>
- </div>
- </main>
+ <div className='mx-auto w-full max-w-2xl py-16 text-center text-gray-900 dark:text-gray-50'>
+ <div className='mx-auto mb-6 flex size-14 items-center justify-center rounded-xl bg-gray-100 dark:bg-slate-800'>
+ <BugIcon className='size-7 text-gray-700 dark:text-gray-200' strokeWidth={1.5} />
</div>
+ <h3 className='text-xl font-medium tracking-tight'>{t('project.noErrorDetails')}</h3>
+ <p className='mx-auto mt-2 max-w-md text-sm whitespace-pre-line text-gray-800 dark:text-gray-200'>
+ {t('project.noErrorDesc')}
+ </p>
</div>
)
}
diff --git a/web/app/pages/Project/tabs/Experiments/ExperimentResults.tsx b/web/app/pages/Project/tabs/Experiments/ExperimentResults.tsx
index 42e2e9255..a2d464d81 100644
--- a/web/app/pages/Project/tabs/Experiments/ExperimentResults.tsx
+++ b/web/app/pages/Project/tabs/Experiments/ExperimentResults.tsx
@@ -50,7 +50,6 @@ import { nFormatter } from '~/utils/generic'
import ExperimentSettingsModal from './ExperimentSettingsModal'
-// Variant colors for the chart
const VARIANT_COLORS = [
'#6366f1', // indigo-500
'#22c55e', // green-500
@@ -70,11 +69,9 @@ interface ExperimentResultsProps {
to: string
timezone?: string
onBack: () => void
- // When this value changes, results are re-fetched (used by global refresh button)
refreshTrigger?: number
}
-// Stats card component with large background icon (matching ErrorsView style)
interface StatCardProps {
icon: React.ReactNode
value: string | number
@@ -83,7 +80,7 @@ interface StatCardProps {
}
const StatCard = memo(({ icon, value, label, subValue }: StatCardProps) => (
- <div className='relative overflow-hidden rounded-xl border border-gray-200 bg-white p-4 dark:border-slate-700 dark:bg-slate-800'>
+ <div className='relative overflow-hidden rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-700 dark:bg-slate-800'>
<div className='pointer-events-none absolute -bottom-5 -left-5 opacity-10 [&>svg]:size-24'>{icon}</div>
<div className='relative'>
<div className='flex items-baseline gap-1.5'>
@@ -105,7 +102,6 @@ const StatCard = memo(({ icon, value, label, subValue }: StatCardProps) => (
StatCard.displayName = 'StatCard'
-// Win Probability Time Series Chart component
const getWinProbabilityChartSettings = (
chartData: ExperimentChartData,
variants: ExperimentVariantResult[],
@@ -114,10 +110,8 @@ const getWinProbabilityChartSettings = (
): ChartOptions => {
const xAxisSize = _size(chartData.x)
- // Create columns: x axis + one column per variant
const columns: any[] = [['x', ..._map(chartData.x, (el) => dayjs(el).toDate())]]
- // Create types and colors for each variant
const types: Record<string, any> = {}
const colors: Record<string, string> = {}
const names: Record<string, string> = {}
@@ -223,7 +217,6 @@ const getWinProbabilityChartSettings = (
}
}
-// Win Probability Chart Panel
const WinProbabilityChart = memo(
({
chartData,
@@ -244,7 +237,7 @@ const WinProbabilityChart = memo(
if (!chartOptions) {
return (
- <div className='flex h-[220px] items-center justify-center rounded-xl border border-gray-200 bg-white p-4 dark:border-slate-700 dark:bg-slate-800'>
+ <div className='flex h-[220px] items-center justify-center rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-700 dark:bg-slate-800'>
<Text colour='muted' size='sm'>
{t('experiments.noDataYet')}
</Text>
@@ -253,7 +246,7 @@ const WinProbabilityChart = memo(
}
return (
- <div className='rounded-xl border border-gray-200 bg-white p-4 dark:border-slate-700 dark:bg-slate-800'>
+ <div className='rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-700 dark:bg-slate-800'>
<Text as='h3' weight='semibold' size='sm' className='mb-2'>
{t('experiments.probabilityOfWinning')}
</Text>
@@ -265,7 +258,6 @@ const WinProbabilityChart = memo(
WinProbabilityChart.displayName = 'WinProbabilityChart'
-// Confidence interval visualization (diamond chart like PostHog)
const ConfidenceBar = memo(
({
improvement,
@@ -276,12 +268,10 @@ const ConfidenceBar = memo(
probabilityOfWinning: number
isControl: boolean
}) => {
- // Calculate position on the bar (-30% to +30% range)
const maxRange = 30
const clampedImprovement = Math.max(-maxRange, Math.min(maxRange, improvement))
const position = ((clampedImprovement + maxRange) / (maxRange * 2)) * 100
- // Determine color based on improvement and confidence
const isPositive = improvement > 0
const isSignificant = probabilityOfWinning >= 95
@@ -303,13 +293,10 @@ const ConfidenceBar = memo(
return (
<div className='relative h-6 w-full'>
- {/* Background bar */}
<div className='absolute top-1/2 h-1 w-full -translate-y-1/2 rounded-full bg-gray-100 dark:bg-slate-700' />
- {/* Center line (0%) */}
<div className='absolute top-1/2 left-1/2 h-4 w-0.5 -translate-x-1/2 -translate-y-1/2 bg-gray-300 dark:bg-gray-600' />
- {/* Diamond marker */}
<div className='absolute top-1/2 -translate-x-1/2 -translate-y-1/2' style={{ left: `${position}%` }}>
<div className={cx('size-3.5 rotate-45 rounded-sm shadow-sm', getColor())} />
</div>
@@ -320,7 +307,6 @@ const ConfidenceBar = memo(
ConfidenceBar.displayName = 'ConfidenceBar'
-// Table header cell
const TableHeader = ({ children, className }: { children: React.ReactNode; className?: string }) => (
<th
className={cx(
@@ -332,18 +318,16 @@ const TableHeader = ({ children, className }: { children: React.ReactNode; class
</th>
)
-// Table data cell
const TableCell = ({ children, className }: { children: React.ReactNode; className?: string }) => (
<td className={cx('px-4 py-4', className)}>{children}</td>
)
-// Exposures table component (like PostHog)
const ExposuresTable = memo(
({ variants, totalExposures }: { variants: ExperimentVariantResult[]; totalExposures: number }) => {
const { t } = useTranslation()
return (
- <div className='overflow-hidden rounded-xl border border-gray-200 bg-white dark:border-slate-700/50 dark:bg-slate-800/50'>
+ <div className='overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-slate-700/50 dark:bg-slate-800/50'>
<div className='border-b border-gray-200 px-4 py-3 dark:border-slate-700'>
<Text weight='semibold' size='sm'>
{t('experiments.totalExposures')}
@@ -415,7 +399,6 @@ const ExposuresTable = memo(
ExposuresTable.displayName = 'ExposuresTable'
-// Metrics results table component (like PostHog)
const MetricsTable = memo(
({
variants,
@@ -432,7 +415,7 @@ const MetricsTable = memo(
const testVariants = variants.filter((v) => !v.isControl)
return (
- <div className='overflow-hidden rounded-xl border border-gray-200 bg-white dark:border-slate-700/50 dark:bg-slate-800/50'>
+ <div className='overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-slate-700/50 dark:bg-slate-800/50'>
<div className='border-b border-gray-200 px-4 py-3 dark:border-slate-700'>
<div className='flex items-center gap-2'>
<Text weight='semibold' size='sm'>
@@ -459,7 +442,6 @@ const MetricsTable = memo(
</tr>
</thead>
<tbody className='divide-y divide-gray-200 dark:divide-slate-700'>
- {/* Control variant */}
{controlVariant ? (
<tr className='hover:bg-gray-50 dark:hover:bg-slate-700/30'>
<TableCell>
@@ -502,7 +484,6 @@ const MetricsTable = memo(
</tr>
) : null}
- {/* Test variants */}
{_map(testVariants, (variant) => {
const isWinner = hasWinner && variant.key === winnerKey
const isPositive = variant.improvement > 0
@@ -598,13 +579,12 @@ const MetricsTable = memo(
MetricsTable.displayName = 'MetricsTable'
-// Collapsible section component
const CollapsibleSection = memo(
({ title, children, defaultOpen = true }: { title: string; children: React.ReactNode; defaultOpen?: boolean }) => {
const [isOpen, setIsOpen] = useState(defaultOpen)
return (
- <div className='overflow-hidden rounded-xl border border-gray-200 bg-white dark:border-slate-700/50 dark:bg-slate-800/50'>
+ <div className='overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-slate-700/50 dark:bg-slate-800/50'>
<button
type='button'
onClick={() => setIsOpen(!isOpen)}
@@ -658,11 +638,9 @@ const ExperimentResults = ({
useEffect(() => {
const loadData = async () => {
const hasData = !!experiment && !!results
- // Avoid flickering: only show the full loader when we don't have any data yet.
if (!hasData) {
setIsLoading(true)
}
- // Clear previous error on a new attempt; if refresh fails, we keep existing data rendered.
setError(null)
try {
@@ -676,7 +654,6 @@ const ExperimentResults = ({
try {
goalData = await getGoal(experimentData.goalId)
} catch {
- // Goal is optional and might have been deleted or be inaccessible.
goalData = null
}
}
@@ -727,7 +704,7 @@ const ExperimentResults = ({
return (
<>
<DashboardHeader onBack={onBack} showLiveVisitors={false} />
- <div className='rounded-xl border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20'>
+ <div className='rounded-lg border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20'>
<Text colour='muted'>{error || t('experiments.loadError')}</Text>
</div>
</>
@@ -740,7 +717,6 @@ const ExperimentResults = ({
onBack={onBack}
showLiveVisitors={false}
rightContent={
- // Backend forbids updating running/completed experiments; keep button visible (disabled) to make this explicit.
<Tooltip
text={
results.status === 'running'
@@ -797,10 +773,9 @@ const ExperimentResults = ({
projectId={experiment.pid}
experimentId={experiment.id}
/>
- <div className='mt-4 space-y-6'>
- {/* Winner announcement */}
+ <div className='space-y-3'>
{results.hasWinner && results.winnerKey ? (
- <div className='flex items-center gap-4 rounded-xl border border-green-300 bg-linear-to-r from-green-50 to-emerald-50 p-4 dark:border-green-700 dark:bg-green-900/20'>
+ <div className='flex items-center gap-4 rounded-lg border border-green-300 bg-linear-to-r from-green-50 to-emerald-50 p-4 dark:border-green-700 dark:bg-green-900/20'>
<div className='flex size-12 shrink-0 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/50'>
<TrophyIcon className='size-6 text-green-600 dark:text-green-400' />
</div>
@@ -817,9 +792,8 @@ const ExperimentResults = ({
</div>
) : null}
- {/* No data message */}
{results.totalExposures === 0 ? (
- <div className='flex items-start gap-4 rounded-xl border border-yellow-300 bg-yellow-50 p-4 dark:border-yellow-700 dark:bg-yellow-900/20'>
+ <div className='flex items-start gap-4 rounded-lg border border-yellow-300 bg-yellow-50 p-4 dark:border-yellow-700 dark:bg-yellow-900/20'>
<div className='flex size-12 shrink-0 items-center justify-center rounded-full bg-yellow-100 dark:bg-yellow-900/40'>
<InfoIcon className='size-6 text-yellow-700 dark:text-yellow-300' strokeWidth={1.5} />
</div>
@@ -845,14 +819,11 @@ const ExperimentResults = ({
</div>
) : null}
- {/* Chart and Stats Row */}
<div className='flex flex-col gap-3 lg:flex-row'>
- {/* Win Probability Chart - Left side */}
<div className='w-full lg:w-[65%]'>
<WinProbabilityChart chartData={results.chart} variants={sortedVariants} timeBucket={timeBucket} />
</div>
- {/* Stats Grid - Right side as 2x2 */}
<div className='grid w-full grid-cols-2 gap-3 lg:w-[35%]'>
<StatCard
icon={<UsersIcon className='text-blue-600' strokeWidth={1.5} />}
@@ -878,13 +849,10 @@ const ExperimentResults = ({
</div>
</div>
- {/* Metrics Table */}
<MetricsTable variants={sortedVariants} winnerKey={results.winnerKey} hasWinner={results.hasWinner} />
- {/* Exposures Table */}
<ExposuresTable variants={sortedVariants} totalExposures={results.totalExposures} />
- {/* Hypothesis */}
{experiment.hypothesis ? (
<CollapsibleSection title={t('experiments.hypothesisLabel')}>
<Text className='italic' colour='muted'>
diff --git a/web/app/pages/Project/tabs/Experiments/ExperimentSettingsModal.tsx b/web/app/pages/Project/tabs/Experiments/ExperimentSettingsModal.tsx
index 1535be62e..0177bfd97 100644
--- a/web/app/pages/Project/tabs/Experiments/ExperimentSettingsModal.tsx
+++ b/web/app/pages/Project/tabs/Experiments/ExperimentSettingsModal.tsx
@@ -60,7 +60,6 @@ const ExperimentSettingsModal = ({
const [featureFlags, setFeatureFlags] = useState<ProjectFeatureFlag[]>([])
const [featureFlagsLoading, setFeatureFlagsLoading] = useState(false)
- // Form state
const [name, setName] = useState('')
const [description, setDescription] = useState('')
const [featureFlagKey, setFeatureFlagKey] = useState('')
@@ -68,7 +67,6 @@ const ExperimentSettingsModal = ({
const [goalDirection, setGoalDirection] = useState<GoalDirection>('increase')
const [variants, setVariants] = useState<ExperimentVariant[]>(defaultVariants)
- // Advanced settings
const [showAdvanced, setShowAdvanced] = useState(false)
const [exposureTrigger, setExposureTrigger] = useState<ExposureTrigger>('feature_flag')
const [customEventName, setCustomEventName] = useState('')
@@ -76,10 +74,8 @@ const ExperimentSettingsModal = ({
const [featureFlagMode, setFeatureFlagMode] = useState<FeatureFlagMode>('create')
const [existingFeatureFlagId, setExistingFeatureFlagId] = useState('')
- // Error state
const [errors, setErrors] = useState<Record<string, string>>({})
- // Auto-generate feature flag key from name
const suggestedFlagKey = useMemo(() => {
if (!name.trim()) return ''
return name
@@ -121,7 +117,6 @@ const ExperimentSettingsModal = ({
setFeatureFlagMode(experiment.featureFlagMode || 'create')
setExistingFeatureFlagId(experiment.featureFlagId || '')
- // Show advanced if non-default values are set
if (
experiment.exposureTrigger === 'custom_event' ||
experiment.multipleVariantHandling === 'first_exposure' ||
@@ -270,7 +265,6 @@ const ExperimentSettingsModal = ({
}
}
- // Helper to distribute percentages evenly across variants
const distributePercentages = (variantsList: ExperimentVariant[]): ExperimentVariant[] => {
const count = variantsList.length
const basePercentage = Math.floor(100 / count)
@@ -290,7 +284,6 @@ const ExperimentSettingsModal = ({
rolloutPercentage: 0,
isControl: false,
}
- // Add the new variant and redistribute percentages evenly
const newVariants = distributePercentages([...variants, newVariant])
setVariants(newVariants)
if (errors.variants) {
@@ -304,7 +297,6 @@ const ExperimentSettingsModal = ({
const handleRemoveVariant = (index: number) => {
if (variants.length <= 2) return
const filteredVariants = variants.filter((_, i) => i !== index)
- // Redistribute percentages evenly after removal
const newVariants = distributePercentages(filteredVariants)
setVariants(newVariants)
if (errors.variants) {
@@ -376,7 +368,6 @@ const ExperimentSettingsModal = ({
) : (
<form onSubmit={handleSubmit}>
<div className='px-6 pt-5 pb-4'>
- {/* Header */}
<div className='flex items-center justify-between'>
<DialogTitle className='text-lg font-semibold text-gray-900 dark:text-gray-50'>
{isEditing ? t('experiments.edit') : t('experiments.create')}
@@ -391,7 +382,6 @@ const ExperimentSettingsModal = ({
</div>
<div className='mt-5 space-y-5'>
- {/* Basic Info */}
<div className='space-y-3'>
<Input
label={t('experiments.name')}
@@ -424,7 +414,6 @@ const ExperimentSettingsModal = ({
/>
</div>
- {/* Feature Flag Key */}
{featureFlagMode === 'create' ? (
<div>
<div className='flex items-center gap-1.5'>
@@ -449,7 +438,6 @@ const ExperimentSettingsModal = ({
</div>
) : null}
- {/* Variants */}
<div>
<div className='mb-2 flex items-center justify-between'>
<div className='flex items-center gap-1.5'>
@@ -487,7 +475,6 @@ const ExperimentSettingsModal = ({
: 'border-gray-200 bg-gray-50 dark:border-slate-700 dark:bg-slate-800',
)}
>
- {/* Variant letter badge */}
<div
className={cx(
'flex size-8 shrink-0 items-center justify-center rounded-md text-sm font-semibold',
@@ -499,7 +486,6 @@ const ExperimentSettingsModal = ({
{String.fromCharCode(65 + index)}
</div>
- {/* Name & Key */}
<div className='flex flex-1 gap-2'>
<input
type='text'
@@ -523,7 +509,6 @@ const ExperimentSettingsModal = ({
/>
</div>
- {/* Percentage */}
<div className='flex items-center gap-1'>
<input
type='text'
@@ -541,7 +526,6 @@ const ExperimentSettingsModal = ({
</Text>
</div>
- {/* Control toggle */}
<label className='flex shrink-0 cursor-pointer items-center gap-1.5'>
<input
type='radio'
@@ -555,7 +539,6 @@ const ExperimentSettingsModal = ({
</Text>
</label>
- {/* Remove button */}
{variants.length > 2 ? (
<button
type='button'
@@ -590,7 +573,6 @@ const ExperimentSettingsModal = ({
</div>
</div>
- {/* Success Metric */}
<div>
<div className='flex items-center gap-1.5'>
<Text as='label' size='sm' weight='medium' className='text-gray-700 dark:text-gray-200'>
@@ -662,7 +644,6 @@ const ExperimentSettingsModal = ({
) : null}
</div>
- {/* Advanced Settings */}
<div className='border-t border-gray-200 pt-4 dark:border-slate-700'>
<button
type='button'
@@ -679,7 +660,6 @@ const ExperimentSettingsModal = ({
{showAdvanced ? (
<div className='mt-4 space-y-4'>
- {/* Feature flag mode */}
<div>
<div className='flex items-center gap-1.5'>
<Text as='label' size='sm' weight='medium' className='text-gray-700 dark:text-gray-200'>
@@ -745,7 +725,6 @@ const ExperimentSettingsModal = ({
</div>
) : null}
- {/* Exposure trigger */}
<div>
<div className='flex items-center gap-1.5'>
<Text as='label' size='sm' weight='medium' className='text-gray-700 dark:text-gray-200'>
@@ -794,7 +773,6 @@ const ExperimentSettingsModal = ({
) : null}
</div>
- {/* Multiple variant handling */}
<div>
<div className='flex items-center gap-1.5'>
<Text as='label' size='sm' weight='medium' className='text-gray-700 dark:text-gray-200'>
@@ -848,7 +826,6 @@ const ExperimentSettingsModal = ({
</div>
</div>
- {/* Footer */}
<div className='flex justify-end gap-3 border-t border-gray-200 px-6 py-4 dark:border-slate-700'>
<Button type='button' onClick={onClose} secondary regular>
{t('common.cancel')}
diff --git a/web/app/pages/Project/tabs/Experiments/ExperimentsView.tsx b/web/app/pages/Project/tabs/Experiments/ExperimentsView.tsx
index b6c1f9a5c..151e7c419 100644
--- a/web/app/pages/Project/tabs/Experiments/ExperimentsView.tsx
+++ b/web/app/pages/Project/tabs/Experiments/ExperimentsView.tsx
@@ -111,7 +111,7 @@ const ExperimentRow = ({
return (
<>
- <li className='relative mb-3 overflow-hidden rounded-xl border border-gray-200 bg-gray-50 transition-colors dark:border-slate-800/25 dark:bg-slate-800/70'>
+ <li className='relative mb-3 overflow-hidden rounded-lg border border-gray-200 bg-gray-50 transition-colors dark:border-slate-800/25 dark:bg-slate-800/70'>
<div className='flex justify-between gap-x-6 px-4 py-4 sm:px-6'>
<div className='flex min-w-0 gap-x-4'>
<div className='min-w-0 flex-auto'>
@@ -507,7 +507,7 @@ const ExperimentsView = ({ period, from = '', to = '', timezone }: ExperimentsVi
<div>
{isLoading && !_isEmpty(experiments) ? <LoadingBar /> : null}
{_isEmpty(experiments) ? (
- <div className='mt-5 rounded-xl bg-gray-700 p-5'>
+ <div className='mt-5 rounded-lg bg-gray-700 p-5'>
<div className='flex items-center text-gray-50'>
<FlaskConicalIcon className='mr-2 h-8 w-8' strokeWidth={1.5} />
<p className='text-3xl font-bold'>{t('experiments.title')}</p>
diff --git a/web/app/pages/Project/tabs/FeatureFlags/FeatureFlagsView.tsx b/web/app/pages/Project/tabs/FeatureFlags/FeatureFlagsView.tsx
index 3b6560e0d..b9983cc6c 100644
--- a/web/app/pages/Project/tabs/FeatureFlags/FeatureFlagsView.tsx
+++ b/web/app/pages/Project/tabs/FeatureFlags/FeatureFlagsView.tsx
@@ -173,7 +173,7 @@ const FeatureFlagRow = ({
return (
<>
- <li className='relative mb-3 overflow-hidden rounded-xl border border-gray-200 bg-gray-50 transition-colors dark:border-slate-800/25 dark:bg-slate-800/70'>
+ <li className='relative mb-3 overflow-hidden rounded-lg border border-gray-200 bg-gray-50 transition-colors dark:border-slate-800/25 dark:bg-slate-800/70'>
{/* Main row - clickable to expand */}
<div
onClick={() => onToggleExpand(flag.id)}
@@ -788,7 +788,7 @@ const FeatureFlagsView = ({ period, from = '', to = '', timezone }: FeatureFlags
<div>
{isLoading && !_isEmpty(flags) ? <LoadingBar /> : null}
{_isEmpty(flags) ? (
- <div className='mt-5 rounded-xl bg-gray-700 p-5'>
+ <div className='mt-5 rounded-lg bg-gray-700 p-5'>
<div className='flex items-center text-gray-50'>
<FlagIcon className='mr-2 h-8 w-8' strokeWidth={1.5} />
<p className='text-3xl font-bold'>{t('featureFlags.title')}</p>
diff --git a/web/app/pages/Project/tabs/Funnels/FunnelsList.tsx b/web/app/pages/Project/tabs/Funnels/FunnelsList.tsx
index 42eb5c091..8799c4b84 100644
--- a/web/app/pages/Project/tabs/Funnels/FunnelsList.tsx
+++ b/web/app/pages/Project/tabs/Funnels/FunnelsList.tsx
@@ -44,7 +44,7 @@ const FunnelCard = ({ funnel, openFunnelSettings, deleteFunnel, loading, allowed
to={{
search,
}}
- className='min-h-[120px] cursor-pointer overflow-hidden rounded-xl border border-gray-200 bg-gray-50 transition-colors hover:bg-gray-200/70 dark:border-slate-800/25 dark:bg-slate-800/70 dark:hover:bg-slate-700/60'
+ className='min-h-[120px] cursor-pointer overflow-hidden rounded-lg border border-gray-200 bg-gray-50 transition-colors hover:bg-gray-200/70 dark:border-slate-800/25 dark:bg-slate-800/70 dark:hover:bg-slate-700/60'
>
<div className='px-4 py-4'>
<div className='flex items-center justify-between'>
@@ -119,7 +119,7 @@ const FunnelsList = ({ funnels, openFunnelSettings, deleteFunnel, loading, allow
const { isAuthenticated } = useAuth()
return (
- <div role='list' className='mt-4 grid grid-cols-1 gap-3 lg:grid-cols-3'>
+ <div role='list' className='grid grid-cols-1 gap-3 lg:grid-cols-3'>
{_map(funnels, (funnel) => (
<FunnelCard
key={funnel.id}
diff --git a/web/app/pages/Project/tabs/Funnels/FunnelsView.tsx b/web/app/pages/Project/tabs/Funnels/FunnelsView.tsx
index 8e33434e5..05fe8948a 100644
--- a/web/app/pages/Project/tabs/Funnels/FunnelsView.tsx
+++ b/web/app/pages/Project/tabs/Funnels/FunnelsView.tsx
@@ -258,7 +258,7 @@ const FunnelsView = () => {
{/* Funnel Chart */}
<div
className={cx(
- 'relative overflow-hidden rounded-lg border border-gray-300 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-800/25',
+ 'relative overflow-hidden rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-800/25',
{ hidden: analyticsLoading },
)}
>
diff --git a/web/app/pages/Project/tabs/Goals/GoalsView.tsx b/web/app/pages/Project/tabs/Goals/GoalsView.tsx
index 32996ef89..7fe0c927d 100644
--- a/web/app/pages/Project/tabs/Goals/GoalsView.tsx
+++ b/web/app/pages/Project/tabs/Goals/GoalsView.tsx
@@ -276,7 +276,7 @@ const GoalRow = ({
return (
<>
- <li className='relative mb-3 overflow-hidden rounded-xl border border-gray-200 bg-gray-50 transition-colors dark:border-slate-800/25 dark:bg-slate-800/70'>
+ <li className='relative mb-3 overflow-hidden rounded-lg border border-gray-200 bg-gray-50 transition-colors dark:border-slate-800/25 dark:bg-slate-800/70'>
{/* Main row - clickable to expand */}
<div
onClick={() => onToggleExpand(goal.id)}
@@ -681,7 +681,7 @@ const GoalsView = ({ period, from = '', to = '', timezone }: GoalsViewProps) =>
<div>
{isLoading && !_isEmpty(goals) ? <LoadingBar /> : null}
{_isEmpty(goals) ? (
- <div className='mt-5 rounded-xl bg-gray-700 p-5'>
+ <div className='mt-5 rounded-lg bg-gray-700 p-5'>
<div className='flex items-center text-gray-50'>
<TargetIcon className='mr-2 h-8 w-8' strokeWidth={1.5} />
<p className='text-3xl font-bold'>{t('goals.title')}</p>
diff --git a/web/app/pages/Project/tabs/Performance/PerformanceView.tsx b/web/app/pages/Project/tabs/Performance/PerformanceView.tsx
index 0e22d5ebb..8a0c5ec78 100644
--- a/web/app/pages/Project/tabs/Performance/PerformanceView.tsx
+++ b/web/app/pages/Project/tabs/Performance/PerformanceView.tsx
@@ -602,7 +602,7 @@ const PerformanceView = ({ tnMapping }: PerformanceViewProps) => {
<DashboardHeader />
{dataLoading && !isPanelsDataEmpty ? <LoadingBar /> : null}
<div className={cx({ hidden: isPanelsDataEmpty || analyticsLoading })}>
- <div className='relative overflow-hidden rounded-lg border border-gray-300 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='relative overflow-hidden rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-800/25'>
<div className='mb-3 flex w-full items-center justify-end gap-2 lg:absolute lg:top-2 lg:right-2 lg:mb-0 lg:w-auto lg:justify-normal'>
<Dropdown
items={chartMetrics}
diff --git a/web/app/pages/Project/tabs/Profiles/ProfileDetails.tsx b/web/app/pages/Project/tabs/Profiles/ProfileDetails.tsx
new file mode 100644
index 000000000..dfaa17c71
--- /dev/null
+++ b/web/app/pages/Project/tabs/Profiles/ProfileDetails.tsx
@@ -0,0 +1,413 @@
+import dayjs from 'dayjs'
+import _capitalize from 'lodash/capitalize'
+import _isEmpty from 'lodash/isEmpty'
+import {
+ EyeIcon,
+ SparklesIcon,
+ ClockIcon,
+ CalendarIcon,
+ FileTextIcon,
+ MonitorIcon,
+ SmartphoneIcon,
+ TabletIcon,
+ GlobeIcon,
+ DollarSignIcon,
+} from 'lucide-react'
+import { useMemo } 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 { useTheme } from '~/providers/ThemeProvider'
+import Button from '~/ui/Button'
+import Loader from '~/ui/Loader'
+import { Text } from '~/ui/Text'
+import Tooltip from '~/ui/Tooltip'
+import { cn, getLocaleDisplayName, getStringFromTime, getTimeFromSeconds } from '~/utils/generic'
+import { getProfileDisplayName, ProfileAvatar } from '~/utils/profileAvatars'
+
+import CCRow from '../../View/components/CCRow'
+import { SessionChart } from '../Sessions/SessionChart'
+import { Sessions } from '../Sessions/Sessions'
+
+interface ProfileDetailsProps {
+ details: ProfileDetailsType | null
+ sessions: Session[]
+ sessionsLoading: boolean | null
+ timeFormat: '12-hour' | '24-hour'
+ onLoadMoreSessions: () => void
+ canLoadMoreSessions: boolean
+ currency?: string
+}
+
+const ActivityCalendar = ({ data }: { data: { date: string; count: number }[] }) => {
+ const { t } = useTranslation('common')
+
+ const countMap = useMemo(() => {
+ const map = new Map<string, number>()
+ data.forEach((item) => map.set(item.date, item.count))
+ return map
+ }, [data])
+
+ const weeks = useMemo(() => {
+ const result: { date: string; count: number }[][] = []
+ const now = dayjs()
+ const startDate = now.subtract(4, 'month').startOf('week')
+ const endDate = now.endOf('week')
+
+ let currentWeek: { date: string; count: number }[] = []
+ let currentDay = startDate
+
+ while (currentDay.isBefore(endDate) || currentDay.isSame(endDate, 'day')) {
+ const dateStr = currentDay.format('YYYY-MM-DD')
+ currentWeek.push({ date: dateStr, count: countMap.get(dateStr) || 0 })
+ if (currentWeek.length === 7) {
+ result.push(currentWeek)
+ currentWeek = []
+ }
+ currentDay = currentDay.add(1, 'day')
+ }
+ if (currentWeek.length > 0) result.push(currentWeek)
+ return result
+ }, [countMap])
+
+ const monthLabels = useMemo(() => {
+ const labels: { month: string; weekIndex: number }[] = []
+ let lastMonth = ''
+ weeks.forEach((week, weekIndex) => {
+ const firstDay = dayjs(week[0].date)
+ const month = firstDay.format('MMM')
+ if (month !== lastMonth) {
+ labels.push({ month, weekIndex })
+ lastMonth = month
+ }
+ })
+ return labels
+ }, [weeks])
+
+ const getColor = (count: number) => {
+ if (count === 0) return 'bg-gray-100 dark:bg-slate-700/50'
+ if (count <= 2) return 'bg-emerald-200 dark:bg-emerald-800'
+ if (count <= 5) return 'bg-emerald-300 dark:bg-emerald-700'
+ if (count <= 10) return 'bg-emerald-400 dark:bg-emerald-600'
+ return 'bg-emerald-500'
+ }
+
+ const dayLabels = ['S', 'M', 'T', 'W', 'T', 'F', 'S']
+
+ const TooltipContent = ({ day }: { day: { date: string; count: number } }) => (
+ <div className='text-center'>
+ <div className='font-medium'>{dayjs(day.date).format('MMM D, YYYY')}</div>
+ <div className='text-gray-300'>
+ {day.count} {t('dashboard.pageviews').toLowerCase()}
+ </div>
+ </div>
+ )
+
+ return (
+ <div className='w-full'>
+ <div className='mb-1 flex w-full gap-[2px]' style={{ paddingLeft: '18px' }}>
+ {weeks.map((_, weekIdx) => (
+ <div key={weekIdx} className='relative flex-1 text-[10px] text-gray-400'>
+ {monthLabels.find((m) => m.weekIndex === weekIdx)?.month}
+ </div>
+ ))}
+ </div>
+ <div className='flex w-full gap-[2px]'>
+ <div className='flex shrink-0 flex-col gap-[2px] pr-1 text-[9px] text-gray-400'>
+ {dayLabels.map((d, i) => (
+ <div key={i} className='flex h-3 w-3 items-center justify-end'>
+ {i % 2 === 1 ? d : ''}
+ </div>
+ ))}
+ </div>
+ <div className='flex flex-1 gap-[2px]'>
+ {weeks.map((week, weekIdx) => (
+ <div key={weekIdx} className='flex flex-1 flex-col gap-[2px]'>
+ {week.map((day, dayIdx) => (
+ <Tooltip
+ key={dayIdx}
+ text={<TooltipContent day={day} />}
+ tooltipNode={<div className={cn('h-3 w-full rounded-[2px]', getColor(day.count))} />}
+ delay={0}
+ />
+ ))}
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+ )
+}
+
+const StatItem = ({ icon, label, value }: { icon: React.ReactNode; label: string; value: string | number }) => (
+ <div>
+ <Text size='xxs' weight='medium' colour='muted' className='mb-0.5 flex items-center gap-1.5 uppercase'>
+ {icon}
+ {label}
+ </Text>
+ <Text size='lg' weight='semibold' colour='primary'>
+ {value}
+ </Text>
+ </div>
+)
+
+const InfoRow = ({ label, value }: { label: string; value: React.ReactNode }) => (
+ <div className='flex items-center justify-between border-b border-gray-100 py-2 last:border-0 dark:border-slate-700/50'>
+ <Text size='sm' colour='muted'>
+ {label}
+ </Text>
+ <Text size='sm' weight='medium' colour='primary' className='flex items-center gap-1'>
+ {value}
+ </Text>
+ </div>
+)
+
+const DeviceIcon = ({ device }: { device: string | null }) => {
+ const deviceLower = device?.toLowerCase() || ''
+ if (deviceLower === 'mobile') return <SmartphoneIcon className='h-4 w-4' />
+ if (deviceLower === 'tablet') return <TabletIcon className='h-4 w-4' />
+ return <MonitorIcon className='h-4 w-4' />
+}
+
+const BrowserIcon = ({ browser }: { browser: string | null }) => {
+ if (!browser) return <GlobeIcon className='h-4 w-4' />
+
+ const logoUrl = BROWSER_LOGO_MAP[browser as keyof typeof BROWSER_LOGO_MAP]
+
+ if (!logoUrl) return <GlobeIcon className='h-4 w-4' />
+
+ return <img src={logoUrl} className='h-4 w-4' alt='' />
+}
+
+const OSIcon = ({ os, theme }: { os: string | null; theme: string }) => {
+ if (!os) return <GlobeIcon className='h-4 w-4' />
+
+ const logoPathLight = OS_LOGO_MAP[os as keyof typeof OS_LOGO_MAP]
+ const logoPathDark = OS_LOGO_MAP_DARK[os as keyof typeof OS_LOGO_MAP_DARK]
+
+ let logoPath = theme === 'dark' ? logoPathDark : logoPathLight
+ logoPath ||= logoPathLight
+
+ if (!logoPath) return <GlobeIcon className='h-4 w-4' />
+
+ return <img src={`/${logoPath}`} className='h-4 w-4' alt='' />
+}
+
+export const ProfileDetails = ({
+ details,
+ sessions,
+ sessionsLoading,
+ timeFormat,
+ onLoadMoreSessions,
+ canLoadMoreSessions,
+ currency,
+}: ProfileDetailsProps) => {
+ const {
+ t,
+ i18n: { language },
+ } = useTranslation('common')
+ const { theme } = useTheme()
+
+ const displayName = useMemo(() => {
+ if (!details) return ''
+ return getProfileDisplayName(details.profileId, details.isIdentified)
+ }, [details])
+
+ const formatDate = (date: string | undefined) => {
+ if (!date) return 'N/A'
+ return dayjs(date).format('MMM D, YYYY')
+ }
+
+ const dataNames = useMemo(
+ () => ({
+ pageviews: t('dashboard.pageviews'),
+ customEvents: t('dashboard.events'),
+ errors: t('dashboard.errors'),
+ }),
+ [t],
+ )
+
+ if (!details) return <Loader />
+
+ const avgDurationStr = details.avgDuration ? getStringFromTime(getTimeFromSeconds(details.avgDuration)) : 'N/A'
+
+ return (
+ <div className='flex flex-col gap-3 lg:flex-row'>
+ <div className='space-y-3 lg:w-[380px]'>
+ <div className='rounded-lg border border-gray-300 bg-white px-4 py-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='flex items-center gap-4'>
+ <ProfileAvatar className='-mr-0.75 -mb-0.75' profileId={details.profileId} size={42} />
+ <div className='flex flex-col gap-0.5'>
+ <Text size='base' weight='bold' colour='primary'>
+ {displayName}
+ </Text>
+ <Text size='xs' colour='muted' code>
+ {details.profileId}
+ </Text>
+ </div>
+ </div>
+ <div className='mt-4 grid grid-cols-2 gap-y-5'>
+ <StatItem
+ icon={<FileTextIcon className='h-3.5 w-3.5' />}
+ label={t('project.sessions')}
+ value={details.sessionsCount || 0}
+ />
+ <StatItem
+ icon={<EyeIcon className='h-3.5 w-3.5' />}
+ label={t('dashboard.pageviews')}
+ value={details.pageviewsCount || 0}
+ />
+ <StatItem
+ icon={<SparklesIcon className='h-3.5 w-3.5' />}
+ label={t('dashboard.events')}
+ value={details.eventsCount || 0}
+ />
+ <StatItem
+ icon={<ClockIcon className='h-3.5 w-3.5' />}
+ label={t('project.avgDuration')}
+ value={avgDurationStr}
+ />
+ <StatItem
+ icon={<CalendarIcon className='h-3.5 w-3.5' />}
+ label={t('project.firstSeen')}
+ value={formatDate(details.firstSeen)}
+ />
+ <StatItem
+ icon={<CalendarIcon className='h-3.5 w-3.5' />}
+ label={t('project.lastSeen')}
+ value={formatDate(details.lastSeen)}
+ />
+ {details.totalRevenue !== undefined && details.totalRevenue > 0 ? (
+ <StatItem
+ icon={<DollarSignIcon className='h-3.5 w-3.5 text-green-500' />}
+ label={t('dashboard.revenue')}
+ value={new Intl.NumberFormat('en-US', {
+ style: 'currency',
+ currency: details.revenueCurrency || 'USD',
+ minimumFractionDigits: 2,
+ }).format(details.totalRevenue)}
+ />
+ ) : null}
+ </div>
+ </div>
+
+ <div className='rounded-lg border border-gray-300 bg-white px-4 py-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <Text as='h3' size='xs' weight='semibold' colour='primary' className='mb-2 uppercase' tracking='wide'>
+ {t('project.locationAndDevice')}
+ </Text>
+ <div>
+ <InfoRow
+ label={t('project.mapping.cc')}
+ value={details.cc ? <CCRow size={16} cc={details.cc} language={language} /> : '-'}
+ />
+ {details.rg ? <InfoRow label={t('project.mapping.rg')} value={details.rg} /> : null}
+ <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)}
+ </>
+ ) : (
+ '-'
+ )
+ }
+ />
+ <InfoRow
+ label={t('project.mapping.br')}
+ value={
+ details.br ? (
+ <>
+ <BrowserIcon browser={details.br} />
+ {details.br}
+ {details.brv ? ` v${details.brv}` : ''}
+ </>
+ ) : (
+ '-'
+ )
+ }
+ />
+ <InfoRow
+ label={t('project.mapping.os')}
+ value={
+ details.os ? (
+ <>
+ <OSIcon os={details.os} theme={theme} />
+ {details.os}
+ {details.osv ? ` v${details.osv}` : ''}
+ </>
+ ) : (
+ '-'
+ )
+ }
+ />
+ </div>
+ </div>
+
+ <div className='rounded-lg border border-gray-300 bg-white px-4 py-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <Text as='h3' size='xs' weight='semibold' colour='primary' className='mb-2 uppercase' tracking='wide'>
+ {t('project.activityCalendar')}
+ </Text>
+ <ActivityCalendar data={details.activityCalendar || []} />
+ </div>
+ </div>
+
+ <div className='flex-1 space-y-3'>
+ {details.chart && !_isEmpty(details.chart.x) ? (
+ <div className='max-h-max rounded-lg border border-gray-300 bg-white px-4 py-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <Text as='h3' size='xs' weight='semibold' colour='primary' className='mb-2 uppercase' tracking='wide'>
+ {t('dashboard.pageviews')}
+ </Text>
+ <SessionChart
+ chart={details.chart}
+ timeBucket={details.timeBucket}
+ timeFormat={timeFormat}
+ rotateXAxis={false}
+ dataNames={dataNames}
+ className='h-[300px] [&_svg]:overflow-visible!'
+ />
+ </div>
+ ) : null}
+
+ <div className='rounded-lg border border-gray-300 bg-white px-4 py-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <Text as='h3' size='xs' weight='semibold' colour='primary' className='mb-2 uppercase' tracking='wide'>
+ {t('project.userSessions')}
+ </Text>
+ {sessionsLoading && sessions.length === 0 ? (
+ <Loader />
+ ) : sessions.length === 0 ? (
+ <p className='py-4 text-center text-sm text-gray-400'>{t('project.noSessions')}</p>
+ ) : (
+ <>
+ <Sessions
+ sessions={sessions}
+ timeFormat={timeFormat}
+ hideNewReturnBadge
+ hideUserDetails
+ currency={currency}
+ />
+ {canLoadMoreSessions ? (
+ <Button
+ onClick={onLoadMoreSessions}
+ disabled={!!sessionsLoading}
+ loading={!!sessionsLoading}
+ className='mt-4 w-full'
+ primary
+ regular
+ >
+ {t('project.loadMore')}
+ </Button>
+ ) : null}
+ </>
+ )}
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/web/app/pages/Project/tabs/Profiles/Users.tsx b/web/app/pages/Project/tabs/Profiles/Profiles.tsx
similarity index 92%
rename from web/app/pages/Project/tabs/Profiles/Users.tsx
rename to web/app/pages/Project/tabs/Profiles/Profiles.tsx
index 4cf8d1b8f..9c417bc21 100644
--- a/web/app/pages/Project/tabs/Profiles/Users.tsx
+++ b/web/app/pages/Project/tabs/Profiles/Profiles.tsx
@@ -19,7 +19,6 @@ import CCRow from '../../View/components/CCRow'
dayjs.extend(relativeTime)
-// Time thresholds for online status (in minutes)
const ONLINE_THRESHOLD_MINUTES = 5
const RECENTLY_ACTIVE_THRESHOLD_MINUTES = 30
@@ -46,7 +45,7 @@ interface UsersProps {
timeFormat: '12-hour' | '24-hour'
}
-interface UserRowProps {
+interface ProfileRowProps {
profile: ProfileType
timeFormat: '12-hour' | '24-hour'
}
@@ -57,7 +56,7 @@ const Separator = () => (
</svg>
)
-const UserRow = ({ profile, timeFormat }: UserRowProps) => {
+const ProfileRow = ({ profile, timeFormat }: ProfileRowProps) => {
const {
t,
i18n: { language },
@@ -90,11 +89,10 @@ const UserRow = ({ profile, timeFormat }: UserRowProps) => {
return (
<Link to={{ search: params.toString() }}>
- <li className='relative mb-3 flex cursor-pointer justify-between gap-x-6 overflow-hidden rounded-xl border border-gray-200 bg-gray-50 px-4 py-4 transition-colors hover:bg-gray-200/70 sm:px-6 dark:border-slate-800/25 dark:bg-slate-800/70 dark:hover:bg-slate-700/60'>
- <div className='flex min-w-0 gap-x-4'>
- {/* Avatar with online status indicator */}
+ <li className='relative mb-3 flex cursor-pointer justify-between gap-x-6 overflow-hidden rounded-lg border border-gray-200 bg-gray-50 px-4 py-4 transition-colors hover:bg-gray-200/70 sm:px-6 dark:border-slate-800/25 dark:bg-slate-800/70 dark:hover:bg-slate-700/60'>
+ <div className='flex min-w-0 gap-x-3'>
<div className='relative shrink-0'>
- <ProfileAvatar profileId={profile.profileId} size={40} />
+ <ProfileAvatar className='mt-1' profileId={profile.profileId} size={40} />
{onlineStatus === 'offline' ? null : (
<Tooltip
text={t('project.lastSeenAgo', { time: lastSeenAgo })}
@@ -118,7 +116,7 @@ const UserRow = ({ profile, timeFormat }: UserRowProps) => {
{profile.isIdentified ? <Badge label={t('project.identified')} colour='indigo' className='ml-2' /> : null}
</p>
<p className='mt-1 flex flex-wrap items-center gap-x-2 text-xs leading-5 text-gray-500 dark:text-gray-300'>
- <span className='flex'>
+ <span className='flex items-center'>
{profile.cc ? <CCRow size={18} cc={profile.cc} language={language} /> : t('project.unknownCountry')}
</span>
<Separator />
@@ -181,12 +179,12 @@ const UserRow = ({ profile, timeFormat }: UserRowProps) => {
)
}
-interface UsersFilterProps {
+interface ProfilesFilterProps {
profileType: 'all' | 'anonymous' | 'identified'
onProfileTypeChange: (type: 'all' | 'anonymous' | 'identified') => void
}
-export const UsersFilter: React.FC<UsersFilterProps> = ({ profileType, onProfileTypeChange }) => {
+export const ProfilesFilter: React.FC<ProfilesFilterProps> = ({ profileType, onProfileTypeChange }) => {
const { t } = useTranslation('common')
const filterButtonClass = (isActive: boolean) =>
@@ -224,7 +222,7 @@ export const UsersFilter: React.FC<UsersFilterProps> = ({ profileType, onProfile
)
}
-export const Users: React.FC<UsersProps> = ({ profiles, timeFormat }) => {
+export const Profiles: React.FC<UsersProps> = ({ profiles, timeFormat }) => {
return (
<ClientOnly
fallback={
@@ -236,7 +234,7 @@ export const Users: React.FC<UsersProps> = ({ profiles, timeFormat }) => {
{() => (
<ul className='mt-4'>
{_map(profiles, (profile) => (
- <UserRow key={profile.profileId} profile={profile} timeFormat={timeFormat} />
+ <ProfileRow key={profile.profileId} profile={profile} timeFormat={timeFormat} />
))}
</ul>
)}
diff --git a/web/app/pages/Project/tabs/Profiles/ProfilesView.tsx b/web/app/pages/Project/tabs/Profiles/ProfilesView.tsx
index b6282ed89..41e8e0fa7 100644
--- a/web/app/pages/Project/tabs/Profiles/ProfilesView.tsx
+++ b/web/app/pages/Project/tabs/Profiles/ProfilesView.tsx
@@ -6,9 +6,9 @@ import { useTranslation } from 'react-i18next'
import { useSearchParams } from 'react-router'
import { getProfiles, getProfile, getProfileSessions } from '~/api'
-import { Profile, ProfileDetails, Session } from '~/lib/models/Project'
-import { UserDetails } from '~/pages/Project/tabs/Profiles/UserDetails'
-import { Users, UsersFilter } from '~/pages/Project/tabs/Profiles/Users'
+import { Profile, ProfileDetails as ProfileDetailsType, Session } from '~/lib/models/Project'
+import { ProfileDetails } from '~/pages/Project/tabs/Profiles/ProfileDetails'
+import { Profiles, ProfilesFilter } from '~/pages/Project/tabs/Profiles/Profiles'
import DashboardHeader from '~/pages/Project/View/components/DashboardHeader'
import NoEvents from '~/pages/Project/View/components/NoEvents'
import { useViewProjectContext } from '~/pages/Project/View/ViewProject'
@@ -31,7 +31,7 @@ const ProfilesView = () => {
const [canLoadMoreProfiles, setCanLoadMoreProfiles] = useState(false)
const [profiles, setProfiles] = useState<Profile[]>([])
const [profilesLoading, setProfilesLoading] = useState<boolean | null>(null)
- const [activeProfile, setActiveProfile] = useState<ProfileDetails | null>(null)
+ const [activeProfile, setActiveProfile] = useState<ProfileDetailsType | null>(null)
const [profileLoading, setProfileLoading] = useState(false)
const [profileSessions, setProfileSessions] = useState<Session[]>([])
const [profileSessionsLoading, setProfileSessionsLoading] = useState<boolean | null>(null)
@@ -321,7 +321,7 @@ const ProfilesView = () => {
{profileLoading && !activeProfile ? (
<Loader />
) : (
- <UserDetails
+ <ProfileDetails
details={activeProfile}
sessions={profileSessions}
sessionsLoading={profileSessionsLoading}
@@ -344,7 +344,7 @@ const ProfilesView = () => {
<>
<DashboardHeader showLiveVisitors />
{profilesLoading && !_isEmpty(profiles) ? <LoadingBar /> : null}
- <UsersFilter
+ <ProfilesFilter
profileType={profileTypeFilter}
onProfileTypeChange={(type) => {
setProfileTypeFilter(type)
@@ -355,7 +355,7 @@ const ProfilesView = () => {
{typeof profilesLoading === 'boolean' && !profilesLoading && _isEmpty(profiles) ? (
<NoEvents filters={filters} />
) : null}
- <Users profiles={profiles} timeFormat={timeFormat} />
+ <Profiles profiles={profiles} timeFormat={timeFormat} />
{canLoadMoreProfiles ? (
<button
type='button'
diff --git a/web/app/pages/Project/tabs/Profiles/UserDetails.tsx b/web/app/pages/Project/tabs/Profiles/UserDetails.tsx
deleted file mode 100644
index 5d91ead8f..000000000
--- a/web/app/pages/Project/tabs/Profiles/UserDetails.tsx
+++ /dev/null
@@ -1,419 +0,0 @@
-import dayjs from 'dayjs'
-import _capitalize from 'lodash/capitalize'
-import _isEmpty from 'lodash/isEmpty'
-import {
- EyeIcon,
- SparklesIcon,
- ClockIcon,
- CalendarIcon,
- FileTextIcon,
- MonitorIcon,
- SmartphoneIcon,
- TabletIcon,
- GlobeIcon,
- DollarSignIcon,
-} from 'lucide-react'
-import { useMemo } 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 { useTheme } from '~/providers/ThemeProvider'
-import Button from '~/ui/Button'
-import Loader from '~/ui/Loader'
-import Tooltip from '~/ui/Tooltip'
-import { cn, getLocaleDisplayName, getStringFromTime, getTimeFromSeconds } from '~/utils/generic'
-import { getProfileDisplayName, ProfileAvatar } from '~/utils/profileAvatars'
-
-import CCRow from '../../View/components/CCRow'
-import { SessionChart } from '../Sessions/SessionChart'
-import { Sessions } from '../Sessions/Sessions'
-
-interface UserDetailsProps {
- details: ProfileDetailsType | null
- sessions: Session[]
- sessionsLoading: boolean | null
- timeFormat: '12-hour' | '24-hour'
- onLoadMoreSessions: () => void
- canLoadMoreSessions: boolean
- currency?: string
-}
-
-// Activity Calendar Component
-const ActivityCalendar = ({ data }: { data: { date: string; count: number }[] }) => {
- const { t } = useTranslation('common')
-
- const countMap = useMemo(() => {
- const map = new Map<string, number>()
- data.forEach((item) => map.set(item.date, item.count))
- return map
- }, [data])
-
- const weeks = useMemo(() => {
- const result: { date: string; count: number }[][] = []
- const now = dayjs()
- const startDate = now.subtract(4, 'month').startOf('week')
- const endDate = now.endOf('week')
-
- let currentWeek: { date: string; count: number }[] = []
- let currentDay = startDate
-
- while (currentDay.isBefore(endDate) || currentDay.isSame(endDate, 'day')) {
- const dateStr = currentDay.format('YYYY-MM-DD')
- currentWeek.push({ date: dateStr, count: countMap.get(dateStr) || 0 })
- if (currentWeek.length === 7) {
- result.push(currentWeek)
- currentWeek = []
- }
- currentDay = currentDay.add(1, 'day')
- }
- if (currentWeek.length > 0) result.push(currentWeek)
- return result
- }, [countMap])
-
- const monthLabels = useMemo(() => {
- const labels: { month: string; weekIndex: number }[] = []
- let lastMonth = ''
- weeks.forEach((week, weekIndex) => {
- const firstDay = dayjs(week[0].date)
- const month = firstDay.format('MMM')
- if (month !== lastMonth) {
- labels.push({ month, weekIndex })
- lastMonth = month
- }
- })
- return labels
- }, [weeks])
-
- const getColor = (count: number) => {
- if (count === 0) return 'bg-gray-100 dark:bg-slate-700/50'
- if (count <= 2) return 'bg-emerald-200 dark:bg-emerald-800'
- if (count <= 5) return 'bg-emerald-300 dark:bg-emerald-700'
- if (count <= 10) return 'bg-emerald-400 dark:bg-emerald-600'
- return 'bg-emerald-500'
- }
-
- const dayLabels = ['S', 'M', 'T', 'W', 'T', 'F', 'S']
-
- const TooltipContent = ({ day }: { day: { date: string; count: number } }) => (
- <div className='text-center'>
- <div className='font-medium'>{dayjs(day.date).format('MMM D, YYYY')}</div>
- <div className='text-gray-300'>
- {day.count} {t('dashboard.pageviews').toLowerCase()}
- </div>
- </div>
- )
-
- return (
- <div className='w-full'>
- <div className='mb-1 flex w-full gap-[2px]' style={{ paddingLeft: '18px' }}>
- {weeks.map((_, weekIdx) => (
- <div key={weekIdx} className='relative flex-1 text-[10px] text-gray-400'>
- {monthLabels.find((m) => m.weekIndex === weekIdx)?.month}
- </div>
- ))}
- </div>
- <div className='flex w-full gap-[2px]'>
- <div className='flex shrink-0 flex-col gap-[2px] pr-1 text-[9px] text-gray-400'>
- {dayLabels.map((d, i) => (
- <div key={i} className='flex h-3 w-3 items-center justify-end'>
- {i % 2 === 1 ? d : ''}
- </div>
- ))}
- </div>
- <div className='flex flex-1 gap-[2px]'>
- {weeks.map((week, weekIdx) => (
- <div key={weekIdx} className='flex flex-1 flex-col gap-[2px]'>
- {week.map((day, dayIdx) => (
- <Tooltip
- key={dayIdx}
- text={<TooltipContent day={day} />}
- tooltipNode={<div className={cn('h-3 w-full rounded-[2px]', getColor(day.count))} />}
- delay={0}
- />
- ))}
- </div>
- ))}
- </div>
- </div>
- </div>
- )
-}
-
-// Stat Item Component
-const StatItem = ({ icon, label, value }: { icon: React.ReactNode; label: string; value: string | number }) => (
- <div>
- <div className='mb-0.5 flex items-center gap-1.5 text-[10px] font-medium tracking-wide text-gray-600 uppercase dark:text-gray-400'>
- {icon}
- {label}
- </div>
- <div className='text-lg font-semibold text-gray-900 dark:text-white'>{value}</div>
- </div>
-)
-
-// Info Row Component for Location & Device
-const InfoRow = ({ label, value }: { label: string; value: React.ReactNode }) => (
- <div className='flex items-center justify-between border-b border-gray-100 py-2 last:border-0 dark:border-slate-700/50'>
- <span className='text-sm text-gray-600 dark:text-gray-400'>{label}</span>
- <span className='flex items-center gap-1.5 text-sm font-medium text-gray-900 dark:text-white'>{value}</span>
- </div>
-)
-
-// Device Icon Component
-const DeviceIcon = ({ device }: { device: string | null }) => {
- const deviceLower = device?.toLowerCase() || ''
- if (deviceLower === 'mobile') return <SmartphoneIcon className='h-4 w-4' />
- if (deviceLower === 'tablet') return <TabletIcon className='h-4 w-4' />
- return <MonitorIcon className='h-4 w-4' />
-}
-
-// Browser Icon Component
-const BrowserIcon = ({ browser }: { browser: string | null }) => {
- if (!browser) return <GlobeIcon className='h-4 w-4' />
-
- const logoUrl = BROWSER_LOGO_MAP[browser as keyof typeof BROWSER_LOGO_MAP]
-
- if (!logoUrl) return <GlobeIcon className='h-4 w-4' />
-
- return <img src={logoUrl} className='h-4 w-4' alt='' />
-}
-
-// OS Icon Component
-const OSIcon = ({ os, theme }: { os: string | null; theme: string }) => {
- if (!os) return <GlobeIcon className='h-4 w-4' />
-
- const logoPathLight = OS_LOGO_MAP[os as keyof typeof OS_LOGO_MAP]
- const logoPathDark = OS_LOGO_MAP_DARK[os as keyof typeof OS_LOGO_MAP_DARK]
-
- let logoPath = theme === 'dark' ? logoPathDark : logoPathLight
- logoPath ||= logoPathLight
-
- if (!logoPath) return <GlobeIcon className='h-4 w-4' />
-
- return <img src={`/${logoPath}`} className='h-4 w-4' alt='' />
-}
-
-export const UserDetails = ({
- details,
- sessions,
- sessionsLoading,
- timeFormat,
- onLoadMoreSessions,
- canLoadMoreSessions,
- currency,
-}: UserDetailsProps) => {
- const {
- t,
- i18n: { language },
- } = useTranslation('common')
- const { theme } = useTheme()
-
- const displayName = useMemo(() => {
- if (!details) return ''
- return getProfileDisplayName(details.profileId, details.isIdentified)
- }, [details])
-
- const formatDate = (date: string | undefined) => {
- if (!date) return 'N/A'
- return dayjs(date).format('MMM D, YYYY')
- }
-
- const dataNames = useMemo(
- () => ({
- pageviews: t('dashboard.pageviews'),
- customEvents: t('dashboard.events'),
- errors: t('dashboard.errors'),
- }),
- [t],
- )
-
- if (!details) return <Loader />
-
- const avgDurationStr = details.avgDuration ? getStringFromTime(getTimeFromSeconds(details.avgDuration)) : 'N/A'
-
- return (
- <div className='space-y-6'>
- {/* Header */}
- <div className='flex items-center gap-4'>
- <ProfileAvatar profileId={details.profileId} size={56} className='shrink-0' />
- <div>
- <h2 className='text-2xl font-bold text-gray-900 dark:text-white'>{displayName}</h2>
- <code className='text-sm text-gray-400'>{details.profileId}</code>
- </div>
- </div>
-
- {/* Main Content - Two Column Layout */}
- <div className='flex flex-col gap-5 lg:flex-row'>
- {/* Left Column - Stats & Location/Device & Activity Calendar */}
- <div className='space-y-4 lg:w-[380px]'>
- {/* Stats Card */}
- <div className='rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
- <div className='grid grid-cols-2 gap-y-5'>
- <StatItem
- icon={<FileTextIcon className='h-3.5 w-3.5' />}
- label={t('project.sessions')}
- value={details.sessionsCount || 0}
- />
- <StatItem
- icon={<EyeIcon className='h-3.5 w-3.5' />}
- label={t('dashboard.pageviews')}
- value={details.pageviewsCount || 0}
- />
- <StatItem
- icon={<SparklesIcon className='h-3.5 w-3.5' />}
- label={t('dashboard.events')}
- value={details.eventsCount || 0}
- />
- <StatItem
- icon={<ClockIcon className='h-3.5 w-3.5' />}
- label={t('project.avgDuration')}
- value={avgDurationStr}
- />
- <StatItem
- icon={<CalendarIcon className='h-3.5 w-3.5' />}
- label={t('project.firstSeen')}
- value={formatDate(details.firstSeen)}
- />
- <StatItem
- icon={<CalendarIcon className='h-3.5 w-3.5' />}
- label={t('project.lastSeen')}
- value={formatDate(details.lastSeen)}
- />
- {details.totalRevenue !== undefined && details.totalRevenue > 0 ? (
- <StatItem
- icon={<DollarSignIcon className='h-3.5 w-3.5 text-green-500' />}
- label={t('dashboard.revenue')}
- value={new Intl.NumberFormat('en-US', {
- style: 'currency',
- currency: details.revenueCurrency || 'USD',
- minimumFractionDigits: 2,
- }).format(details.totalRevenue)}
- />
- ) : null}
- </div>
- </div>
-
- {/* Location & Device Card */}
- <div className='rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
- <h3 className='mb-3 text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
- {t('project.locationAndDevice')}
- </h3>
- <div>
- <InfoRow
- label={t('project.mapping.cc')}
- value={details.cc ? <CCRow size={16} cc={details.cc} language={language} /> : '-'}
- />
- {details.rg ? <InfoRow label={t('project.mapping.rg')} value={details.rg} /> : null}
- <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)}
- </>
- ) : (
- '-'
- )
- }
- />
- <InfoRow
- label={t('project.mapping.br')}
- value={
- details.br ? (
- <>
- <BrowserIcon browser={details.br} />
- {details.br}
- {details.brv ? ` v${details.brv}` : ''}
- </>
- ) : (
- '-'
- )
- }
- />
- <InfoRow
- label={t('project.mapping.os')}
- value={
- details.os ? (
- <>
- <OSIcon os={details.os} theme={theme} />
- {details.os}
- {details.osv ? ` v${details.osv}` : ''}
- </>
- ) : (
- '-'
- )
- }
- />
- </div>
- </div>
-
- {/* Activity Calendar Card */}
- <div className='rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
- <h3 className='mb-3 text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
- {t('project.activityCalendar')}
- </h3>
- <ActivityCalendar data={details.activityCalendar || []} />
- </div>
- </div>
-
- {/* Right Column - Chart & Sessions */}
- <div className='flex-1 space-y-4'>
- {details.chart && !_isEmpty(details.chart.x) ? (
- <div className='max-h-max rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
- <h3 className='mb-3 text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
- {t('dashboard.pageviews')}
- </h3>
- <SessionChart
- chart={details.chart}
- timeBucket={details.timeBucket}
- timeFormat={timeFormat}
- rotateXAxis={false}
- dataNames={dataNames}
- className='h-[300px] [&_svg]:overflow-visible!'
- />
- </div>
- ) : null}
-
- {/* Sessions */}
- <div className='rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
- <h3 className='mb-3 text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
- {t('project.userSessions')}
- </h3>
- {sessionsLoading && sessions.length === 0 ? (
- <Loader />
- ) : sessions.length === 0 ? (
- <p className='py-4 text-center text-sm text-gray-400'>{t('project.noSessions')}</p>
- ) : (
- <>
- <Sessions
- sessions={sessions}
- timeFormat={timeFormat}
- hideNewReturnBadge
- hideUserDetails
- currency={currency}
- />
- {canLoadMoreSessions ? (
- <Button
- onClick={onLoadMoreSessions}
- disabled={!!sessionsLoading}
- loading={!!sessionsLoading}
- className='mt-4 w-full'
- primary
- regular
- >
- {t('project.loadMore')}
- </Button>
- ) : null}
- </>
- )}
- </div>
- </div>
- </div>
- </div>
- )
-}
diff --git a/web/app/pages/Project/tabs/Sessions/NoSessionDetails.tsx b/web/app/pages/Project/tabs/Sessions/NoSessionDetails.tsx
index d3832f240..b6a39302f 100644
--- a/web/app/pages/Project/tabs/Sessions/NoSessionDetails.tsx
+++ b/web/app/pages/Project/tabs/Sessions/NoSessionDetails.tsx
@@ -1,28 +1,18 @@
import { FaceFrownIcon } from '@heroicons/react/24/outline'
import { useTranslation } from 'react-i18next'
-import { Text } from '~/ui/Text'
-
const NoSessionDetails = () => {
const { t } = useTranslation('common')
return (
- <div className='px-4 py-16 sm:px-6 sm:py-24 md:grid md:place-items-center lg:px-8'>
- <div className='mx-auto max-w-max'>
- <main className='sm:flex'>
- <FaceFrownIcon type='giant' className='mb-2 -ml-1.5 h-12 w-12 sm:m-0 sm:h-20 sm:w-20' />
- <div className='sm:ml-6'>
- <div className='sm:border-l sm:border-gray-200 sm:pl-6'>
- <Text as='h1' size='4xl' weight='bold' className='sm:text-5xl'>
- {t('project.noSessionDetails')}
- </Text>
- <Text as='p' size='base' colour='secondary' className='mt-1 max-w-prose whitespace-pre-line'>
- {t('project.noSessionDesc')}
- </Text>
- </div>
- </div>
- </main>
+ <div className='mx-auto w-full max-w-2xl py-16 text-center text-gray-900 dark:text-gray-50'>
+ <div className='mx-auto mb-6 flex size-14 items-center justify-center rounded-xl bg-gray-100 dark:bg-slate-800'>
+ <FaceFrownIcon className='size-7 text-gray-700 dark:text-gray-200' strokeWidth={1.5} />
</div>
+ <h3 className='text-xl font-medium tracking-tight'>{t('project.noSessionDetails')}</h3>
+ <p className='mx-auto mt-2 max-w-md text-sm whitespace-pre-line text-gray-800 dark:text-gray-200'>
+ {t('project.noSessionDesc')}
+ </p>
</div>
)
}
diff --git a/web/app/pages/Project/tabs/Sessions/SessionDetailView.tsx b/web/app/pages/Project/tabs/Sessions/SessionDetailView.tsx
index db4b6efdd..910c45788 100644
--- a/web/app/pages/Project/tabs/Sessions/SessionDetailView.tsx
+++ b/web/app/pages/Project/tabs/Sessions/SessionDetailView.tsx
@@ -11,6 +11,8 @@ import { BROWSER_LOGO_MAP, OS_LOGO_MAP, OS_LOGO_MAP_DARK } from '~/lib/constants
import { SessionDetails as SessionDetailsType } from '~/lib/models/Project'
import { useTheme } from '~/providers/ThemeProvider'
import Loader from '~/ui/Loader'
+import { Text } from '~/ui/Text'
+import Tooltip from '~/ui/Tooltip'
import { getLocaleDisplayName, getStringFromTime, getTimeFromSeconds } from '~/utils/generic'
import CCRow from '../../View/components/CCRow'
@@ -44,15 +46,17 @@ interface SessionDetailViewProps {
dataNames: Record<string, string>
}
-// Info Row Component for Location & Device
const InfoRow = ({ label, value }: { label: string; value: React.ReactNode }) => (
<div className='flex items-center justify-between border-b border-gray-100 py-2 last:border-0 dark:border-slate-700/50'>
- <span className='text-sm text-gray-600 dark:text-gray-400'>{label}</span>
- <span className='flex items-center gap-1.5 text-sm font-medium text-gray-900 dark:text-white'>{value}</span>
+ <Text size='sm' colour='muted'>
+ {label}
+ </Text>
+ <Text size='sm' weight='medium' colour='primary' className='flex items-center gap-1'>
+ {value}
+ </Text>
</div>
)
-// Device Icon Component
const DeviceIcon = ({ device }: { device: string | null }) => {
const deviceLower = device?.toLowerCase() || ''
if (deviceLower === 'mobile') return <SmartphoneIcon className='h-4 w-4' />
@@ -60,7 +64,6 @@ const DeviceIcon = ({ device }: { device: string | null }) => {
return <MonitorIcon className='h-4 w-4' />
}
-// Browser Icon Component
const BrowserIcon = ({ browser }: { browser: string | null }) => {
if (!browser) return <GlobeIcon className='h-4 w-4' />
@@ -71,7 +74,6 @@ const BrowserIcon = ({ browser }: { browser: string | null }) => {
return <img src={logoUrl} className='h-4 w-4' alt='' />
}
-// OS Icon Component
const OSIcon = ({ os, theme }: { os: string | null; theme: string }) => {
if (!os) return <GlobeIcon className='h-4 w-4' />
@@ -100,7 +102,6 @@ export const SessionDetailView = ({
const { theme } = useTheme()
const [zoomedTimeRange, setZoomedTimeRange] = useState<[Date, Date] | null>(null)
- // Calculate session duration from pages if sdur is 0 or not available
const sessionDuration = useMemo(() => {
if (!activeSession?.details) return 0
@@ -108,7 +109,6 @@ export const SessionDetailView = ({
return activeSession.details.sdur
}
- // Fallback: calculate duration from pageview timestamps only
if (!_isEmpty(activeSession.pages)) {
const pageviews = activeSession.pages!.filter((p) => p.type === 'pageview')
if (pageviews.length >= 1) {
@@ -143,19 +143,14 @@ export const SessionDetailView = ({
}
return (
- <div className='space-y-5'>
- {/* Main Content - Two Column Layout */}
- <div className='flex flex-col gap-5 lg:flex-row'>
- {/* Left Column - Session Details */}
+ <div className='space-y-3'>
+ <div className='flex flex-col gap-3 lg:flex-row'>
<div className='space-y-4 lg:w-[380px]'>
- {/* Session Details Card */}
- <div className='rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
- {/* Session Info */}
- <h3 className='mb-3 text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
+ <div className='rounded-lg border border-gray-200 bg-white px-4 py-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <Text as='h3' size='xs' weight='semibold' colour='primary' className='mb-2 uppercase' tracking='wide'>
{t('project.sessionInfo')}
- </h3>
+ </Text>
<div>
- {/* Session Duration */}
<InfoRow
label={t('dashboard.sessionDuration')}
value={
@@ -174,17 +169,21 @@ export const SessionDetailView = ({
)
}
/>
- {/* Referrer */}
<InfoRow
label={t('project.mapping.ref')}
value={
details.ref ? (
- <>
- <LinkIcon className='h-4 w-4' />
- <span title={_size(details.ref) > 25 ? details.ref : undefined}>
- {_truncate(details.ref, { length: 25 })}
- </span>
- </>
+ <Tooltip
+ text={details.ref}
+ tooltipNode={
+ <div className='flex items-center gap-1'>
+ <LinkIcon className='h-4 w-4' />
+ <span title={_size(details.ref) > 25 ? details.ref : undefined}>
+ {_truncate(details.ref, { length: 25 })}
+ </span>
+ </div>
+ }
+ />
) : (
t('project.directNone')
)
@@ -192,10 +191,9 @@ export const SessionDetailView = ({
/>
</div>
- {/* Location & Device */}
- <h3 className='mt-5 mb-3 text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
+ <Text as='h3' size='xs' weight='semibold' colour='primary' className='mt-5 mb-2 uppercase' tracking='wide'>
{t('project.locationAndDevice')}
- </h3>
+ </Text>
<div>
<InfoRow
label={t('project.mapping.cc')}
@@ -250,12 +248,11 @@ export const SessionDetailView = ({
/>
</div>
- {/* UTM Campaigns */}
{details.so || details.me || details.ca || details.te || details.co ? (
<>
- <h3 className='mt-5 mb-3 text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
+ <Text as='h3' size='xs' weight='semibold' colour='primary' className='mb-2 uppercase' tracking='wide'>
{t('project.campaigns')}
- </h3>
+ </Text>
<div>
{details.so ? <InfoRow label={t('project.mapping.so')} value={details.so} /> : null}
{details.me ? <InfoRow label={t('project.mapping.me')} value={details.me} /> : null}
@@ -268,14 +265,13 @@ export const SessionDetailView = ({
</div>
</div>
- {/* Right Column - Chart */}
<div className='flex-1'>
{!_isEmpty(activeSession?.chart) ? (
- <div className='rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
- <div className='mb-3 flex items-center justify-between'>
- <h3 className='text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
+ <div className='rounded-lg border border-gray-200 bg-white px-4 py-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='mb-2 flex items-center justify-between'>
+ <Text as='h3' size='xs' weight='semibold' colour='primary' className='uppercase' tracking='wide'>
{t('project.sessionActivity')}
- </h3>
+ </Text>
{zoomedTimeRange ? (
<button
onClick={resetZoom}
@@ -299,8 +295,7 @@ export const SessionDetailView = ({
</div>
</div>
- {/* Pageflow Section - Full Width Below */}
- <div className='rounded-lg border border-gray-300 bg-white p-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='rounded-lg border border-gray-200 bg-white px-4 py-5 dark:border-slate-800/60 dark:bg-slate-800/25'>
<h3 className='mb-4 text-xs font-semibold tracking-wide text-gray-900 uppercase dark:text-gray-50'>
{t('project.pageflow')}
</h3>
diff --git a/web/app/pages/Project/tabs/Sessions/Sessions.tsx b/web/app/pages/Project/tabs/Sessions/Sessions.tsx
index 1768b4de2..b5508b04b 100644
--- a/web/app/pages/Project/tabs/Sessions/Sessions.tsx
+++ b/web/app/pages/Project/tabs/Sessions/Sessions.tsx
@@ -22,11 +22,9 @@ import CCRow from '../../View/components/CCRow'
dayjs.extend(duration)
dayjs.extend(relativeTime)
-// Time thresholds for online status (in minutes)
const ONLINE_THRESHOLD_MINUTES = 5
const RECENTLY_ACTIVE_THRESHOLD_MINUTES = 30
-// Currency symbols
const CURRENCY_SYMBOLS: Record<string, string> = {
USD: '$',
EUR: '€',
@@ -95,7 +93,6 @@ const Session = ({ session, timeFormat, hideNewReturnBadge, hideUserDetails, cur
sessionDurationString = getStringFromTime(getTimeFromSeconds(session.sdur))
} else {
const diffSeconds = dayjs(session.lastActivity).diff(sessionStartTime, 'seconds')
- // Only set duration string if it's meaningfully positive
if (diffSeconds > 0) {
sessionDurationString = getStringFromTime(getTimeFromSeconds(diffSeconds))
}
@@ -149,13 +146,12 @@ const Session = ({ session, timeFormat, hideNewReturnBadge, hideUserDetails, cur
return (
<Link to={{ search: params.toString() }}>
- <li className='relative mb-3 flex cursor-pointer justify-between gap-x-6 overflow-hidden rounded-xl border border-gray-200 bg-gray-50 px-4 py-4 transition-colors hover:bg-gray-200/70 sm:px-6 dark:border-slate-800/25 dark:bg-slate-800/70 dark:hover:bg-slate-700/60'>
- <div className='flex min-w-0 gap-x-4'>
- {/* Avatar with online status indicator */}
+ <li className='relative mb-3 flex cursor-pointer justify-between gap-x-6 overflow-hidden rounded-lg border border-gray-200 bg-gray-50 px-4 py-4 transition-colors hover:bg-gray-200/70 sm:px-6 dark:border-slate-800/25 dark:bg-slate-800/70 dark:hover:bg-slate-700/60'>
+ <div className='flex min-w-0 gap-x-3'>
{hideUserDetails ? null : (
<div className='relative shrink-0'>
{session.profileId ? (
- <ProfileAvatar profileId={session.profileId} size={40} />
+ <ProfileAvatar className='mt-1' profileId={session.profileId} size={40} />
) : (
<div className='flex h-10 w-10 items-center justify-center rounded-full bg-gray-200 dark:bg-slate-600'>
<span className='text-sm font-medium text-gray-500 dark:text-gray-300'>?</span>
@@ -196,7 +192,7 @@ const Session = ({ session, timeFormat, hideNewReturnBadge, hideUserDetails, cur
</p>
)}
<p className='mt-1 flex flex-wrap items-center gap-x-2 text-xs leading-5 text-gray-500 dark:text-gray-300'>
- <span className='flex'>
+ <span className='flex items-center'>
{session.cc ? <CCRow size={18} cc={session.cc} language={language} /> : t('project.unknownCountry')}
</span>
<Separator />
diff --git a/web/app/pages/Project/tabs/Traffic/TrafficView.tsx b/web/app/pages/Project/tabs/Traffic/TrafficView.tsx
index d04295075..b1c748221 100644
--- a/web/app/pages/Project/tabs/Traffic/TrafficView.tsx
+++ b/web/app/pages/Project/tabs/Traffic/TrafficView.tsx
@@ -938,7 +938,7 @@ const TrafficView = ({
<DashboardHeader rightContent={headerRightContent} />
{dataLoading && !isPanelsDataEmpty ? <LoadingBar /> : null}
<div className={cx({ hidden: isPanelsDataEmpty || analyticsLoading })}>
- <div className='relative overflow-hidden rounded-lg border border-gray-300 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-800/25'>
+ <div className='relative overflow-hidden rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-800/25'>
<div className='mb-3 flex w-full items-center justify-end gap-2 lg:absolute lg:top-2 lg:right-2 lg:mb-0 lg:w-auto lg:justify-normal'>
<Dropdown
header={t('project.metricVis')}
diff --git a/web/app/styles/tailwind.css b/web/app/styles/tailwind.css
index 8a37b8ff9..ca63722c7 100644
--- a/web/app/styles/tailwind.css
+++ b/web/app/styles/tailwind.css
@@ -36,11 +36,20 @@
}
@keyframes slide-in-left {
- 0% {
- transform: translateX(-100%);
+ from {
+ transform: translate3d(-100%, 0, 0);
}
- 100% {
- transform: translateX(0);
+ to {
+ transform: translate3d(0, 0, 0);
+ }
+}
+
+@keyframes fade-in {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
}
}
@@ -51,7 +60,13 @@
}
.animate-slide-in-left {
- animation: slide-in-left 0.2s ease-out;
+ animation: slide-in-left 0.2s cubic-bezier(0.32, 0.72, 0, 1);
+ will-change: transform;
+ }
+
+ .animate-fade-in {
+ animation: fade-in 0.15s ease-out;
+ will-change: opacity;
}
.antialiased {
diff --git a/web/app/ui/Flag.tsx b/web/app/ui/Flag.tsx
index 2dbf5e868..b23911630 100644
--- a/web/app/ui/Flag.tsx
+++ b/web/app/ui/Flag.tsx
@@ -14,12 +14,16 @@ const MISSING_FLAGS = ['t1']
const Flag = ({ country, size = 24, alt, ...props }: FlagProps) => {
const countryLower = country ? _toLower(country) : 'pirate'
+ const width = size
+ const height = size * 0.75 // flags are 4:3
if (_includes(MISSING_FLAGS, countryLower)) {
return <span className={props.className}>{country}</span>
}
- return <img src={`${FLAGS_PREFIX_PATH}/${countryLower}.svg`} alt={alt || ' '} {...props} width={size} height={size} />
+ return (
+ <img src={`${FLAGS_PREFIX_PATH}/${countryLower}.svg`} alt={alt || ' '} {...props} width={width} height={height} />
+ )
}
export default Flag
diff --git a/web/app/ui/Text.tsx b/web/app/ui/Text.tsx
index 0ec51c671..324c79ce8 100644
--- a/web/app/ui/Text.tsx
+++ b/web/app/ui/Text.tsx
@@ -3,9 +3,10 @@ import React from 'react'
import { cn } from '~/utils/generic'
type TextElement = 'span' | 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label' | 'div'
-type TextSize = 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl'
+type TextSize = 'xxs' | 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl'
type TextWeight = 'light' | 'normal' | 'medium' | 'semibold' | 'bold'
type TextColour = 'primary' | 'secondary' | 'muted' | 'success' | 'warning' | 'error' | 'inherit'
+type Tracking = 'tight' | 'normal' | 'wide'
interface TextProps {
children: React.ReactNode
@@ -13,6 +14,7 @@ interface TextProps {
size?: TextSize
weight?: TextWeight
colour?: TextColour
+ tracking?: Tracking
truncate?: boolean
code?: boolean
className?: string
@@ -20,6 +22,7 @@ interface TextProps {
}
const sizeClasses: Record<TextSize, string> = {
+ xxs: 'text-[10px]',
xs: 'text-xs',
sm: 'text-sm',
base: 'text-base',
@@ -41,19 +44,26 @@ const weightClasses: Record<TextWeight, string> = {
const colourClasses: Record<TextColour, string> = {
primary: 'text-gray-900 dark:text-gray-50',
secondary: 'text-gray-700 dark:text-gray-200',
- muted: 'text-gray-500 dark:text-gray-400',
+ muted: 'text-gray-600 dark:text-gray-400',
success: 'text-green-600 dark:text-green-400',
warning: 'text-yellow-600 dark:text-yellow-500',
error: 'text-red-600 dark:text-red-400',
inherit: '',
}
+const trackingClasses: Record<Tracking, string> = {
+ tight: 'tracking-tight',
+ normal: 'tracking-normal',
+ wide: 'tracking-wide',
+}
+
export const Text = ({
children,
as: Component = 'span',
size = 'base',
weight = 'normal',
colour = 'primary',
+ tracking = 'normal',
truncate,
code,
className,
@@ -64,6 +74,7 @@ export const Text = ({
sizeClasses[size],
weightClasses[weight],
colourClasses[colour],
+ trackingClasses[tracking],
{ truncate },
code && 'rounded bg-gray-200/80 px-1.5 py-0.5 font-mono dark:bg-slate-700',
className,
diff --git a/web/app/utils/profileAvatars.tsx b/web/app/utils/profileAvatars.tsx
index 3ba4ba401..ed0f701dd 100644
--- a/web/app/utils/profileAvatars.tsx
+++ b/web/app/utils/profileAvatars.tsx
@@ -1,6 +1,5 @@
import Avatar from 'boring-avatars'
-// Adjectives and nouns for generating anonymous display names
const ADJECTIVES = [
'Amber',
'Azure',
@@ -163,8 +162,7 @@ const NOUNS = [
'Zebra',
]
-// Color palette for boring-avatars
-const AVATAR_COLORS = ['#92A1C6', '#146A7C', '#F0AB3D', '#C271B4', '#C20D90']
+const AVATAR_COLORS = ['#0a0310', '#49007e', '#ff005b', '#ff7d10', '#ffb238']
/**
* Generate a deterministic display name from profileId
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index 9e16e04db..c295ef157 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -875,18 +875,6 @@
"featureFlags": "Feature Flags",
"featureFlagsDesc": "Feature flags allow you to toggle features for cohorts or individuals.\nTest the impact before rolling out to everyone.",
"askAi": "Ask AI",
- "askAiHint": "Get AI-powered insights and answers about your analytics data.",
- "trafficHint": "Monitor your website visitors, page views, and traffic sources.",
- "performanceHint": "Analyze page load times and user experience metrics.",
- "funnelsHint": "Track user conversion through multi-step processes.",
- "alertsHint": "Set up automated notifications for traffic and event changes.",
- "profilesHint": "View detailed information about your website visitors.",
- "sessionsHint": "Explore individual user sessions and their journey.",
- "errorsHint": "Track and analyze your error data to understand and fix issues.",
- "goalsHint": "Define and track conversion goals for important user actions.",
- "experimentsHint": "Run A/B tests to optimize your website.",
- "featureFlagsHint": "Toggle features for specific user cohorts.",
- "captchaHint": "Protect your forms with privacy-focused CAPTCHA.",
"revenue": "Revenue",
"refunds": "Refunds",
"revenueHint": "Track sales, refunds and revenue from your payment providers.",
@@ -1166,7 +1154,6 @@
"featureFlagKeyPlaceholder": "e.g., new-landing-page, betaFeature, ab_test_1",
"featureFlagKeyHint": "Each experiment is backed by a feature flag. This key will be used to control the experiment in your code.",
"selectFeatureFlag": "Select a feature flag",
- "noFeatureFlagsHint": "No available feature flags to link",
"loadingFeatureFlags": "Loading feature flags...",
"rollout": "Rollout",
"metrics": "Metrics",
@@ -1354,6 +1341,10 @@
"title": "No events yet",
"desc": "You haven't tracked any events yet.\n<snippet>Click here</snippet> to view your JavaScript tracking code.\n\nStill not working? Try <turl>troubleshooting</turl> your integration or <curl>contact us</curl> for help with your setup."
},
+ "waitingCaptcha": {
+ "title": "No CAPTCHA events yet",
+ "desc": "You haven't tracked any CAPTCHA events yet.\nSee our <guideurl>integration guide</guideurl> to learn more about how to use it in your application.\n\nStill not working? Try <turl>troubleshooting</turl> your integration or <curl>contact us</curl> for help with your setup."
+ },
"waitingError": {
"title": "No errors yet",
"desc": "You haven't tracked any errors yet.\n<howto>Click here</howto> to learn how to set up error tracking for your website.\n\nStill not working? Try <turl>troubleshooting</turl> your integration or <curl>contact us</curl> for help with your setup."