import { useState, useEffect } from 'react'
import {
BrowserRouter as Router,
Routes,
Route,
useNavigate,
useLocation,
Navigate,
} from 'react-router-dom'
import LeaderboardPage from './components/LeaderboardPage'
import Examples from './components/Examples'
import Docs from './components/Docs'
import Descriptions from './Descriptions'
const TABS = [
{ label: 'Audio', type: 'audio-leaderboard', path: '/audio-leaderboard' },
{ label: 'Image', type: 'image-leaderboard', path: '/image-leaderboard' },
{ label: 'Video', type: 'video-leaderboard', path: '/video-leaderboard' },
{ label: 'Image Examples', type: 'image-examples', path: '/image-examples' },
{ label: 'Audio Examples', type: 'audio-examples', path: '/audio-examples' },
{ label: 'Video Examples', type: 'video-examples', path: '/video-examples' },
{ label: 'Docs', type: 'docs', path: '/docs' },
]
function TabbedNav({ activeTab }: { activeTab: string }) {
const navigate = useNavigate()
return (
{TABS.map((tab) => (
navigate(tab.path)}
/>
))}
)
}
function AppContent() {
const location = useLocation()
const [theme, setTheme] = useState<'dark' | 'light'>('dark')
// Load descriptions on app load
useEffect(() => {
Descriptions.getInstance().load()
}, [])
useEffect(() => {
document.documentElement.setAttribute('data-theme', theme)
}, [theme])
// Find the active tab based on the current path
const activeTab = TABS.find((tab) => tab.path === location.pathname)?.type || TABS[0].type
let content = null
if (activeTab === 'audio-leaderboard') {
content =
} else if (activeTab === 'image-leaderboard') {
content =
} else if (activeTab === 'video-leaderboard') {
content =
} else if (activeTab === 'image-examples') {
content =
} else if (activeTab === 'audio-examples') {
content =
} else if (activeTab === 'video-examples') {
content =
} else if (activeTab === 'docs') {
content =
}
return (
} />
} />
} />
} />
} />
} />
} />
{/* Redirect root to audio-leaderboard */}
} />
} />
)
}
export default function App() {
return (
)
}