import React from 'react';
import { NavLink, useParams, useLocation } from 'react-router-dom';
import { Button } from '@/components/ui/button';
import { CheckSquare, GalleryHorizontal, Home, Trophy } from 'lucide-react';
import { useEventData } from '../hooks/useEventData';
function TabLink({
to,
children,
isActive
}: {
to: string;
children: React.ReactNode;
isActive: boolean;
}) {
return (
{children}
);
}
export default function BottomNav() {
const { slug } = useParams();
const location = useLocation();
const { event } = useEventData();
if (!slug) return null; // Only show bottom nav within event context
const base = `/e/${encodeURIComponent(slug)}`;
const currentPath = location.pathname;
const locale = event?.default_locale || 'de';
// Translations
const translations = {
de: {
home: 'Start',
tasks: 'Aufgaben',
achievements: 'Erfolge',
gallery: 'Galerie'
},
en: {
home: 'Home',
tasks: 'Tasks',
achievements: 'Achievements',
gallery: 'Gallery'
}
};
const t = translations[locale as keyof typeof translations] || translations.de;
// Improved active state logic
const isHomeActive = currentPath === base || currentPath === `/${slug}`;
const isTasksActive = currentPath.startsWith(`${base}/tasks`) || currentPath === `${base}/upload`;
const isAchievementsActive = currentPath.startsWith(`${base}/achievements`);
const isGalleryActive = currentPath.startsWith(`${base}/gallery`) || currentPath.startsWith(`${base}/photos`);
return (
{t.home}
{t.tasks}
{t.achievements}
{t.gallery}
);
}