import React from 'react'; import { XStack, YStack } from '@tamagui/stacks'; import { Button } from '@tamagui/button'; import { Sparkles, Share2, Image, Camera, Settings, Home, Menu } from 'lucide-react'; import { useLocation, useNavigate } from 'react-router-dom'; import TopBar from './TopBar'; import FloatingActionButton from './FloatingActionButton'; import CompassHub, { type CompassAction } from './CompassHub'; import AmbientBackground from './AmbientBackground'; import NotificationSheet from './NotificationSheet'; import SettingsSheet from './SettingsSheet'; import GuestAnalyticsNudge from './GuestAnalyticsNudge'; import { useEventData } from '../context/EventDataContext'; import { buildEventPath } from '../lib/routes'; import { useOptionalNotificationCenter } from '@/guest/context/NotificationCenterContext'; import { useTranslation } from '@/guest/i18n/useTranslation'; import { useGuestThemeVariant } from '../lib/guestTheme'; type AppShellProps = { children: React.ReactNode; }; export default function AppShell({ children }: AppShellProps) { const [compassOpen, setCompassOpen] = React.useState(false); const [notificationsOpen, setNotificationsOpen] = React.useState(false); const [settingsOpen, setSettingsOpen] = React.useState(false); const { tasksEnabled, event, token } = useEventData(); const notificationCenter = useOptionalNotificationCenter(); const navigate = useNavigate(); const location = useLocation(); const { t } = useTranslation(); const { isDark } = useGuestThemeVariant(); const actionIconColor = isDark ? '#F8FAFF' : '#0F172A'; const matomoEnabled = typeof window !== 'undefined' && Boolean((window as any).__MATOMO_GUEST__?.enabled); const isUploadRoute = /\/upload(?:\/|$)/.test(location.pathname); const showFab = !/\/photo\/\d+/.test(location.pathname); const dockBackground = isDark ? 'rgba(12, 16, 32, 0.72)' : 'rgba(255, 255, 255, 0.9)'; const dockBorder = isDark ? 'rgba(255,255,255,0.16)' : 'rgba(15,23,42,0.12)'; const dockShadow = isDark ? '0 14px 28px rgba(2, 6, 23, 0.5)' : '0 12px 24px rgba(15, 23, 42, 0.14)'; const goTo = (path: string) => () => { setCompassOpen(false); setNotificationsOpen(false); setSettingsOpen(false); const target = buildEventPath(token, path); if (location.pathname === target) { return; } navigate(target); }; const openCompass = () => { setNotificationsOpen(false); setSettingsOpen(false); setCompassOpen((prev) => !prev); }; const compassQuadrants: [CompassAction, CompassAction, CompassAction, CompassAction] = [ { key: 'home', label: t('navigation.home', 'Home'), icon: , onPress: goTo('/'), }, { key: 'gallery', label: t('navigation.gallery', 'Gallery'), icon: , onPress: goTo('/gallery'), }, tasksEnabled ? { key: 'tasks', label: t('navigation.tasks', 'Tasks'), icon: , onPress: goTo('/tasks'), } : { key: 'settings', label: t('settings.title', 'Settings'), icon: , onPress: goTo('/settings'), }, { key: 'share', label: t('navigation.share', 'Share'), icon: , onPress: goTo('/share'), }, ]; return ( { setNotificationsOpen(false); setCompassOpen(false); setSettingsOpen(true); }} onNotificationsPress={() => { setSettingsOpen(false); setCompassOpen(false); setNotificationsOpen(true); }} notificationCount={notificationCenter?.unreadCount ?? 0} /> {children} {showFab ? ( isUploadRoute ? ( ) : ( ) ) : null} , onPress: goTo('/upload'), }} quadrants={compassQuadrants} /> ); }