📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Sidebar positioning improvements
Blue Mouse99cacc9bd14c
diff --git a/web/app/pages/Project/Traffic/View/TrafficView.tsx b/web/app/pages/Project/Traffic/View/TrafficView.tsxindex 7e6e72c7f..00501ec04 100644--- a/web/app/pages/Project/Traffic/View/TrafficView.tsx+++ b/web/app/pages/Project/Traffic/View/TrafficView.tsx@@ -34,6 +34,7 @@ import CustomMetrics from '~/pages/Project/View/components/CustomMetrics'import Filters from '~/pages/Project/View/components/Filters'import { MetricCard, MetricCards } from '~/pages/Project/View/components/MetricCards'import NoEvents from '~/pages/Project/View/components/NoEvents'+import WaitingForAnEvent from '~/pages/Project/View/components/WaitingForAnEvent'import RefRow from '~/pages/Project/View/components/RefRow'import { TrafficChart } from '~/pages/Project/View/components/TrafficChart'import UserFlow from '~/pages/Project/View/components/UserFlow'@@ -711,6 +712,11 @@ const TrafficView = ({// eslint-disable-next-line react-hooks/exhaustive-deps}, [trafficRefreshTrigger])+ // Show waiting state if project has no traffic data yet+ if (!project?.isDataExists) {+ return <WaitingForAnEvent />+ }+// Show loader during initial loadif (analyticsLoading) {return <Loader />diff --git a/web/app/pages/Project/View/ViewProject.tsx b/web/app/pages/Project/View/ViewProject.tsxindex b60da90ad..9ac449f2a 100644--- a/web/app/pages/Project/View/ViewProject.tsx+++ b/web/app/pages/Project/View/ViewProject.tsx@@ -74,7 +74,6 @@ import Dropdown from '~/ui/Dropdown'import Flag from '~/ui/Flag'import Loader from '~/ui/Loader'import LoadingBar from '~/ui/LoadingBar'-import Select from '~/ui/Select'import { removeDuplicates } from '~/utils/generic'import { getItem, setItem } from '~/utils/localstorage'import routes from '~/utils/routes'@@ -97,10 +96,9 @@ import { ChartManagerProvider } from './components/ChartManager'const CaptchaView = lazy(() => import('./components/CaptchaView'))// Keywords list now reuses shared Panel UI; dedicated component removed from renderimport LockedDashboard from './components/LockedDashboard'-import ProjectSidebar from './components/ProjectSidebar'+import ProjectSidebar, { MobileSidebarTrigger } from './components/ProjectSidebar'import SearchFilters from './components/SearchFilters'import TrafficHeaderActions from './components/TrafficHeaderActions'-import WaitingForAnEvent from './components/WaitingForAnEvent'import {Customs,Filter,@@ -298,7 +296,6 @@ const ViewProjectContent = () => {{ label: string; onClick: (data: typeof _panelsData, tFunction: typeof t) => void }[]>([])const [isAddAViewOpened, setIsAddAViewOpened] = useState(false)- const [analyticsLoading, _setAnalyticsLoading] = useState(true)// prevY2NeededRef removed - no longer needed with new chart managementconst [dataLoading, _setDataLoading] = useState(false)@@ -576,6 +573,7 @@ const ViewProjectContent = () => {}, [activeTab, isActiveCompare, period, periodPairs])const [showFiltersSearch, setShowFiltersSearch] = useState(false)+ const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState(false)// @ts-expect-errorconst tabs: {@@ -1144,27 +1142,9 @@ const ViewProjectContent = () => {updatePeriod(pair)})- // Mobile tab selector dropdown- const MobileTabSelector = () => (- <div className='mb-4 md:hidden'>- <Select- items={tabs}- keyExtractor={(item) => item.id}- labelExtractor={(item) => item.label}- onSelect={(item) => {- if (item.id === 'settings') {- openSettingsHandler()- return- }-- setDashboardTab(item?.id)- }}- title={activeTabLabel}- capitalise- selectedItem={tabs.find((tab) => tab.id === activeTab)}- />- </div>- )+ // Mobile sidebar handlers+ const openMobileSidebar = useCallback(() => setIsMobileSidebarOpen(true), [])+ const closeMobileSidebar = useCallback(() => setIsMobileSidebarOpen(false), [])const contextValue = useMemo(() => ({@@ -1285,7 +1265,7 @@ const ViewProjectContent = () => {<divclassName={cx('flex flex-col bg-gray-50 dark:bg-slate-900', {'min-h-including-header': !isEmbedded,- 'min-h-[100vh]': isEmbedded,+ 'min-h-screen': isEmbedded,})}><Loader />@@ -1300,13 +1280,13 @@ const ViewProjectContent = () => {<>{!isEmbedded ? <Header /> : null}<div- className={cx('flex bg-gray-50 dark:bg-slate-900', {+ className={cx('flex min-h-screen flex-col bg-gray-50 dark:bg-slate-900', {'min-h-including-header': !isEmbedded,- 'min-h-[100vh]': isEmbedded,+ 'min-h-screen': isEmbedded,})}>- {/* Desktop Sidebar */}- <div className='h-including-header sticky top-0 hidden md:block'>+ <div className='relative flex flex-1'>+ {/* Desktop Sidebar */}<ProjectSidebartabs={tabs}activeTab={activeTab}@@ -1316,54 +1296,33 @@ const ViewProjectContent = () => {dataLoading={dataLoading}searchParams={searchParams}allowedToManage={allowedToManage}+ className='hidden md:flex'/>+ {/* Mobile Sidebar */}+ {isMobileSidebarOpen ? (+ <ProjectSidebar+ tabs={tabs}+ activeTab={activeTab}+ onTabChange={setDashboardTab}+ projectId={id}+ projectName={project.name}+ dataLoading={dataLoading}+ searchParams={searchParams}+ allowedToManage={allowedToManage}+ isMobileOpen={isMobileSidebarOpen}+ onMobileClose={closeMobileSidebar}+ />+ ) : null}++ {/* Main Content */}+ <div className='flex flex-1 flex-col px-4 py-2 sm:px-6 lg:px-8'>+ <MobileSidebarTrigger onClick={openMobileSidebar} activeTabLabel={activeTabLabel} />+ <LockedDashboard />+ </div></div>- {/* Main Content */}- <div className='flex flex-1 flex-col px-4 py-2 sm:px-6 lg:px-8'>- <MobileTabSelector />- <LockedDashboard />- </div>- </div>- {!isEmbedded ? <Footer /> : null}- </>- )- }- if (- !project.isDataExists &&- activeTab !== PROJECT_TABS.errors &&- !(activeTab === PROJECT_TABS.captcha && project.isCaptchaDataExists) &&- !analyticsLoading- ) {- return (- <>- {!isEmbedded ? <Header /> : null}- <div- className={cx('flex bg-gray-50 dark:bg-slate-900', {- 'min-h-including-header': !isEmbedded,- 'min-h-[100vh]': isEmbedded,- })}- >- {/* Desktop Sidebar */}- <div className='h-including-header sticky top-0 hidden md:block'>- <ProjectSidebar- tabs={tabs}- activeTab={activeTab}- onTabChange={setDashboardTab}- projectId={id}- projectName={project.name}- dataLoading={dataLoading}- searchParams={searchParams}- allowedToManage={allowedToManage}- />- </div>- {/* Main Content */}- <div className='flex flex-1 flex-col px-4 py-2 sm:px-6 lg:px-8'>- <MobileTabSelector />- <WaitingForAnEvent />- </div>+ {!isEmbedded ? <Footer /> : null}</div>- {!isEmbedded ? <Footer /> : null}</>)}@@ -1374,16 +1333,15 @@ const ViewProjectContent = () => {<ViewProjectContext.Provider value={contextValue}><>{dataLoading && !isAutoRefreshing ? <LoadingBar /> : null}- {!isEmbedded ? <Header /> : null}- <EventsRunningOutBanner /><div- ref={ref}- className={cx('flex bg-gray-50 dark:bg-slate-900', {- 'min-h-[100vh]': analyticsLoading && isEmbedded,+ className={cx('flex min-h-screen flex-col bg-gray-50 dark:bg-slate-900', {+ 'min-h-including-header': !isEmbedded,+ 'min-h-screen': isEmbedded,})}>- {/* Desktop Sidebar */}- <div className='h-including-header sticky top-0 hidden md:block'>+ {!isEmbedded ? <Header /> : null}++ <div ref={ref} className='relative flex flex-1'><ProjectSidebartabs={tabs}activeTab={activeTab}@@ -1393,94 +1351,101 @@ const ViewProjectContent = () => {dataLoading={dataLoading}searchParams={searchParams}allowedToManage={allowedToManage}+ className='hidden md:flex'/>- </div>- {/* Main Content */}- <div- 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}- >- <MobileTabSelector />- <AnimatePresence mode='wait'>- <motion.div- key={activeTab}- initial={{ opacity: 0 }}- animate={{ opacity: 1 }}- exit={{ opacity: 0 }}- transition={{ duration: 0.15 }}- >- {activeTab === PROJECT_TABS.ai ? <AskAIView projectId={id} /> : null}- {activeTab === PROJECT_TABS.traffic ? (- <TrafficView- tnMapping={tnMapping}- customMetrics={customMetrics}- onCustomMetric={onCustomMetric}- onRemoveCustomMetric={onRemoveCustomMetric}- resetCustomMetrics={resetCustomMetrics}- mode={mode}- sdkInstance={sdkInstance}- headerRightContent={- <TrafficHeaderActions- projectViews={projectViews}- projectViewsLoading={projectViewsLoading}- projectViewDeleting={projectViewDeleting}- loadProjectViews={loadProjectViews}- onProjectViewDelete={onProjectViewDelete}- setProjectViewToUpdate={setProjectViewToUpdate}- setIsAddAViewOpened={setIsAddAViewOpened}- onCustomMetric={onCustomMetric}- filters={filters}- allowedToManage={allowedToManage}- dataLoading={dataLoading}- exportTypes={exportTypes}- customExportTypes={customExportTypes}- panelsData={_panelsData}- />- }- />- ) : null}- {activeTab === PROJECT_TABS.performance ? <PerformanceView tnMapping={tnMapping} /> : null}- {activeTab === PROJECT_TABS.funnels ? <FunnelsView /> : null}- {activeTab === PROJECT_TABS.alerts ? <ProjectAlertsView /> : null}- {activeTab === PROJECT_TABS.profiles ? <ProfilesView chartType={chartType} /> : null}- {activeTab === PROJECT_TABS.sessions ? (- <SessionsView tnMapping={tnMapping} chartType={chartType} rotateXAxis={rotateXAxis} />- ) : null}- {activeTab === PROJECT_TABS.errors ? <ErrorsView /> : null}- {activeTab === PROJECT_TABS.goals ? (- <GoalsView- period={period}- from={dateRange ? getFormatDate(dateRange[0]) : ''}- to={dateRange ? getFormatDate(dateRange[1]) : ''}- timezone={timezone}- />- ) : null}- {activeTab === PROJECT_TABS.experiments ? (- <ExperimentsView- period={period}- from={dateRange ? getFormatDate(dateRange[0]) : ''}- to={dateRange ? getFormatDate(dateRange[1]) : ''}- timezone={timezone}- />- ) : null}- {activeTab === PROJECT_TABS.featureFlags ? (- <FeatureFlagsView- period={period}- from={dateRange ? getFormatDate(dateRange[0]) : ''}- to={dateRange ? getFormatDate(dateRange[1]) : ''}- timezone={timezone}- />- ) : null}- {activeTab === PROJECT_TABS.captcha ? <CaptchaView projectId={id} /> : null}- </motion.div>- </AnimatePresence>-- {isEmbedded ? null : (- <>- <div className='flex-1' />+ {isMobileSidebarOpen ? (+ <ProjectSidebar+ tabs={tabs}+ activeTab={activeTab}+ onTabChange={setDashboardTab}+ projectId={id}+ projectName={project.name}+ dataLoading={dataLoading}+ searchParams={searchParams}+ allowedToManage={allowedToManage}+ isMobileOpen={isMobileSidebarOpen}+ onMobileClose={closeMobileSidebar}+ />+ ) : null}+ {/* Main Content */}+ <div className='flex flex-1 flex-col px-4 py-2 sm:px-6 lg:px-8' ref={dashboardRef}>+ <EventsRunningOutBanner />+ <MobileSidebarTrigger onClick={openMobileSidebar} activeTabLabel={activeTabLabel} />+ <AnimatePresence mode='wait'>+ <motion.div+ key={activeTab}+ initial={{ opacity: 0 }}+ animate={{ opacity: 1 }}+ exit={{ opacity: 0 }}+ transition={{ duration: 0.15 }}+ >+ {activeTab === PROJECT_TABS.ai ? <AskAIView projectId={id} /> : null}+ {activeTab === PROJECT_TABS.traffic ? (+ <TrafficView+ tnMapping={tnMapping}+ customMetrics={customMetrics}+ onCustomMetric={onCustomMetric}+ onRemoveCustomMetric={onRemoveCustomMetric}+ resetCustomMetrics={resetCustomMetrics}+ mode={mode}+ sdkInstance={sdkInstance}+ headerRightContent={+ <TrafficHeaderActions+ projectViews={projectViews}+ projectViewsLoading={projectViewsLoading}+ projectViewDeleting={projectViewDeleting}+ loadProjectViews={loadProjectViews}+ onProjectViewDelete={onProjectViewDelete}+ setProjectViewToUpdate={setProjectViewToUpdate}+ setIsAddAViewOpened={setIsAddAViewOpened}+ onCustomMetric={onCustomMetric}+ filters={filters}+ allowedToManage={allowedToManage}+ dataLoading={dataLoading}+ exportTypes={exportTypes}+ customExportTypes={customExportTypes}+ panelsData={_panelsData}+ />+ }+ />+ ) : null}+ {activeTab === PROJECT_TABS.performance ? <PerformanceView tnMapping={tnMapping} /> : null}+ {activeTab === PROJECT_TABS.funnels ? <FunnelsView /> : null}+ {activeTab === PROJECT_TABS.alerts ? <ProjectAlertsView /> : null}+ {activeTab === PROJECT_TABS.profiles ? <ProfilesView chartType={chartType} /> : null}+ {activeTab === PROJECT_TABS.sessions ? (+ <SessionsView tnMapping={tnMapping} chartType={chartType} rotateXAxis={rotateXAxis} />+ ) : null}+ {activeTab === PROJECT_TABS.errors ? <ErrorsView /> : null}+ {activeTab === PROJECT_TABS.goals ? (+ <GoalsView+ period={period}+ from={dateRange ? getFormatDate(dateRange[0]) : ''}+ to={dateRange ? getFormatDate(dateRange[1]) : ''}+ timezone={timezone}+ />+ ) : null}+ {activeTab === PROJECT_TABS.experiments ? (+ <ExperimentsView+ period={period}+ from={dateRange ? getFormatDate(dateRange[0]) : ''}+ to={dateRange ? getFormatDate(dateRange[1]) : ''}+ timezone={timezone}+ />+ ) : null}+ {activeTab === PROJECT_TABS.featureFlags ? (+ <FeatureFlagsView+ period={period}+ from={dateRange ? getFormatDate(dateRange[0]) : ''}+ to={dateRange ? getFormatDate(dateRange[1]) : ''}+ timezone={timezone}+ />+ ) : null}+ {activeTab === PROJECT_TABS.captcha ? <CaptchaView projectId={id} /> : null}+ </motion.div>+ </AnimatePresence>++ {isEmbedded ? null : (<div className='mt-4 flex w-full items-center justify-between gap-2'><Dropdownitems={whitelist}@@ -1564,9 +1529,11 @@ const ViewProjectContent = () => {/></div></div>- </>- )}+ )}+ </div></div>++ {isEmbedded ? null : <Footer showDBIPMessage />}</div><ViewProjectHotkeys isOpened={isHotkeysHelpOpened} onClose={() => setIsHotkeysHelpOpened(false)} /><SearchFilters@@ -1590,7 +1557,6 @@ const ViewProjectContent = () => {defaultView={projectViewToUpdate}tnMapping={tnMapping}/>- {!isEmbedded ? <Footer showDBIPMessage /> : null}</></ViewProjectContext.Provider>)}diff --git a/web/app/pages/Project/View/components/CaptchaView.tsx b/web/app/pages/Project/View/components/CaptchaView.tsxindex e2b8648dd..c7fc21bf4 100644--- a/web/app/pages/Project/View/components/CaptchaView.tsx+++ b/web/app/pages/Project/View/components/CaptchaView.tsx@@ -10,6 +10,7 @@ import { useSearchParams } from 'react-router'import { getCaptchaData } from '~/api'import useSize from '~/hooks/useSize'import { chartTypes, BROWSER_LOGO_MAP, OS_LOGO_MAP, OS_LOGO_MAP_DARK } from '~/lib/constants'+import { useCurrentProject } from '~/providers/CurrentProjectProvider'import { useTheme } from '~/providers/ThemeProvider'import Loader from '~/ui/Loader'import LoadingBar from '~/ui/LoadingBar'@@ -25,6 +26,7 @@ import CCRow from './CCRow'import DashboardHeader from './DashboardHeader'import Filters from './Filters'import NoEvents from './NoEvents'+import WaitingForAnEvent from './WaitingForAnEvent'const PANELS_ORDER = ['cc', 'br', 'os', 'dv']@@ -49,6 +51,7 @@ interface CaptchaViewProps {const CaptchaView = ({ projectId }: CaptchaViewProps) => {const { theme } = useTheme()+ const { project } = useCurrentProject()const { period, timeBucket, dateRange, captchaRefreshTrigger, timeFormat, size } = useContext(ViewProjectContext)const [searchParams] = useSearchParams()@@ -173,6 +176,11 @@ const CaptchaView = ({ projectId }: CaptchaViewProps) => {// Check if we have existing dataconst hasExistingData = chartData !== null || !_isEmpty(panelsData.types)+ // Show waiting state if project has no captcha data yet+ if (!project?.isCaptchaDataExists) {+ return <WaitingForAnEvent />+ }+// Show Loader only on initial load (no existing data)if (analyticsLoading && !hasExistingData) {return <Loader />diff --git a/web/app/pages/Project/View/components/ProjectSidebar.tsx b/web/app/pages/Project/View/components/ProjectSidebar.tsxindex e79af4d66..0203027bb 100644--- a/web/app/pages/Project/View/components/ProjectSidebar.tsx+++ b/web/app/pages/Project/View/components/ProjectSidebar.tsx@@ -1,13 +1,21 @@-import cx from 'clsx'import _map from 'lodash/map'-import { ChevronDownIcon, ChevronRightIcon, PanelLeftCloseIcon, PanelLeftOpenIcon, SettingsIcon } from 'lucide-react'-import React, { useState, useMemo, useCallback } from 'react'+import {+ ChevronDownIcon,+ ChevronRightIcon,+ PanelLeftCloseIcon,+ PanelLeftOpenIcon,+ SettingsIcon,+ XIcon,+ MenuIcon,+} from 'lucide-react'+import React, { useState, useMemo, useCallback, useEffect } from 'react'import { useTranslation } from 'react-i18next'import { Link, LinkProps } from 'react-router'import { PROJECT_TABS } from '~/lib/constants'import { Text } from '~/ui/Text'import Tooltip from '~/ui/Tooltip'+import { cn } from '~/utils/generic'import routes from '~/utils/routes'const SIDEBAR_COLLAPSED_KEY = 'project-sidebar-collapsed'@@ -48,6 +56,7 @@ interface TabGroup {}interface ProjectSidebarProps {+ className?: stringtabs: Tab[]activeTab: ProjectTabKeyonTabChange: (tabId: keyof typeof PROJECT_TABS) => void@@ -56,6 +65,9 @@ interface ProjectSidebarProps {dataLoading?: booleansearchParams: URLSearchParamsallowedToManage?: boolean+ // Mobile-specific props+ isMobileOpen?: boolean+ onMobileClose?: () => void}const CollapsibleGroup: React.FC<{@@ -66,7 +78,8 @@ const CollapsibleGroup: React.FC<{dataLoading?: booleansearchParams: URLSearchParamsisCollapsed?: boolean-}> = ({ group, activeTab, onTabChange, projectId, dataLoading, searchParams, isCollapsed }) => {+ onMobileClose?: () => void+}> = ({ group, activeTab, onTabChange, projectId, dataLoading, searchParams, isCollapsed, onMobileClose }) => {const [isExpanded, setIsExpanded] = useState(true)const hasActiveTab = useMemo(() => {@@ -91,12 +104,14 @@ const CollapsibleGroup: React.FC<{const handleClick = (e: React.MouseEvent) => {if (tab.id === 'settings') {+ onMobileClose?.()return}e.preventDefault()if (!dataLoading) {onTabChange(tab.id as keyof typeof PROJECT_TABS)+ onMobileClose?.()}}@@ -115,7 +130,7 @@ const CollapsibleGroup: React.FC<{<Linkto={tabUrl}onClick={handleClick}- className={cx('group flex items-center justify-center rounded-md p-2 transition-colors', {+ className={cn('group flex items-center justify-center rounded-md p-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',@@ -123,7 +138,7 @@ const CollapsibleGroup: React.FC<{aria-current={isCurrent ? 'page' : undefined}aria-label={tab.label}>- <TabIcon className={cx('size-5 shrink-0', iconColorClass)} strokeWidth={1.5} aria-hidden='true' />+ <TabIcon className={cn('size-5 shrink-0', iconColorClass)} strokeWidth={1.5} aria-hidden='true' /></Link>}/>@@ -152,7 +167,7 @@ const CollapsibleGroup: React.FC<{</button><div- className={cx('overflow-hidden transition-all duration-200 ease-in-out', {+ className={cn('overflow-hidden transition-all duration-200 ease-in-out', {'max-h-96 opacity-100': isExpanded,'max-h-0 opacity-0': !isExpanded,})}@@ -165,12 +180,14 @@ const CollapsibleGroup: React.FC<{const handleClick = (e: React.MouseEvent) => {if (tab.id === 'settings') {+ onMobileClose?.()return // Let the Link handle navigation}e.preventDefault()if (!dataLoading) {onTabChange(tab.id as keyof typeof PROJECT_TABS)+ onMobileClose?.()}}@@ -186,14 +203,14 @@ const CollapsibleGroup: React.FC<{key={tab.id}to={tabUrl}onClick={handleClick}- className={cx('group flex items-center gap-1.5 rounded-md px-2.5 py-2 transition-colors', {+ 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={cx('size-4 shrink-0', iconColorClass)} strokeWidth={1.5} aria-hidden='true' />+ <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>@@ -215,6 +232,9 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({dataLoading,searchParams,allowedToManage,+ isMobileOpen = false,+ onMobileClose,+ className,}) => {const { t } = useTranslation('common')const [isCollapsed, setIsCollapsed] = useState(() => {@@ -232,12 +252,36 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({})}, [])- // Find Ask AI tab (standalone, not in a group)+ useEffect(() => {+ const handleEscape = (e: KeyboardEvent) => {+ if (e.key === 'Escape' && isMobileOpen) {+ onMobileClose?.()+ }+ }++ if (isMobileOpen) {+ document.addEventListener('keydown', handleEscape)+ document.body.style.overflow = 'hidden'+ }++ return () => {+ document.removeEventListener('keydown', handleEscape)+ document.body.style.overflow = ''+ }+ }, [isMobileOpen, onMobileClose])++ const handleTabChange = useCallback(+ (tabId: keyof typeof PROJECT_TABS) => {+ onTabChange(tabId)+ onMobileClose?.()+ },+ [onTabChange, onMobileClose],+ )+const askAiTab = useMemo(() => {return tabs.find((tab) => tab.id === PROJECT_TABS.ai)}, [tabs])- // Group tabs by categoryconst tabGroups = useMemo<TabGroup[]>(() => {const groups: TabGroup[] = []@@ -284,16 +328,17 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({return groups}, [tabs, t])- return (+ const sidebarContent = (<aside- className={cx(- 'flex h-full shrink-0 flex-col overflow-y-auto border-r border-gray-200 bg-white transition-all duration-200 dark:border-slate-800 dark:bg-slate-900',- isCollapsed ? 'w-14' : 'w-56',+ className={cn(+ 'sticky top-0 flex h-screen shrink-0 flex-col self-start border-r border-gray-200 bg-white transition-all duration-200 dark:border-slate-800 dark:bg-slate-900',+ isMobileOpen ? 'w-64' : isCollapsed ? 'w-14' : 'w-56',+ className,)}>{/* Project name at the top */}- <div className='sticky top-0 z-10 flex items-center border-b border-gray-200 bg-white px-4 py-2 dark:border-slate-800 dark:bg-slate-900'>- {isCollapsed ? (+ <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 dark:bg-slate-900'>+ {isCollapsed && !isMobileOpen ? (<Tooltiptext={projectName}tooltipNode={@@ -304,7 +349,7 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({/>) : (<Tooltip- className='max-w-full'+ className='max-w-full flex-1'text={projectName}tooltipNode={<Text as='h2' size='lg' weight='semibold' truncate className='max-w-full'>@@ -313,10 +358,21 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({}/>)}+ {/* Close button for mobile */}+ {isMobileOpen ? (+ <button+ type='button'+ onClick={onMobileClose}+ className='ml-2 rounded-md p-1.5 text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-slate-800 dark:hover:text-gray-200'+ aria-label={t('common.close')}+ >+ <XIcon className='h-5 w-5' strokeWidth={1.5} />+ </button>+ ) : null}</div>{/* Tabs area */}- <div className='flex-1 px-2 py-3'>+ <div className='flex-1 overflow-y-auto px-2 py-3'>{/* Ask AI - standalone tab above groups */}{askAiTab ? (<div className='mb-3'>@@ -328,14 +384,14 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({const handleClick = (e: React.MouseEvent) => {e.preventDefault()if (!dataLoading) {- onTabChange(askAiTab.id as keyof typeof PROJECT_TABS)+ handleTabChange(askAiTab.id as keyof typeof PROJECT_TABS)}}const newSearchParams = new URLSearchParams(searchParams.toString())newSearchParams.set('tab', askAiTab.id)- if (isCollapsed) {+ if (isCollapsed && !isMobileOpen) {return (<Tooltiptext={askAiTab.label}@@ -343,7 +399,7 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({<Linkto={{ search: newSearchParams.toString() }}onClick={handleClick}- className={cx('group flex items-center justify-center rounded-md p-2 transition-colors', {+ className={cn('group flex items-center justify-center rounded-md p-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,@@ -353,7 +409,7 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({aria-label={askAiTab.label}><TabIcon- className={cx('size-5 shrink-0', iconColorClass)}+ className={cn('size-5 shrink-0', iconColorClass)}strokeWidth={1.5}aria-hidden='true'/>@@ -367,7 +423,7 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({<Linkto={{ search: newSearchParams.toString() }}onClick={handleClick}- className={cx('group flex items-center gap-2 rounded-md px-2.5 py-2 transition-colors', {+ 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,@@ -375,7 +431,7 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({})}aria-current={isCurrent ? 'page' : undefined}>- <TabIcon className={cx('size-4 shrink-0', iconColorClass)} strokeWidth={1.5} aria-hidden='true' />+ <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>@@ -394,56 +450,101 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({projectId={projectId}dataLoading={dataLoading}searchParams={searchParams}- isCollapsed={isCollapsed}+ isCollapsed={isCollapsed && !isMobileOpen ? true : false}+ onMobileClose={onMobileClose}/>))}</div>{/* Bottom section: Collapse button + Settings */}<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 dark:bg-slate-900'>- {/* Collapse/Expand button */}- <button- type='button'- onClick={toggleCollapsed}- className={cx(- 'group flex w-full items-center rounded-md px-2.5 py-2 text-sm font-medium transition-colors',- 'text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-slate-800/60 dark:hover:text-gray-200',- isCollapsed ? 'justify-center' : 'gap-2.5',- )}- aria-label={isCollapsed ? t('common.expand') : t('common.collapse')}- >- {isCollapsed ? (- <PanelLeftOpenIcon className='h-5 w-5 shrink-0' strokeWidth={1.5} aria-hidden='true' />- ) : (- <>- <PanelLeftCloseIcon className='h-5 w-5 shrink-0' strokeWidth={1.5} aria-hidden='true' />- <span className='truncate'>{t('common.collapse')}</span>- </>- )}- </button>+ {/* Collapse/Expand button - hide on mobile */}+ {!isMobileOpen ? (+ <button+ type='button'+ onClick={toggleCollapsed}+ className={cn(+ 'group flex w-full items-center rounded-md px-2.5 py-2 text-sm font-medium transition-colors',+ 'text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-slate-800/60 dark:hover:text-gray-200',+ isCollapsed ? 'justify-center' : 'gap-2.5',+ )}+ aria-label={isCollapsed ? t('common.expand') : t('common.collapse')}+ >+ {isCollapsed ? (+ <PanelLeftOpenIcon className='h-5 w-5 shrink-0' strokeWidth={1.5} aria-hidden='true' />+ ) : (+ <>+ <PanelLeftCloseIcon className='h-5 w-5 shrink-0' strokeWidth={1.5} aria-hidden='true' />+ <span className='truncate'>{t('common.collapse')}</span>+ </>+ )}+ </button>+ ) : null}{/* Settings - always show if user is allowed to manage */}{allowedToManage ? (<Linkto={routes.project_settings.replace(':id', projectId)}- className={cx(+ onClick={onMobileClose}+ className={cn('group flex w-full items-center rounded-md px-2.5 py-2 text-sm font-medium transition-colors','text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-slate-800/60 dark:hover:text-gray-200',- isCollapsed ? 'justify-center' : 'gap-2.5',+ isCollapsed && !isMobileOpen ? 'justify-center' : 'gap-2.5',)}aria-label={t('common.settings')}><SettingsIcon- className={cx('h-5 w-5 shrink-0', ICON_COLORS.settings)}+ className={cn('h-5 w-5 shrink-0', ICON_COLORS.settings)}strokeWidth={1.5}aria-hidden='true'/>- {!isCollapsed ? <span className='truncate'>{t('common.settings')}</span> : null}+ {!isCollapsed || isMobileOpen ? <span className='truncate'>{t('common.settings')}</span> : null}</Link>) : null}</div></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-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+}++export const MobileSidebarTrigger: React.FC<MobileSidebarTriggerProps> = ({ onClick, activeTabLabel }) => {+ const { t } = useTranslation('common')++ return (+ <div className='mb-4 flex items-center gap-3 md:hidden'>+ <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'+ aria-label={t('common.openMenu')}+ >+ <MenuIcon className='h-5 w-5' strokeWidth={1.5} />+ </button>+ {activeTabLabel ? (+ <span className='text-sm font-medium text-gray-700 dark:text-gray-200'>{activeTabLabel}</span>+ ) : null}+ </div>+ )}export default ProjectSidebardiff --git a/web/app/styles/tailwind.css b/web/app/styles/tailwind.cssindex a39674a4c..8a37b8ff9 100644--- a/web/app/styles/tailwind.css+++ b/web/app/styles/tailwind.css@@ -15,6 +15,7 @@/* Heights */--header-height: 60px;+ --height-including-header: calc(100vh - var(--header-height));--min-height-page: calc(100vh - 74px);--min-height-min-footer: calc(100vh - 157px);--min-height-including-header: calc(100vh - var(--header-height));@@ -34,12 +35,25 @@}}+@keyframes slide-in-left {+ 0% {+ transform: translateX(-100%);+ }+ 100% {+ transform: translateX(0);+ }+}+/* Custom Animation Classes */@layer utilities {.animate-ping-slow {animation: ping-op 3s cubic-bezier(0, 0, 0.2, 1) infinite;}+ .animate-slide-in-left {+ animation: slide-in-left 0.2s ease-out;+ }+.antialiased {-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;