'use client';
import { usePathname, useRouter } from 'next/navigation';
import { useState } from 'react';
import { BottomNavigation, BottomNavigationAction, Paper, Fab, Box, IconButton } from '@mui/material';
import {
Home,
Timeline,
Insights,
Chat,
Mic,
} from '@mui/icons-material';
import { useTranslation } from '@/hooks/useTranslation';
export const TabBar = () => {
const { t } = useTranslation('common');
const router = useRouter();
const pathname = usePathname();
const [voiceOpen, setVoiceOpen] = useState(false);
const tabs = [
{ label: t('navigation.home'), icon: , value: '/' },
{ label: t('navigation.track'), icon: , value: '/track' },
{ label: '', icon: null, value: 'voice' }, // Placeholder for center button
{ label: t('navigation.insights'), icon: , value: '/insights' },
{ label: t('navigation.aiChat'), icon: , value: '/ai-assistant' },
];
return (
<>
{
if (newValue !== 'voice') {
router.push(newValue);
}
}}
showLabels
sx={{
height: 64,
borderRadius: { xs: 0, md: 2 },
'& .MuiBottomNavigationAction-root': {
minWidth: 60,
'&.Mui-selected': {
color: 'primary.main',
},
},
}}
>
{tabs.map((tab) => {
if (tab.value === 'voice') {
// Center voice button - using BottomNavigationAction as wrapper to avoid prop warnings
return (
{
e.stopPropagation();
const voiceButton = document.querySelector('[aria-label="voice input"]') as HTMLButtonElement;
if (voiceButton) {
voiceButton.click();
}
}}
icon={(
)}
sx={{ minWidth: 80 }}
/>
);
}
return (
);
})}
{/* Voice Command Floating Button is now centralized in layout.tsx - removed duplicate */}
>
);
};