Files
ccp/web/src/tip.ts
T
adamfandClaude Opus 5.5 7f7650252d
Test and publish / test (push) Failing after 47s
Test and publish / publish (push) Has been skipped
Add a day timeline, trend chart and goal history to the dashboard
The dashboard gains a per-kind timeline of the selected day, a 14-day
trend chart per kind, and a goal history grid with streaks, sharing a
tooltip and a fixed color per top series. The activities limit rises
to 5000 so busy days fit on the timeline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 22:50:00 +01:00

20 lines
669 B
TypeScript

import { reactive } from "vue";
// One floating tooltip per chart. The first line is the value, shown strongest.
export interface TipRow { text: string; color?: string }
export function useTip() {
const tip = reactive({ show: false, x: 0, y: 0, rows: [] as TipRow[] });
function show(e: MouseEvent | FocusEvent, rows: TipRow[]) {
if (e instanceof MouseEvent) {
tip.x = e.clientX; tip.y = e.clientY;
} else {
const r = (e.target as Element).getBoundingClientRect();
tip.x = r.left + r.width / 2; tip.y = r.top;
}
tip.rows = rows;
tip.show = true;
}
const hide = () => { tip.show = false; };
return { tip, show, hide };
}