[pending-judge] feat(DC-168): calendar widget UX + theming — "No upcoming appointments" state, month grid with highlighted appointment days, theme-correct styling
Owner directives (2026-10-10/11, verbatim in brief): show "no upcoming
appointments" when empty; show a month calendar with days and times
highlighted when there are events; stylize to fit every theme; keep the
widget weather-widget-sized.
Changes (status/ frontend + tests):
- status/js/calendar-widget.js: rewritten render path — chip states ("No
upcoming appointments" / next appointment with highlighted when-span),
month grid modal (cal-grid + prev/next nav, appointment days highlighted,
per-event time dots), upcoming list with day/time emphasis, month-following
fetch with window-authoritative event merge (via calendar-cache.js),
forced refresh on periodic tick + source mutations, local escapeHtml (was
an undefined global).
- status/js/calendar-cache.js (new): uid+start-keyed event cache; fetched
window is authoritative for entries starting inside it (deletions and
reschedules propagate), entries outside survive. Dual export (module +
window) for tests and browser bundle.
- status/build.js: calendar-cache.js bundled before calendar-widget.js.
- status/css/dashboard.css: DC-168 block — chip states, month grid, day
highlight states, dots, list/source rows, universal light-bg contrast
rules (color-mix; WCAG >= 4.5:1 verified for all 10 builtin themes, worst
4.60:1 ocean) + light-surface rules.
Tests: 20 total in __tests__/calendar — 9 in caldav-default-ns (extraction
incl. mixed docs, empty multistatus, namespace-aware fixture validation,
undeclared-prefix rejection both quote styles, positive declared-attr),
5 in dc168-cache-contract (merge, duplicate suppression, recurring uid+start,
window-authoritative removal on refetch, cross-window survival, ended-
exclusion), 6 in dc168-widget-contract (navigation fetch windows, forced-
refresh semantics, cache+widget integration, interval coverage). Existing
suites pass unmodified; eslint 0 errors on touched files.
This commit is contained in:
9 files changed
+1232
-306
No files matched your search
@@ -4247,3 +4247,112 @@ button:focus-visible {
|
||||
.top-row[data-logo-pos="left"] .calendar-widget-container { order: 3; }
|
||||
.top-row[data-logo-pos="center"] .calendar-widget-container { order: 3; }
|
||||
.top-row[data-logo-pos="right"] .calendar-widget-container { order: 3; margin-top: -80px; }
|
||||
|
||||
/* ========== CALENDAR WIDGET — DC-168 (month grid + themed chip) ========== */
|
||||
/* Chip: weather-widget sized (same padding/font as before); all colors via
|
||||
CSS variables so every theme + user theme renders correctly. */
|
||||
|
||||
/* Chip text states */
|
||||
.calendar-widget .cal-chip-muted { color: var(--muted); }
|
||||
.calendar-widget .cal-chip-title { color: var(--fg); font-weight: 600; }
|
||||
.calendar-widget .cal-chip-when {
|
||||
color: var(--cal-chip-when, var(--accent));
|
||||
font-size: 0.78em;
|
||||
font-weight: 600;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
/* Month navigation bar */
|
||||
.cal-monthbar {
|
||||
display: flex; align-items: center; justify-content: center; gap: 10px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.cal-month-label { font-weight: 600; color: var(--fg); min-width: 130px; text-align: center; }
|
||||
.cal-nav-btn {
|
||||
background: var(--base); color: var(--fg);
|
||||
border: 1px solid var(--border); border-radius: 6px;
|
||||
padding: 2px 10px; cursor: pointer; font-size: 0.95rem; line-height: 1.3;
|
||||
}
|
||||
.cal-nav-btn:hover { background: var(--hover); border-color: var(--accent); }
|
||||
|
||||
/* Month grid */
|
||||
.cal-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
gap: 3px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.cal-dow {
|
||||
text-align: center; font-size: 0.68rem; font-weight: 700;
|
||||
color: var(--muted); text-transform: uppercase; padding: 2px 0;
|
||||
}
|
||||
.cal-day {
|
||||
position: relative;
|
||||
min-height: 34px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
padding: 2px 4px;
|
||||
font-size: 0.72rem;
|
||||
color: var(--fg);
|
||||
background: transparent;
|
||||
display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
|
||||
}
|
||||
.cal-day.cal-pad { border-color: transparent; }
|
||||
.cal-day.cal-today {
|
||||
border-color: var(--accent);
|
||||
box-shadow: inset 0 0 0 1px var(--accent);
|
||||
}
|
||||
.cal-day.cal-has-events {
|
||||
background: color-mix(in srgb, var(--accent) 16%, transparent);
|
||||
border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
|
||||
font-weight: 600;
|
||||
}
|
||||
.cal-day.cal-has-events.cal-today {
|
||||
background: color-mix(in srgb, var(--accent) 26%, transparent);
|
||||
}
|
||||
.cal-dots { display: flex; gap: 2px; }
|
||||
.cal-dot {
|
||||
width: 5px; height: 5px; border-radius: 50%;
|
||||
background: var(--cal-dot, var(--accent-strong));
|
||||
}
|
||||
|
||||
/* Upcoming list rows */
|
||||
.cal-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
|
||||
.cal-row { display: flex; gap: 8px; align-items: baseline; }
|
||||
.cal-when { font-size: 0.78rem; color: var(--cal-when, var(--accent)); white-space: nowrap; font-weight: 600; }
|
||||
.cal-evtitle { font-size: 0.85rem; color: var(--fg); }
|
||||
.cal-loc { font-size: 0.75rem; color: var(--muted); }
|
||||
.cal-empty { color: var(--muted); font-size: 0.85rem; }
|
||||
|
||||
/* Sources rows */
|
||||
.cal-src-row {
|
||||
border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px;
|
||||
align-items: center;
|
||||
}
|
||||
.cal-btn {
|
||||
font-size: 0.75rem; padding: 2px 8px;
|
||||
background: var(--base); color: var(--fg);
|
||||
border: 1px solid var(--border); border-radius: 4px; cursor: pointer;
|
||||
}
|
||||
.cal-btn:hover { background: var(--hover); border-color: var(--accent); }
|
||||
.cal-btn-danger { color: var(--error, var(--bad-fg)); }
|
||||
|
||||
|
||||
/* ========== DC-168: calendar chip contrast (theme-aware, universal) ==========
|
||||
theme.js adds the CLASS `light-bg` to <html> (not a data-theme attribute)
|
||||
when the active theme's background is light (luminance > 0.4) — this covers
|
||||
builtin AND user themes with no per-slug rules. On dark surfaces, small
|
||||
accent text is lightened via color-mix; on light surfaces the raw accent
|
||||
(dark tones) is correct. */
|
||||
:root:not(.light-bg) .calendar-widget .cal-chip-when,
|
||||
:root:not(.light-bg) .cal-when {
|
||||
--cal-chip-when: color-mix(in srgb, var(--accent) 20%, white);
|
||||
--cal-when: color-mix(in srgb, var(--accent) 20%, white);
|
||||
--cal-dot: color-mix(in srgb, var(--accent) 75%, white);
|
||||
}
|
||||
:root.light-bg .calendar-widget .cal-chip-when,
|
||||
:root.light-bg .cal-when {
|
||||
--cal-chip-when: color-mix(in srgb, var(--accent) 72%, black);
|
||||
--cal-when: color-mix(in srgb, var(--accent) 72%, black);
|
||||
--cal-dot: color-mix(in srgb, var(--accent) 72%, black);
|
||||
}
|
||||
Reference in new issue
Block a user