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!

better sidebar design

Blue Mouse224bfe7131b6
diff --git a/web/app/pages/Project/View/ViewProject.tsx b/web/app/pages/Project/View/ViewProject.tsx
index 6234c8aed..805fd9037 100644
--- a/web/app/pages/Project/View/ViewProject.tsx
+++ b/web/app/pages/Project/View/ViewProject.tsx
@@ -38,8 +38,8 @@ import {
EyeIcon,
PercentIcon,
KeyboardIcon,
- ShieldCheckIcon,
TargetIcon,
+ PuzzleIcon,
} from 'lucide-react'
import React, {
useState,
@@ -1531,7 +1531,7 @@ const ViewProjectContent = () => {
{
id: PROJECT_TABS.captcha,
label: t('common.captcha'),
- icon: ShieldCheckIcon,
+ icon: PuzzleIcon,
},
...adminTabs,
].filter((x) => !!x)
@@ -3285,7 +3285,7 @@ const ViewProjectContent = () => {
{!isEmbedded ? <Header /> : null}
<div
className={cx('flex flex-col bg-gray-50 dark:bg-slate-900', {
- 'min-h-min-footer': !isEmbedded,
+ 'min-h-including-header': !isEmbedded,
'min-h-[100vh]': isEmbedded,
})}
>
@@ -3302,12 +3302,12 @@ const ViewProjectContent = () => {
{!isEmbedded ? <Header /> : null}
<div
className={cx('flex bg-gray-50 dark:bg-slate-900', {
- 'min-h-min-footer': !isEmbedded,
+ 'min-h-including-header': !isEmbedded,
'min-h-[100vh]': isEmbedded,
})}
>
{/* Desktop Sidebar */}
- <div className='sticky top-0 hidden h-dvh md:block'>
+ <div className='h-including-header sticky top-0 hidden md:block'>
<ProjectSidebar
tabs={tabs}
activeTab={activeTab}
@@ -3320,7 +3320,7 @@ const ViewProjectContent = () => {
/>
</div>
{/* Main Content */}
- <div className='flex-1 px-4 py-3 sm:px-6 lg:px-8'>
+ <div className='flex flex-1 flex-col px-4 py-2 sm:px-6 lg:px-8'>
<MobileTabSelector />
<LockedDashboard />
</div>
@@ -3341,12 +3341,12 @@ const ViewProjectContent = () => {
{!isEmbedded ? <Header /> : null}
<div
className={cx('flex bg-gray-50 dark:bg-slate-900', {
- 'min-h-min-footer': !isEmbedded,
+ 'min-h-including-header': !isEmbedded,
'min-h-[100vh]': isEmbedded,
})}
>
{/* Desktop Sidebar */}
- <div className='sticky top-0 hidden h-dvh md:block'>
+ <div className='h-including-header sticky top-0 hidden md:block'>
<ProjectSidebar
tabs={tabs}
activeTab={activeTab}
@@ -3359,7 +3359,7 @@ const ViewProjectContent = () => {
/>
</div>
{/* Main Content */}
- <div className='flex-1 px-4 py-3 sm:px-6 lg:px-8'>
+ <div className='flex flex-1 flex-col px-4 py-2 sm:px-6 lg:px-8'>
<MobileTabSelector />
<WaitingForAnEvent />
</div>
@@ -3379,12 +3379,12 @@ const ViewProjectContent = () => {
{!isEmbedded ? <Header /> : null}
<div
className={cx('flex bg-gray-50 dark:bg-slate-900', {
- 'min-h-min-footer': !isEmbedded,
+ 'min-h-including-header': !isEmbedded,
'min-h-[100vh]': isEmbedded,
})}
>
{/* Desktop Sidebar */}
- <div className='sticky top-0 hidden h-dvh md:block'>
+ <div className='h-including-header sticky top-0 hidden md:block'>
<ProjectSidebar
tabs={tabs}
activeTab={activeTab}
@@ -3397,7 +3397,7 @@ const ViewProjectContent = () => {
/>
</div>
{/* Main Content */}
- <div className='flex-1 px-4 py-3 sm:px-6 lg:px-8'>
+ <div className='flex flex-1 flex-col px-4 py-2 sm:px-6 lg:px-8'>
<MobileTabSelector />
<WaitingForAnError />
</div>
@@ -3448,7 +3448,7 @@ const ViewProjectContent = () => {
})}
>
{/* Desktop Sidebar */}
- <div className='sticky top-0 hidden h-dvh md:block'>
+ <div className='h-including-header sticky top-0 hidden md:block'>
<ProjectSidebar
tabs={tabs}
activeTab={activeTab}
@@ -3462,8 +3462,8 @@ const ViewProjectContent = () => {
</div>
{/* Main Content */}
<div
- className={cx('flex-1 px-4 py-3 sm:px-6 lg:px-8', {
- 'min-h-min-footer': !isEmbedded,
+ className={cx('flex flex-1 flex-col px-4 py-2 sm:px-6 lg:px-8', {
+ 'min-h-including-header': !isEmbedded,
'min-h-[100vh]': isEmbedded,
})}
ref={dashboardRef}
diff --git a/web/app/pages/Project/View/components/ProjectSidebar.tsx b/web/app/pages/Project/View/components/ProjectSidebar.tsx
index b8f92d580..ab38d5075 100644
--- a/web/app/pages/Project/View/components/ProjectSidebar.tsx
+++ b/web/app/pages/Project/View/components/ProjectSidebar.tsx
@@ -1,13 +1,6 @@
import cx from 'clsx'
import _map from 'lodash/map'
-import {
- ChevronDownIcon,
- ChevronRightIcon,
- GlobeIcon,
- BarChart3Icon,
- SettingsIcon,
- ShieldCheckIcon,
-} from 'lucide-react'
+import { ChevronDownIcon, ChevronRightIcon, SettingsIcon } from 'lucide-react'
import React, { useState, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { Link, LinkProps } from 'react-router'
@@ -36,13 +29,6 @@ const ICON_COLORS: Record<string, string> = {
settings: 'text-gray-500',
}
-// Group icon colors
-const GROUP_ICON_COLORS: Record<string, string> = {
- webAnalytics: 'text-blue-500',
- productAnalytics: 'text-green-500',
- captcha: 'text-emerald-500',
-}
-
interface Tab {
id: ProjectTabKey
label: string
@@ -52,9 +38,7 @@ interface Tab {
interface TabGroup {
id: string
label: string
- icon: React.ComponentType<{ className?: string; strokeWidth?: number }>
tabs: Tab[]
- defaultExpanded?: boolean
}
interface ProjectSidebarProps {
@@ -76,7 +60,7 @@ const CollapsibleGroup: React.FC<{
dataLoading?: boolean
searchParams: URLSearchParams
}> = ({ group, activeTab, onTabChange, projectId, dataLoading, searchParams }) => {
- const [isExpanded, setIsExpanded] = useState(group.defaultExpanded ?? true)
+ const [isExpanded, setIsExpanded] = useState(true)
const hasActiveTab = useMemo(() => {
return group.tabs.some((tab) => tab.id === activeTab)
@@ -88,30 +72,20 @@ const CollapsibleGroup: React.FC<{
}
}, [hasActiveTab]) // eslint-disable-line react-hooks/exhaustive-deps
- const GroupIcon = group.icon
- const groupColorClass = GROUP_ICON_COLORS[group.id] || 'text-gray-500'
-
return (
<div className='mb-1'>
<button
type='button'
onClick={() => setIsExpanded(!isExpanded)}
- className={cx(
- 'group flex w-full items-center justify-between rounded-md px-2 py-1.5 text-left text-xs font-semibold tracking-wide uppercase transition-colors hover:bg-gray-100 dark:hover:bg-slate-800/50',
- {
- 'text-gray-700 dark:text-gray-300': !hasActiveTab,
- 'text-gray-900 dark:text-gray-100': hasActiveTab,
- },
- )}
+ className='group flex w-full items-center justify-between rounded-md px-2 py-1.5 text-left transition-colors hover:bg-gray-100 dark:hover:bg-slate-800/50'
>
- <div className='flex items-center gap-2'>
- <GroupIcon className={cx('h-4 w-4', groupColorClass)} strokeWidth={1.5} />
- <span>{group.label}</span>
- </div>
+ <Text as='span' size='xs' colour='secondary' weight='semibold' truncate className='max-w-full'>
+ {group.label}
+ </Text>
{isExpanded ? (
- <ChevronDownIcon className='h-3.5 w-3.5 text-gray-400' strokeWidth={2} />
+ <ChevronDownIcon className='size-3.5 text-gray-400' strokeWidth={2} />
) : (
- <ChevronRightIcon className='h-3.5 w-3.5 text-gray-400' strokeWidth={2} />
+ <ChevronRightIcon className='size-3.5 text-gray-400' strokeWidth={2} />
)}
</button>
@@ -150,19 +124,17 @@ const CollapsibleGroup: React.FC<{
key={tab.id}
to={tabUrl}
onClick={handleClick}
- className={cx(
- 'group flex items-center gap-2.5 rounded-md px-2.5 py-2 text-sm font-medium transition-colors',
- {
- 'bg-gray-100 text-gray-900 dark:bg-slate-800 dark:text-gray-50': isCurrent,
- 'text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-slate-800/50 dark:hover:text-gray-200':
- !isCurrent,
- 'cursor-wait opacity-50': dataLoading && tab.id !== 'settings',
- },
- )}
+ className={cx('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-50 dark:hover:bg-slate-800/50': !isCurrent,
+ 'cursor-wait': dataLoading && tab.id !== 'settings',
+ })}
aria-current={isCurrent ? 'page' : undefined}
>
- <TabIcon className={cx('h-5 w-5 shrink-0', iconColorClass)} strokeWidth={1.5} aria-hidden='true' />
- <span className='truncate'>{tab.label}</span>
+ <TabIcon className={cx('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>
)
})}
@@ -188,7 +160,6 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
const tabGroups = useMemo<TabGroup[]>(() => {
const groups: TabGroup[] = []
- // Web Analytics group
const webAnalyticsTabs = tabs.filter((tab) =>
[PROJECT_TABS.traffic, PROJECT_TABS.performance, PROJECT_TABS.alerts].includes(tab.id as any),
)
@@ -196,13 +167,10 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
groups.push({
id: 'webAnalytics',
label: t('dashboard.webAnalytics'),
- icon: GlobeIcon,
tabs: webAnalyticsTabs,
- defaultExpanded: true,
})
}
- // Product Analytics group
const productAnalyticsTabs = tabs.filter((tab) =>
[
PROJECT_TABS.profiles,
@@ -216,21 +184,16 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
groups.push({
id: 'productAnalytics',
label: t('dashboard.productAnalytics'),
- icon: BarChart3Icon,
tabs: productAnalyticsTabs,
- defaultExpanded: true,
})
}
- // CAPTCHA group
- const captchaTabs = tabs.filter((tab) => tab.id === PROJECT_TABS.captcha)
- if (captchaTabs.length > 0) {
+ const securityTabs = tabs.filter((tab) => tab.id === PROJECT_TABS.captcha)
+ if (securityTabs.length > 0) {
groups.push({
- id: 'captcha',
- label: t('common.captcha'),
- icon: ShieldCheckIcon,
- tabs: captchaTabs,
- defaultExpanded: false,
+ id: 'security',
+ label: t('dashboard.security'),
+ tabs: securityTabs,
})
}
diff --git a/web/app/styles/tailwind.css b/web/app/styles/tailwind.css
index 009beb8cc..86203683b 100644
--- a/web/app/styles/tailwind.css
+++ b/web/app/styles/tailwind.css
@@ -16,6 +16,7 @@
/* Minimum Heights */
--min-height-page: calc(100vh - 74px);
--min-height-min-footer: calc(100vh - 157px);
+ --min-height-including-header: calc(100vh - 60px); /* 60px - header height */
--default-transition-duration: 250ms;
}
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index b4d33bfc5..606796ef8 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -819,6 +819,7 @@
"delete": "Delete organisation"
},
"dashboard": {
+ "security": "Security",
"gridView": "Grid view",
"listView": "List view",
"sortAlphaAsc": "A to Z",