import React from 'react'; import { NavLink, useParams, useLocation, Link } from 'react-router-dom'; import { CheckSquare, GalleryHorizontal, Home, Trophy, Camera } from 'lucide-react'; import { useEventData } from '../hooks/useEventData'; import { useTranslation } from '../i18n/useTranslation'; import { useEventBranding } from '../context/EventBrandingContext'; import { isTaskModeEnabled } from '../lib/engagement'; function TabLink({ to, children, isActive, accentColor, radius, style, compact = false, }: { to: string; children: React.ReactNode; isActive: boolean; accentColor: string; radius: number; style?: React.CSSProperties; compact?: boolean; }) { const activeStyle = isActive ? { background: `linear-gradient(135deg, ${accentColor}, ${accentColor}cc)`, color: '#ffffff', boxShadow: `0 12px 30px ${accentColor}33`, borderRadius: radius, ...style, } : { borderRadius: radius, ...style }; return ( {children} ); } export default function BottomNav() { const { token } = useParams(); const location = useLocation(); const { event, status } = useEventData(); const { t } = useTranslation(); const { branding } = useEventBranding(); const radius = branding.buttons?.radius ?? 12; const buttonStyle = branding.buttons?.style ?? 'filled'; const linkColor = branding.buttons?.linkColor ?? branding.secondaryColor; const surface = branding.palette?.surface ?? branding.backgroundColor; const isReady = status === 'ready' && !!event; if (!token || !isReady) return null; const base = `/e/${encodeURIComponent(token)}`; const currentPath = location.pathname; const tasksEnabled = isTaskModeEnabled(event); const labels = { home: t('navigation.home'), tasks: t('navigation.tasks'), achievements: t('navigation.achievements'), gallery: t('navigation.gallery'), upload: t('home.actions.items.upload.label'), }; const isHomeActive = currentPath === base || currentPath === `/${token}`; const isTasksActive = currentPath.startsWith(`${base}/tasks`); const isAchievementsActive = currentPath.startsWith(`${base}/achievements`); const isGalleryActive = currentPath.startsWith(`${base}/gallery`) || currentPath.startsWith(`${base}/photos`); const isUploadActive = currentPath.startsWith(`${base}/upload`); const compact = isUploadActive; const navPaddingBottom = `calc(env(safe-area-inset-bottom, 0px) + ${compact ? 12 : 18}px)`; return (
{labels.home}
{tasksEnabled ? (
{labels.tasks}
) : null}
{labels.achievements}
{labels.gallery}
); }