Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ automatisch mit [git-cliff](https://git-cliff.org) aus den Commit-Messages gener
### Changed

- Tags nur noch für festgehaltene Versionen
- Schichtzeiten mit Minuten in den Projektregeln

### Fixed

- **icons**: Hochgeladene SVG-Symbole nehmen die Textfarbe an
- **calendar**: Schichtzeiten immer mit Minuten

## [0.9.1] - 2026-11-14

Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Nutzerentscheidung 2026-11-14: Der Spiegel besteht aus **internen Modulen**, und
- **Darstellung:** Eine Liste mit relativen Zeitangaben wie bisher („in 2 Std.“, „Morgen 14:30“, „noch 2 Tage“).
- **Einfärbung** (Nutzerentscheidung 2026-11-14): je Bereich abschaltbar; nur die Zeitangabe wird gefärbt, nach Zeit bis zum Beginn in drei Stufen mit eigener Farbe – läuft gerade (Vorgabe an, `#f6b73c`), beginnt in weniger als X Stunden, beginnt heute. Die Farbe berechnet der Server (`calendar.HighlightColor`, reine Funktion mit `now`) und liefert sie als `highlightColor`; Bereiche ohne `highlight` in `settings.json` laden mit den Vorgaben.
- **Regeln** sind eine geordnete Liste mit klaren Bedingungen (Kalender, Titel enthält/beginnt mit/ist gleich) und Aktionen (ausblenden, Symbol setzen, Titel umbenennen). Im Admin zeigt eine Vorschau mit echten Terminen, welche Regel greift.
- **Dienstplan als eigene Schichtanzeige:** Ein Bereichstyp „Schichten“ erkennt Schichten an Kürzeln bzw. Stichworten im Titel (z. B. „F“, „Früh“). Die Zuordnung Kürzel → Name, Zeiten und Symbol stellt man im Admin ein. Die Anzeige sieht aus wie die Terminliste: Symbol und Schichtname links, rechts Tag und Zeit („Heute 06:30–19:00“, „Montag 06–14“), eine laufende Schicht hervorgehoben. Standard sind die nächsten Arbeitstage (Anzahl einstellbar, Vorgabe 5, gesucht im Vorschau-Zeitraum des Bereichs). Eine heutige Schicht verschwindet, sobald sie vorbei ist. Freie Tage („frei“) zeigt der Bereich nur, wenn „Freie Tage anzeigen“ an ist (Nutzerentscheidung 2026-11-14 nach der Abnahme am Pi).
- **Dienstplan als eigene Schichtanzeige:** Ein Bereichstyp „Schichten“ erkennt Schichten an Kürzeln bzw. Stichworten im Titel (z. B. „F“, „Früh“). Die Zuordnung Kürzel → Name, Zeiten und Symbol stellt man im Admin ein. Die Anzeige sieht aus wie die Terminliste: Symbol und Schichtname links, rechts Tag und Zeit, immer mit Minuten („Heute 06:30–19:00“, „Montag 11:00–19:00“), eine laufende Schicht hervorgehoben. Standard sind die nächsten Arbeitstage (Anzahl einstellbar, Vorgabe 5, gesucht im Vorschau-Zeitraum des Bereichs). Eine heutige Schicht verschwindet, sobald sie vorbei ist. Freie Tage („frei“) zeigt der Bereich nur, wenn „Freie Tage anzeigen“ an ist (Nutzerentscheidung 2026-11-14 nach der Abnahme am Pi).
- **Das Admin-UI** wird am Handy und am Rechner benutzt und muss bis 360 px Breite ohne waagerechtes Scrollen funktionieren.
- Texte auf Deutsch mit „du“.
- Jede Seite hat genau eine `h1`, Abschnitte sind `h2`.
Expand Down
2 changes: 1 addition & 1 deletion api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ components:
description: Shift name, the event title when no shift matches, or `frei`.
timeRange:
type: string
description: For example `06–14` or `06:30–19:00`; absent when unknown.
description: For example `06:00–14:00` or `06:30–19:00`; absent when unknown.
icon:
$ref: "#/components/schemas/IconRef"
free:
Expand Down
2 changes: 1 addition & 1 deletion server/internal/api/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/internal/api/calendar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func TestDashboardCalendarSections(t *testing.T) {
if days[0].DayLabel != "Heute" || !days[0].Free || days[0].Title != "frei" || days[0].Ongoing || days[0].TimeRange != nil {
t.Errorf("day 0 = %+v", days[0])
}
if days[3].Title != "Spätdienst" || days[3].TimeRange == nil || *days[3].TimeRange != "14–22" || days[3].Free || days[3].Icon.Kind != Bootstrap || *days[3].Icon.Name != "moon" || days[3].Date.Format("2006-01-02") != "2026-11-17" {
if days[3].Title != "Spätdienst" || days[3].TimeRange == nil || *days[3].TimeRange != "14:00–22:00" || days[3].Free || days[3].Icon.Kind != Bootstrap || *days[3].Icon.Name != "moon" || days[3].Date.Format("2006-01-02") != "2026-11-17" {
t.Errorf("day 3 = %+v", days[3])
}
if strings.Contains(rec.Body.String(), "secret-token") {
Expand Down
2 changes: 1 addition & 1 deletion server/internal/calendar/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestServiceShiftsSection(t *testing.T) {
for _, d := range res.Days {
got = append(got, d.DayLabel+": "+d.Title+" "+d.TimeRange)
}
want := []string{"Montag: Standup ", "Dienstag: Spätdienst 14–22"}
want := []string{"Montag: Standup ", "Dienstag: Spätdienst 14:00–22:00"}
if !reflect.DeepEqual(got, want) {
t.Errorf("rows = %q\nwant %q", got, want)
}
Expand Down
8 changes: 3 additions & 5 deletions server/internal/calendar/shifts.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type ShiftDay struct {
Date string // yyyy-MM-dd
DayLabel string
Title string
TimeRange string // "06–14" or "06:30–19:00"; empty when unknown
TimeRange string // "06:00–14:00" or "06:30–19:00"; empty when unknown
Icon IconRef
Free bool
Ongoing bool
Expand All @@ -48,11 +48,9 @@ func parseHM(s string) (h, m int, ok bool) {
return t.Hour(), t.Minute(), true
}

// formatRange renders "06–14" or, with minutes, "06:30–14:15".
// formatRange always renders "HH:MM–HH:MM" (e.g. "11:00–19:00"), never
// dropping zero minutes, and without a trailing "Uhr".
func formatRange(sh, sm, eh, em int) string {
if sm == 0 && em == 0 {
return fmt.Sprintf("%02d–%02d", sh, eh)
}
return fmt.Sprintf("%02d:%02d–%02d:%02d", sh, sm, eh, em)
}

Expand Down
41 changes: 27 additions & 14 deletions server/internal/calendar/shifts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestBuildShifts(t *testing.T) {
occs: []SourcedOccurrence{mk("F", at(10, 6, 0), at(10, 14, 0), false)},
shifts: testShifts, days: 2,
want: []ShiftDay{
{Date: "2026-03-10", DayLabel: "Heute", Title: "Frühdienst", TimeRange: "06–14", Icon: IconRef{Kind: IconBootstrap, Name: "sunrise"}},
{Date: "2026-03-10", DayLabel: "Heute", Title: "Frühdienst", TimeRange: "06:00–14:00", Icon: IconRef{Kind: IconBootstrap, Name: "sunrise"}},
{Date: "2026-03-11", DayLabel: "Morgen", Title: "frei", Free: true},
},
},
Expand All @@ -49,7 +49,7 @@ func TestBuildShifts(t *testing.T) {
occs: []SourcedOccurrence{mk("f", at(10, 6, 0), at(10, 14, 0), false), mk("Frei", at(11, 8, 0), at(11, 9, 0), false)},
shifts: testShifts, days: 2,
want: []ShiftDay{
{Date: "2026-03-10", DayLabel: "Heute", Title: "Frühdienst", TimeRange: "06–14", Icon: IconRef{Kind: IconBootstrap, Name: "sunrise"}},
{Date: "2026-03-10", DayLabel: "Heute", Title: "Frühdienst", TimeRange: "06:00–14:00", Icon: IconRef{Kind: IconBootstrap, Name: "sunrise"}},
{Date: "2026-03-11", DayLabel: "Morgen", Title: "Frei", Icon: def},
},
},
Expand All @@ -64,8 +64,8 @@ func TestBuildShifts(t *testing.T) {
occs: []SourcedOccurrence{mk("Dienst Nachtbereitschaft", at(10, 22, 0), at(11, 6, 0), false)},
shifts: testShifts, days: 2,
want: []ShiftDay{
{Date: "2026-03-10", DayLabel: "Heute", Title: "Nachtdienst", TimeRange: "22–06", Icon: def},
{Date: "2026-03-11", DayLabel: "Morgen", Title: "Nachtdienst", TimeRange: "22–06", Icon: def},
{Date: "2026-03-10", DayLabel: "Heute", Title: "Nachtdienst", TimeRange: "22:00–06:00", Icon: def},
{Date: "2026-03-11", DayLabel: "Morgen", Title: "Nachtdienst", TimeRange: "22:00–06:00", Icon: def},
},
},
{
Expand All @@ -84,7 +84,7 @@ func TestBuildShifts(t *testing.T) {
name: "all-day shift with definition times uses them",
occs: []SourcedOccurrence{mk("F", at(10, 0, 0), at(11, 0, 0), true)},
shifts: testShifts, days: 1,
want: []ShiftDay{{Date: "2026-03-10", DayLabel: "Heute", Title: "Frühdienst", TimeRange: "06–14", Icon: IconRef{Kind: IconBootstrap, Name: "sunrise"}}},
want: []ShiftDay{{Date: "2026-03-10", DayLabel: "Heute", Title: "Frühdienst", TimeRange: "06:00–14:00", Icon: IconRef{Kind: IconBootstrap, Name: "sunrise"}}},
},
{
name: "multi-day all-day shift shows on every day it covers",
Expand Down Expand Up @@ -119,7 +119,7 @@ func TestBuildShifts(t *testing.T) {
{ID: "r1", MatchMode: MatchEquals, Text: "Dienst A", Action: ActionRename, RenameTo: "F"},
},
shifts: testShifts, days: 1,
want: []ShiftDay{{Date: "2026-03-10", DayLabel: "Heute", Title: "Frühdienst", TimeRange: "06–14", Icon: IconRef{Kind: IconBootstrap, Name: "sunrise"}}},
want: []ShiftDay{{Date: "2026-03-10", DayLabel: "Heute", Title: "Frühdienst", TimeRange: "06:00–14:00", Icon: IconRef{Kind: IconBootstrap, Name: "sunrise"}}},
},
{
name: "hide rule removes the event, day becomes free",
Expand All @@ -136,7 +136,7 @@ func TestBuildShifts(t *testing.T) {
mk("Zahnarzt", at(10, 5, 0), at(10, 5, 30), false),
},
shifts: testShifts, days: 1,
want: []ShiftDay{{Date: "2026-03-10", DayLabel: "Heute", Title: "Frühdienst", TimeRange: "06–14", Icon: IconRef{Kind: IconBootstrap, Name: "sunrise"}}},
want: []ShiftDay{{Date: "2026-03-10", DayLabel: "Heute", Title: "Frühdienst", TimeRange: "06:00–14:00", Icon: IconRef{Kind: IconBootstrap, Name: "sunrise"}}},
},
{
name: "definitions are tried in order",
Expand All @@ -146,7 +146,7 @@ func TestBuildShifts(t *testing.T) {
{ID: "b", Match: "nachtfrüh", MatchMode: MatchEquals, Label: "B"},
},
days: 1,
want: []ShiftDay{{Date: "2026-03-10", DayLabel: "Heute", Title: "A", TimeRange: "04–06", Icon: def}},
want: []ShiftDay{{Date: "2026-03-10", DayLabel: "Heute", Title: "A", TimeRange: "04:00–06:00", Icon: def}},
},
{
name: "definition with an empty keyword never matches",
Expand Down Expand Up @@ -262,7 +262,7 @@ func TestBuildShiftsWorkDays(t *testing.T) {
if want := []string{"2026-10-27", "2026-10-29", "2026-10-30"}; !reflect.DeepEqual(dates(got), want) {
t.Fatalf("dates %v, want %v", dates(got), want)
}
if got[0].DayLabel != "Dienstag" || got[0].Title != "Frühdienst" || got[0].TimeRange != "06–14" || got[0].Free {
if got[0].DayLabel != "Dienstag" || got[0].Title != "Frühdienst" || got[0].TimeRange != "06:00–14:00" || got[0].Free {
t.Errorf("row 0 = %+v", got[0])
}
if got[1].DayLabel != "Donnerstag" || got[1].TimeRange != "14:00–22:30" {
Expand Down Expand Up @@ -340,11 +340,24 @@ func TestBuildShiftsWorkDays(t *testing.T) {
})
}

func TestFormatRangeHasNoSuffix(t *testing.T) {
if got := formatRange(6, 0, 14, 0); got != "06–14" {
t.Errorf("got %q", got)
func TestFormatRange(t *testing.T) {
tests := []struct {
name string
sh, sm, eh, em int
want string
}{
{"full hours", 11, 0, 19, 0, "11:00–19:00"},
{"early full hours", 6, 0, 14, 0, "06:00–14:00"},
{"minutes", 6, 30, 19, 0, "06:30–19:00"},
{"minutes at end", 6, 0, 14, 15, "06:00–14:15"},
{"overnight", 18, 30, 7, 0, "18:30–07:00"},
{"overnight full hours", 22, 0, 6, 0, "22:00–06:00"},
}
if got := formatRange(6, 30, 19, 0); got != "06:30–19:00" {
t.Errorf("got %q", got)
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := formatRange(tt.sh, tt.sm, tt.eh, tt.em); got != tt.want {
t.Errorf("got %q, want %q", got, tt.want)
}
})
}
}
4 changes: 2 additions & 2 deletions web/src/features/admin/calendar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ describe('calendar preview', () => {
title: 'Dienst',
type: 'shifts',
days: [
{ date: '2026-11-14', dayLabel: 'Heute', title: 'Frühdienst', timeRange: '06–14', icon: none, free: false, ongoing: true, highlightColor: '#ff8a65' },
{ date: '2026-11-14', dayLabel: 'Heute', title: 'Frühdienst', timeRange: '06:00–14:00', icon: none, free: false, ongoing: true, highlightColor: '#ff8a65' },
{ date: '2026-11-15', dayLabel: 'Morgen', title: 'frei', icon: none, free: true, ongoing: false },
],
},
Expand Down Expand Up @@ -446,7 +446,7 @@ describe('calendar preview', () => {
const shifts = within(screen.getByRole('group', { name: 'Vorschau Dienst' }))
expect(shifts.getByText('Frühdienst')).toBeInTheDocument()
// The time text carries the colour the server computed; rows without one stay plain.
expect(shifts.getByText('06–14')).toHaveStyle({ color: '#ff8a65' })
expect(shifts.getByText('06:00–14:00')).toHaveStyle({ color: '#ff8a65' })
expect(shifts.getByText('Heute')).toHaveStyle({ color: '#ff8a65' })
expect(shifts.getByText('Morgen').getAttribute('style') ?? '').not.toContain('color')
expect(shifts.getByText('frei')).toBeInTheDocument()
Expand Down
4 changes: 2 additions & 2 deletions web/src/features/modules/calendar/Widget.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ describe('calendar widget (shifts)', () => {
type: 'shifts',
days: [
{ date: '2026-11-14', dayLabel: 'Heute', title: 'Frühdienst', timeRange: '06:30–19:00', icon: { kind: 'bootstrap', name: 'sunrise' }, free: false, ongoing: true },
{ date: '2026-11-16', dayLabel: 'Montag', title: 'Spätdienst', timeRange: '14–22', icon: none, free: false, ongoing: false },
{ date: '2026-11-16', dayLabel: 'Montag', title: 'Spätdienst', timeRange: '14:00–22:00', icon: none, free: false, ongoing: false },
],
...parts,
})
Expand All @@ -220,7 +220,7 @@ describe('calendar widget (shifts)', () => {
expect(rows[0].querySelector('.mirror-agenda__title')).toHaveTextContent('Frühdienst')
expect(rows[0].querySelector('.mirror-agenda__time .mirror-agenda__relative')).toHaveTextContent('Heute 06:30–19:00')
expect(rows[0].querySelector('.mirror-agenda__symbol i')).toHaveClass('bi-sunrise')
expect(rows[1].querySelector('.mirror-agenda__relative')).toHaveTextContent('Montag 14–22')
expect(rows[1].querySelector('.mirror-agenda__relative')).toHaveTextContent('Montag 14:00–22:00')
expect(container.querySelector('.mirror-shifts')).toBeNull()
})

Expand Down
2 changes: 1 addition & 1 deletion web/src/shared/api/schema.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ export interface components {
dayLabel: string;
/** @description Shift name, the event title when no shift matches, or `frei`. */
title: string;
/** @description For example `06–14` or `06:30–19:00`; absent when unknown. */
/** @description For example `06:00–14:00` or `06:30–19:00`; absent when unknown. */
timeRange?: string;
icon: components["schemas"]["IconRef"];
free: boolean;
Expand Down
Loading