import React from 'react' import { Tabs, Tab, Box } from '@mui/material' import { useNavigate } from 'react-router-dom' import { useAppSelector } from '../store' interface NavigationTabsProps { currentPath: string } export const NavigationTabs: React.FC = ({ currentPath }) => { const navigate = useNavigate() const { currentDocument, extractionById } = useAppSelector((state) => state.document) const tabs = [ { label: 'Téléversement', path: '/', alwaysEnabled: true }, { label: 'Extraction', path: '/extraction', alwaysEnabled: true }, { label: 'Contexte', path: '/contexte', alwaysEnabled: false }, { label: 'Conseil', path: '/conseil', alwaysEnabled: false }, ] const currentTabIndex = tabs.findIndex(tab => tab.path === currentPath) // Vérifier si au moins une extraction est terminée const hasCompletedExtraction = currentDocument && extractionById[currentDocument.id] const handleTabChange = (_event: React.SyntheticEvent, newValue: number) => { const tab = tabs[newValue] if (tab.alwaysEnabled || hasCompletedExtraction) { navigate(tab.path) } } return ( = 0 ? currentTabIndex : 0} onChange={handleTabChange} aria-label="navigation tabs" variant="scrollable" scrollButtons="auto" > {tabs.map((tab, index) => ( ))} ) }