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]>
20 lines
669 B
TypeScript
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 };
|
|
}
|