Spaces:
Running
Running
Mark Duppenthaler
Updated table. No more individual rows, separate tabs for leaderboard type, export tables
7f6ef8f
import { useState, useEffect } from 'react' | |
import LeaderboardPage from './components/LeaderboardPage' | |
import Examples from './components/Examples' | |
const TABS = [ | |
{ label: 'Audio', type: 'audio-leaderboard' }, | |
{ label: 'Image', type: 'image-leaderboard' }, | |
{ label: 'Video', type: 'video-leaderboard' }, | |
{ label: 'Image Examples', type: 'image-examples' }, | |
{ label: 'Audio Examples', type: 'audio-examples' }, | |
{ label: 'Video Examples', type: 'video-examples' }, | |
] | |
function App() { | |
const [activeTab, setActiveTab] = useState<string>('audio-leaderboard') | |
const [theme, setTheme] = useState<'dark' | 'light'>('dark') | |
useEffect(() => { | |
document.documentElement.setAttribute('data-theme', theme) | |
}, [theme]) | |
let content = null | |
if (activeTab === 'audio-leaderboard') { | |
content = <LeaderboardPage datasetType="audio" /> | |
} else if (activeTab === 'image-leaderboard') { | |
content = <LeaderboardPage datasetType="image" /> | |
} else if (activeTab === 'video-leaderboard') { | |
content = <LeaderboardPage datasetType="video" /> | |
} else if (activeTab === 'image-examples') { | |
content = <Examples fileType="image" /> | |
} else if (activeTab === 'audio-examples') { | |
content = <Examples fileType="audio" /> | |
} else if (activeTab === 'video-examples') { | |
content = <Examples fileType="video" /> | |
} | |
return ( | |
<div className="min-h-screen w-11/12 mx-auto"> | |
<div className="bg-base-100 my-4"> | |
<div className="flex flex-row justify-between items-center"> | |
<h2 className="card-title">π₯ Omni Seal Bench Watermarking Leaderboard</h2> | |
<div className="flex justify-end items-center gap-2"> | |
<span className="text-sm">{theme === 'dark' ? 'π Dark Mode' : 'βοΈ Light Mode'}</span> | |
<input | |
type="checkbox" | |
className="toggle" | |
checked={theme === 'dark'} | |
onChange={() => setTheme(theme === 'dark' ? 'light' : 'dark')} | |
aria-label="Toggle dark mode" | |
/> | |
</div> | |
</div> | |
</div> | |
<div className="tabs tabs-border mb-2 "> | |
{TABS.map((tab) => ( | |
<input | |
key={tab.type} | |
type="radio" | |
name="leaderboard_tabs" | |
className="tab" | |
aria-label={tab.label} | |
checked={activeTab === tab.type} | |
onChange={() => setActiveTab(tab.type)} | |
/> | |
))} | |
</div> | |
<div className="w-full ">{content}</div> | |
</div> | |
) | |
} | |
export default App | |