'use client'; import { useState } from 'react'; import { KUPPELN } from '@/types/logbuch'; import type { Kuppel, LogbuchEintrag } from '@/types/logbuch'; import LogbuchForm from '@/components/LogbuchForm'; import LogbuchList from '@/components/LogbuchList'; import packageJson from '@/package.json'; interface Props { kuerzel: string; beoId: number; beoName: string; } export default function MainClient({ kuerzel, beoId, beoName }: Props) { const [activeKuppel, setActiveKuppel] = useState('West'); const [activeTab, setActiveTab] = useState<'eingabe' | 'liste'>('eingabe'); const [refreshKey, setRefreshKey] = useState(0); const [editEntry, setEditEntry] = useState(null); const version = packageJson.version; const buildDate = process.env.NEXT_PUBLIC_BUILD_DATE || new Date().toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' }); const currentUserBeo = { ID: beoId, Kuerzel: kuerzel, Name: beoName }; function handleSaved() { setRefreshKey((k) => k + 1); setEditEntry(null); if (editEntry) setActiveTab('liste'); } function handleEdit(entry: LogbuchEintrag) { setEditEntry(entry); setActiveTab('eingabe'); } async function handleLogout() { await fetch('/api/logout', { method: 'POST' }); window.location.href = '/login'; } return (

Logbuch — Sternwarte Welzheim

{kuerzel} — {beoName}
{/* Kuppel-Tabs */}
{KUPPELN.map((k) => ( ))}
{/* Eingabe/Liste-Tabs */}
{(['eingabe', 'liste'] as const).map((tab) => ( ))}
{activeTab === 'eingabe' && (
{editEntry && (
Eintrag bearbeiten (ID {editEntry.ID})
)}
)} {activeTab === 'liste' && ( )}
); }