v1.2.0: Formular-Redesign und Listen-Verbesserungen

- Eingabe: alle 5 Felder (Führung, Datum, Start, Ende, Besucher) in einer Zeile
- Eingabe: Datum einmalig, Start- und Endzeit getrennt
- Führungsarten: Kürzel werden nur in DB gespeichert, Anzeige als Klartext
- Liste: Datum und Zeit getrennt in eigenen Spalten
- Hintergrundfarbe #EEF4FF auf Login- und Passwort-Seite übertragen
- Alle Inputfelder gleich hoch (text-sm durchgehend)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-01 11:00:19 +02:00
parent 7055fd0229
commit 50719322c8
7 changed files with 77 additions and 78 deletions

View File

@@ -10,7 +10,7 @@ export default function ChangePasswordPage() {
return ( return (
<div className="min-h-screen bg-white py-4 px-4"> <div className="min-h-screen bg-white py-4 px-4">
<main className="max-w-6xl mx-auto border-2 border-black rounded-lg p-6 bg-[#FFFFDD]"> <main className="max-w-6xl mx-auto border-2 border-black rounded-lg p-6 bg-[#EEF4FF]">
<h1 className="text-3xl font-bold mb-6">Logbuch Sternwarte Welzheim</h1> <h1 className="text-3xl font-bold mb-6">Logbuch Sternwarte Welzheim</h1>
<div className="flex justify-center py-10"> <div className="flex justify-center py-10">

View File

@@ -15,7 +15,7 @@ export default function LoginPage() {
return ( return (
<div className="min-h-screen bg-white py-4 px-4"> <div className="min-h-screen bg-white py-4 px-4">
<main className="max-w-6xl mx-auto border-2 border-black rounded-lg p-6 bg-[#FFFFDD]"> <main className="max-w-6xl mx-auto border-2 border-black rounded-lg p-6 bg-[#EEF4FF]">
<div className="flex justify-between items-center mb-6"> <div className="flex justify-between items-center mb-6">
<h1 className="text-3xl font-bold">Logbuch Sternwarte Welzheim</h1> <h1 className="text-3xl font-bold">Logbuch Sternwarte Welzheim</h1>
</div> </div>

View File

@@ -39,7 +39,7 @@ export default function CustomSelect({ options, placeholder, onChange, keepOpen
<button <button
type="button" type="button"
onClick={() => setOpen((v) => !v)} onClick={() => setOpen((v) => !v)}
className="w-full flex items-center justify-between px-4 py-2 border-2 border-gray-400 rounded-lg bg-white text-base text-gray-900 focus:border-blue-500 focus:outline-none" className="w-full flex items-center justify-between px-4 py-2 border-2 border-gray-400 rounded-lg bg-white text-sm text-gray-900 focus:border-blue-500 focus:outline-none"
> >
<span>{placeholder}</span> <span>{placeholder}</span>
<svg <svg

View File

@@ -2,7 +2,7 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import type { Kuppel, ArtFuehrung, BeoOption, SelectedObjekt, Wetter, LogbuchEintrag } from '@/types/logbuch'; import type { Kuppel, ArtFuehrung, BeoOption, SelectedObjekt, Wetter, LogbuchEintrag } from '@/types/logbuch';
import { ARTEN, ARTEN_MAP } from '@/types/logbuch'; import { ARTEN, ARTEN_MAP, artLabel } from '@/types/logbuch';
import BeoSelector from './BeoSelector'; import BeoSelector from './BeoSelector';
import ObjektSelector from './ObjektSelector'; import ObjektSelector from './ObjektSelector';
import CustomSelect from './CustomSelect'; import CustomSelect from './CustomSelect';
@@ -194,21 +194,18 @@ export default function LogbuchForm({ kuppel, currentUserBeo, editEntry, onSaved
return ( return (
<form onSubmit={handleSubmit} className="space-y-3 max-w-2xl mx-auto border-2 border-gray-400 rounded-xl p-4 bg-white"> <form onSubmit={handleSubmit} className="space-y-3 max-w-2xl mx-auto border-2 border-gray-400 rounded-xl p-4 bg-white">
{/* Art der Führung — volle Breite */} {/* Art der Führung / Datum / Startzeit / Endzeit / Besucher — eine Zeile */}
<div> <div className="flex flex-wrap gap-3 items-end">
<div className="flex-1 min-w-[160px]">
<label className={labelCls}>Art der Führung</label> <label className={labelCls}>Art der Führung</label>
<CustomSelect <CustomSelect
placeholder={`${artFuehrung}${ARTEN_MAP[artFuehrung]}`} placeholder={artLabel(artFuehrung)}
options={ARTEN.map((a) => ({ value: a, label: `${a}${ARTEN_MAP[a]}` }))} options={ARTEN.map((a) => ({ value: a, label: artLabel(a) }))}
onChange={(v) => setArtFuehrung(v as ArtFuehrung)} onChange={(v) => setArtFuehrung(v as ArtFuehrung)}
/> />
</div> </div>
<div className="shrink-0">
{/* Beginn / Ende / Besucher */} <label className={labelCls}>Datum</label>
<div className="flex flex-col sm:flex-row gap-3 sm:items-end">
<div className="w-full sm:flex-1">
<label className={labelCls}>Beginn</label>
<div className="flex gap-2">
<input <input
type="date" type="date"
value={beginn.slice(0, 10)} value={beginn.slice(0, 10)}
@@ -218,8 +215,11 @@ export default function LogbuchForm({ kuppel, currentUserBeo, editEntry, onSaved
setEnde(e.target.value + 'T' + (ende.slice(11, 16) || '00:00')); setEnde(e.target.value + 'T' + (ende.slice(11, 16) || '00:00'));
}} }}
required required
className="flex-1 px-2 py-2 border-2 border-gray-400 rounded-lg bg-white text-sm text-gray-900 focus:border-blue-500 focus:outline-none" className="px-2 py-2 border-2 border-gray-400 rounded-lg bg-white text-sm text-gray-900 focus:border-blue-500 focus:outline-none"
/> />
</div>
<div className="shrink-0">
<label className={labelCls}>Startzeit</label>
<TimePicker5 <TimePicker5
value={beginn.slice(11, 16)} value={beginn.slice(11, 16)}
onChange={(t) => { onChange={(t) => {
@@ -229,29 +229,16 @@ export default function LogbuchForm({ kuppel, currentUserBeo, editEntry, onSaved
className="w-24" className="w-24"
/> />
</div> </div>
</div> <div className="shrink-0">
<div className="w-full sm:flex-1"> <label className={labelCls}>Endzeit</label>
<label className={labelCls}>Ende</label>
<div className="flex gap-2">
<input
type="date"
value={ende.slice(0, 10)}
onChange={(e) => {
if (!e.target.value) return;
setEnde(e.target.value + 'T' + (ende.slice(11, 16) || '00:00'));
}}
required
className="flex-1 px-2 py-2 border-2 border-gray-400 rounded-lg bg-white text-sm text-gray-900 focus:border-blue-500 focus:outline-none"
/>
<TimePicker5 <TimePicker5
value={ende.slice(11, 16)} value={ende.slice(11, 16)}
onChange={(t) => setEnde(ende.slice(0, 10) + 'T' + t)} onChange={(t) => setEnde(ende.slice(0, 10) + 'T' + t)}
className="w-24" className="w-24"
/> />
</div> </div>
</div>
{showBesucher && ( {showBesucher && (
<div className="sm:shrink-0"> <div className="shrink-0">
<label className={labelCls}>Besucher</label> <label className={labelCls}>Besucher</label>
<input <input
type="number" type="number"
@@ -259,7 +246,7 @@ export default function LogbuchForm({ kuppel, currentUserBeo, editEntry, onSaved
onChange={(e) => setBesucher(e.target.value === '' ? '' : parseInt(e.target.value) || 0)} onChange={(e) => setBesucher(e.target.value === '' ? '' : parseInt(e.target.value) || 0)}
min={0} min={0}
max={9999} max={9999}
className="w-20 px-2 py-2 border-2 border-gray-400 rounded-lg bg-white text-base focus:border-blue-500 focus:outline-none" className="w-20 px-2 py-2 border-2 border-gray-400 rounded-lg bg-white text-sm focus:border-blue-500 focus:outline-none"
/> />
</div> </div>
)} )}

View File

@@ -11,15 +11,21 @@ interface Props {
compact?: boolean; compact?: boolean;
} }
function formatDateTime(dt: string, short = false): string { const pad = (n: number) => String(n).padStart(2, '0');
function formatDate(dt: string, short = false): string {
if (!dt) return ''; if (!dt) return '';
const d = new Date(dt); const d = new Date(dt);
if (isNaN(d.getTime())) return dt; if (isNaN(d.getTime())) return dt;
if (short) { if (short) return `${pad(d.getDate())}.${pad(d.getMonth() + 1)}.`;
const pad = (n: number) => String(n).padStart(2, '0'); return `${pad(d.getDate())}.${pad(d.getMonth() + 1)}.${d.getFullYear()}`;
return `${pad(d.getDate())}.${pad(d.getMonth() + 1)}. ${pad(d.getHours())}:${pad(d.getMinutes())}`;
} }
return d.toLocaleString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit' });
function formatTime(dt: string): string {
if (!dt) return '';
const d = new Date(dt);
if (isNaN(d.getTime())) return dt;
return `${pad(d.getHours())}:${pad(d.getMinutes())}`;
} }
export default function LogbuchList({ kuppel, refreshKey, onEdit, limit = 20, compact = false }: Props) { export default function LogbuchList({ kuppel, refreshKey, onEdit, limit = 20, compact = false }: Props) {
@@ -65,7 +71,8 @@ export default function LogbuchList({ kuppel, refreshKey, onEdit, limit = 20, co
<table className="w-full border-collapse" style={{ fontSize: compact ? '0.75rem' : '0.875rem' }}> <table className="w-full border-collapse" style={{ fontSize: compact ? '0.75rem' : '0.875rem' }}>
<thead> <thead>
<tr className="bg-gray-100 text-left"> <tr className="bg-gray-100 text-left">
<th className={`${head} whitespace-nowrap`}>Beginn</th> <th className={`${head} whitespace-nowrap`}>Datum</th>
<th className={`${head} whitespace-nowrap`}>Start</th>
<th className={`${head} whitespace-nowrap`}>Ende</th> <th className={`${head} whitespace-nowrap`}>Ende</th>
<th className={head}>Art</th> <th className={head}>Art</th>
<th className={`${head} text-center w-10`}>Bes.</th> <th className={`${head} text-center w-10`}>Bes.</th>
@@ -78,8 +85,9 @@ export default function LogbuchList({ kuppel, refreshKey, onEdit, limit = 20, co
<tbody> <tbody>
{entries.map((e) => ( {entries.map((e) => (
<tr key={e.ID} className="hover:bg-gray-50"> <tr key={e.ID} className="hover:bg-gray-50">
<td className={`${cell} whitespace-nowrap`}>{formatDateTime(e.Beginn, compact)}</td> <td className={`${cell} whitespace-nowrap`}>{formatDate(e.Beginn, compact)}</td>
<td className={`${cell} whitespace-nowrap`}>{formatDateTime(e.Ende, compact)}</td> <td className={`${cell} whitespace-nowrap`}>{formatTime(e.Beginn)}</td>
<td className={`${cell} whitespace-nowrap`}>{formatTime(e.Ende)}</td>
<td className={cell}>{e.ArtFuehrung}</td> <td className={cell}>{e.ArtFuehrung}</td>
<td className={`${cell} text-center`}>{e.Besucher || ''}</td> <td className={`${cell} text-center`}>{e.Besucher || ''}</td>
<td className={cell}>{e.BEOs || '—'}</td> <td className={cell}>{e.BEOs || '—'}</td>

View File

@@ -1,6 +1,6 @@
{ {
"name": "logbuch", "name": "logbuch",
"version": "1.1.0", "version": "1.2.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",

View File

@@ -4,19 +4,23 @@ export type ArtFuehrung = 'RF' | 'SF' | 'PrF' | 'BEOS' | 'SonF' | 'TD' | 'Beob'
export const KUPPELN: Kuppel[] = ['West', 'Ost', 'Süd', 'Pluto']; export const KUPPELN: Kuppel[] = ['West', 'Ost', 'Süd', 'Pluto'];
export const ARTEN_MAP: Record<ArtFuehrung, string> = { export const ARTEN_MAP: Record<ArtFuehrung, string> = {
RF: 'Reguläre Führung', RF: 'regulär',
SF: 'Sonderführung', SF: 'sonder',
PrF: 'Private Führung', PrF: 'privat',
BEOS: 'BEO-Sitzung', BEOS: '',
SonF: 'Sonnenführung', SonF: 'sonnen',
TD: 'Technischer Dienst', TD: '',
Beob: 'Beobachtung', Beob: 'Beobachtung',
ToT: 'Tag der offenen Tür', ToT: '',
Sonst: 'Sonstiges', Sonst: 'Sonstiges',
}; };
export const ARTEN = Object.keys(ARTEN_MAP) as ArtFuehrung[]; export const ARTEN = Object.keys(ARTEN_MAP) as ArtFuehrung[];
export function artLabel(a: ArtFuehrung): string {
return ARTEN_MAP[a] || a;
}
export interface BeoOption { export interface BeoOption {
ID: number; ID: number;
Kuerzel: string; Kuerzel: string;