add Statistik component and API route
This commit is contained in:
+21
-4
@@ -5,6 +5,7 @@ import { KUPPELN } from '@/types/logbuch';
|
||||
import type { Kuppel, LogbuchEintrag } from '@/types/logbuch';
|
||||
import LogbuchForm from '@/components/LogbuchForm';
|
||||
import LogbuchList from '@/components/LogbuchList';
|
||||
import Statistik from '@/components/Statistik';
|
||||
import packageJson from '@/package.json';
|
||||
|
||||
interface Props {
|
||||
@@ -15,7 +16,7 @@ interface Props {
|
||||
|
||||
export default function MainClient({ kuerzel, beoId, beoName }: Props) {
|
||||
const [activeKuppel, setActiveKuppel] = useState<Kuppel>('West');
|
||||
const [activeTab, setActiveTab] = useState<'eingabe' | 'liste'>('eingabe');
|
||||
const [activeTab, setActiveTab] = useState<'eingabe' | 'liste' | 'statistik'>('eingabe');
|
||||
const [refreshKey, setRefreshKey] = useState(0);
|
||||
const [editEntry, setEditEntry] = useState<LogbuchEintrag | null>(null);
|
||||
|
||||
@@ -80,9 +81,9 @@ export default function MainClient({ kuerzel, beoId, beoName }: Props) {
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Eingabe/Liste-Tabs */}
|
||||
{/* Eingabe/Liste/Statistik-Tabs */}
|
||||
<div className="flex gap-1 mb-3 border-b border-gray-200 print:hidden">
|
||||
{(['eingabe', 'liste'] as const).map((tab) => (
|
||||
{(['eingabe', 'liste', 'statistik'] as const).map((tab) => (
|
||||
<button
|
||||
key={tab}
|
||||
onClick={() => { setActiveTab(tab); if (tab === 'eingabe') setEditEntry(null); }}
|
||||
@@ -92,7 +93,7 @@ export default function MainClient({ kuerzel, beoId, beoName }: Props) {
|
||||
: 'border-transparent text-gray-500 hover:text-gray-700'
|
||||
}`}
|
||||
>
|
||||
{tab === 'eingabe' ? 'Eingabe' : 'Liste'}
|
||||
{tab === 'eingabe' ? 'Eingabe' : tab === 'liste' ? 'Liste' : 'Statistik'}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
@@ -162,6 +163,22 @@ export default function MainClient({ kuerzel, beoId, beoName }: Props) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Statistik-Tab */}
|
||||
{activeTab === 'statistik' && (
|
||||
<div className="border-2 border-gray-400 rounded-xl bg-white p-3 print:border-0 print:rounded-none print:p-0">
|
||||
<div className="flex justify-between items-center mb-2 print:hidden">
|
||||
<span className="text-sm font-semibold text-gray-600">Statistik {activeKuppel}-Kuppel</span>
|
||||
<button
|
||||
onClick={() => window.print()}
|
||||
className="text-sm px-3 py-1.5 bg-gray-200 hover:bg-gray-300 text-gray-700 rounded-lg"
|
||||
>
|
||||
🖨 Drucken
|
||||
</button>
|
||||
</div>
|
||||
<Statistik kuppel={activeKuppel} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<footer className="mt-6 flex justify-between items-center text-xs sm:text-sm text-gray-600 px-1 sm:px-4 print:hidden">
|
||||
<div>
|
||||
<a href="mailto:rxf@gmx.de" className="text-blue-600 hover:underline">
|
||||
|
||||
Reference in New Issue
Block a user