design: give PulseCast a shift-board identity
ci / check (push) Successful in 50s

- replace default Onyx surfaces with paper/ink, signal orange and Archivo
- make /plan answer peak, staff-hours, cost vs flat and coverage above the fold
- add the weekly shift board, shared plan helpers and a pulse line
- rebuild /live as a phone-first dark board and /stage as a full-bleed projector
- label the real 14-20 Nov window; remove 'next week' claims
- keep Onyx components, SSR, live scenario updates and accessible states
This commit is contained in:
Noel Sabia committed 2026-11-14 11:03:18 +01:00
1 parent 66b80a62fb
commit 33063afbdf
18 files changed
+4300 -1452

No files matched your search

+102 -11
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { LIVE_COLORS, LIVE_LABELS, liveAge } from '#shared/live'
import { LIVE_LABELS, liveAge } from '#shared/live'
import type { LiveConnection } from '#shared/live'
const props = withDefaults(
@@ -7,31 +7,122 @@ const props = withDefaults(
status: LiveConnection
lastEventAt?: string
compact?: boolean
dark?: boolean
}>(),
{ lastEventAt: '', compact: false },
{ lastEventAt: '', compact: false, dark: false },
)
const color = computed(() => LIVE_COLORS[props.status])
const label = computed(() => LIVE_LABELS[props.status])
const age = computed(() => (props.lastEventAt ? liveAge(props.lastEventAt) : ''))
</script>
<template>
<span class="live-status" role="status" aria-live="polite" :title="lastEventAt ? `Last event ${age}` : undefined">
<OnyxBadge :color="color" :density="compact ? 'compact' : 'default'">{{ label }}</OnyxBadge>
<span v-if="lastEventAt && !compact" class="live-status__age">{{ age }}</span>
<span
class="pc-status"
:class="[`pc-status--${status}`, { 'pc-status--compact': compact, 'pc-status--dark': dark }]"
role="status"
aria-live="polite"
:title="lastEventAt ? `Last event ${age}` : undefined"
>
<span class="pc-status__dot" aria-hidden="true" />
<span class="pc-status__label">{{ label }}</span>
<span v-if="lastEventAt && !compact" class="pc-status__age">{{ age }}</span>
</span>
</template>
<style scoped>
.live-status {
.pc-status {
display: inline-flex;
align-items: center;
gap: 0.35rem;
gap: 0.4rem;
color: var(--pc-muted, #6e665a);
font-size: 0.72rem;
font-weight: 700;
letter-spacing: 0.04em;
line-height: 1;
text-transform: uppercase;
white-space: nowrap;
}
.live-status__age {
color: var(--onyx-color-text-icons-neutral-soft);
font-size: 0.7rem;
.pc-status__dot {
width: 0.45rem;
height: 0.45rem;
flex: none;
border-radius: 50%;
background: currentColor;
}
.pc-status__label {
color: var(--pc-ink, #16130f);
}
.pc-status--live .pc-status__dot {
background: var(--pc-green, #2e6b4f);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc-green, #2e6b4f) 16%, transparent);
}
.pc-status--polling .pc-status__dot {
background: var(--pc-signal-text, #b63a00);
}
.pc-status--offline .pc-status__dot {
background: var(--pc-danger, #b3261e);
}
.pc-status--connecting .pc-status__dot {
background: var(--pc-muted, #6e665a);
}
.pc-status__age {
color: var(--pc-muted, #6e665a);
font-size: 0.66rem;
font-weight: 500;
letter-spacing: 0.02em;
text-transform: none;
}
.pc-status--compact .pc-status__label {
font-size: 0.66rem;
}
.pc-status--dark {
color: var(--pc-dark-muted, #b4ae9f);
}
.pc-status--dark .pc-status__label {
color: var(--pc-paper, #f4efe6);
}
.pc-status--dark .pc-status__age {
color: var(--pc-dark-muted, #b4ae9f);
}
.pc-status--dark.pc-status--live .pc-status__dot {
background: var(--pc-green-bright, #5fc99a);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc-green-bright, #5fc99a) 18%, transparent);
}
.pc-status--dark.pc-status--polling .pc-status__dot {
background: var(--pc-signal-bright, #ff6a2a);
}
.pc-status--dark.pc-status--offline .pc-status__dot {
background: var(--pc-danger-bright, #ff7a6e);
}
@media (prefers-reduced-motion: no-preference) {
.pc-status--live .pc-status__dot {
animation: pc-status-pulse 2.4s ease-in-out infinite;
}
}
@keyframes pc-status-pulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.55;
}
}
</style>
+108
View File
@@ -0,0 +1,108 @@
<script setup lang="ts">
import type { Point } from '#shared/types'
const props = withDefaults(
defineProps<{
points: Point[]
label: string
height?: number
showPeak?: boolean
}>(),
{ height: 56, showPeak: true },
)
const chart = computed(() => {
const values = props.points.map((point) => point.v)
if (!values.length) return { path: 'M 0 30 L 100 30', peak: null as null | { x: number; y: number } }
const max = Math.max(...values, 1)
const step = values.length > 1 ? 100 / (values.length - 1) : 100
const coords = values.map((value, index) => ({
x: index * step,
y: 30 - (Math.max(0, value) / max) * 27,
}))
const path = coords.map((coord, index) => `${index === 0 ? 'M' : 'L'} ${coord.x.toFixed(2)} ${coord.y.toFixed(2)}`).join(' ')
const peakIndex = values.indexOf(Math.max(...values))
return { path, peak: coords[peakIndex] ?? null }
})
const pathKey = computed(() => `${props.points.length}-${props.points[0]?.t ?? ''}-${props.points.at(-1)?.v ?? ''}`)
</script>
<template>
<svg
class="pc-pulse"
:style="{ height: `${height}px` }"
viewBox="0 0 100 32"
preserveAspectRatio="none"
role="img"
:aria-label="label"
>
<title>{{ label }}</title>
<line class="pc-pulse__baseline" x1="0" y1="30" x2="100" y2="30" />
<path
:key="pathKey"
class="pc-pulse__line"
:d="chart.path"
pathLength="1"
fill="none"
vector-effect="non-scaling-stroke"
/>
<circle
v-if="showPeak && chart.peak"
class="pc-pulse__peak"
:cx="chart.peak.x"
:cy="chart.peak.y"
r="1.8"
vector-effect="non-scaling-stroke"
/>
</svg>
</template>
<style scoped>
.pc-pulse {
display: block;
width: 100%;
overflow: visible;
color: var(--pc-pulse-color, var(--pc-line-strong, #8e8475));
}
.pc-pulse__baseline {
stroke: currentColor;
stroke-width: 0.6;
opacity: 0.35;
vector-effect: non-scaling-stroke;
}
.pc-pulse__line {
stroke: currentColor;
stroke-width: 1.5;
stroke-linejoin: round;
stroke-linecap: round;
stroke-dasharray: 1;
stroke-dashoffset: 0;
vector-effect: non-scaling-stroke;
animation: pc-pulse-draw 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.pc-pulse__peak {
fill: var(--pc-signal, #e84100);
stroke: var(--pc-paper, #f4efe6);
stroke-width: 0.8;
vector-effect: non-scaling-stroke;
}
@keyframes pc-pulse-draw {
from {
stroke-dashoffset: 1;
}
to {
stroke-dashoffset: 0;
}
}
@media (prefers-reduced-motion: reduce) {
.pc-pulse__line {
animation: none;
}
}
</style>
+419
View File
@@ -0,0 +1,419 @@
<script setup lang="ts">
import type { Point } from '#shared/types'
import type { PlanDay } from '~/utils/plan'
const props = withDefaults(
defineProps<{
days: PlanDay[]
peakDate?: string
selectedDate?: string
interactive?: boolean
dense?: boolean
large?: boolean
dark?: boolean
showPulse?: boolean
label?: string
}>(),
{
peakDate: '',
selectedDate: '',
interactive: false,
dense: false,
large: false,
dark: false,
showPulse: false,
label: 'Weekly shift board',
},
)
const emit = defineEmits<{ select: [date: string] }>()
function duration(shift: { start: string; end: string }): number {
return Math.max(0.5, Number(shift.end.slice(0, 2)) - Number(shift.start.slice(0, 2)))
}
function pulseOf(day: PlanDay): Point[] {
return day.hours.map((hour) => ({ t: hour.t, v: hour.footfall }))
}
function dayLabel(day: PlanDay): string {
const blocks = day.shifts.map((shift) => `${shift.start}–${shift.end}: ${shift.staff} staff`).join(', ')
return `${day.weekdayLong} ${day.dayNumber} ${day.month}: ${blocks || 'no shifts'}. ${day.staffHours} staff-hours.`
}
function activate(day: PlanDay) {
if (props.interactive) emit('select', day.date)
}
</script>
<template>
<div
class="pc-board"
:class="{
'pc-board--dense': dense,
'pc-board--large': large,
'pc-board--dark': dark,
'pc-board--interactive': interactive,
}"
role="group"
:aria-label="label"
>
<component
:is="interactive ? 'button' : 'div'"
v-for="day in days"
:key="day.date"
class="pc-board__day"
:class="{
'pc-board__day--peak': day.date === peakDate,
'pc-board__day--selected': day.date === selectedDate,
}"
:type="interactive ? 'button' : undefined"
:aria-pressed="interactive ? day.date === selectedDate : undefined"
:aria-label="interactive ? dayLabel(day) : undefined"
@click="activate(day)"
>
<span class="pc-board__head">
<span class="pc-board__weekday">{{ day.weekday }}</span>
<span class="pc-board__date">{{ day.dayNumber }}</span>
<span v-if="day.date === peakDate" class="pc-board__peak" aria-hidden="true">Peak</span>
</span>
<PulseLine
v-if="showPulse && day.hours.length"
class="pc-board__pulse"
:points="pulseOf(day)"
:height="dense ? 16 : large ? 38 : 22"
:show-peak="false"
:label="`Forecast footfall for ${day.weekdayLong} ${day.dayNumber}`"
/>
<span class="pc-board__track" aria-hidden="true">
<span
v-for="shift in day.shifts"
:key="`${shift.date}-${shift.start}`"
class="pc-board__block"
:class="{ 'pc-board__block--short': duration(shift) < 3 }"
:style="{ flex: `${duration(shift)} 1 0` }"
>
<span class="pc-board__staff">{{ shift.staff }}</span>
<span v-if="!dense" class="pc-board__time">{{ shift.start }}–{{ shift.end }}</span>
</span>
<span v-if="!day.shifts.length" class="pc-board__empty">No shifts</span>
</span>
<span class="pc-board__foot" aria-hidden="true">
<span class="pc-board__hours">{{ day.staffHours }}h</span>
<span v-if="!dense" class="pc-board__peakstaff">{{ day.peakStaff }} peak</span>
</span>
</component>
</div>
</template>
<style scoped>
.pc-board {
--pc-board-block: var(--pc-paper-2, #e9e3d7);
--pc-board-border: var(--pc-line-strong, #a99f8e);
--pc-board-text: var(--pc-ink, #16130f);
display: grid;
grid-auto-flow: column;
grid-auto-columns: minmax(0, 1fr);
gap: 1px;
width: 100%;
background: var(--pc-line, #d3caba);
border-block: 1px solid var(--pc-board-border);
}
.pc-board--dense {
gap: 1px;
}
.pc-board__day {
display: flex;
min-width: 0;
min-height: 0;
flex-direction: column;
gap: 0.35rem;
padding: 0.55rem 0.5rem 0.5rem;
border: 0;
background: var(--pc-paper, #f4efe6);
color: var(--pc-board-text);
font: inherit;
text-align: left;
}
.pc-board--interactive .pc-board__day {
min-height: 44px;
cursor: pointer;
transition: background-color 160ms ease, outline-color 160ms ease;
}
.pc-board--interactive .pc-board__day:hover {
background: var(--pc-paper-2, #e9e3d7);
}
.pc-board__day:focus-visible {
outline: 2px solid var(--pc-focus, #b63a00);
outline-offset: -3px;
z-index: 1;
}
.pc-board__day--peak {
background: var(--pc-signal-wash, #ffe4d6);
box-shadow: inset 0 3px 0 var(--pc-signal, #e84100);
}
.pc-board__day--selected {
outline: 2px solid var(--pc-ink, #16130f);
outline-offset: -2px;
}
.pc-board__head {
display: flex;
align-items: baseline;
gap: 0.3rem;
min-width: 0;
}
.pc-board__weekday {
color: var(--pc-muted, #6e665a);
font-size: 0.62rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.pc-board__date {
font-size: 0.95rem;
font-weight: 800;
letter-spacing: -0.02em;
font-variant-numeric: tabular-nums;
}
.pc-board__peak {
margin-inline-start: auto;
color: var(--pc-signal-text, #b63a00);
font-size: 0.55rem;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.pc-board__pulse {
--pc-pulse-color: var(--pc-board-border);
margin-block: 0.1rem;
}
.pc-board__track {
display: flex;
min-height: 9rem;
flex: 1 1 auto;
flex-direction: column;
gap: 2px;
}
.pc-board__block {
display: flex;
min-height: 0;
flex-direction: column;
align-items: flex-start;
justify-content: center;
gap: 0.05rem;
padding: 0.2rem 0.35rem;
border: 1px solid var(--pc-board-border);
background: var(--pc-board-block);
color: var(--pc-board-text);
overflow: hidden;
}
.pc-board__day--peak .pc-board__block {
border-color: var(--pc-signal-text, #b63a00);
background: var(--pc-signal, #e84100);
color: var(--pc-ink, #16130f);
}
.pc-board__staff {
font-size: 1.35rem;
font-weight: 800;
line-height: 0.9;
letter-spacing: -0.03em;
font-variant-numeric: tabular-nums;
}
.pc-board__time {
color: var(--pc-ink-2, #2a261f);
font-size: 0.55rem;
font-weight: 650;
letter-spacing: 0.02em;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.pc-board__day--peak .pc-board__time {
color: var(--pc-ink, #16130f);
}
.pc-board__block--short .pc-board__time {
display: none;
}
.pc-board__block--short .pc-board__staff {
font-size: 1.05rem;
}
.pc-board__empty {
display: grid;
flex: 1;
place-items: center;
border: 1px dashed var(--pc-board-border);
color: var(--pc-muted, #6e665a);
font-size: 0.65rem;
}
.pc-board__foot {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 0.2rem;
margin-top: auto;
color: var(--pc-muted, #6e665a);
font-size: 0.62rem;
font-variant-numeric: tabular-nums;
}
.pc-board__hours {
color: var(--pc-board-text);
font-weight: 700;
}
.pc-board__peakstaff {
white-space: nowrap;
}
/* Dense phone/stage variants */
.pc-board--dense .pc-board__day {
padding: 0.35rem 0.25rem 0.3rem;
gap: 0.2rem;
}
.pc-board--dense .pc-board__track {
min-height: 6.5rem;
}
.pc-board--dense .pc-board__staff {
font-size: 0.9rem;
}
.pc-board--dense .pc-board__weekday {
font-size: 0.52rem;
}
.pc-board--dense .pc-board__date {
font-size: 0.78rem;
}
.pc-board--dense .pc-board__foot {
font-size: 0.52rem;
}
.pc-board--dense .pc-board__peak {
display: none;
}
/* Projector variant */
.pc-board--large {
gap: 2px;
border-block-width: 3px;
}
.pc-board--large .pc-board__day {
gap: 0.7rem;
padding: 1rem 0.9rem 0.9rem;
}
.pc-board--large .pc-board__weekday {
font-size: 1rem;
}
.pc-board--large .pc-board__date {
font-size: 1.9rem;
}
.pc-board--large .pc-board__peak {
display: none;
}
.pc-board--large .pc-board__track {
min-height: 21rem;
}
.pc-board--large .pc-board__staff {
font-size: 3rem;
}
.pc-board--large .pc-board__time {
display: none;
}
.pc-board--large .pc-board__block {
padding: 0.55rem 0.7rem;
}
.pc-board--large .pc-board__foot {
font-size: 1rem;
}
/* Dark board variant */
.pc-board--dark {
--pc-board-block: var(--pc-dark-2, #191c18);
--pc-board-border: var(--pc-dark-line, #343a31);
--pc-board-text: var(--pc-paper, #f4efe6);
background: var(--pc-dark-line, #343a31);
border-color: var(--pc-dark-line, #343a31);
}
.pc-board--dark .pc-board__day {
background: var(--pc-dark, #0e100e);
}
.pc-board--dark.pc-board--interactive .pc-board__day:hover {
background: var(--pc-dark-2, #191c18);
}
.pc-board--dark .pc-board__day--peak {
background: color-mix(in srgb, var(--pc-signal-bright, #ff6a2a) 12%, var(--pc-dark, #0e100e));
box-shadow: inset 0 3px 0 var(--pc-signal-bright, #ff6a2a);
}
.pc-board--dark .pc-board__day--selected {
outline-color: var(--pc-paper, #f4efe6);
}
.pc-board--dark .pc-board__weekday,
.pc-board--dark .pc-board__foot,
.pc-board--dark .pc-board__peakstaff,
.pc-board--dark .pc-board__time {
color: var(--pc-dark-muted, #b4ae9f);
}
.pc-board--dark .pc-board__peak {
color: var(--pc-signal-bright, #ff6a2a);
}
.pc-board--dark .pc-board__day--peak .pc-board__block {
border-color: var(--pc-signal-bright, #ff6a2a);
background: var(--pc-signal-bright, #ff6a2a);
color: var(--pc-dark, #0e100e);
}
.pc-board--dark .pc-board__day--peak .pc-board__time {
color: color-mix(in srgb, var(--pc-dark, #0e100e) 80%, transparent);
}
.pc-board--dark .pc-board__hours {
color: var(--pc-paper, #f4efe6);
}
.pc-board--dark .pc-board__pulse {
--pc-pulse-color: var(--pc-dark-line, #343a31);
}
</style>