import { useState } from 'react'; import { SessionList } from '../components/history/SessionList'; import { ExerciseChart } from '../components/history/ExerciseChart'; import { getActiveUserId } from '../stores/userStore'; type Tab = 'history' | 'stats'; async function downloadExport() { const uid = getActiveUserId(); const headers: Record = {}; if (uid) headers['X-User-ID'] = uid; const res = await fetch('/api/v1/export', { headers }); if (!res.ok) return; const blob = await res.blob(); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `training-export-${new Date().toISOString().slice(0, 10)}.csv`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); } export function HistoryPage() { const [activeTab, setActiveTab] = useState('history'); return (

Historie

{/* Tab Toggle */}
{activeTab === 'history' ? : }
); }