22
33import {
44 BugIcon ,
5- ClockIcon ,
65 FunnelIcon ,
76 GlobeIcon ,
87 HouseIcon ,
98 InfoIcon ,
109 ListIcon ,
1110 MapPinIcon ,
1211 TargetIcon ,
12+ UserIcon ,
1313 UsersIcon ,
1414 XIcon ,
1515} from '@phosphor-icons/react' ;
16+ import { useAtom } from 'jotai' ;
1617import Link from 'next/link' ;
1718import { usePathname } from 'next/navigation' ;
1819import { useCallback , useEffect , useState } from 'react' ;
20+ import { toast } from 'sonner' ;
1921import { Logo } from '@/components/layout/logo' ;
2022import { ThemeToggle } from '@/components/layout/theme-toggle' ;
2123import { UserMenu } from '@/components/layout/user-menu' ;
2224import { NotificationsPopover } from '@/components/notifications/notifications-popover' ;
2325import { Button } from '@/components/ui/button' ;
2426import { ScrollArea } from '@/components/ui/scroll-area' ;
2527import { cn } from '@/lib/utils' ;
28+ import {
29+ dynamicQueryFiltersAtom ,
30+ isAnalyticsRefreshingAtom ,
31+ } from '@/stores/jotai/filterAtoms' ;
32+ import { AnalyticsToolbar } from '@/app/(main)/websites/[id]/_components/analytics-toolbar' ;
2633
2734const DEMO_WEBSITE_ID = 'OXmNQsViBT-FOS_wZCTHc' ;
2835const DEMO_WEBSITE_URL = 'https://www.databuddy.cc' ;
@@ -39,7 +46,7 @@ const demoNavigation = [
3946 } ,
4047 {
4148 name : 'Sessions' ,
42- icon : ClockIcon ,
49+ icon : UserIcon ,
4350 href : `/demo/${ DEMO_WEBSITE_ID } /sessions` ,
4451 highlight : true ,
4552 } ,
@@ -234,11 +241,39 @@ interface MainLayoutProps {
234241}
235242
236243export default function MainLayout ( { children } : MainLayoutProps ) {
244+ const [ isRefreshing , setIsRefreshing ] = useAtom ( isAnalyticsRefreshingAtom ) ;
245+ const [ selectedFilters , setSelectedFilters ] = useAtom ( dynamicQueryFiltersAtom ) ;
246+
247+ const handleRefresh = async ( ) => {
248+ setIsRefreshing ( true ) ;
249+ try {
250+ // Simulate refresh for demo
251+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ;
252+ toast . success ( 'Demo data refreshed' ) ;
253+ } catch {
254+ toast . error ( 'Failed to refresh data' ) ;
255+ } finally {
256+ setIsRefreshing ( false ) ;
257+ }
258+ } ;
259+
237260 return (
238261 < div className = "h-screen overflow-hidden bg-gradient-to-br from-background to-muted/20 text-foreground" >
239262 < Sidebar />
240263 < main className = "relative h-screen pt-16 md:pl-64" >
241- < div className = "h-[calc(100vh-4rem)] overflow-y-scroll" > { children } </ div >
264+ < div className = "h-[calc(100vh-4rem)] overflow-y-scroll" >
265+ < div className = "mx-auto max-w-[1600px] p-3 sm:p-4 lg:p-6" >
266+ { /* Analytics toolbar for demo */ }
267+ < AnalyticsToolbar
268+ isRefreshing = { isRefreshing }
269+ onFiltersChange = { setSelectedFilters }
270+ onRefresh = { handleRefresh }
271+ selectedFilters = { selectedFilters }
272+ />
273+
274+ { children }
275+ </ div >
276+ </ div >
242277 </ main >
243278 </ div >
244279 ) ;
0 commit comments