Skip to content

feat(frontend): show team leave on the Teraz screen - #400

Merged
lowicz merged 5 commits into
mainfrom
fm/oncall-leave-u-step2
Dec 2, 2026
Merged

lowicz merged 5 commits into
mainfrom
fm/oncall-leave-u-step2

Conversation

@lowicz

@lowicz lowicz commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Intent

The oncall project gained a new preference kind "U" (urlop, leave) in step 1 (PR 399, merged). The captain approved a 5-step plan; this is STEP 2: the panel "Urlopy" on the "Teraz" screen (T1), so the whole team sees who is on leave today and in the next 30 days. The approved design and decisions are in ~/firstmate/data/oncall-leave-u-scout/report.md (sections 4-9, 11 and 6.2 step 2, plan table in section 7), with critique evidence in data/oncall-leave-u-scout/critique/. Leave is team-visible only as "urlop", never with a reason or note (D14).

What the referenced report and critique say about this step, quoted so this text stands on its own:

Plan table (section 7): step 1 is U as the fourth kind end to end (merged). Step 2 is the panel "Urlopy" on "Teraz" (T1), size S. Step 3 is U in the past by coordinator or admin with the "dopisany po fakcie" tag, step 4 the overlap warning (T3), step 5 the morning e-mail (T5). Each step is dispatched separately; steps 3-5 are not part of this one.

T1, the panel (section 4.5): "Panel "Urlopy" on "Teraz", below the matrix. Header "Urlopy · najbliższe 30 dni". The first row answers today: "Dziś nikt nie jest na urlopie" or "Dziś na urlopie: Marek Nowak (do pt 11 gru)". Then one row per leave: U mark, name, range, working days; tags "trwa" and "4 dyżury bez zastępstwa"; one button "Pokaż pierwszą kolizję". Empty: one line, "Nikt nie ma urlopu w najbliższych 30 dniach." More than five leaves: five rows and "Pokaż wszystkie (8)". Loading: two skeleton rows; failure: the existing error state with retry; the rest of the screen never waits for the panel. The panel is named for what the app knows (leave) and never says that everyone is present."

The approved mock of the panel draws each row as the U mark and the name, under it "pon 7 – pt 11 gru · 5 dni roboczych", and on the right the tags and the button; on the live day, when the person on leave holds a duty today that nobody took over, the first row reads "Dziś na urlopie: Marek Nowak (do pt 11 gru) · ma SECONDARY i 11–19 bez zastępstwa". The option the captain chose (D8, T1) says: who is on leave today and in the next 30 days, with working days and the duties still to hand over; everyone who sees availability sees it (D4).

Section 11.3 on the panel: it is titled "Urlopy", not "Nieobecności"; the first row answers today; a one-line empty state; the tag says "bez zastępstwa"; one button to the first collision; loading, error and a cap on the rows. Reason: the app knows only leave.

Visibility (D4-A, section 4.3): the existing rule. Members, coordinators and admins see the kind; the note only its author, coordinators and admins; viewers and share links see no availability.

What U means (D14-A): any whole day away from work. The word stays "urlop"; the team sees only "urlop", never a reason; the app does not ask for one.

Default 7 (section 5): leave days are counted in Polish working days (the holiday calendar is already in the app), with the date range shown beside the count.

Impact of step 2 (section 6.2): "Frontend only if the panel reads the existing calendar query for today plus 30 days (it carries availability with the visibility rule already applied). That payload also carries 30 days of assignments the panel does not need; a dedicated read is the upgrade if it proves heavy. New: one component on screens/Duty.tsx, catalog strings, tests."

States of the panel from the critique (impeccable-harden.md, part B):

  • Nobody has leave in the next 30 days: the panel stays, one muted line. An empty list never looks broken.
  • Loading: the panel loads after the duty cards and never delays them: its own request, aria-busy, two skeleton rows.
  • Load error: the existing ErrorState with "Spróbuj ponownie" inside the panel only; the rest of Teraz is unaffected.
  • Many leaves: leaves that run today first (earliest end first), then upcoming by start date. Rows with duties to hand over are never cut off: they sort first inside their group.
  • Long names, narrow window: the name truncates with an ellipsis, the tag and the button drop to a second line.
  • A leave that continues past the 30-day window, or started before today: show the real dates, tag "trwa" while running, working days counted for the whole leave.
  • One holiday stored as several adjacent entries (painted in two strokes, or different notes): adjacent U entries of one person are shown as one row. A gap of a weekend or public holiday between two entries is still two rows.
  • The panel may hold only what the matrix cannot say at a glance: who is away today, working-day counts, leaves beyond the visible range, duties still to hand over. No avatars, no second calendar.
  • Viewer account or share link: sees no U anywhere, including no team panel.

Accessibility (section 4.7): leave is never colour alone; U goes through the existing availability mark, which carries a title and a visually hidden label. No motion is added.

The interface is Polish by default with English as the second language, and the user documentation exists in both.

What Changed

  • New "Urlopy" (Leave) panel under the schedule on the Teraz screen. It says who is on leave today, then lists every leave in the next 30 days with full dates, Polish working days, an "ongoing" tag, the number of duties with no cover and a button to the first conflict. Leaves with uncovered duties are always listed; of the rest, five show before "Show all". The panel loads on its own, so the rest of the screen never waits for it. Viewer accounts and share links do not get it.
  • The calendar API response has a new leaves list. Leave entries on back-to-back days are joined into one leave. Each leave keeps its full dates even when it goes past the requested range. It carries the working-day count and the duties the person still holds, counted from the start of the range, and no note. It follows the existing availability visibility rule.
  • Supporting changes: Polish and English interface text, user documentation in both languages, a note in DESIGN.md, the OpenAPI snapshot, and new backend and frontend tests with Polish screen snapshots.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change adds a read-only panel and a calendar field that uses the existing visibility rule, so viewers and share links get no team leave and no note is added; both earlier review decisions (whole leaves, and never hiding open duties) are implemented at the API and panel level.

Testing

I ran the real app with a throwaway database and drove the panel in a browser. All 12 scenarios passed: who sees it, its content, order, limit, page states, phone layout, English and help text. Test leaves that began in the past, and some other test data, went straight into the database because the app cannot enter past days. Handovers went through the real API, not the dialog. No automated tests were run. Two early attempts failed only because of my scripts (a reason text that was too short and a wrong page selector), and both passed when redone. The one note is an older phone-width problem outside the panel. Everything I started is stopped and cleaned up.

  • Live validation: ✅ go - 12 of 12 scenarios driven live against the product
Scenario Result Live Evidence
A member opens Teraz and the first row says who is away today, until when, and which duties today have no cover ✅ pass live 01-member-teraz-full.png. The row reads: "Dziś na urlopie: Marek Nowak (do pt 4 gru) · ma SECONDARY i 11–19 bez zastępstwa, Ola Wiśniewska (do śr 2 gru)".
Each leave is one row with its real whole dates and working days, even when it began earlier, goes past 30 days, or was entered in two parts ✅ pass live 02-member-panel-short.png and 13-two-strokes-one-row.png. Marek: 30 Nov - 4 Dec, 5 days. Anna: 28 Dec - 8 Jan, 8 days (New Year and Epiphany not counted). Filip: 22 - 31 Dec, 6 days. Leave on Friday a…
The 30-day edges hold: 1 January is listed; 2 January, a leave that ended yesterday and "nie mogę" entries are not ✅ pass live 03-member-panel-all.png and 17-empty.png.
Order and limit: running leaves first, open duties first in each group, and no leave with open duties is ever hidden ✅ pass live 02-member-panel-short.png, 03-member-panel-all.png, 15-cap-keeps-open-duties.png. All 4 leaves with open duties plus 5 others show, then "Pokaż wszystkie (11)". Five quiet running leaves do not hide a…
"Pokaż pierwszą kolizję" opens the Schedule on the first uncovered day ✅ pass live 04-collision-marek.png (2 Dec) and 05-collision-anna-29dec.png (29 Dec).
After a duty is handed over, the panel's warnings go down or disappear ✅ pass live 11-after-handover.png: Anna goes from 3 to 2 and her button moves to 4 January. 14-today-secondary-covered.png: Marek's warning and button are gone.
Viewer accounts and share links see no leave and no panel, and nobody's note appears in the panel ✅ pass live 06-viewer.png and 12-share-link.png: no panel, and the API returns empty leave and availability lists. The secret note text was absent for member, coordinator and admin.
While the panel loads or fails, the rest of Teraz works, and retry brings the rows back ✅ pass live 07-loading.png (two skeleton rows, aria-busy) and 08-error.png. Retry loaded all 11 leave rows.
With nobody away today, or no leave at all, the panel says so in one line and stays on screen ✅ pass live 16-nobody-today.png and 17-empty.png.
On a phone or tablet, a long name is cut with an ellipsis and the tags and button stay inside the panel ✅ pass live 10-phone-390.png, 10-phone-320.png, 10-light-tablet-820.png and the two 76-char-name pictures.
The leave mark has a title and hidden text, so colour is never the only sign ✅ pass live Live page HTML: a span with title="Urlop" showing U, followed by a span class="sr-only" with "Urlop". Links read "Pokaż pierwszą kolizję: Marek Nowak, śr 2 gru".
An English user sees the panel in English, and the help pages describe it in both languages ✅ pass live 09-english.png, 18-docs-pl.png and 19-docs-en.png.

Teraz screen for a member, panel below the matrix

Panel before "Pokaż wszystkie"

Panel after "Pokaż wszystkie (11)"

First collision opens 2 December

First collision opens 29 December

Viewer account: no panel

Loading: two skeleton rows, rest of screen ready

Load error with retry, rest of screen fine

English panel

820 px, light theme, long name cut

Phone 390 px, dark

Phone 320 px, light

Phone 390 px, only the panel shown, 76-character name

Phone 320 px, only the panel shown, 76-character name

Duty count lower after one handover

Share link: no panel

Two strokes shown as one row

Today's duties covered, warning gone

Open duties stay visible past five rows

Nobody on leave today

Empty panel

Polish help page

English help page

  • Outcome: ⚠️ 1 info across 1 run (4m37s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 info
  • ℹ️ frontend/src/styles.css - This is a separate problem, and the leave panel does not cause it. On a 390 px phone, "Teraz" scrolls sideways (667 px wide) when someone on duty has a name of 76 characters with no spaces, such as an e-mail address. Hiding the new panel leaves the width at 667 px. The wide parts are the duty cards (.dcard-next) and the day list (.dayrow-role, .dayrow-rs). The panel alone fits at 390 and 320 px with that name. A long name with spaces (Bartłomiej Aleksander Wiśniewski-Kowalczykowski) causes no sideways scroll. A possible later fix is to let those two lists break long words.
  • Live validation: ✅ go - 12 of 12 scenarios driven live against the product
Scenario Result Live Evidence
A member opens Teraz and the first row says who is away today, until when, and which duties today have no cover ✅ pass live 01-member-teraz-full.png. The row reads: "Dziś na urlopie: Marek Nowak (do pt 4 gru) · ma SECONDARY i 11–19 bez zastępstwa, Ola Wiśniewska (do śr 2 gru)".
Each leave is one row with its real whole dates and working days, even when it began earlier, goes past 30 days, or was entered in two parts ✅ pass live 02-member-panel-short.png and 13-two-strokes-one-row.png. Marek: 30 Nov - 4 Dec, 5 days. Anna: 28 Dec - 8 Jan, 8 days (New Year and Epiphany not counted). Filip: 22 - 31 Dec, 6 days. Leave on Friday a…
The 30-day edges hold: 1 January is listed; 2 January, a leave that ended yesterday and "nie mogę" entries are not ✅ pass live 03-member-panel-all.png and 17-empty.png.
Order and limit: running leaves first, open duties first in each group, and no leave with open duties is ever hidden ✅ pass live 02-member-panel-short.png, 03-member-panel-all.png, 15-cap-keeps-open-duties.png. All 4 leaves with open duties plus 5 others show, then "Pokaż wszystkie (11)". Five quiet running leaves do not hide a…
"Pokaż pierwszą kolizję" opens the Schedule on the first uncovered day ✅ pass live 04-collision-marek.png (2 Dec) and 05-collision-anna-29dec.png (29 Dec).
After a duty is handed over, the panel's warnings go down or disappear ✅ pass live 11-after-handover.png: Anna goes from 3 to 2 and her button moves to 4 January. 14-today-secondary-covered.png: Marek's warning and button are gone.
Viewer accounts and share links see no leave and no panel, and nobody's note appears in the panel ✅ pass live 06-viewer.png and 12-share-link.png: no panel, and the API returns empty leave and availability lists. The secret note text was absent for member, coordinator and admin.
While the panel loads or fails, the rest of Teraz works, and retry brings the rows back ✅ pass live 07-loading.png (two skeleton rows, aria-busy) and 08-error.png. Retry loaded all 11 leave rows.
With nobody away today, or no leave at all, the panel says so in one line and stays on screen ✅ pass live 16-nobody-today.png and 17-empty.png.
On a phone or tablet, a long name is cut with an ellipsis and the tags and button stay inside the panel ✅ pass live 10-phone-390.png, 10-phone-320.png, 10-light-tablet-820.png and the two 76-char-name pictures.
The leave mark has a title and hidden text, so colour is never the only sign ✅ pass live Live page HTML: a span with title="Urlop" showing U, followed by a span class="sr-only" with "Urlop". Links read "Pokaż pierwszą kolizję: Marek Nowak, śr 2 gru".
An English user sees the panel in English, and the help pages describe it in both languages ✅ pass live 09-english.png, 18-docs-pl.png and 19-docs-en.png.
  • Real app: Postgres 18.7 in a throwaway container, alembic upgrade head, uvicorn oncall.main:app, npm run build (exit 0) and vite preview, driven in Chromium with Playwright
  • Signed in as member, coordinator, admin and viewer, and opened a real share link; compared the screen with the calendar API answer
  • Read every panel row for a test team with 11 leaves: dates, working days, tags, order, the limit and "Pokaż wszystkie"
  • Clicked "Pokaż pierwszą kolizję" and checked which day opened
  • Added leave in two strokes through PUT /api/v1/availability/me/range
  • Handed over duties through POST /api/v1/calendar/override and reloaded the panel
  • Delayed, then blocked, only the panel's request, and pressed the retry button
  • Checked empty, nobody today, English, light and dark themes, and widths 1280, 820, 390 and 320 px
  • Opened the Polish and English help pages
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Under the schedule on "Teraz" the team sees who is on leave today and in
the next 30 days. The first row answers today; then every leave has one
row with its whole dates, its working days, the tag "trwa" while it runs
and, when the person holds duties inside it, how many have no cover and a
button to the first such day.

- the panel reads the calendar for today plus 30 days on its own, so the
  rest of the screen never waits for it; it has its own loading rows,
  error state with retry, one-line empty state and a cut after five rows
- entries that touch are one leave, entries a weekend apart are two;
  running leaves come first, and a leave with open duties leads its group
- leave only, never a note or a reason, and nothing for a viewer account
  or a share link
- the calendar's availability entries gain `entry_working_days`: the
  holiday calendar lives in the API, so only it can count the working
  days of a leave that reaches past the days read
- docs in both languages and DESIGN.md describe the panel
SonarCloud asked for the element that carries the status role by itself
instead of a div with `role="status"` (S6819); the other status lines of
the app already use it.

Also let a display name that is one long word break in the line that
answers today: at phone width it ran past the panel's edge, as the
pipeline's browser check of the previous run found.
@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

@lowicz
lowicz merged commit a667d38 into main Dec 2, 2026
18 checks passed
@lowicz
lowicz deleted the fm/oncall-leave-u-step2 branch December 2, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant