Files
Noel Sabia 33063afbdf
ci / check (push) Successful in 50s
design: give PulseCast a shift-board identity
- 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
2026-11-14 11:03:18 +01:00

109 lines
2.5 KiB
Vue

<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>