diff --git a/.env.example b/.env.example
index 82dedcb4..3e8c67ad 100644
--- a/.env.example
+++ b/.env.example
@@ -15,6 +15,17 @@ ONCALL_VERSION=
ONCALL_APP_NAME=On-call
ONCALL_APP_SUBTITLE=
+# Optional decoration of the interface, off while this is empty. List the
+# packs once and leave the line alone: each knows its own days. `winter` (a
+# hat on the logo, lights and snow on the "Teraz" strip, a winter night on the
+# sign-in screen, a sleigh on the generator's progress bar) shows from
+# 6 December to 6 January; `doodles` puts a small drawing on the logo on seven
+# days of the year. Both: ONCALL_ACCENT=winter,doodles
+ONCALL_ACCENT=
+# Another winter season, as MM-DD, both or neither; it may run across New Year.
+# ONCALL_ACCENT_FROM=12-01
+# ONCALL_ACCENT_UNTIL=01-06
+
# Local development default, publicly known. Every non-local host sets a unique
# POSTGRES_PASSWORD (below) before the first start and the same password here;
# user and database match POSTGRES_USER and POSTGRES_DB. Changing it on an
diff --git a/DESIGN.md b/DESIGN.md
index 67305d04..ebe12034 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -556,6 +556,40 @@ in the light theme), today a 12 % blue wash and the day-number pill in
action blue, a gap in staffing a pink wash. In the sticky header every wash
lies on an opaque `s2`. The start of a week is a 2 px left line.
+## Seasonal accent
+An opt-in exception to the calm of everything above, off unless the
+deployment sets `ONCALL_ACCENT` (`docs/wdrozenie/uruchomienie.md`, "Ozdoby
+sezonowe"). The API names what today carries, the shell and the sign-in
+screen write it to `data-accent` on `` (`src/accent.ts`), and every
+drawing lives in one lazily loaded chunk with its own stylesheet
+(`src/decor/`).
+
+`winter` puts a hat on the logo mark, snow inside the "Teraz" strip and a
+garland of lights under it, a night sky with a tree of role marks on the
+sign-in screen, and a sleigh ahead of the generator's progress bar.
+`doodles` puts one small drawing on the logo mark on seven days of the year.
+The garland and the snow of the strip are on the desktop "Teraz" strip only:
+the top bar of a phone shows only the hat or the day's doodle on the mark,
+because a garland under that sticky bar would cover content.
+
+### Named Rules
+**The Frame, Not the Instrument Rule.** The accent decorates the frame: the
+rail, the strip, the sign-in screen, a progress bar. It never draws on the
+duty matrix, never covers text or a control, and never borrows a role or
+state colour as a state.
+**The Decoration Only Rule.** Every drawing carries the class `fx`, is
+`aria-hidden`, takes no pointer events and takes its colours from
+`tokens.css`: the accent's own `--fx-*` ones, and the palette where they
+already match. `decor.css` styles it on a screen only, so a printout, the
+e-mails and the exports are the plain interface.
+**The Stillness Rule.** Nothing of it moves under `prefers-reduced-motion`
+(the snow is a still scatter of flakes), and what moves without end (the
+snow and the lights of the strip) can be turned off by each person in the
+account menu. The sign-in screen, which has no such switch yet, stops moving
+by itself.
+**The Insiders Rule.** A share-link session, opened by people outside the
+team, is never decorated.
+
## Do's and Don'ts
### Do:
@@ -583,7 +617,8 @@ lies on an opaque `s2`. The start of a week is a 2 px left line.
- **Don't** use the action blue as a text colour or a section background;
the text blue is `--sig`.
- **Don't** introduce a second accent, gradients (apart from the radial
- sign-in background) or coloured icons; icons are monochrome, 24 px.
+ sign-in background) or coloured icons; icons are monochrome, 24 px. The
+ one exception is the opt-in seasonal accent, under its own rules above.
- **Don't** add a component library or custom date pickers; fields are
native (`AGENTS.md`).
- **Don't** format numbers or name days inside a component; everything
diff --git a/backend/contracts/openapi.json b/backend/contracts/openapi.json
index 73c831ec..6635e85b 100644
--- a/backend/contracts/openapi.json
+++ b/backend/contracts/openapi.json
@@ -3408,6 +3408,21 @@
"PublicConfigResponse": {
"description": "Instance settings the UI needs before anyone is logged in.",
"properties": {
+ "accent": {
+ "items": {
+ "enum": [
+ "winter",
+ "sparkle",
+ "doughnut",
+ "heart",
+ "egg",
+ "flip"
+ ],
+ "type": "string"
+ },
+ "title": "Accent",
+ "type": "array"
+ },
"app_name": {
"title": "App Name",
"type": "string"
@@ -3446,6 +3461,7 @@
"sso_enabled",
"app_name",
"app_subtitle",
+ "accent",
"version",
"audit_retention_days",
"login_audit_retention_days",
diff --git a/backend/src/oncall/accent.py b/backend/src/oncall/accent.py
new file mode 100644
index 00000000..8d29aaf7
--- /dev/null
+++ b/backend/src/oncall/accent.py
@@ -0,0 +1,70 @@
+"""The opt-in seasonal accent: which decorations the interface draws today.
+
+A deployment lists packs in ``ONCALL_ACCENT``; none is the default. Each pack
+carries its own calendar, so the setting is written once and left, and the
+answer changes with the Warsaw business date: ``winter`` holds through its
+season, ``doodles`` names the one drawing its day puts on the logo mark.
+The interface draws what ``/api/v1/config`` lists and keeps no calendar of
+its own.
+"""
+
+from collections.abc import Collection
+from datetime import date, timedelta
+from typing import Literal
+
+from oncall.workdays import polish_holidays
+
+#: What a deployment may list in ONCALL_ACCENT.
+AccentPack = Literal["winter", "doodles"]
+#: What the interface may be told to draw: `winter`, or the day's doodle.
+Accent = Literal["winter", "sparkle", "doughnut", "heart", "egg", "flip"]
+
+#: The winter season of a deployment that names no bounds of its own, as
+#: inclusive MM-DD: St Nicholas' Day to Epiphany.
+WINTER_SEASON = ("12-06", "01-06")
+
+#: Fat Thursday, the last Thursday before Lent.
+_FAT_THURSDAY_BEFORE_EASTER = timedelta(days=52)
+
+
+def easter_sunday(year: int) -> date:
+ """Easter by the statutory calendar, where its Sunday and Monday are the
+ only holidays between the earliest and the latest date Easter can have."""
+ return min(polish_holidays(date(year, 3, 22), date(year, 4, 25)))
+
+
+def in_season(day: date, starts: str, ends: str) -> bool:
+ """Whether the day lies within inclusive MM-DD bounds. A season that
+ starts later in the year than it ends runs across New Year."""
+ today = day.strftime("%m-%d")
+ if starts <= ends:
+ return starts <= today <= ends
+ return today >= starts or today <= ends
+
+
+def doodle_of(day: date) -> Accent | None:
+ """The drawing this day puts on the logo mark, on the seven days that
+ have one. A movable feast wins the day it shares with a fixed one."""
+ easter = easter_sunday(day.year)
+ month_day = (day.month, day.day)
+ if month_day in ((12, 31), (1, 1)):
+ return "sparkle"
+ if day == easter - _FAT_THURSDAY_BEFORE_EASTER:
+ return "doughnut"
+ if month_day == (2, 14):
+ return "heart"
+ if easter <= day <= easter + timedelta(days=1):
+ return "egg"
+ if month_day == (4, 1):
+ return "flip"
+ return None
+
+
+def accents_on(day: date, packs: Collection[str], season: tuple[str, str]) -> list[Accent]:
+ """What the listed packs draw on this day; `season` bounds `winter` only."""
+ active: list[Accent] = []
+ if "winter" in packs and in_season(day, *season):
+ active.append("winter")
+ if "doodles" in packs and (doodle := doodle_of(day)):
+ active.append(doodle)
+ return active
diff --git a/backend/src/oncall/config.py b/backend/src/oncall/config.py
index 4ba4e258..d37bfc97 100644
--- a/backend/src/oncall/config.py
+++ b/backend/src/oncall/config.py
@@ -1,12 +1,16 @@
import os
+import re
+from datetime import date
from functools import lru_cache
from math import ceil
from pathlib import Path
-from typing import Self
+from typing import Annotated, Self
from cryptography.fernet import Fernet
from pydantic import Field, SecretStr, field_validator, model_validator
-from pydantic_settings import BaseSettings, SettingsConfigDict
+from pydantic_settings import BaseSettings, NoDecode, SettingsConfigDict
+
+from oncall.accent import WINTER_SEASON, AccentPack
CGROUP_ROOT = Path("/sys/fs/cgroup")
@@ -73,6 +77,16 @@ class Settings(BaseSettings):
#: public repository carries no organisation name.
app_name: str = "On-call"
app_subtitle: str = ""
+ #: Opt-in decoration of the interface (`oncall.accent`): the packs this
+ #: deployment allows, comma-separated. Empty, the default, draws nothing.
+ #: It is written once and left, because each pack knows its own days:
+ #: `winter` holds through its season, 6 December to 6 January unless both
+ #: bounds below name another (MM-DD, inclusive, across New Year when the
+ #: first is the later date); `doodles` puts a small drawing on the logo
+ #: mark on seven days of the year and ignores the bounds.
+ accent: Annotated[tuple[AccentPack, ...], NoDecode] = ()
+ accent_from: str = ""
+ accent_until: str = ""
#: The release this process runs, shown in the interface. The image bakes
#: in the git tag it was built from (backend/Dockerfile, ARG ONCALL_VERSION
#: from release.yml), so this names what really runs even when the host's
@@ -256,6 +270,32 @@ def _blank_version_means_dev(cls, value: str) -> str:
"""An empty ONCALL_VERSION (a copied .env with the line unset) is a dev build."""
return value.strip() or DEV_VERSION
+ @field_validator("accent", mode="before")
+ @classmethod
+ def _accent_is_a_comma_separated_list(cls, value: object) -> object:
+ """`winter,doodles` as the environment writes it; blank is none."""
+ if isinstance(value, str):
+ return tuple(name.strip() for name in value.split(",")) if value.strip() else ()
+ return value
+
+ @field_validator("accent_from", "accent_until")
+ @classmethod
+ def _accent_bound_is_a_day_of_the_year(cls, value: str) -> str:
+ """Blank is unset; anything else is a day of the year, 29 February
+ included, in two digits each so two bounds compare as text."""
+ if not value.strip():
+ return ""
+ try:
+ if not re.fullmatch(r"\d{2}-\d{2}", value, re.ASCII):
+ raise ValueError
+ date.fromisoformat(f"2000-{value}")
+ except ValueError:
+ raise ValueError(
+ "ONCALL_ACCENT_FROM and ONCALL_ACCENT_UNTIL are days of the year written "
+ "MM-DD, such as 12-06."
+ ) from None
+ return value
+
@field_validator("solver_workers", mode="before")
@classmethod
def _blank_solver_workers_is_unset(cls, value: object) -> object:
@@ -316,6 +356,17 @@ def _secrets_key_is_fernet_keys(cls, value: SecretStr | None) -> SecretStr | Non
) from None
return SecretStr(",".join(keys))
+ @model_validator(mode="after")
+ def _accent_bounds_come_in_pairs(self) -> Self:
+ """Half a season has no meaning, and guessing the other half would
+ decorate on days nobody chose."""
+ if bool(self.accent_from) != bool(self.accent_until):
+ raise ValueError(
+ "Set both ONCALL_ACCENT_FROM and ONCALL_ACCENT_UNTIL to move the winter "
+ "season, or leave both empty for 6 December to 6 January."
+ )
+ return self
+
@model_validator(mode="after")
def _smtp_credentials_come_in_pairs(self) -> Self:
"""A username alone would log in with an empty password, and a
@@ -367,6 +418,12 @@ def _https_requires_secure_cookie(self) -> Self:
)
return self
+ @property
+ def accent_season(self) -> tuple[str, str]:
+ """The inclusive MM-DD bounds of `winter`: this deployment's own, or
+ the pack's."""
+ return (self.accent_from, self.accent_until) if self.accent_from else WINTER_SEASON
+
@lru_cache
def get_settings() -> Settings:
diff --git a/backend/src/oncall/presentation/system.py b/backend/src/oncall/presentation/system.py
index 96fb0aa3..ad98e039 100644
--- a/backend/src/oncall/presentation/system.py
+++ b/backend/src/oncall/presentation/system.py
@@ -2,6 +2,8 @@
from pydantic import BaseModel
+from oncall.accent import Accent
+
class HealthResponse(BaseModel):
status: str = "ok"
@@ -16,6 +18,10 @@ class PublicConfigResponse(BaseModel):
#: Brand shown before login: the product name and its optional subtitle.
app_name: str
app_subtitle: str
+ #: The decorations to draw today (`oncall.accent`): `winter` through its
+ #: season, and the day's doodle for the logo mark. Empty on every day of
+ #: a deployment that lists no pack.
+ accent: list[Accent]
#: The release running, as its image was built: `1.2.0`, `1.3.0-rc.1`,
#: or `dev` for a build from a checkout.
version: str
diff --git a/backend/src/oncall/routes/system.py b/backend/src/oncall/routes/system.py
index 2fead7de..3251fa4a 100644
--- a/backend/src/oncall/routes/system.py
+++ b/backend/src/oncall/routes/system.py
@@ -1,6 +1,8 @@
from fastapi import APIRouter
+from oncall.accent import accents_on
from oncall.config import get_settings
+from oncall.domain.clock import business_today
from oncall.notifications.service import UNDO_WINDOW
from oncall.presentation.system import HealthResponse, PublicConfigResponse
@@ -20,6 +22,7 @@ async def public_config() -> PublicConfigResponse:
sso_enabled=settings.sso_enabled,
app_name=settings.app_name,
app_subtitle=settings.app_subtitle,
+ accent=accents_on(business_today(), settings.accent, settings.accent_season),
version=settings.version,
audit_retention_days=settings.retention_audit_days,
login_audit_retention_days=settings.retention_login_audit_days,
diff --git a/backend/tests/contract/test_http_contract.py b/backend/tests/contract/test_http_contract.py
index 90b75888..2a65b38d 100644
--- a/backend/tests/contract/test_http_contract.py
+++ b/backend/tests/contract/test_http_contract.py
@@ -33,6 +33,7 @@ async def test_public_response_and_validation_envelopes(client) -> None:
"sso_enabled": False,
"app_name": "On-call",
"app_subtitle": "",
+ "accent": [],
"version": "dev",
"audit_retention_days": 365,
"login_audit_retention_days": 90,
diff --git a/backend/tests/test_accent.py b/backend/tests/test_accent.py
new file mode 100644
index 00000000..61ff573b
--- /dev/null
+++ b/backend/tests/test_accent.py
@@ -0,0 +1,153 @@
+"""The seasonal accent: which decorations a day carries, and how a
+deployment's setting reaches the interface."""
+
+from datetime import UTC, date, datetime
+
+import pytest
+
+from oncall.accent import WINTER_SEASON, accents_on, doodle_of, easter_sunday, in_season
+from oncall.config import Settings
+from oncall.routes import system
+from tests.frozen_clock import FrozenClock
+
+
+@pytest.mark.parametrize(
+ "easter",
+ [
+ date(2008, 3, 23),
+ date(2024, 3, 31),
+ date(2026, 4, 5),
+ date(2027, 3, 28),
+ date(2029, 4, 1),
+ date(2038, 4, 25),
+ ],
+ ids=str,
+)
+def test_easter_sunday_is_the_known_date(easter: date) -> None:
+ assert easter_sunday(easter.year) == easter
+
+
+@pytest.mark.parametrize(
+ ("day", "inside"),
+ [
+ (date(2026, 12, 5), False),
+ (date(2026, 12, 6), True),
+ (date(2026, 12, 31), True),
+ (date(2027, 1, 1), True),
+ (date(2027, 1, 6), True),
+ (date(2027, 1, 7), False),
+ (date(2027, 6, 17), False),
+ ],
+ ids=str,
+)
+def test_the_winter_season_runs_across_new_year_with_both_ends_included(
+ day: date, inside: bool
+) -> None:
+ assert in_season(day, *WINTER_SEASON) is inside
+
+
+@pytest.mark.parametrize(
+ ("day", "inside"),
+ [
+ (date(2027, 1, 31), False),
+ (date(2027, 2, 1), True),
+ (date(2028, 2, 29), True),
+ (date(2027, 3, 1), False),
+ ],
+ ids=str,
+)
+def test_a_season_inside_one_year_does_not_wrap(day: date, inside: bool) -> None:
+ assert in_season(day, "02-01", "02-29") is inside
+
+
+@pytest.mark.parametrize(
+ ("day", "doodle"),
+ [
+ (date(2026, 12, 31), "sparkle"),
+ (date(2027, 1, 1), "sparkle"),
+ (date(2027, 2, 4), "doughnut"),
+ (date(2027, 2, 14), "heart"),
+ (date(2027, 3, 28), "egg"),
+ (date(2027, 3, 29), "egg"),
+ (date(2027, 4, 1), "flip"),
+ (date(2027, 3, 30), None),
+ (date(2027, 6, 17), None),
+ ],
+ ids=str,
+)
+def test_seven_days_of_a_year_carry_a_doodle(day: date, doodle: str | None) -> None:
+ assert doodle_of(day) == doodle
+
+
+def test_a_movable_feast_wins_the_day_it_shares_with_a_fixed_one() -> None:
+ # Easter Sunday on 1 April, and Fat Thursday on 14 February.
+ assert doodle_of(date(2029, 4, 1)) == "egg"
+ assert easter_sunday(2075) == date(2075, 4, 7)
+ assert doodle_of(date(2075, 2, 14)) == "doughnut"
+
+
+def test_no_pack_draws_nothing_on_any_day() -> None:
+ assert accents_on(date(2026, 12, 24), (), WINTER_SEASON) == []
+ assert accents_on(date(2027, 1, 1), (), WINTER_SEASON) == []
+
+
+def test_each_pack_answers_for_its_own_days() -> None:
+ both = ("winter", "doodles")
+ assert accents_on(date(2026, 12, 24), both, WINTER_SEASON) == ["winter"]
+ assert accents_on(date(2027, 1, 1), both, WINTER_SEASON) == ["winter", "sparkle"]
+ assert accents_on(date(2027, 2, 4), both, WINTER_SEASON) == ["doughnut"]
+ assert accents_on(date(2027, 6, 17), both, WINTER_SEASON) == []
+ assert accents_on(date(2027, 1, 1), ("winter",), WINTER_SEASON) == ["winter"]
+ assert accents_on(date(2027, 1, 1), ("doodles",), WINTER_SEASON) == ["sparkle"]
+
+
+def test_a_season_of_the_deployments_own_moves_winter_and_leaves_the_doodles() -> None:
+ both = ("winter", "doodles")
+ assert accents_on(date(2026, 12, 1), both, ("12-01", "12-26")) == ["winter"]
+ assert accents_on(date(2027, 1, 1), both, ("12-01", "12-26")) == ["sparkle"]
+
+
+async def _accent_served(client, monkeypatch, settings: Settings, instant: datetime) -> list[str]:
+ monkeypatch.setattr(system, "get_settings", lambda: settings)
+ monkeypatch.setattr("oncall.domain.clock.system_clock", FrozenClock(instant))
+ response = await client.get("/api/v1/config")
+ assert response.status_code == 200
+ return response.json()["accent"]
+
+
+async def test_the_interface_is_told_nothing_unless_the_deployment_opts_in(
+ client, monkeypatch
+) -> None:
+ christmas_eve = datetime(2026, 12, 24, 12, 0, tzinfo=UTC)
+
+ assert await _accent_served(client, monkeypatch, Settings(), christmas_eve) == []
+ assert await _accent_served(
+ client, monkeypatch, Settings(accent="winter,doodles"), christmas_eve
+ ) == ["winter"]
+
+
+async def test_the_season_starts_with_the_warsaw_day_not_the_utc_one(client, monkeypatch) -> None:
+ settings = Settings(accent="winter")
+
+ # 23:30 UTC on the fifth is already half past midnight on the sixth in Warsaw.
+ still_fifth = datetime(2026, 12, 5, 22, 30, tzinfo=UTC)
+ already_sixth = datetime(2026, 12, 5, 23, 30, tzinfo=UTC)
+
+ assert await _accent_served(client, monkeypatch, settings, still_fifth) == []
+ assert await _accent_served(client, monkeypatch, settings, already_sixth) == ["winter"]
+
+
+async def test_the_deployments_own_season_decides_when_winter_is_served(
+ client, monkeypatch
+) -> None:
+ settings = Settings(accent="winter", accent_from="12-01", accent_until="12-26")
+
+ assert await _accent_served(
+ client, monkeypatch, settings, datetime(2026, 12, 2, 12, 0, tzinfo=UTC)
+ ) == ["winter"]
+ assert (
+ await _accent_served(
+ client, monkeypatch, settings, datetime(2026, 12, 27, 12, 0, tzinfo=UTC)
+ )
+ == []
+ )
diff --git a/backend/tests/test_config.py b/backend/tests/test_config.py
index bdf437d5..10b2d492 100644
--- a/backend/tests/test_config.py
+++ b/backend/tests/test_config.py
@@ -311,6 +311,85 @@ def test_a_refused_setting_does_not_echo_the_configuration(monkeypatch) -> None:
assert "hunter2-do-not-log" not in str(refused.value)
+def test_the_accent_is_off_by_default() -> None:
+ settings = Settings()
+
+ assert settings.accent == ()
+ assert settings.accent_season == ("12-06", "01-06")
+
+
+@pytest.mark.parametrize("blank", ["", " "], ids=["empty", "spaces"])
+def test_a_blank_accent_is_none(monkeypatch, blank: str) -> None:
+ monkeypatch.setenv("ONCALL_ACCENT", blank)
+ monkeypatch.setenv("ONCALL_ACCENT_FROM", " ")
+ monkeypatch.setenv("ONCALL_ACCENT_UNTIL", "")
+
+ settings = Settings()
+
+ assert settings.accent == ()
+ assert settings.accent_season == ("12-06", "01-06")
+
+
+def test_the_accent_lists_packs_separated_by_commas(monkeypatch) -> None:
+ monkeypatch.setenv("ONCALL_ACCENT", " winter, doodles ")
+
+ assert Settings().accent == ("winter", "doodles")
+ assert Settings(accent=("doodles",)).accent == ("doodles",)
+
+
+def test_an_unknown_accent_pack_is_refused_without_echoing_it(monkeypatch) -> None:
+ monkeypatch.setenv("ONCALL_ACCENT", "winter,halloween-do-not-log")
+
+ with pytest.raises(ValidationError) as refused:
+ Settings()
+
+ assert "'winter' or 'doodles'" in str(refused.value)
+ assert "halloween-do-not-log" not in str(refused.value)
+
+
+@pytest.mark.parametrize("names", ["Winter", "WINTER,doodles", "winter,", " , "])
+def test_an_accent_pack_is_named_exactly(monkeypatch, names: str) -> None:
+ monkeypatch.setenv("ONCALL_ACCENT", names)
+
+ with pytest.raises(ValidationError, match="'winter' or 'doodles'"):
+ Settings()
+
+
+def test_a_deployment_may_name_its_own_winter_season() -> None:
+ settings = Settings(accent="winter", accent_from="12-01", accent_until="02-29")
+
+ assert settings.accent_season == ("12-01", "02-29")
+
+
+@pytest.mark.parametrize(
+ "bound",
+ [
+ "13-01",
+ "02-30",
+ "6 Dec",
+ "12-06-2026",
+ "1206",
+ "12-1",
+ "2-29",
+ " 12-06 ",
+ "12-06\n",
+ "W12-6",
+ "١٢-٠٦",
+ ],
+)
+def test_an_accent_bound_must_be_a_day_of_the_year(bound: str) -> None:
+ with pytest.raises(ValidationError, match="written MM-DD"):
+ Settings(accent_from=bound, accent_until="01-06")
+
+
+@pytest.mark.parametrize(
+ ("starts", "ends"), [("12-01", ""), ("", "01-06")], ids=["no end", "no start"]
+)
+def test_half_an_accent_season_is_refused(starts: str, ends: str) -> None:
+ with pytest.raises(ValidationError, match="Set both ONCALL_ACCENT_FROM"):
+ Settings(accent_from=starts, accent_until=ends)
+
+
@pytest.mark.parametrize("blank", ["", " "], ids=["empty", "spaces"])
def test_blank_solver_workers_leaves_the_count_to_the_cpu_allocation(monkeypatch, blank) -> None:
"""Compose passes an unset ONCALL_SOLVER_WORKERS as an empty string."""
diff --git a/docker-compose.yml b/docker-compose.yml
index 1eafae55..a6f92816 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -97,6 +97,9 @@ services:
environment:
ONCALL_APP_NAME: ${ONCALL_APP_NAME:-On-call}
ONCALL_APP_SUBTITLE: ${ONCALL_APP_SUBTITLE:-}
+ ONCALL_ACCENT: ${ONCALL_ACCENT:-}
+ ONCALL_ACCENT_FROM: ${ONCALL_ACCENT_FROM:-}
+ ONCALL_ACCENT_UNTIL: ${ONCALL_ACCENT_UNTIL:-}
ONCALL_DATABASE_URL: ${ONCALL_DATABASE_URL:-postgresql+asyncpg://oncall:oncall@db:5432/oncall}
ONCALL_DATABASE_POOL_SIZE: ${ONCALL_DATABASE_POOL_SIZE:-3}
ONCALL_DATABASE_MAX_OVERFLOW: ${ONCALL_DATABASE_MAX_OVERFLOW:-2}
diff --git a/docs/en/uzytkownik/pierwsze-kroki.md b/docs/en/uzytkownik/pierwsze-kroki.md
index f6eae6f9..8254afb3 100644
--- a/docs/en/uzytkownik/pierwsze-kroki.md
+++ b/docs/en/uzytkownik/pierwsze-kroki.md
@@ -90,6 +90,11 @@ choice is remembered in the browser, also covers messages from the server
in the chosen language; a new user always starts in Polish, regardless of
the browser settings.
+If the administrator has turned seasonal decorations on (winter ones, for
+example), then on the days they show, the same place offers **Decorations**:
+**On** (the default) or **Off**. The choice applies to your browser only and
+is remembered there.
+
## Date format
Dates in the application are displayed as **`DD-MM-YYYY`**, regardless of the
diff --git a/docs/en/wdrozenie/uruchomienie.md b/docs/en/wdrozenie/uruchomienie.md
index fe78ebcc..9df6dfb1 100644
--- a/docs/en/wdrozenie/uruchomienie.md
+++ b/docs/en/wdrozenie/uruchomienie.md
@@ -81,6 +81,8 @@ The full list with comments is in `.env.example`.
| `ONCALL_WEB_HTTPS_PORT` | `8443` | the HTTPS port exposed on the host |
| `ONCALL_APP_NAME` | `On-call` | the product name in the interface, e-mails and calendar names |
| `ONCALL_APP_SUBTITLE` | empty | the second line under the name in the navigation, on the sign-in screen and in the e-mail header; empty hides the line |
+| `ONCALL_ACCENT` | empty | optional decorations of the interface, see [Seasonal decorations](#seasonal-decorations); empty turns them off entirely |
+| `ONCALL_ACCENT_FROM`, `ONCALL_ACCENT_UNTIL` | empty | a winter season other than 6 December - 6 January, as `MM-DD`; both or neither |
| `ONCALL_PUBLIC_BASE_URL` | `http://localhost:8080` | the address in e-mails, ICS feeds and links |
| `ONCALL_HANDOVER_REMINDER_HOUR` | `9` | the hour (Warsaw time) of the announcements and reminders about a starting duty, see [Integrations](../produkt/integracje.md#e-mail-notifications) |
| `ONCALL_COORDINATOR_DIGEST_HOUR` | `8` | the hour (Warsaw time, 0-23) of the message sent on working days telling coordinators and administrators who is on duty today and on the days off that follow; independent of `ONCALL_HANDOVER_REMINDER_HOUR` |
@@ -107,6 +109,43 @@ In Compose the worker process has an allocation of 2 CPUs, and the default
number of solver threads follows from it. Changing the allocation changes that
number automatically.
+## Seasonal decorations
+
+The interface can wear seasonal decorations. They are off by default: while
+`ONCALL_ACCENT` is empty, nothing changes.
+
+`ONCALL_ACCENT` is a list of packs separated by commas. You write it once and
+leave it: each pack knows its own days, so nobody switches the setting when a
+season starts or ends.
+
+| Pack | When | What it shows |
+| --- | --- | --- |
+| `winter` | from 6 December to 6 January | a hat on the product mark, a garland of lights under the “Teraz” strip and snow inside that strip, a winter night on the sign-in screen, a sleigh on the generator's progress bar |
+| `doodles` | seven days a year | a small drawing on the product mark: on 31 December and 1 January, on Fat Thursday, on 14 February, on Easter Sunday and Monday, and on 1 April |
+
+The garland and the snow inside the strip are on the desktop “Teraz” strip
+only. A phone has no such strip: its top bar shows only the hat or the day's
+drawing on the product mark.
+
+```env
+ONCALL_ACCENT=winter,doodles
+```
+
+`ONCALL_ACCENT_FROM` and `ONCALL_ACCENT_UNTIL` set another winter season: a
+day of the year as `MM-DD`, both ends included. You give both or neither, and
+the season may run across New Year. The `doodles` pack does not read them. An
+unknown pack name, a malformed date or only one of the two dates stops `api`
+at startup with a message in the log.
+
+Whether today is one of a pack's days is decided by the date in the
+Europe/Warsaw zone. An open browser tab learns it when the page loads.
+
+The decorations are on the screen only: they do not reach a printout,
+e-mails, ICS calendars or CSV reports, and they cover nothing. With the
+system's reduced-motion setting they stand still, and each person can turn
+them off for themselves in the account menu (**Decorations**). A preview from
+a share link never shows them.
+
## CA file
A deployment names its certificate authorities in **one** PEM file,
diff --git a/docs/uzytkownik/pierwsze-kroki.md b/docs/uzytkownik/pierwsze-kroki.md
index 60287375..3e3ccabb 100644
--- a/docs/uzytkownik/pierwsze-kroki.md
+++ b/docs/uzytkownik/pierwsze-kroki.md
@@ -85,6 +85,11 @@ zostaje zapamiętany w przeglądarce, obejmuje także komunikaty z serwera
języku; nowy użytkownik zawsze zaczyna po polsku, niezależnie od ustawień
przeglądarki.
+Jeśli administrator włączył sezonowe ozdoby (na przykład zimowe), w dniach,
+w których są widoczne, w tym samym miejscu pojawia się wybór **Ozdoby**:
+**Włączone** (domyślnie) albo **Wyłączone**. Wybór dotyczy tylko Twojej
+przeglądarki i zostaje w niej zapamiętany.
+
## Format dat
Daty w aplikacji są wyświetlane jako **`DD-MM-RRRR`**, niezależnie od ustawień
diff --git a/docs/wdrozenie/uruchomienie.md b/docs/wdrozenie/uruchomienie.md
index e8b764d6..0b0f1a35 100644
--- a/docs/wdrozenie/uruchomienie.md
+++ b/docs/wdrozenie/uruchomienie.md
@@ -79,6 +79,8 @@ Pełna lista z komentarzami jest w `.env.example`.
| `ONCALL_WEB_HTTPS_PORT` | `8443` | port HTTPS wystawiony na hosta |
| `ONCALL_APP_NAME` | `On-call` | nazwa produktu w interfejsie, e-mailach i nazwach kalendarzy |
| `ONCALL_APP_SUBTITLE` | puste | drugi wiersz pod nazwą w nawigacji, na ekranie logowania i w nagłówku e-maili; pusty ukrywa wiersz |
+| `ONCALL_ACCENT` | puste | opcjonalne ozdoby interfejsu, patrz [Ozdoby sezonowe](#ozdoby-sezonowe); puste wyłącza je całkowicie |
+| `ONCALL_ACCENT_FROM`, `ONCALL_ACCENT_UNTIL` | puste | inny sezon zimowy niż 6 grudnia - 6 stycznia, jako `MM-DD`; obie albo żadna |
| `ONCALL_PUBLIC_BASE_URL` | `http://localhost:8080` | adres w e-mailach, kanałach ICS i linkach |
| `ONCALL_HANDOVER_REMINDER_HOUR` | `9` | godzina (czasu warszawskiego) zapowiedzi i przypomnień o rozpoczęciu dyżuru, patrz [Integracje](../produkt/integracje.md#powiadomienia-e-mail) |
| `ONCALL_COORDINATOR_DIGEST_HOUR` | `8` | godzina (czasu warszawskiego, 0-23) wiadomości wysyłanej w dni robocze do koordynatorów i administratorów o tym, kto ma dyżur dziś i w następujące po nim dni wolne; niezależna od `ONCALL_HANDOVER_REMINDER_HOUR` |
@@ -104,6 +106,43 @@ Liczba procesów API razy rozmiar puli połączeń musi mieścić się poniżej
Proces roboczy ma w Compose przydział 2 CPU i z niego wynika domyślna liczba
wątków solvera. Zmiana przydziału zmienia tę liczbę automatycznie.
+## Ozdoby sezonowe
+
+Interfejs może nosić sezonowe ozdoby. Domyślnie są wyłączone: dopóki
+`ONCALL_ACCENT` jest puste, nic się nie zmienia.
+
+`ONCALL_ACCENT` to lista pakietów oddzielonych przecinkami. Wpisujesz ją raz
+i zostawiasz: każdy pakiet zna swoje dni, więc nikt nie przełącza ustawienia
+na początku ani na końcu sezonu.
+
+| Pakiet | Kiedy | Co pokazuje |
+| --- | --- | --- |
+| `winter` | od 6 grudnia do 6 stycznia | czapkę na znaku produktu, girlandę światełek pod paskiem „Teraz” i śnieg w tym pasku, zimową noc na ekranie logowania, sanie na pasku postępu generatora |
+| `doodles` | siedem dni w roku | mały rysunek na znaku produktu: 31 grudnia i 1 stycznia, w Tłusty Czwartek, 14 lutego, w Niedzielę i Poniedziałek Wielkanocny oraz 1 kwietnia |
+
+Girlanda i śnieg w pasku są tylko na pasku „Teraz” w układzie na komputer.
+Telefon nie ma tego paska: jego górny pasek pokazuje samą czapkę albo rysunek
+dnia na znaku produktu.
+
+```env
+ONCALL_ACCENT=winter,doodles
+```
+
+Inny sezon zimowy ustawiają `ONCALL_ACCENT_FROM` i `ONCALL_ACCENT_UNTIL`:
+dzień roku jako `MM-DD`, oba końce włącznie. Podajesz obie albo żadnej, a
+sezon może przechodzić przez Nowy Rok. Pakiet `doodles` ich nie czyta.
+Nieznana nazwa pakietu, błędna data albo tylko jedna z dwóch dat zatrzymują
+`api` przy starcie z komunikatem w logu.
+
+O tym, czy dziś jest dzień pakietu, decyduje data w strefie Europe/Warsaw.
+Otwarta karta przeglądarki dowiaduje się o tym przy załadowaniu strony.
+
+Ozdoby są tylko na ekranie: nie trafiają do wydruku, e-maili, kalendarzy ICS
+ani raportów CSV i niczego nie zasłaniają. Przy systemowym ustawieniu
+ograniczenia ruchu stoją w miejscu, a każda osoba może je wyłączyć dla siebie
+w menu konta (**Ozdoby**). Podgląd z linku udostępnienia nie pokazuje ich
+nigdy.
+
## Plik CA
Wdrożenie wskazuje swoje urzędy certyfikacji **jednym** plikiem PEM,
diff --git a/frontend/scripts/decor-load.test.mjs b/frontend/scripts/decor-load.test.mjs
new file mode 100644
index 00000000..6f1d4713
--- /dev/null
+++ b/frontend/scripts/decor-load.test.mjs
@@ -0,0 +1,55 @@
+import { mkdtempSync, mkdirSync, rmSync } from 'node:fs'
+import path from 'node:path'
+import { fileURLToPath, pathToFileURL } from 'node:url'
+import { afterAll, beforeAll, expect, it, vi } from 'vitest'
+import { act, createElement } from 'react'
+import { render } from '@testing-library/react'
+import { build } from 'vite'
+
+// Only the production build waits for the stylesheet of a lazy chunk, so only
+// there can that stylesheet fail (a release replaced it, the network dropped).
+// The decorations are then missing; the interface around them must stay.
+const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
+let outDir
+
+beforeAll(async () => {
+ // Inside node_modules, where vitest runs a file exactly as it was built.
+ const cache = path.join(root, 'node_modules', '.cache')
+ mkdirSync(cache, { recursive: true })
+ outDir = mkdtempSync(path.join(cache, 'decor-load-'))
+ await build({
+ root,
+ logLevel: 'silent',
+ publicDir: false,
+ build: {
+ outDir,
+ rollupOptions: {
+ input: path.join(root, 'src/decor/index.tsx'),
+ preserveEntrySignatures: 'strict',
+ output: { entryFileNames: 'entry.mjs', chunkFileNames: '[name].mjs' },
+ },
+ },
+ })
+})
+
+afterAll(() => {
+ rmSync(outDir, { recursive: true, force: true })
+})
+
+it('a decoration stylesheet that cannot be loaded leaves the plain interface', async () => {
+ const decor = await import(/* @vite-ignore */ pathToFileURL(path.join(outDir, 'entry.mjs')).href)
+ const { container } = render(
+ createElement('div', null, createElement('p', null, 'interface'), createElement(decor.StripDecor)),
+ )
+ const stylesheet = await vi.waitFor(() => {
+ const link = document.head.querySelector('link[rel="stylesheet"]')
+ expect(link).not.toBeNull()
+ return link
+ })
+ await act(async () => {
+ stylesheet.dispatchEvent(new Event('error'))
+ await new Promise((settled) => { setTimeout(settled, 100) })
+ })
+
+ expect(container.innerHTML).toBe('
interface
')
+})
diff --git a/frontend/src/App.test.tsx b/frontend/src/App.test.tsx
index c02b15cc..065e2a2f 100644
--- a/frontend/src/App.test.tsx
+++ b/frontend/src/App.test.tsx
@@ -153,7 +153,7 @@ describe('the dashboard', () => {
it.each([
['/grafik', 'Schedule role=viewer displayName=Jan Kowal hasTeamMember=false'],
- ['/wiecej', 'More displayName=Jan Kowal avatar=null'],
+ ['/wiecej', 'More displayName=Jan Kowal avatar=null share=null'],
])('lets anyone open %s', async (route, shown) => {
signIn(user('viewer'))
renderScreen(, { route })
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index e78fd6f5..2c0982c5 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -77,7 +77,7 @@ function Dashboard({ displayName, avatar, role, hasTeamMember, share }: {
} />
{/* The old path stays linkable. */}
} />
- } />
+ } />
applyAccent(''))
+
+function Worn() {
+ return
+}
+
+function Switch() {
+ const [preference, setPreference] = useAccentPreference()
+ return
+}
+
+describe('the seasonal accent', () => {
+ it('is worn by nothing until a screen puts it on', () => {
+ render()
+
+ expect(screen.getByLabelText('worn')).toHaveTextContent('')
+ expect(document.documentElement).not.toHaveAttribute('data-accent')
+ })
+
+ it('reaches every reader through one attribute on , and leaves the same way', () => {
+ render()
+
+ act(() => applyAccent('winter sparkle'))
+ expect(document.documentElement).toHaveAttribute('data-accent', 'winter sparkle')
+ expect(screen.getByLabelText('worn')).toHaveTextContent('winter+sparkle')
+
+ act(() => applyAccent(''))
+ expect(document.documentElement).not.toHaveAttribute('data-accent')
+ expect(screen.getByLabelText('worn')).toHaveTextContent('')
+ })
+
+ it('stops telling a reader that has left the screen', () => {
+ const { unmount } = render()
+ unmount()
+
+ expect(() => act(() => applyAccent('winter'))).not.toThrow()
+ })
+})
+
+describe('the personal switch of the decorations', () => {
+ it('is on unless this browser turned it off', () => {
+ expect(readAccentPreference()).toBe('on')
+
+ window.localStorage.setItem(ACCENT_STORAGE_KEY, 'whatever')
+ expect(readAccentPreference()).toBe('on')
+
+ window.localStorage.setItem(ACCENT_STORAGE_KEY, 'off')
+ expect(readAccentPreference()).toBe('off')
+ })
+
+ it('is remembered in the browser and seen at once by whoever shows it', () => {
+ render()
+
+ fireEvent.click(screen.getByRole('button', { name: 'on' }))
+ expect(screen.getByRole('button', { name: 'off' })).toBeInTheDocument()
+ expect(window.localStorage.getItem(ACCENT_STORAGE_KEY)).toBe('off')
+
+ act(() => setAccentPreference('on'))
+ expect(screen.getByRole('button', { name: 'on' })).toBeInTheDocument()
+ })
+
+ it('still switches for this page in a browser that cannot store the choice', () => {
+ window.localStorage.setItem(ACCENT_STORAGE_KEY, 'on')
+ const full = vi.spyOn(Storage.prototype, 'setItem').mockImplementation(() => { throw new Error('full') })
+ render()
+
+ fireEvent.click(screen.getByRole('button', { name: 'on' }))
+ expect(screen.getByRole('button', { name: 'off' })).toBeInTheDocument()
+ fireEvent.click(screen.getByRole('button', { name: 'off' }))
+ expect(screen.getByRole('button', { name: 'on' })).toBeInTheDocument()
+
+ full.mockRestore()
+ fireEvent.click(screen.getByRole('button', { name: 'on' }))
+ expect(window.localStorage.getItem(ACCENT_STORAGE_KEY)).toBe('off')
+ })
+})
diff --git a/frontend/src/accent.ts b/frontend/src/accent.ts
new file mode 100644
index 00000000..3e003239
--- /dev/null
+++ b/frontend/src/accent.ts
@@ -0,0 +1,60 @@
+import { useMemo, useSyncExternalStore } from 'react'
+import type { Accent } from './api'
+import { readStored, writeStored } from './theme'
+
+/**
+ * The opt-in seasonal accent. The API lists what today carries (`winter`,
+ * the day's doodle) and nothing at all unless the deployment set
+ * ONCALL_ACCENT. A screen that may wear it writes that list to `data-accent`
+ * on (`useAccentHost`), the one attribute the accent stylesheet and
+ * the decorated components read, as `data-theme` is for the palette. A
+ * person can turn the decorations off for their own browser.
+ */
+export type AccentPreference = 'on' | 'off'
+
+export const ACCENT_STORAGE_KEY = 'oncall-accent'
+
+const NONE: Accent[] = []
+const listeners = new Set<() => void>()
+
+function subscribe(listener: () => void) {
+ listeners.add(listener)
+ return () => {
+ listeners.delete(listener)
+ }
+}
+
+function notify() {
+ for (const listener of listeners) listener()
+}
+
+export function readAccentPreference(): AccentPreference {
+ return readStored(ACCENT_STORAGE_KEY) === 'off' ? 'off' : 'on'
+}
+
+export function setAccentPreference(preference: AccentPreference) {
+ writeStored(ACCENT_STORAGE_KEY, preference)
+ notify()
+}
+
+export function useAccentPreference(): [AccentPreference, (preference: AccentPreference) => void] {
+ return [useSyncExternalStore(subscribe, readAccentPreference), setAccentPreference]
+}
+
+const worn = () => document.documentElement.dataset.accent ?? ''
+
+/** Writes what the current screen wears to , as the space-separated
+ * list CSS matches with `~=`; an empty list wears nothing. */
+export function applyAccent(list: string) {
+ const root = document.documentElement
+ if (list) root.dataset.accent = list
+ else delete root.dataset.accent
+ notify()
+}
+
+/** What the current screen wears right now; empty on every screen of a
+ * deployment that did not opt in. */
+export function useAccent(): Accent[] {
+ const list = useSyncExternalStore(subscribe, worn)
+ return useMemo(() => (list ? (list.split(' ') as Accent[]) : NONE), [list])
+}
diff --git a/frontend/src/api.ts b/frontend/src/api.ts
index beeecc7c..58811254 100644
--- a/frontend/src/api.ts
+++ b/frontend/src/api.ts
@@ -4,6 +4,10 @@ export type AssignmentRole = 'primary' | 'secondary' | 'late_shift'
export type RotationMode = 'hybrid' | 'daily' | 'weekly'
export type LateShiftAnchor = 'secondary' | 'primary' | 'independent'
+/** What the opt-in seasonal accent may draw: the winter season, or the day's
+ * doodle on the logo mark (`src/accent.ts`). */
+export type Accent = 'winter' | 'sparkle' | 'doughnut' | 'heart' | 'egg' | 'flip'
+
/** Instance settings the interface reads before anyone is logged in. */
export interface PublicConfig {
ldap_enabled: boolean
@@ -14,6 +18,9 @@ export interface PublicConfig {
app_name: string
/** Optional second line under the name; empty hides it. */
app_subtitle: string
+ /** The decorations today carries; empty unless the deployment opted in
+ * (ONCALL_ACCENT) and today is one of a pack's days. */
+ accent: Accent[]
/** The release running, as its image was built: `1.2.0`, `1.3.0-rc.1`, or
* `dev` for a build from a checkout. */
version: string
diff --git a/frontend/src/components/AppShell.test.tsx b/frontend/src/components/AppShell.test.tsx
index 9428937f..d436629a 100644
--- a/frontend/src/components/AppShell.test.tsx
+++ b/frontend/src/components/AppShell.test.tsx
@@ -5,7 +5,8 @@ import { renderScreen } from '../test/render'
import { AppShell } from './AppShell'
import { MoreScreen } from '../screens/More'
import { api } from '../api'
-import type { ShareSession, SwapRequest } from '../api'
+import type { Accent, ShareSession, SwapRequest } from '../api'
+import { ACCENT_STORAGE_KEY } from '../accent'
import { Access } from '../lib/nav'
const swap = (over: Partial & { id: string }): SwapRequest => ({
@@ -31,13 +32,14 @@ function renderShell(
avatar: string | null = null,
route = '/',
subtitle = '',
+ accent: Accent[] = [],
) {
// `null`: the configuration never arrives, as in the first moments after
// the page loads.
vi.spyOn(api, 'publicConfig').mockImplementation(() => (
version === null
? new Promise(() => {})
- : Promise.resolve({ ldap_enabled: false, app_name: 'On-call', app_subtitle: subtitle, version, audit_retention_days: 365, login_audit_retention_days: 90, undo_window_seconds: 10, sso_enabled: false })
+ : Promise.resolve({ ldap_enabled: false, app_name: 'On-call', app_subtitle: subtitle, accent, version, audit_retention_days: 365, login_audit_retention_days: 90, undo_window_seconds: 10, sso_enabled: false })
))
vi.spyOn(api, 'publishedSchedule').mockResolvedValue({
generated_at: '2026-09-01T10:00:00Z',
@@ -307,6 +309,77 @@ describe('AppShell account menu', () => {
})
})
+describe('AppShell seasonal accent', () => {
+ const SHARE: ShareSession = { label: 'Audyt', starts_on: '2026-09-05', ends_on: '2026-10-02', expires_at: '2026-10-03T00:00:00Z' }
+ const inWinter = (share: ShareSession | null = null) => {
+ vi.spyOn(api, 'swaps').mockResolvedValue([])
+ return renderShell({ role: 'member', hasTeamMember: true }, 'Piotr Zieliński', share, '1.4.0', null, '/', '', ['winter'])
+ }
+ const openMenu = async () => {
+ fireEvent.click(await screen.findByRole('button', { name: /^Konto: / }))
+ return screen.findByRole('menu')
+ }
+ const worn = () => document.documentElement.getAttribute('data-accent')
+
+ it('wears what today carries: a hat on the mark, snow in the strip and lights under it', async () => {
+ const { container, unmount } = inWinter()
+
+ await waitFor(() => expect(worn()).toBe('winter'))
+ await waitFor(() => expect(container.querySelector('.rail .mark .fx-hat')).not.toBeNull())
+ const strip = screen.getByRole('region', { name: 'Dyżur teraz' })
+ await waitFor(() => expect(strip.querySelector('.fx-garland')).not.toBeNull())
+ expect(strip.querySelector('.fx-strip-snow')).not.toBeNull()
+
+ unmount()
+ expect(worn()).toBeNull()
+ })
+
+ it('stays plain on a day the deployment decorates nothing, and offers no switch', async () => {
+ vi.spyOn(api, 'swaps').mockResolvedValue([])
+ const { container } = renderShell({ role: 'member', hasTeamMember: true })
+ const menu = await openMenu()
+
+ expect(within(menu).queryByText('Ozdoby')).not.toBeInTheDocument()
+ expect(container.querySelector('.fx')).toBeNull()
+ expect(worn()).toBeNull()
+ })
+
+ it('lets a person turn the decorations off for their own browser, and on again', async () => {
+ const { container } = inWinter()
+ await waitFor(() => expect(container.querySelector('.fx-garland')).not.toBeNull())
+ const menu = await openMenu()
+
+ expect(within(menu).getByText('Ozdoby')).toBeInTheDocument()
+ expect(within(menu).getByRole('menuitemradio', { name: 'Włączone' })).toHaveAttribute('aria-checked', 'true')
+ fireEvent.click(within(menu).getByRole('menuitemradio', { name: 'Wyłączone' }))
+
+ await waitFor(() => expect(worn()).toBeNull())
+ expect(container.querySelector('.fx')).toBeNull()
+ expect(window.localStorage.getItem(ACCENT_STORAGE_KEY)).toBe('off')
+ // The menu stays open, as it does for the theme, so the choice can be undone at once.
+ fireEvent.click(within(screen.getByRole('menu')).getByRole('menuitemradio', { name: 'Włączone' }))
+ await waitFor(() => expect(worn()).toBe('winter'))
+ })
+
+ it('never decorates a share-link session, and offers it no switch', async () => {
+ const { container } = inWinter(SHARE)
+ const menu = await openMenu()
+
+ expect(within(menu).getByRole('menuitemradio', { name: 'Ciemny' })).toBeInTheDocument()
+ expect(within(menu).queryByText('Ozdoby')).not.toBeInTheDocument()
+ expect(worn()).toBeNull()
+ expect(container.querySelector('.fx')).toBeNull()
+ })
+
+ it('puts the hat on the mark of the phone top bar, where there is no strip to decorate', async () => {
+ pretendNarrow(true)
+ const { container } = inWinter()
+
+ await waitFor(() => expect(container.querySelector('.mob-top .mark .fx-hat')).not.toBeNull())
+ expect(container.querySelector('.fx-garland')).toBeNull()
+ })
+})
+
describe('AppShell version', () => {
const openMenu = async () => {
fireEvent.click(await screen.findByRole('button', { name: /^Konto: / }))
@@ -351,7 +424,7 @@ describe('AppShell version', () => {
it('lists it on the phone „Więcej” screen under the application settings', async () => {
vi.spyOn(api, 'publicConfig').mockResolvedValue({
- ldap_enabled: false, app_name: 'On-call', app_subtitle: '', version: '1.4.0', audit_retention_days: 365, login_audit_retention_days: 90, undo_window_seconds: 10, sso_enabled: false,
+ ldap_enabled: false, app_name: 'On-call', app_subtitle: '', accent: [], version: '1.4.0', audit_retention_days: 365, login_audit_retention_days: 90, undo_window_seconds: 10, sso_enabled: false,
})
renderScreen()
expect(await screen.findByText('1.4.0')).toBeInTheDocument()
diff --git a/frontend/src/components/AppShell.tsx b/frontend/src/components/AppShell.tsx
index ba2d4518..9b4623d5 100644
--- a/frontend/src/components/AppShell.tsx
+++ b/frontend/src/components/AppShell.tsx
@@ -8,6 +8,8 @@ import { formatDate } from '../lib/dates'
import { useBranding, useDocumentTitle } from '../hooks/useBranding'
import { useNarrow } from '../hooks/useMediaQuery'
import { Density, ThemeMode, useDensity, useThemeMode } from '../theme'
+import { AccentPreference, useAccentPreference } from '../accent'
+import { useAccentHost, useAccentOffered } from '../hooks/useAccentHost'
import { useLanguage, useMessages } from '../i18n'
import { LanguageMenuRadio } from './LanguageControl'
import { Avatar, Icon, IconButton, Mark, Menu, MenuLink, MenuItem, MenuRadioGroup, MenuSeparator, Segmented, cx } from '../ui'
@@ -27,7 +29,11 @@ function useThemeOptions() {
{ value: 'default', label: t.densities.default },
{ value: 'compact', label: t.densities.compact },
]
- return { themeOptions, densityOptions }
+ const decorationOptions: Array<{ value: AccentPreference; label: string }> = [
+ { value: 'on', label: t.decorationModes.on },
+ { value: 'off', label: t.decorationModes.off },
+ ]
+ return { themeOptions, densityOptions, decorationOptions }
}
export function ThemeSegmented() {
@@ -44,6 +50,15 @@ export function DensitySegmented() {
return size="sm" label={t.density} value={density} onChange={setDensity} options={densityOptions} />
}
+/** The personal switch of the seasonal decorations; a screen offers it only
+ * while the deployment has something to decorate with (`useAccentOffered`). */
+export function DecorationsSegmented() {
+ const t = useMessages().theme
+ const { decorationOptions } = useThemeOptions()
+ const [decorations, setDecorations] = useAccentPreference()
+ return size="sm" label={t.decorations} value={decorations} onChange={setDecorations} options={decorationOptions} />
+}
+
function RailLink({ path, label, icon, badge }: { path: string; label: string; icon: Parameters[0]['name']; badge?: number }) {
const t = useMessages()
return (
@@ -57,8 +72,9 @@ function RailLink({ path, label, icon, badge }: { path: string; label: string; i
/**
* The account menu behind the avatar: who is logged in, the theme, the
- * matrix density and the language as radio groups (Base UI keeps the menu open while they
- * change), the documentation, the palette and the way out. The release
+ * matrix density, the language and, on the days there are any, the seasonal
+ * decorations as radio groups (Base UI keeps the menu open while they change),
+ * the documentation, the palette and the way out. The release
* running closes the menu as a dim footer: this menu is the one place every
* layout has (a phone, the collapsed rail, a share-link session), so it is
* where the version can always be found. The avatar is the person's photo
@@ -76,9 +92,12 @@ function AccountMenu({ displayName, avatar, roleLine, version, share, onPalette,
}) {
const t = useMessages()
const [language] = useLanguage()
- const { themeOptions, densityOptions } = useThemeOptions()
+ const { themeOptions, densityOptions, decorationOptions } = useThemeOptions()
const [mode, setMode] = useThemeMode()
const [density, setDensity] = useDensity()
+ const [decorations, setDecorations] = useAccentPreference()
+ // A share-link session never wears the accent, so it has nothing to switch.
+ const decorationsOffered = useAccentOffered(!share)
return (