Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(board): rebuild the Board as a three-tab insights page

rubenluetke10-beep220100c79dbb
diff --git a/jarvis/ui/web/frontend/src/components/board/AIProfileCard.tsx b/jarvis/ui/web/frontend/src/components/board/AIProfileCard.tsx
deleted file mode 100644
index fc86dd0a49..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/AIProfileCard.tsx
+++ /dev/null
@@ -1,193 +0,0 @@
-import { Check, Loader2, RefreshCw, Sparkles, X, Zap } from "lucide-react";
-import { useEffect, useState } from "react";
-import {
- type BioFeedbackKind,
- useBio,
- useBioFeedback,
- useBioRegenerate,
-} from "@/hooks/useBoard";
-import { cn } from "@/lib/utils";
-import { useT } from "@/i18n";
-
-/**
- * "Who is this user?" — an AI-generated self-observation by Jarvis in
- * first-person narrator style, biting with a wink (brainstorm 2026-05-02).
- *
- * Three reaction buttons under the text calibrate the next bio generation
- * (Correct / Incorrect / Harder). Clicks do NOT regenerate immediately —
- * they flow as a tone vector into the Sunday run.
- */
-export function AIProfileCard() {
- const t = useT();
- const bio = useBio();
- const regen = useBioRegenerate();
- const feedback = useBioFeedback();
-
- const data = bio.data;
- const [lastFeedback, setLastFeedback] = useState<BioFeedbackKind | null>(null);
-
- // Hide the "Noted." toast again after 2.5s so it doesn't linger.
- useEffect(() => {
- if (!lastFeedback) return;
- const t = setTimeout(() => setLastFeedback(null), 2500);
- return () => clearTimeout(t);
- }, [lastFeedback]);
-
- const handleFeedback = (kind: BioFeedbackKind) => {
- if (!data?.generated_at) return;
- feedback.mutate(
- { bio_generated_at: data.generated_at, kind },
- { onSuccess: () => setLastFeedback(kind) },
- );
- };
-
- const stalenessLabel = (() => {
- const d = data?.staleness_days;
- if (d == null) return null;
- if (d === 0) return t("board_view.ai_profile_today");
- if (d === 1) return t("board_view.ai_profile_one_day_ago");
- return t("board_view.ai_profile_days_ago").replace("{0}", String(d));
- })();
-
- return (
- <section className="space-y-3 rounded-xl border border-border bg-card/30 p-5 backdrop-blur">
- <header className="flex items-start gap-3">
- <div className="flex h-8 w-8 items-center justify-center rounded-lg border border-primary/40 bg-primary/10 text-primary">
- <Sparkles className="h-4 w-4" />
- </div>
- <div className="flex-1 min-w-0">
- <h3 className="font-display text-sm font-semibold">{t("board_view.ai_profile_title")}</h3>
- <p className="text-xs text-muted-foreground">
- {t("board_view.ai_profile_description")}
- </p>
- </div>
- <button
- type="button"
- onClick={() => regen.mutate({})}
- disabled={regen.isPending}
- className={cn(
- "inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1 text-xs font-medium transition-colors",
- "hover:border-primary/40 hover:bg-background/60",
- regen.isPending && "opacity-60",
- )}
- title={t("board_view.ai_profile_regenerate_tooltip")}
- >
- <RefreshCw className={cn("h-3 w-3", regen.isPending && "animate-spin")} />
- {t("board_view.ai_profile_regenerate")}
- </button>
- </header>
-
- {bio.isLoading && (
- <div className="flex items-center gap-2 text-xs text-muted-foreground">
- <Loader2 className="h-3 w-3 animate-spin" /> {t("board_view.ai_profile_loading")}
- </div>
- )}
-
- {!bio.isLoading && !data?.text && (
- <div className="rounded-lg border border-dashed border-border/60 p-4 text-sm text-muted-foreground">
- <div className="flex items-center gap-2">
- <Loader2 className="h-3 w-3 animate-spin opacity-60" />
- <span>{t("board_view.ai_profile_collecting")}</span>
- </div>
- <p className="mt-1.5 text-xs opacity-80">
- {t("board_view.ai_profile_first_bio_hint")}
- </p>
- </div>
- )}
-
- {data?.text && (
- <div className="space-y-3">
- <p className="whitespace-pre-wrap text-sm leading-relaxed text-foreground/90">
- {data.text}
- </p>
- <div className="flex items-center gap-3 text-micro uppercase tracking-wider text-muted-foreground">
- {stalenessLabel && <span>{stalenessLabel}</span>}
- {data.triggered_by && <span>· {data.triggered_by}</span>}
- {data.model_used && <span>· {data.model_used}</span>}
- </div>
- <div className="flex flex-wrap items-center gap-2 border-t border-border/40 pt-3">
- <FeedbackButton
- kind="trifft"
- icon={<Check className="h-3 w-3" />}
- label={t("board_view.feedback_correct")}
- colorClass="border-muted-foreground/40 bg-muted-foreground/10 text-muted-foreground hover:bg-muted-foreground/20"
- active={lastFeedback === "trifft"}
- disabled={feedback.isPending}
- onClick={() => handleFeedback("trifft")}
- />
- <FeedbackButton
- kind="trifft_nicht" // i18n-allow: API contract value matched in logic
- icon={<X className="h-3 w-3" />}
- label={t("board_view.feedback_incorrect")}
- colorClass="border-rose-500/40 bg-rose-500/10 text-rose-300 hover:bg-rose-500/20"
- active={lastFeedback === "trifft_nicht"} // i18n-allow: API contract value matched in logic
- disabled={feedback.isPending}
- onClick={() => handleFeedback("trifft_nicht")} // i18n-allow: API contract value matched in logic
- />
- <FeedbackButton
- kind="haerter"
- icon={<Zap className="h-3 w-3" />}
- label={t("board_view.feedback_harder")}
- colorClass="border-foreground/40 bg-foreground/10 text-foreground hover:bg-foreground/20"
- active={lastFeedback === "haerter"}
- disabled={feedback.isPending}
- onClick={() => handleFeedback("haerter")}
- />
- {lastFeedback && (
- <span className="text-xs italic text-muted-foreground">
- {t("board_view.feedback_noted")}
- </span>
- )}
- </div>
- </div>
- )}
-
- {regen.isError && (
- <div className="text-xs text-destructive">
- {t("board_view.regenerate_failed")}: {(regen.error as Error).message}
- </div>
- )}
- {regen.data && !regen.data.ok && regen.data.reason && (
- <div className="text-xs text-foreground">
- {regen.data.reason}
- </div>
- )}
- </section>
- );
-}
-
-interface FeedbackButtonProps {
- kind: BioFeedbackKind;
- icon: React.ReactNode;
- label: string;
- colorClass: string;
- active: boolean;
- disabled: boolean;
- onClick: () => void;
-}
-
-function FeedbackButton({
- icon,
- label,
- colorClass,
- active,
- disabled,
- onClick,
-}: FeedbackButtonProps) {
- return (
- <button
- type="button"
- onClick={onClick}
- disabled={disabled}
- className={cn(
- "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",
- colorClass,
- active && "ring-1 ring-current",
- disabled && "opacity-60",
- )}
- >
- {icon}
- {label}
- </button>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/AchievementGrid.tsx b/jarvis/ui/web/frontend/src/components/board/AchievementGrid.tsx
deleted file mode 100644
index a782f62cec..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/AchievementGrid.tsx
+++ /dev/null
@@ -1,128 +0,0 @@
-import { useEffect } from "react";
-import { useQueryClient } from "@tanstack/react-query";
-import { Award, Lock, Sparkles } from "lucide-react";
-import { useAchievements, type AchievementItem } from "@/hooks/useBoard";
-import { useT } from "@/i18n";
-import { cn } from "@/lib/utils";
-
-/**
- * Full trophy wall. Unlocked in primary color, locked grayed out
- * with a lock icon. No badge counter for other users (Plan §0 — no
- * public like counts); the wall is private, only the user sees it.
- */
-export function AchievementGrid() {
- const t = useT();
- const qc = useQueryClient();
- const { data, isLoading } = useAchievements();
-
- // Live unlock via WS — when the evaluator publishes an unlock,
- // this invalidates the React-Query cache and the card fills in
- // without a polling delay.
- useEffect(() => {
- const handler = () => qc.invalidateQueries({ queryKey: ["board", "achievements"] });
- window.addEventListener("jarvis:achievement-unlocked", handler as EventListener);
- return () => window.removeEventListener(
- "jarvis:achievement-unlocked", handler as EventListener,
- );
- }, [qc]);
-
- if (isLoading) {
- return <div className="h-24 animate-pulse rounded-md bg-muted/10" />;
- }
- if (!data) return null;
-
- const mastery = data.items.filter((i) => i.tier === "mastery");
- const reflection = data.items.filter((i) => i.tier === "reflection");
-
- return (
- <section className="space-y-4 rounded-xl border border-border bg-card/30 p-5 backdrop-blur">
- <header className="flex items-start gap-3">
- <div className="flex h-8 w-8 items-center justify-center rounded-lg border border-primary/40 bg-primary/10 text-primary">
- <Award className="h-4 w-4" />
- </div>
- <div className="flex-1 min-w-0">
- <h3 className="font-display text-sm font-semibold">Achievements</h3>
- <p className="text-xs text-muted-foreground">
- {`${data.unlocked} ${t("achievement_grid.unlocked_of")} ${data.total} ${t("achievement_grid.unlocked_count")}`}
- </p>
- </div>
- </header>
-
- {mastery.length > 0 && (
- <div className="space-y-2">
- <div className="text-micro uppercase tracking-wider text-muted-foreground">
- Mastery
- </div>
- <div className="grid gap-2 sm:grid-cols-2 xl:grid-cols-3">
- {mastery.map((a) => <AchievementCard key={a.id} item={a} />)}
- </div>
- </div>
- )}
-
- {reflection.length > 0 && (
- <div className="space-y-2">
- <div className="text-micro uppercase tracking-wider text-muted-foreground">
- Reflection
- </div>
- <div className="grid gap-2 sm:grid-cols-2 xl:grid-cols-3">
- {reflection.map((a) => <AchievementCard key={a.id} item={a} />)}
- </div>
- </div>
- )}
- </section>
- );
-}
-
-function AchievementCard({ item }: { item: AchievementItem }) {
- const unlocked = !!item.unlocked_at;
- return (
- <div
- className={cn(
- "flex items-start gap-3 rounded-lg border px-3 py-2.5 transition-colors",
- unlocked
- ? "border-primary/40 bg-primary/5"
- : "border-border/50 bg-muted/10 opacity-70",
- )}
- >
- <div
- className={cn(
- "flex h-7 w-7 shrink-0 items-center justify-center rounded-md",
- unlocked
- ? "bg-primary/20 text-primary"
- : "bg-muted/30 text-muted-foreground",
- )}
- >
- {unlocked ? <Sparkles className="h-3.5 w-3.5" /> : <Lock className="h-3 w-3" />}
- </div>
- <div className="min-w-0 flex-1">
- <div
- className={cn(
- "text-sm font-medium",
- unlocked ? "text-foreground" : "text-muted-foreground",
- )}
- >
- {item.title}
- </div>
- <div className="text-xs leading-snug text-muted-foreground">
- {item.description}
- </div>
- {unlocked && item.unlocked_at && (
- <div className="mt-1 text-micro text-muted-foreground">
- {formatUnlockDate(item.unlocked_at)}
- </div>
- )}
- </div>
- </div>
- );
-}
-
-function formatUnlockDate(iso: string): string {
- try {
- const d = new Date(iso);
- return d.toLocaleDateString("de-DE", {
- day: "2-digit", month: "2-digit", year: "numeric",
- });
- } catch {
- return iso;
- }
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/ActivityFeed.tsx b/jarvis/ui/web/frontend/src/components/board/ActivityFeed.tsx
deleted file mode 100644
index 783ccc5fab..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/ActivityFeed.tsx
+++ /dev/null
@@ -1,155 +0,0 @@
-import { useState } from "react";
-import { Loader2, MessageSquarePlus, RefreshCw, Sparkles } from "lucide-react";
-import {
- useFeed, useFriendsList, useSendReaction,
- type ActivityItemDTO, type Reaction,
-} from "@/hooks/useFederation";
-import { ReactionBar } from "@/components/board/ReactionBar";
-import { StoryComposer } from "@/components/board/StoryComposer";
-import { cn } from "@/lib/utils";
-import { useT } from "@/i18n";
-
-export function ActivityFeed() {
- const t = useT();
- const [sort, setSort] = useState<"interesting" | "latest">("interesting");
- const [composerOpen, setComposerOpen] = useState(false);
- const feed = useFeed(sort);
- const friends = useFriendsList();
- const sendReact = useSendReaction();
-
- const friendsByPubkey = new Map(
- (friends.data?.friends ?? []).map((f) => [f.pubkey, f]),
- );
-
- return (
- <section className="space-y-4 rounded-xl border border-border bg-card/30 p-5 backdrop-blur">
- <header className="flex flex-wrap items-center gap-3">
- <h3 className="font-display text-sm font-semibold flex-1">{t("activity_feed.title")}</h3>
- <SortToggle value={sort} onChange={setSort} />
- <button
- type="button"
- onClick={() => feed.refetch()}
- className="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs hover:border-primary/40"
- title={t("activity_feed.refresh_tooltip")}
- >
- <RefreshCw className={cn("h-3 w-3", feed.isFetching && "animate-spin")} />
- Refresh
- </button>
- <button
- type="button"
- onClick={() => setComposerOpen(true)}
- className="inline-flex items-center gap-1 rounded-md border border-primary/40 bg-primary/10 px-2.5 py-1 text-xs text-primary hover:bg-primary/20"
- >
- <MessageSquarePlus className="h-3 w-3" />
- Story
- </button>
- </header>
-
- {feed.isLoading && (
- <div className="flex items-center gap-2 text-xs text-muted-foreground">
- <Loader2 className="h-3 w-3 animate-spin" /> {t("activity_feed.loading")}
- </div>
- )}
- {feed.isError && (
- <div className="rounded-md border border-destructive/30 bg-destructive/5 p-2 text-xs text-destructive">
- {(feed.error as Error).message}
- </div>
- )}
-
- {feed.data?.items.length === 0 && (
- <div className="rounded-md border border-dashed border-border/60 p-4 text-xs text-muted-foreground">
- {t("activity_feed.empty")}
- </div>
- )}
-
- <ul className="space-y-3">
- {(feed.data?.items ?? []).map((it) => (
- <FeedRow
- key={it.id} item={it}
- friendName={friendsByPubkey.get(it.author_pubkey)?.display_name}
- onReact={(r) => sendReact.mutate({
- item_id: it.id, reaction: r, author_pubkey: it.author_pubkey,
- })}
- />
- ))}
- </ul>
-
- {composerOpen && <StoryComposer onClose={() => setComposerOpen(false)} />}
- </section>
- );
-}
-
-function SortToggle({
- value, onChange,
-}: { value: "interesting" | "latest"; onChange: (v: "interesting" | "latest") => void }) {
- return (
- <div className="flex gap-0.5 rounded-md border border-border bg-background/40 p-0.5">
- <button
- onClick={() => onChange("interesting")}
- className={cn(
- "rounded px-2 py-0.5 text-micro uppercase tracking-wider transition-colors",
- value === "interesting" ? "bg-primary/15 text-primary" : "text-muted-foreground",
- )}
- >Interesting</button>
- <button
- onClick={() => onChange("latest")}
- className={cn(
- "rounded px-2 py-0.5 text-micro uppercase tracking-wider transition-colors",
- value === "latest" ? "bg-primary/15 text-primary" : "text-muted-foreground",
- )}
- >Latest</button>
- </div>
- );
-}
-
-function FeedRow({
- item, friendName, onReact,
-}: {
- item: ActivityItemDTO;
- friendName: string | undefined;
- onReact: (r: Reaction) => void;
-}) {
- const author = friendName ?? item.author_display_name ?? `${item.author_pubkey.slice(0, 8)}…`;
- return (
- <li className="rounded-lg border border-border bg-background/40 p-3">
- <header className="mb-2 flex items-center gap-2 text-micro uppercase tracking-wider text-muted-foreground">
- <Sparkles className="h-3 w-3 text-primary" />
- <span>{author}</span>
- <span>·</span>
- <span>{new Date(item.created_at).toLocaleString("de-DE")}</span>
- <span>·</span>
- <span className={cn(
- item.visibility === "public" && "text-muted-foreground",
- item.visibility === "private" && "text-foreground",
- )}>{item.visibility}</span>
- </header>
- <ItemBody item={item} />
- <footer className="mt-2 flex items-center justify-between">
- <ReactionBar
- counts={item.reaction_counts}
- hasReactions={item.has_reactions}
- onReact={onReact}
- />
- </footer>
- </li>
- );
-}
-
-function ItemBody({ item }: { item: ActivityItemDTO }) {
- if (item.kind === "story") {
- const text = (item.payload?.text as string) ?? "";
- return <p className="whitespace-pre-wrap text-sm">{text}</p>;
- }
- if (item.kind === "achievement_unlocked") {
- const id = (item.payload?.achievement_id as string) ?? "achievement";
- return (
- <p className="text-sm">
- <span className="font-medium">Achievement: </span>
- <span className="font-mono text-primary">{id}</span>
- </p>
- );
- }
- return (
- <p className="text-xs text-muted-foreground">{item.kind}</p>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/ActivityHeatmap.tsx b/jarvis/ui/web/frontend/src/components/board/ActivityHeatmap.tsx
deleted file mode 100644
index fd732bcbbc..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/ActivityHeatmap.tsx
+++ /dev/null
@@ -1,145 +0,0 @@
-import { useMemo } from "react";
-import type { HeatmapCell } from "@/hooks/useBoard";
-import { useT } from "@/i18n";
-import { cn } from "@/lib/utils";
-
-const LEVEL: Record<number, string> = {
- 0: "bg-sheen/[0.04] ring-1 ring-inset ring-sheen/[0.03]",
- 1: "bg-primary/30",
- 2: "bg-primary/50",
- 3: "bg-primary/75",
- 4: "bg-foreground/70 /50",
-};
-
-const DEFAULT_WEEKS = 26;
-
-function isoOf(d: Date): string {
- return (
- `${d.getFullYear()}-` +
- `${String(d.getMonth() + 1).padStart(2, "0")}-` +
- `${String(d.getDate()).padStart(2, "0")}`
- );
-}
-
-interface Slot {
- date: string;
- events: number;
- hours: number;
- future: boolean;
-}
-
-/**
- * GitHub-style contribution grid: columns = weeks (oldest left, current week
- * right), rows = weekdays (Mon..Sun). Replaces the old boustrophedon "snake"
- * that was split into two scrolling halves. Bounded to ``weeks`` columns so it
- * fits a one-pager without horizontal scroll.
- */
-export function ActivityHeatmap({
- cells,
- weeks = DEFAULT_WEEKS,
-}: {
- cells: HeatmapCell[];
- weeks?: number;
-}) {
- const t = useT();
-
- const { columns, monthLabels, max } = useMemo(() => {
- const byDate = new Map(cells.map((c) => [c.date, c]));
- const peak = Math.max(1, ...cells.map((c) => c.activity_events));
- const todayIso = cells.length
- ? cells[cells.length - 1].date
- : isoOf(new Date());
- const today = new Date(todayIso + "T00:00:00");
- // Monday-based weekday index: 0 = Mon … 6 = Sun.
- const weekday = (today.getDay() + 6) % 7;
- const thisMonday = new Date(today);
- thisMonday.setDate(today.getDate() - weekday);
-
- const cols: Slot[][] = [];
- const labels: string[] = [];
- let prevMonth = -1;
- for (let c = 0; c < weeks; c += 1) {
- const colMonday = new Date(thisMonday);
- colMonday.setDate(thisMonday.getDate() - (weeks - 1 - c) * 7);
- const month = colMonday.getMonth();
- // Label a column only when its first weekday rolls into a new month.
- if (month !== prevMonth) {
- labels.push(colMonday.toLocaleDateString(undefined, { month: "short" }));
- prevMonth = month;
- } else {
- labels.push("");
- }
- const col: Slot[] = [];
- for (let r = 0; r < 7; r += 1) {
- const d = new Date(colMonday);
- d.setDate(colMonday.getDate() + r);
- const iso = isoOf(d);
- const cell = byDate.get(iso);
- col.push({
- date: iso,
- events: cell?.activity_events ?? 0,
- hours: cell?.conversation_hours ?? 0,
- future: d > today,
- });
- }
- cols.push(col);
- }
- return { columns: cols, monthLabels: labels, max: peak };
- }, [cells, weeks]);
-
- return (
- <div className="inline-flex flex-col gap-1.5">
- <div className="flex gap-[3px]">
- {monthLabels.map((label, ci) => (
- <div
- key={ci}
- className="w-3.5 text-micro capitalize leading-none text-muted-foreground/70"
- >
- {label}
- </div>
- ))}
- </div>
- <div className="flex gap-[3px]">
- {columns.map((col, ci) => (
- <div key={ci} className="flex flex-col gap-[3px]">
- {col.map((slot, ri) => {
- if (slot.future) {
- return <div key={ri} className="h-3.5 w-3.5 rounded-[4px]" />;
- }
- const intensity =
- slot.events === 0
- ? 0
- : Math.min(4, Math.ceil((slot.events / max) * 4));
- return (
- <div
- key={ri}
- className={cn(
- "h-3.5 w-3.5 rounded-[4px] transition-colors",
- LEVEL[intensity],
- )}
- title={t("board_view.heatmap_tooltip")
- .replace("{0}", slot.date)
- .replace("{1}", String(slot.events))
- .replace("{2}", slot.hours.toFixed(1))}
- />
- );
- })}
- </div>
- ))}
- </div>
- </div>
- );
-}
-
-export function HeatmapScale() {
- const t = useT();
- return (
- <div className="flex items-center gap-1.5 text-micro uppercase tracking-wider text-muted-foreground">
- <span>{t("board_view.heatmap_less")}</span>
- {[0, 1, 2, 3, 4].map((lvl) => (
- <span key={lvl} className={cn("h-2.5 w-2.5 rounded-[2px]", LEVEL[lvl])} />
- ))}
- <span>{t("board_view.heatmap_more")}</span>
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/BackendConnectionSection.tsx b/jarvis/ui/web/frontend/src/components/board/BackendConnectionSection.tsx
deleted file mode 100644
index 96b80fce21..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/BackendConnectionSection.tsx
+++ /dev/null
@@ -1,112 +0,0 @@
-import { useState } from "react";
-import { Copy, Loader2, Plug, PlugZap } from "lucide-react";
-import { useDisconnect, useFederationStatus } from "@/hooks/useFederation";
-import { robustCopy } from "@/lib/clipboard";
-import { useT } from "@/i18n";
-
-/**
- * Settings section: backend connection (Plan §D spec).
- *
- * - Disconnect button (local-only mode): toggles board.federation.enabled in-memory.
- * - Backend URL: read-only display; a permanent change happens in jarvis.toml.
- * - Pubkey: display + copy.
- *
- * Plan §D §0: NO online indicator. We only show whether federation
- * is enabled (a setting), not whether the backend connection is currently
- * "live".
- */
-export function BackendConnectionSection() {
- const t = useT();
- const status = useFederationStatus();
- const disconnect = useDisconnect();
- const [copied, setCopied] = useState(false);
-
- return (
- <div className="rounded-lg border border-border bg-card/60 p-4">
- <header className="mb-3 flex items-center gap-2">
- {status.data?.enabled ? (
- <PlugZap className="h-4 w-4 text-muted-foreground" />
- ) : (
- <Plug className="h-4 w-4 text-muted-foreground" />
- )}
- <h4 className="font-display text-sm font-semibold flex-1">
- {t("board_view.backend_section_title")}
- </h4>
- {status.data?.enabled && (
- <button
- type="button"
- onClick={() => disconnect.mutate()}
- disabled={disconnect.isPending}
- className="rounded-md border border-border px-2.5 py-1 text-xs text-muted-foreground hover:text-foreground disabled:opacity-50"
- title={t("board_view.backend_disconnect_tooltip")}
- >
- {disconnect.isPending && <Loader2 className="mr-1 inline h-3 w-3 animate-spin" />}
- {t("board_view.backend_disconnect")}
- </button>
- )}
- </header>
-
- {status.isLoading && (
- <div className="flex items-center gap-2 text-xs text-muted-foreground">
- <Loader2 className="h-3 w-3 animate-spin" /> {t("board_view.backend_status_loading")}
- </div>
- )}
-
- {status.data && !status.data.enabled && (
- <p className="text-xs text-muted-foreground">
- {t("board_view.backend_local_only")}
- </p>
- )}
-
- {status.data?.enabled && (
- <div className="space-y-2 text-xs">
- <Row label={t("board_view.backend_url_label")}>
- <code className="font-mono text-xs">
- {status.data.backend_url || t("board_view.backend_url_unset")}
- </code>
- <p className="mt-1 text-micro text-muted-foreground">
- {t("board_view.backend_url_hint")}
- </p>
- </Row>
-
- {status.data.pubkey && (
- <Row label={t("board_view.backend_pubkey_label")}>
- <button
- type="button"
- onClick={() => {
- robustCopy(status.data!.pubkey!)
- .then((ok) => {
- if (ok) {
- setCopied(true);
- setTimeout(() => setCopied(false), 1500);
- }
- })
- .catch((err) => {
- console.warn("Clipboard write failed:", err);
- });
- }}
- className="inline-flex items-center gap-1 font-mono text-micro text-muted-foreground hover:text-foreground"
- title={t("board_view.backend_pubkey_copy_tooltip")}
- >
- <code>{status.data.pubkey.slice(0, 20)}…{status.data.pubkey.slice(-8)}</code>
- <Copy className="h-3 w-3" />
- {copied && <span className="ml-1 text-primary">{t("board_view.backend_pubkey_copied")}</span>}
- </button>
- </Row>
- )}
- </div>
- )}
- </div>
- );
-}
-
-function Row({ label, children }: { label: string; children: React.ReactNode }) {
- return (
- <div className="flex flex-col gap-1 sm:flex-row sm:items-baseline sm:gap-3">
- <div className="w-32 shrink-0 text-micro uppercase tracking-wider text-muted-foreground">
- {label}
- </div>
- <div className="flex-1 min-w-0">{children}</div>
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/BoardCard.tsx b/jarvis/ui/web/frontend/src/components/board/BoardCard.tsx
deleted file mode 100644
index 8964e0ce61..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/BoardCard.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import type { ReactNode } from "react";
-import { cn } from "@/lib/utils";
-
-interface BoardCardProps {
- children: ReactNode;
- className?: string;
- /** Faint primary glow in the corner — for the hero / signature surface. */
- glow?: boolean;
-}
-
-/**
- * The board's single elevated surface. Depth comes from light, not from hard
- * borders: a subtle top-lit gradient lifts the card off the near-black page,
- * a hairline white border replaces the harsh grey, and an inset highlight +
- * soft drop shadow give it a physical edge. This is the whole "premium, not
- * AI-slop" move applied consistently.
- */
-export function BoardCard({ children, className, glow }: BoardCardProps) {
- return (
- <div
- className={cn(
- "relative overflow-hidden rounded-[20px]",
- "bg-gradient-to-b from-sheen/[0.055] to-sheen/[0.015]",
- "border border-sheen/[0.07]",
- "shadow-[inset_0_1px_0_0_rgba(255,255,255,0.06),0_16px_40px_-20px_rgba(0,0,0,0.8)]",
- className,
- )}
- >
- {glow && (
- <div className="pointer-events-none absolute -right-16 -top-20 h-56 w-56 rounded-full bg-primary/[0.12] blur-3xl" />
- )}
- {children}
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/CategoryUsage.tsx b/jarvis/ui/web/frontend/src/components/board/CategoryUsage.tsx
deleted file mode 100644
index 53b9fd219e..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/CategoryUsage.tsx
+++ /dev/null
@@ -1,88 +0,0 @@
-import { useMemo } from "react";
-import type { BoardCategories } from "@/hooks/useBoard";
-import {
- BOARD_CATEGORY_KEYS,
- CATEGORY_META,
- categoryLabelKey,
- type BoardCategoryKey,
-} from "@/lib/boardCategories";
-import { useT } from "@/i18n";
-import { cn } from "@/lib/utils";
-
-/**
- * "What you use Jarvis for" — the honest analogue of a dictation tool's
- * "top apps" panel.
- * Every one of the six categories is shown (zeros muted at the bottom), each
- * with an icon tile, a smooth share bar, and a count + percentage indicator.
- */
-export function CategoryUsage({ data }: { data: BoardCategories }) {
- const t = useT();
-
- const rows = useMemo(() => {
- const counts = new Map(data.categories.map((c) => [c.category, c.count]));
- const max = Math.max(1, ...data.categories.map((c) => c.count));
- return BOARD_CATEGORY_KEYS.map((key) => {
- const count = counts.get(key) ?? 0;
- return { key, count, frac: count / max };
- }).sort((a, b) => b.count - a.count);
- }, [data]);
-
- if (data.total === 0) {
- return (
- <p className="text-xs text-muted-foreground">
- {t("board_view.categories_empty")}
- </p>
- );
- }
-
- return (
- <div className="flex flex-col justify-center gap-2.5">
- {rows.map(({ key, count, frac }) => {
- const meta = CATEGORY_META[key as BoardCategoryKey];
- const Icon = meta.icon;
- const pct = data.total ? Math.round((count / data.total) * 100) : 0;
- const empty = count === 0;
- return (
- <div
- key={key}
- className={cn("flex items-center gap-3", empty && "opacity-40")}
- >
- <div
- className={cn(
- "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg",
- "bg-sheen/[0.04] ring-1 ring-inset ring-sheen/[0.05]",
- )}
- >
- <Icon className={cn("h-4 w-4", meta.accent)} />
- </div>
- <div className="min-w-0 flex-1">
- <div className="mb-1 flex items-baseline justify-between gap-2">
- <span className="truncate text-xs font-medium text-foreground/90">
- {t(categoryLabelKey(key))}
- </span>
- <span className="flex shrink-0 items-baseline gap-1">
- <span className="font-display text-sm font-semibold tabular-nums">
- {count.toLocaleString()}
- </span>
- <span className="text-micro text-muted-foreground tabular-nums">
- {pct}%
- </span>
- </span>
- </div>
- <div className="relative h-1.5 overflow-hidden rounded-full bg-sheen/[0.05]">
- <div
- className={cn(
- "absolute inset-y-0 left-0 rounded-full transition-all duration-700",
- meta.bar,
- meta.glow,
- )}
- style={{ width: count > 0 ? `${Math.max(frac * 100, 5)}%` : "0%" }}
- />
- </div>
- </div>
- </div>
- );
- })}
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/FriendsList.tsx b/jarvis/ui/web/frontend/src/components/board/FriendsList.tsx
deleted file mode 100644
index ef671e8112..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/FriendsList.tsx
+++ /dev/null
@@ -1,124 +0,0 @@
-import { useState } from "react";
-import { Loader2, Sparkles } from "lucide-react";
-import { useFriendsList, useUpdateFriend, type FriendItem } from "@/hooks/useFederation";
-import { cn } from "@/lib/utils";
-import { useT } from "@/i18n";
-
-const INTERVAL_PRESETS_S = [60, 120, 300, 900];
-
-/**
- * Liste aller Friends + Per-Friend-Pull-Interval-Stepper.
- *
- * Plan §D-Spec: Per-Friend-Sync-Interval-Setting. Der Backend-Constraint
- * ist 60..3600 s; wir bieten vier sinnvolle Presets statt freiem Input.
- */
-export function FriendsList() {
- const t = useT();
- const friends = useFriendsList();
- const update = useUpdateFriend();
- const [pendingPubkey, setPendingPubkey] = useState<string | null>(null);
-
- if (friends.isLoading) {
- return <div className="h-12 animate-pulse rounded-md bg-muted/10" />;
- }
- if (!friends.data) return null;
-
- if (friends.data.friends.length === 0) {
- return (
- <div className="rounded-md border border-dashed border-border/60 p-3 text-xs text-muted-foreground">
- {t("friends_list.empty")}
- </div>
- );
- }
-
- return (
- <ul className="space-y-2">
- {friends.data.friends.map((f) => (
- <FriendRow
- key={f.pubkey}
- item={f}
- isPending={pendingPubkey === f.pubkey && update.isPending}
- onUpdateInterval={(s) => {
- setPendingPubkey(f.pubkey);
- update.mutate({ pubkey: f.pubkey, pull_interval_s: s });
- }}
- />
- ))}
- </ul>
- );
-}
-
-function FriendRow({
- item, isPending, onUpdateInterval,
-}: {
- item: FriendItem;
- isPending: boolean;
- onUpdateInterval: (s: number) => void;
-}) {
- const t = useT();
- return (
- <li className="rounded-md border border-border bg-background/40 p-3 text-xs">
- <div className="flex items-start gap-3">
- <Sparkles className="mt-0.5 h-3.5 w-3.5 text-primary" />
- <div className="flex-1 min-w-0">
- <div className="flex items-center justify-between gap-2">
- <div>
- <div className="font-medium">{item.display_name}</div>
- <code className="font-mono text-micro text-muted-foreground">
- {item.pubkey.slice(0, 16)}…
- </code>
- </div>
- <div className="text-right text-micro text-muted-foreground">
- <div>{`${t("friends_list.since")} ${new Date(item.paired_at).toLocaleDateString("de-DE")}`}</div>
- {item.last_pull_at && (
- <div>{`${t("friends_list.last_pull")} ${timeSince(item.last_pull_at)}`}</div>
- )}
- </div>
- </div>
-
- <div className="mt-2 flex items-center gap-2">
- <span className="text-micro uppercase tracking-wider text-muted-foreground">
- {t("friends_list.pull_every")}
- </span>
- <div className="flex gap-1">
- {INTERVAL_PRESETS_S.map((s) => (
- <button
- key={s}
- type="button"
- disabled={isPending}
- onClick={() => onUpdateInterval(s)}
- className={cn(
- "rounded-md border px-2 py-0.5 text-micro transition-colors",
- item.pull_interval_s === s
- ? "border-primary/40 bg-primary/10 text-primary"
- : "border-border/60 bg-background/40 text-muted-foreground hover:bg-background/60",
- isPending && "opacity-50 cursor-wait",
- )}
- >
- {formatInterval(s)}
- </button>
- ))}
- </div>
- {isPending && <Loader2 className="h-3 w-3 animate-spin text-muted-foreground" />}
- </div>
- </div>
- </div>
- </li>
- );
-}
-
-function formatInterval(seconds: number): string {
- if (seconds < 60) return `${seconds}s`;
- if (seconds < 3600) return `${Math.round(seconds / 60)}m`;
- return `${Math.round(seconds / 3600)}h`;
-}
-
-function timeSince(iso: string): string {
- const diffMs = Date.now() - new Date(iso).getTime();
- const minutes = Math.floor(diffMs / 60000);
- if (minutes < 1) return "gerade";
- if (minutes < 60) return `vor ${minutes}m`;
- const hours = Math.floor(minutes / 60);
- if (hours < 24) return `vor ${hours}h`;
- return `vor ${Math.floor(hours / 24)}d`;
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/HeatmapGrid.tsx b/jarvis/ui/web/frontend/src/components/board/HeatmapGrid.tsx
deleted file mode 100644
index 6a26bcd77b..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/HeatmapGrid.tsx
+++ /dev/null
@@ -1,158 +0,0 @@
-import { useMemo } from "react";
-import type { HeatmapCell } from "@/hooks/useBoard";
-import { useT } from "@/i18n";
-import { cn } from "@/lib/utils";
-
-interface HeatmapGridProps {
- cells: HeatmapCell[];
- weeks?: number;
- showLegend?: boolean;
-}
-
-const ROWS = 7;
-
-/**
- * Activity heatmap in a snake layout (boustrophedon).
- * Starts TOP LEFT at the first active cell and alternates
- * right and left through the rows going down:
- * row 1 (top): left -> right
- * row 2: right -> left
- * row 3: left -> right
- * ...
- * Leading zero-activity days (today/yesterday with no activity) are skipped,
- * so active cells appear at the start of the snake.
- */
-export function HeatmapGrid({ cells, weeks = 53, showLegend = true }: HeatmapGridProps) {
- const t = useT();
- const cols = weeks;
-
- const byDate = useMemo(() => {
- const map = new Map<string, HeatmapCell>();
- for (const c of cells) map.set(c.date, c);
- return map;
- }, [cells]);
-
- const grid = useMemo(() => {
- if (cells.length === 0) return [] as HeatmapCell[][];
- const newest = new Date(cells[cells.length - 1].date + "T00:00:00");
- const total = ROWS * cols;
-
- // Chronologically descending: i=0 is today, i=total-1 is the oldest slot.
- const sequence: HeatmapCell[] = new Array(total);
- for (let i = 0; i < total; i += 1) {
- const day = new Date(newest);
- day.setDate(newest.getDate() - i);
- const iso = day.toISOString().slice(0, 10);
- sequence[i] = byDate.get(iso) ?? {
- date: iso,
- tasks_completed: 0,
- tasks_failed: 0,
- activity_events: 0,
- conversation_hours: 0,
- user_words: 0,
- jarvis_words: 0,
- };
- }
-
- // Skip leading zero-activity days so the snake starts at the first
- // active cell instead of at today's empty day.
- let startOffset = 0;
- while (
- startOffset < sequence.length &&
- sequence[startOffset].activity_events === 0
- ) {
- startOffset += 1;
- }
- if (startOffset >= total) startOffset = 0;
-
- // Boustrophedon from the TOP: k = row from the top (k=0 topmost row),
- // k=0 top left->right, k=1 right->left, k=2 left->right, etc.
- const layout: HeatmapCell[][] = Array.from(
- { length: ROWS },
- () => new Array<HeatmapCell>(cols),
- );
- for (let i = 0; i < total; i += 1) {
- const sourceIdx = i + startOffset;
- if (sourceIdx >= sequence.length) break;
- const k = Math.floor(i / cols);
- if (k >= ROWS) break;
- const offset = i % cols;
- const cssRow = k;
- const col = k % 2 === 0 ? offset : cols - 1 - offset;
- layout[cssRow][col] = sequence[sourceIdx];
- }
- return layout;
- }, [cells, byDate, cols]);
-
- const max = useMemo(
- () => Math.max(1, ...cells.map((c) => c.activity_events)),
- [cells],
- );
-
- return (
- <div className="overflow-x-auto">
- <div
- className="grid gap-[3px]"
- style={{
- gridTemplateColumns: `repeat(${cols}, 14px)`,
- gridTemplateRows: `repeat(${ROWS}, 14px)`,
- }}
- >
- {grid.flatMap((row, r) =>
- row.map((c, ci) => {
- if (!c) {
- return (
- <div
- key={`${r}-${ci}`}
- className="h-[14px] w-[14px] rounded-[3px] border border-border/20 bg-muted/10"
- />
- );
- }
- const intensity = c.activity_events === 0
- ? 0
- : Math.min(4, Math.ceil((c.activity_events / max) * 4));
- return (
- <div
- key={`${r}-${ci}`}
- className={cn(
- "h-[14px] w-[14px] rounded-[3px] border border-border/40",
- LEVEL[intensity],
- )}
- title={t("board.heatmap_tooltip").replace("{0}", c.date).replace("{1}", String(c.activity_events)).replace("{2}", String(c.tasks_completed)).replace("{3}", c.conversation_hours.toFixed(1))}
- />
- );
- }),
- )}
- </div>
- {showLegend && <HeatmapLegend className="mt-3" />}
- </div>
- );
-}
-
-export function HeatmapLegend({ className }: { className?: string }) {
- return (
- <div
- className={cn(
- "flex items-center gap-2 text-micro uppercase tracking-wider text-muted-foreground",
- className,
- )}
- >
- <span>less</span>
- {[0, 1, 2, 3, 4].map((lvl) => (
- <span
- key={lvl}
- className={cn("h-[10px] w-[10px] rounded-[2px]", LEVEL[lvl])}
- />
- ))}
- <span>more</span>
- </div>
- );
-}
-
-const LEVEL: Record<number, string> = {
- 0: "bg-muted/20",
- 1: "bg-primary/25",
- 2: "bg-primary/45",
- 3: "bg-primary/70",
- 4: "bg-foreground/70",
-};
diff --git a/jarvis/ui/web/frontend/src/components/board/PairDialog.tsx b/jarvis/ui/web/frontend/src/components/board/PairDialog.tsx
deleted file mode 100644
index d81b920ab7..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/PairDialog.tsx
+++ /dev/null
@@ -1,163 +0,0 @@
-import { useState } from "react";
-import { QRCodeSVG } from "qrcode.react";
-import { Copy, KeyRound, Loader2, X } from "lucide-react";
-import {
- usePairAcceptFromFriend,
- usePairInitiate,
-} from "@/hooks/useFederation";
-import { cn } from "@/lib/utils";
-import { robustCopy } from "@/lib/clipboard";
-import { useT } from "@/i18n";
-
-interface PairDialogProps {
- onClose: () => void;
-}
-
-/**
- * Pair dialog with two modes:
- * - "Generate" — owner generates a token, shows URL + QR.
- * - "Accept" — friend received the URL, pastes it in.
- *
- * Modal is non-blocking — closes on backdrop click. Plan §D §0:
- * NO pop-up that interrupts feed scrolling; but this modal is
- * explicitly opened by the user.
- */
-export function PairDialog({ onClose }: PairDialogProps) {
- const t = useT();
- const [mode, setMode] = useState<"generate" | "accept">("generate");
- const initiate = usePairInitiate();
- const accept = usePairAcceptFromFriend();
- const [acceptUrl, setAcceptUrl] = useState("");
- const [copied, setCopied] = useState(false);
-
- return (
- <div
- className="fixed inset-0 z-50 flex items-center justify-center bg-scrim/50 backdrop-blur-sm"
- onClick={onClose}
- >
- <div
- className="w-full max-w-md rounded-lg bg-popover shadow-float p-6"
- onClick={(e) => e.stopPropagation()}
- >
- <header className="mb-4 flex items-center gap-3">
- <div className="flex h-8 w-8 items-center justify-center rounded-lg border border-primary/40 bg-primary/10 text-primary">
- <KeyRound className="h-4 w-4" />
- </div>
- <h3 className="font-display text-base font-semibold flex-1">{t("pair_dialog.title")}</h3>
- <button type="button" onClick={onClose} aria-label={t("common.close")}
- className="text-muted-foreground hover:text-foreground">
- <X className="h-4 w-4" />
- </button>
- </header>
-
- <div className="mb-4 flex gap-1.5 rounded-md border border-border bg-background/40 p-1">
- <button
- onClick={() => setMode("generate")}
- className={cn(
- "flex-1 rounded px-3 py-1.5 text-xs transition-colors",
- mode === "generate" ? "bg-primary/15 text-primary" : "text-muted-foreground"
- )}
- >{t("pair_dialog.mode_invite")}</button>
- <button
- onClick={() => setMode("accept")}
- className={cn(
- "flex-1 rounded px-3 py-1.5 text-xs transition-colors",
- mode === "accept" ? "bg-primary/15 text-primary" : "text-muted-foreground"
- )}
- >{t("pair_dialog.mode_follow")}</button>
- </div>
-
- {mode === "generate" && (
- <div className="space-y-3">
- <p className="text-xs text-muted-foreground">
- {t("pair_dialog.generate_hint")}
- </p>
- <button
- type="button"
- disabled={initiate.isPending}
- onClick={() => initiate.mutate()}
- className="inline-flex items-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/20"
- >
- {initiate.isPending && <Loader2 className="h-3 w-3 animate-spin" />}
- {t("pair_dialog.generate_button")}
- </button>
- {initiate.data && (
- <div className="space-y-3 rounded-lg border border-border bg-background/40 p-3">
- <div className="flex items-center justify-center">
- <div className="rounded-md bg-white p-2">
- <QRCodeSVG value={initiate.data.url} size={160} level="M" />
- </div>
- </div>
- <div className="flex items-center gap-2 rounded-md border border-border bg-card/50 px-2 py-1.5">
- <code className="flex-1 truncate font-mono text-micro text-muted-foreground">
- {initiate.data.url}
- </code>
- <button
- type="button"
- onClick={() => {
- robustCopy(initiate.data!.url)
- .then((ok) => {
- if (ok) {
- setCopied(true);
- setTimeout(() => setCopied(false), 1500);
- }
- })
- .catch((err) => {
- console.warn("Clipboard write failed:", err);
- });
- }}
- className="inline-flex items-center gap-1 text-micro text-muted-foreground hover:text-foreground"
- >
- <Copy className="h-3 w-3" />{copied ? t("pair_dialog.copied") : t("pair_dialog.copy")}
- </button>
- </div>
- <div className="text-micro text-muted-foreground">
- {`${t("pair_dialog.valid_until")} ${new Date(initiate.data.expires_at).toLocaleString("de-DE")}`}
- </div>
- </div>
- )}
- {initiate.isError && (
- <div className="text-xs text-destructive">
- {`${t("pair_dialog.error_prefix")} ${(initiate.error as Error).message}`}
- </div>
- )}
- </div>
- )}
-
- {mode === "accept" && (
- <div className="space-y-3">
- <p className="text-xs text-muted-foreground">
- {t("pair_dialog.accept_hint")}
- </p>
- <input
- type="url"
- value={acceptUrl}
- onChange={(e) => setAcceptUrl(e.target.value)}
- placeholder="https://board.friend.tld/api/v1/pair/redeem?token=..."
- className="w-full rounded-md border border-border bg-background/40 px-3 py-1.5 text-xs"
- />
- <button
- type="button"
- disabled={accept.isPending || !acceptUrl}
- onClick={() => accept.mutate(acceptUrl)}
- className="inline-flex items-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/20 disabled:opacity-50"
- >
- {accept.isPending && <Loader2 className="h-3 w-3 animate-spin" />}
- {t("pair_dialog.accept_button")}
- </button>
- {accept.data && (
- <div className="rounded-md border border-muted-foreground/30 bg-muted-foreground/5 p-2 text-xs text-muted-foreground">
- {`${t("pair_dialog.paired_with")} ${accept.data.owner_display_name}.`}
- </div>
- )}
- {accept.isError && (
- <div className="text-xs text-destructive">
- {`${t("pair_dialog.error_prefix")} ${(accept.error as Error).message}`}
- </div>
- )}
- </div>
- )}
- </div>
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/PersonalRecordsList.tsx b/jarvis/ui/web/frontend/src/components/board/PersonalRecordsList.tsx
deleted file mode 100644
index c409614e18..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/PersonalRecordsList.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-import { Trophy } from "lucide-react";
-import type { PersonalRecord } from "@/hooks/useBoard";
-import { useT } from "@/i18n";
-
-interface PersonalRecordsListProps {
- records: PersonalRecord[];
-}
-
-const KNOWN_METRICS = [
- "most_tasks_in_a_day",
- "most_unique_tools_in_a_day",
- "most_voice_commands_in_a_day",
- "most_hours_saved_in_a_day",
- "most_active_events_in_a_day",
- "most_conversation_hours_in_a_day",
-];
-
-export function PersonalRecordsList({ records }: PersonalRecordsListProps) {
- const t = useT();
- if (records.length === 0) {
- return (
- <div className="flex h-32 items-center justify-center rounded-lg border border-dashed border-border/60 text-xs text-muted-foreground">
- {t("board_view.no_records_yet")}
- </div>
- );
- }
-
- return (
- <ul className="grid gap-3 md:grid-cols-2">
- {records.map((rec) => {
- const meta = KNOWN_METRICS.includes(rec.metric)
- ? {
- title: t(`board_view.records.${rec.metric}.title`),
- unit: t(`board_view.records.${rec.metric}.unit`),
- }
- : { title: rec.metric, unit: "" };
- const value = Number.isInteger(rec.value)
- ? rec.value.toString()
- : rec.value.toFixed(1);
- return (
- <li
- key={rec.metric}
- className="flex items-start gap-3 rounded-xl border border-border bg-card/30 px-4 py-3 backdrop-blur"
- >
- <div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary">
- <Trophy className="h-4 w-4" />
- </div>
- <div className="min-w-0 flex-1">
- <div className="text-xs uppercase tracking-wider text-muted-foreground">
- {meta.title}
- </div>
- <div className="mt-0.5 font-display text-lg font-semibold">
- {value}
- {meta.unit && (
- <span className="ml-1 text-xs font-normal text-muted-foreground">
- {meta.unit}
- </span>
- )}
- </div>
- <div className="text-micro text-muted-foreground">
- {rec.achieved_on}
- </div>
- </div>
- </li>
- );
- })}
- </ul>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/ReactionBar.tsx b/jarvis/ui/web/frontend/src/components/board/ReactionBar.tsx
deleted file mode 100644
index 327d83346b..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/ReactionBar.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { Brain, Flame, Rocket } from "lucide-react";
-import type { Reaction } from "@/hooks/useFederation";
-import { cn } from "@/lib/utils";
-
-interface ReactionBarProps {
- counts: Record<string, number> | null;
- hasReactions: boolean;
- onReact: (r: Reaction) => void;
- disabled?: boolean;
-}
-
-const ICONS: Record<Reaction, React.ComponentType<{ className?: string }>> = {
- rocket: Rocket,
- brain: Brain,
- fire: Flame,
-};
-
-const LABELS: Record<Reaction, string> = {
- rocket: "rocket",
- brain: "brain",
- fire: "fire",
-};
-
-export function ReactionBar({ counts, hasReactions, onReact, disabled }: ReactionBarProps) {
- const isOwner = counts !== null;
- return (
- <div className="flex items-center gap-1.5">
- {(Object.keys(ICONS) as Reaction[]).map((r) => {
- const Icon = ICONS[r];
- const cnt = isOwner ? (counts![r] ?? 0) : null;
- return (
- <button
- key={r}
- type="button"
- disabled={disabled}
- onClick={() => onReact(r)}
- title={isOwner ? `${LABELS[r]} (${cnt})` : "Click to react"}
- className={cn(
- "inline-flex items-center gap-1 rounded-md border border-border/70 bg-background/40 px-2 py-1 text-xs transition-colors",
- "hover:border-primary/40 hover:bg-background/60",
- disabled && "cursor-not-allowed opacity-50",
- )}
- >
- <Icon className="h-3 w-3" />
- {isOwner ? <span className="font-mono">{cnt}</span> : null}
- </button>
- );
- })}
- {!isOwner && hasReactions && (
- <span className="text-micro text-muted-foreground" title="Others reacted">
- &middot;
- </span>
- )}
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/StatsCard.tsx b/jarvis/ui/web/frontend/src/components/board/StatsCard.tsx
deleted file mode 100644
index b1b32b3d3b..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/StatsCard.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import type { ReactNode } from "react";
-import { cn } from "@/lib/utils";
-
-interface StatsCardProps {
- label: string;
- value: string | number;
- sublabel?: string;
- icon?: ReactNode;
- tone?: "default" | "success" | "warn";
- className?: string;
-}
-
-const TONE: Record<NonNullable<StatsCardProps["tone"]>, string> = {
- default: "border-border bg-card/40 text-foreground",
- success: "border-muted-foreground/30 bg-muted-foreground/5 text-muted-foreground",
- warn: "border-foreground/30 bg-foreground/5 text-foreground",
-};
-
-/** Compact large number + label for board metrics. */
-export function StatsCard({
- label,
- value,
- sublabel,
- icon,
- tone = "default",
- className,
-}: StatsCardProps) {
- return (
- <div
- className={cn(
- "flex flex-col gap-2 rounded-xl border px-5 py-4 backdrop-blur",
- TONE[tone],
- className,
- )}
- >
- <div className="flex items-center gap-2 text-micro uppercase tracking-wider text-muted-foreground">
- {icon}
- <span>{label}</span>
- </div>
- <div className="font-display text-3xl leading-none">
- {value}
- </div>
- {sublabel && (
- <div className="text-xs text-muted-foreground">{sublabel}</div>
- )}
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/StoryComposer.tsx b/jarvis/ui/web/frontend/src/components/board/StoryComposer.tsx
deleted file mode 100644
index 2ffdfb263e..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/StoryComposer.tsx
+++ /dev/null
@@ -1,123 +0,0 @@
-import { useState } from "react";
-import { Loader2, Send, X } from "lucide-react";
-import { useCreateStory, type Visibility } from "@/hooks/useFederation";
-import { cn } from "@/lib/utils";
-import { useT } from "@/i18n";
-
-interface StoryComposerProps {
- onClose: () => void;
-}
-
-const MAX_CHARS = 280;
-
-export function StoryComposer({ onClose }: StoryComposerProps) {
- const t = useT();
- const [text, setText] = useState("");
- const [visibility, setVisibility] = useState<Visibility>("friends");
- const create = useCreateStory();
-
- const remaining = MAX_CHARS - text.length;
-
- return (
- <div
- className="fixed inset-0 z-50 flex items-center justify-center bg-scrim/50 backdrop-blur-sm"
- onClick={onClose}
- >
- <div
- className="w-full max-w-md rounded-lg bg-popover shadow-float p-5"
- onClick={(e) => e.stopPropagation()}
- >
- <header className="mb-3 flex items-center gap-3">
- <h3 className="font-display text-sm font-semibold flex-1">
- {t("story_composer.title")}
- </h3>
- <button type="button" onClick={onClose} aria-label={t("story_composer.close")}
- className="text-muted-foreground hover:text-foreground">
- <X className="h-4 w-4" />
- </button>
- </header>
-
- <textarea
- value={text}
- onChange={(e) => setText(e.target.value.slice(0, MAX_CHARS))}
- rows={4}
- placeholder={t("story_composer.placeholder")}
- className="w-full resize-none rounded-md border border-border bg-background/40 px-3 py-2 text-sm"
- />
- <div className="mt-1 flex items-center justify-between text-micro text-muted-foreground">
- <span>{t("story_composer.expiry_hint")}</span>
- <span className={cn(remaining < 30 && "text-foreground")}>
- {`${remaining} ${t("story_composer.characters")}`}
- </span>
- </div>
-
- <div className="mt-3">
- <VisibilityRadios value={visibility} onChange={setVisibility} />
- </div>
-
- <div className="mt-4 flex justify-end gap-2">
- <button
- onClick={onClose}
- className="rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground"
- >{t("common.cancel")}</button>
- <button
- type="button"
- disabled={create.isPending || text.trim().length === 0}
- onClick={() =>
- create.mutate(
- { text: text.trim(), visibility },
- { onSuccess: onClose },
- )
- }
- className="inline-flex items-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/20 disabled:opacity-50"
- >
- {create.isPending ? <Loader2 className="h-3 w-3 animate-spin" /> : <Send className="h-3 w-3" />}
- {t("story_composer.post")}
- </button>
- </div>
- {create.isError && (
- <div className="mt-2 text-xs text-destructive">
- {`${t("story_composer.error_prefix")} ${(create.error as Error).message}`}
- </div>
- )}
- </div>
- </div>
- );
-}
-
-export function VisibilityRadios({
- value, onChange,
-}: { value: Visibility; onChange: (v: Visibility) => void }) {
- const t = useT();
- const opts: { v: Visibility; label: string; hint: string }[] = [
- { v: "private", label: t("story_composer.visibility_private"), hint: t("story_composer.visibility_private_hint") },
- { v: "friends", label: t("story_composer.visibility_friends"), hint: t("story_composer.visibility_friends_hint") },
- { v: "public", label: t("story_composer.visibility_public"), hint: t("story_composer.visibility_public_hint") },
- ];
- return (
- <div className="grid grid-cols-3 gap-1.5">
- {opts.map((o) => (
- <label
- key={o.v}
- className={cn(
- "flex cursor-pointer flex-col gap-0.5 rounded-md border px-2.5 py-2 text-xs transition-colors",
- value === o.v
- ? "border-primary/40 bg-primary/10 text-primary"
- : "border-border/60 bg-background/40 text-muted-foreground hover:bg-background/60",
- )}
- >
- <input
- type="radio"
- name="visibility"
- value={o.v}
- checked={value === o.v}
- onChange={() => onChange(o.v)}
- className="sr-only"
- />
- <span className="font-medium">{o.label}</span>
- <span className="text-micro opacity-70">{o.hint}</span>
- </label>
- ))}
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/ToolBarChart.tsx b/jarvis/ui/web/frontend/src/components/board/ToolBarChart.tsx
deleted file mode 100644
index 787c0f5ed9..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/ToolBarChart.tsx
+++ /dev/null
@@ -1,96 +0,0 @@
-import {
- Bar,
- BarChart,
- CartesianGrid,
- ResponsiveContainer,
- Tooltip,
- XAxis,
- YAxis,
-} from "recharts";
-import type { ToolHistogramEntry } from "@/hooks/useBoard";
-import { useT } from "@/i18n";
-
-interface ToolBarChartProps {
- histogram: ToolHistogramEntry[];
- limit?: number;
-}
-
-/**
- * Horizontal bar chart of the most-used tools. Takes the top N and
- * sorts descending. "Days used" = number of distinct days on which
- * the tool was invoked successfully at least once (NOT per
- * invocation — that would skew power tools like ``bash``).
- */
-export function ToolBarChart({ histogram, limit = 15 }: ToolBarChartProps) {
- const t = useT();
- const data = histogram.slice(0, limit).map((entry) => ({
- tool: entry.tool,
- days: entry.days_used,
- }));
-
- if (data.length === 0) {
- return (
- <div className="flex h-48 items-center justify-center rounded-lg border border-dashed border-border/60 text-xs text-muted-foreground">
- {t("board_view.tools_chart_empty")}
- </div>
- );
- }
-
- const height = Math.max(180, data.length * 28);
-
- return (
- <div style={{ width: "100%", height }}>
- <ResponsiveContainer
- minWidth={0}
- initialDimension={{ width: 640, height }}
- >
- <BarChart
- data={data}
- layout="vertical"
- margin={{ top: 8, right: 24, bottom: 4, left: 8 }}
- >
- <CartesianGrid
- strokeDasharray="3 3"
- stroke="hsl(var(--border))"
- horizontal={false}
- />
- <XAxis
- type="number"
- allowDecimals={false}
- stroke="hsl(var(--muted-foreground))"
- fontSize={11}
- />
- <YAxis
- type="category"
- dataKey="tool"
- width={120}
- stroke="hsl(var(--muted-foreground))"
- fontSize={11}
- />
- <Tooltip
- cursor={{ fill: "hsl(var(--muted) / 0.2)" }}
- contentStyle={{
- background: "hsl(var(--card))",
- border: "1px solid hsl(var(--border))",
- borderRadius: 6,
- fontSize: 12,
- }}
- labelStyle={{ color: "hsl(var(--foreground))" }}
- formatter={(value) => {
- const n = typeof value === "number" ? value : Number(value) || 0;
- const days = n === 1
- ? t("board_view.tools_chart_days_used_one").replace("{0}", String(n))
- : t("board_view.tools_chart_days_used").replace("{0}", String(n));
- return [days, t("board_view.tools_chart_used_label")];
- }}
- />
- <Bar
- dataKey="days"
- fill="hsl(var(--primary))"
- radius={[0, 4, 4, 0]}
- />
- </BarChart>
- </ResponsiveContainer>
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/WordsTrendChart.tsx b/jarvis/ui/web/frontend/src/components/board/WordsTrendChart.tsx
deleted file mode 100644
index 826a3d0fa0..0000000000
--- a/jarvis/ui/web/frontend/src/components/board/WordsTrendChart.tsx
+++ /dev/null
@@ -1,163 +0,0 @@
-import { useMemo } from "react";
-import {
- Area,
- AreaChart,
- ResponsiveContainer,
- Tooltip,
- XAxis,
- YAxis,
-} from "recharts";
-import type { HeatmapCell } from "@/hooks/useBoard";
-import { useT } from "@/i18n";
-
-export const TREND_YOU = "hsl(var(--primary))"; // signal yellow (primary)
-export const TREND_JARVIS = "hsl(199 90% 64%)"; // soft sky
-
-interface WordsTrendChartProps {
- cells: HeatmapCell[];
- days?: number;
-}
-
-interface Point {
- date: string;
- you: number;
- jarvis: number;
-}
-
-/**
- * Area chart of words per day — "you said" vs "Jarvis said" — over the recent
- * window. Two stacked gradient fills with hairline strokes; axis and grid are
- * stripped to near-nothing so the data shape carries the visual, not chrome.
- */
-export function WordsTrendChart({ cells, days = 45 }: WordsTrendChartProps) {
- const t = useT();
-
- const data: Point[] = useMemo(
- () =>
- cells.slice(-days).map((c) => ({
- date: c.date,
- you: c.user_words,
- jarvis: c.jarvis_words,
- })),
- [cells, days],
- );
-
- const hasData = data.some((d) => d.you > 0 || d.jarvis > 0);
- if (!hasData) {
- return (
- <div className="flex h-full items-center justify-center text-xs text-muted-foreground">
- {t("board_view.chart_empty")}
- </div>
- );
- }
-
- return (
- // minHeight guards the Recharts width/height(-1) initial-measure race in a
- // grid/flex parent: without a positive floor the first measure is 0×0, the
- // Area paths bake in a collapsed scale, and the ResizeObserver re-measure
- // recovers the axes but not the (animated) fills — leaving an empty chart.
- <ResponsiveContainer
- width="100%"
- height="100%"
- minHeight={176}
- minWidth={0}
- initialDimension={{ width: 640, height: 176 }}
- >
- <AreaChart data={data} margin={{ top: 6, right: 2, bottom: 0, left: 2 }}>
- <defs>
- <linearGradient id="board-grad-you" x1="0" y1="0" x2="0" y2="1">
- <stop offset="0%" stopColor={TREND_YOU} stopOpacity={0.42} />
- <stop offset="100%" stopColor={TREND_YOU} stopOpacity={0.02} />
- </linearGradient>
- <linearGradient id="board-grad-jarvis" x1="0" y1="0" x2="0" y2="1">
- <stop offset="0%" stopColor={TREND_JARVIS} stopOpacity={0.28} />
- <stop offset="100%" stopColor={TREND_JARVIS} stopOpacity={0.02} />
- </linearGradient>
- </defs>
- <XAxis
- dataKey="date"
- tickFormatter={fmtTick}
- tick={{ fill: "hsl(0 0% 50%)", fontSize: 10 }}
- axisLine={false}
- tickLine={false}
- minTickGap={44}
- dy={4}
- />
- <YAxis hide domain={[0, "dataMax"]} />
- <Tooltip
- content={<TrendTooltip t={t} />}
- cursor={{ stroke: "hsl(0 0% 32%)", strokeDasharray: "3 3" }}
- />
- <Area
- type="monotone"
- dataKey="jarvis"
- stroke={TREND_JARVIS}
- strokeWidth={1.5}
- fill="url(#board-grad-jarvis)"
- activeDot={{ r: 3, strokeWidth: 0 }}
- isAnimationActive={false}
- />
- <Area
- type="monotone"
- dataKey="you"
- stroke={TREND_YOU}
- strokeWidth={1.75}
- fill="url(#board-grad-you)"
- activeDot={{ r: 3, strokeWidth: 0 }}
- isAnimationActive={false}
- />
- </AreaChart>
- </ResponsiveContainer>
- );
-}
-
-interface TooltipPayloadItem {
- dataKey: string;
- value: number;
-}
-
-function TrendTooltip(props: {
- active?: boolean;
- payload?: TooltipPayloadItem[];
- label?: string;
- t: (k: string) => string;
-}) {
- const { active, payload, label, t } = props;
- if (!active || !payload || payload.length === 0) return null;
- const you = payload.find((p) => p.dataKey === "you")?.value ?? 0;
- const jarvis = payload.find((p) => p.dataKey === "jarvis")?.value ?? 0;
- return (
- <div className="rounded-lg border border-sheen/10 bg-[#0c0c0c]/95 px-3 py-2 text-xs backdrop-blur">
- <div className="mb-1.5 font-medium text-foreground">{fmtFull(label)}</div>
- <Row color={TREND_YOU} label={t("board_view.hero.you_spoke")} value={you} />
- <Row color={TREND_JARVIS} label={t("board_view.hero.jarvis_spoke")} value={jarvis} />
- </div>
- );
-}
-
-function Row({ color, label, value }: { color: string; label: string; value: number }) {
- return (
- <div className="flex items-center gap-2">
- <span className="h-2 w-2 rounded-full" style={{ background: color }} />
- <span className="text-muted-foreground">{label}</span>
- <span className="ml-auto font-semibold tabular-nums">{value.toLocaleString()}</span>
- </div>
- );
-}
-
-function fmtTick(iso: string): string {
- const d = new Date(iso + "T00:00:00");
- if (Number.isNaN(d.getTime())) return iso;
- return d.toLocaleDateString(undefined, { day: "numeric", month: "short" });
-}
-
-function fmtFull(iso?: string): string {
- if (!iso) return "";
- const d = new Date(iso + "T00:00:00");
- if (Number.isNaN(d.getTime())) return iso;
- return d.toLocaleDateString(undefined, {
- weekday: "short",
- day: "numeric",
- month: "short",
- });
-}
diff --git a/jarvis/ui/web/frontend/src/components/board/insights/AgentsTab.tsx b/jarvis/ui/web/frontend/src/components/board/insights/AgentsTab.tsx
new file mode 100644
index 0000000000..d041b45f31
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/board/insights/AgentsTab.tsx
@@ -0,0 +1,222 @@
+import { useState } from "react";
+
+import type { BoardInsights, InsightsAgent } from "@/hooks/useBoardInsights";
+import { agentLabel, chatProviderLabel, compactNumber, formatDay, plural } from "@/lib/boardInsights";
+import {
+ BOARD_CATEGORY_KEYS,
+ CATEGORY_META,
+ categoryLabelKey,
+ type BoardCategoryKey,
+} from "@/lib/boardCategories";
+import { ProviderLogo } from "@/components/providers/ProviderLogo";
+import { TabBar } from "@/components/layout/SectionTabBar";
+import {
+ BigNumber,
+ CardTitleRow,
+ Eyebrow,
+ InsightCard,
+} from "@/components/board/insights/primitives";
+import { useT, useUiLanguage } from "@/i18n";
+import { cn } from "@/lib/utils";
+
+type Range = "30d" | "all";
+
+export function AgentsTab({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const lang = useUiLanguage();
+ const best = data.records.best_agent_day;
+ const sessions30 = data.agents.items.reduce((s, a) => s + a.sessions_30d, 0);
+ return (
+ <div className="flex flex-col gap-4">
+ <div className="grid grid-cols-2 gap-4 lg:grid-cols-4">
+ <StatCard label={t("board_insights.agents.stat_sessions")} value={data.agents.sessions.toLocaleString()} />
+ <StatCard label={t("board_insights.agents.stat_sessions_30d")} value={sessions30.toLocaleString()} />
+ <StatCard label={t("board_insights.agents.stat_tokens")} value={compactNumber(data.agents.tokens)} />
+ <StatCard
+ label={t("board_insights.agents.stat_busiest")}
+ value={best ? best.value.toLocaleString() : "—"}
+ sub={best ? formatDay(best.date, lang) : undefined}
+ />
+ </div>
+ <div className="grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)]">
+ <CodingAgentsCard data={data} />
+ <div className="flex min-w-0 flex-col gap-4">
+ <ChatsCard data={data} />
+ <CategoriesCard data={data} />
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function StatCard({ label, value, sub }: { label: string; value: string; sub?: string }) {
+ return (
+ <InsightCard>
+ <BigNumber>{value}</BigNumber>
+ <div className="mt-2">
+ <Eyebrow>{label}</Eyebrow>
+ </div>
+ {sub && <div className="mt-1 text-sm text-muted-foreground">{sub}</div>}
+ </InsightCard>
+ );
+}
+
+function CodingAgentsCard({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const lang = useUiLanguage();
+ const [range, setRange] = useState<Range>("30d");
+ const sessionsOf = (a: InsightsAgent) => (range === "30d" ? a.sessions_30d : a.sessions);
+ const turnsOf = (a: InsightsAgent) => (range === "30d" ? a.turns_30d : a.turns);
+ const rows = [...data.agents.items].sort((a, b) => sessionsOf(b) - sessionsOf(a));
+ const total = rows.reduce((s, a) => s + sessionsOf(a), 0);
+ const max = Math.max(1, ...rows.map(sessionsOf));
+ const relative = new Intl.RelativeTimeFormat(lang, { numeric: "auto" });
+
+ return (
+ <InsightCard testId="board-coding-agents">
+ <CardTitleRow
+ title={t("board_insights.agents.title")}
+ fact={plural(t, "board_insights.agents.used", rows.filter((a) => sessionsOf(a) > 0).length)}
+ >
+ <p className="mt-1 text-sm text-muted-foreground">{t("board_insights.agents.subtitle")}</p>
+ </CardTitleRow>
+ <TabBar
+ className="mb-2"
+ tabs={[
+ { id: "30d", label: t("board_insights.agents.range_30d") },
+ { id: "all", label: t("board_insights.agents.range_all") },
+ ]}
+ active={range}
+ onChange={(id) => setRange(id as Range)}
+ />
+ {rows.length === 0 ? (
+ <p className="py-6 text-sm text-muted-foreground">{t("board_insights.agents.empty")}</p>
+ ) : (
+ <table className="w-full table-fixed text-sm">
+ <thead>
+ <tr className="text-left text-xs uppercase tracking-[0.06em] text-muted-foreground">
+ <th className="py-2 font-medium">{t("board_insights.agents.col_agent")}</th>
+ <th className="w-[32%] py-2 font-medium">{t("board_insights.agents.col_share")}</th>
+ <th className="w-[13%] py-2 text-right font-medium">{t("board_insights.agents.col_sessions")}</th>
+ <th className="w-[13%] py-2 text-right font-medium">{t("board_insights.agents.col_turns")}</th>
+ <th className="hidden w-[17%] py-2 text-right font-medium md:table-cell">
+ {t("board_insights.agents.col_last")}
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ {rows.map((agent) => {
+ const sessions = sessionsOf(agent);
+ const pct = total ? Math.round((sessions / total) * 100) : 0;
+ return (
+ <tr key={agent.agent} className={cn("border-t border-border", sessions === 0 && "opacity-50")}>
+ <td className="py-2.5">
+ <div className="flex min-w-0 items-center gap-2.5">
+ <ProviderLogo providerId={agent.agent} label={agentLabel(agent.agent)} />
+ <span className="truncate font-medium text-foreground-strong">{agentLabel(agent.agent)}</span>
+ </div>
+ </td>
+ <td className="py-2.5 pr-3">
+ <div className="flex items-center gap-2">
+ <div className="h-2 flex-1 overflow-hidden rounded-full bg-sheen/[0.06]">
+ <div
+ className="h-full rounded-full bg-accent"
+ style={{ width: sessions > 0 ? `${Math.max((sessions / max) * 100, 3)}%` : "0%" }}
+ />
+ </div>
+ <span className="w-9 text-right text-xs tabular-nums text-muted-foreground">{pct}%</span>
+ </div>
+ </td>
+ <td className="py-2.5 text-right tabular-nums text-foreground-strong">{sessions.toLocaleString()}</td>
+ <td className="py-2.5 text-right tabular-nums text-muted-foreground">
+ {compactNumber(turnsOf(agent))}
+ </td>
+ <td className="hidden py-2.5 text-right text-muted-foreground md:table-cell">
+ {agent.last_ms ? relativeDays(agent.last_ms, relative) : "—"}
+ </td>
+ </tr>
+ );
+ })}
+ </tbody>
+ </table>
+ )}
+ </InsightCard>
+ );
+}
+
+function ChatsCard({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const rows = data.chats.providers.slice(0, 6);
+ const max = Math.max(1, ...rows.map((r) => r.messages));
+ return (
+ <InsightCard testId="board-chats">
+ <CardTitleRow
+ title={t("board_insights.chats.title")}
+ fact={plural(t, "board_insights.chats.messages", data.chats.messages)}
+ />
+ {rows.length === 0 ? (
+ <p className="text-sm text-muted-foreground">{t("board_insights.chats.empty")}</p>
+ ) : (
+ <ul className="flex flex-col gap-2.5">
+ {rows.map((row) => (
+ <li key={row.provider} className="flex items-center gap-2.5 text-sm">
+ <ProviderLogo providerId={row.provider} label={chatProviderLabel(row.provider)} size="sm" />
+ <span className="w-24 shrink-0 truncate text-foreground">{chatProviderLabel(row.provider)}</span>
+ <div className="h-2 flex-1 overflow-hidden rounded-full bg-sheen/[0.06]">
+ <div
+ className="h-full rounded-full bg-accent/70"
+ style={{ width: row.messages > 0 ? `${Math.max((row.messages / max) * 100, 3)}%` : "0%" }}
+ />
+ </div>
+ <span className="w-10 text-right tabular-nums text-foreground-strong">{row.messages.toLocaleString()}</span>
+ </li>
+ ))}
+ </ul>
+ )}
+ </InsightCard>
+ );
+}
+
+function CategoriesCard({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const counts = new Map(data.categories.categories.map((c) => [c.category, c.count]));
+ const total = data.categories.total;
+ const rows = BOARD_CATEGORY_KEYS.map((key) => ({ key, count: counts.get(key) ?? 0 }))
+ .filter((r) => r.count > 0)
+ .sort((a, b) => b.count - a.count);
+ return (
+ <InsightCard testId="board-categories">
+ <CardTitleRow title={t("board_insights.categories.title")}>
+ <p className="mt-1 text-sm text-muted-foreground">{t("board_insights.categories.subtitle")}</p>
+ </CardTitleRow>
+ {rows.length === 0 ? (
+ <p className="text-sm text-muted-foreground">{t("board_insights.categories.empty")}</p>
+ ) : (
+ <ul className="flex flex-col gap-2">
+ {rows.map(({ key, count }) => {
+ const Icon = CATEGORY_META[key as BoardCategoryKey].icon;
+ const pct = total ? Math.round((count / total) * 100) : 0;
+ return (
+ <li key={key} className="flex items-center gap-2.5 text-sm">
+ <Icon className="h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />
+ <span className="flex-1 truncate text-foreground">{t(categoryLabelKey(key))}</span>
+ <span className="tabular-nums text-muted-foreground">{count.toLocaleString()}</span>
+ <span className="w-10 text-right text-xs tabular-nums text-foreground-strong">{pct}%</span>
+ </li>
+ );
+ })}
+ </ul>
+ )}
+ </InsightCard>
+ );
+}
+
+function relativeDays(ms: number, fmt: Intl.RelativeTimeFormat): string {
+ const startOfToday = new Date();
+ startOfToday.setHours(0, 0, 0, 0);
+ const then = new Date(ms);
+ then.setHours(0, 0, 0, 0);
+ const days = Math.round((then.getTime() - startOfToday.getTime()) / 86_400_000);
+ return fmt.format(days, "day");
+}
+
diff --git a/jarvis/ui/web/frontend/src/components/board/insights/RhythmTab.tsx b/jarvis/ui/web/frontend/src/components/board/insights/RhythmTab.tsx
new file mode 100644
index 0000000000..843b638bd0
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/board/insights/RhythmTab.tsx
@@ -0,0 +1,280 @@
+import { useMemo } from "react";
+import { Award, Bot, CalendarDays, Flame, type LucideIcon } from "lucide-react";
+
+import type { BoardInsights } from "@/hooks/useBoardInsights";
+import {
+ formatDay,
+ hourTotals,
+ intensityLevels,
+ milestoneProgress,
+ peakSlot,
+ plural,
+ weekdayTotals,
+ weeklyTotals,
+ wordsOf,
+} from "@/lib/boardInsights";
+import { QuickTooltip } from "@/components/ui/tooltip";
+import {
+ CardTitleRow,
+ HEAT_LEVEL_CLASS,
+ InsightCard,
+} from "@/components/board/insights/primitives";
+import { useT, useUiLanguage } from "@/i18n";
+import { cn } from "@/lib/utils";
+
+const WEEKS_SHOWN = 26;
+
+export function RhythmTab({ data }: { data: BoardInsights }) {
+ return (
+ <div className="flex flex-col gap-4">
+ <PunchCard data={data} />
+ <div className="grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)]">
+ <WeeklyVolumeCard data={data} />
+ <RecordsCard data={data} />
+ </div>
+ </div>
+ );
+}
+
+function useWeekdayNames(style: "short" | "long") {
+ const lang = useUiLanguage();
+ return useMemo(() => {
+ const fmt = new Intl.DateTimeFormat(lang, { weekday: style });
+ return Array.from({ length: 7 }, (_, i) => fmt.format(new Date(2024, 0, 1 + i)));
+ }, [lang, style]);
+}
+
+function hourLabel(hour: number, lang: string): string {
+ return new Date(2024, 0, 1, hour).toLocaleTimeString(lang, { hour: "numeric" });
+}
+
+function PunchCard({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const lang = useUiLanguage();
+ const shortDays = useWeekdayNames("short");
+ const longDays = useWeekdayNames("long");
+ const punch = data.punch_card;
+ const level = useMemo(() => intensityLevels(punch.flat()), [punch]);
+ const peak = peakSlot(punch);
+ const hours = hourTotals(punch);
+ const maxHour = Math.max(1, ...hours);
+ const weekdays = weekdayTotals(punch);
+ const topDay = weekdays.indexOf(Math.max(...weekdays));
+
+ return (
+ <InsightCard testId="board-punch-card">
+ <CardTitleRow
+ title={t("board_insights.rhythm.title")}
+ fact={
+ peak
+ ? t("board_insights.rhythm.peak")
+ .replace("{0}", longDays[peak.weekday])
+ .replace("{1}", hourLabel(peak.hour, lang))
+ : undefined
+ }
+ >
+ <p className="mt-1 text-sm text-muted-foreground">{t("board_insights.rhythm.subtitle")}</p>
+ </CardTitleRow>
+ {!peak ? (
+ <p className="py-6 text-sm text-muted-foreground">{t("board_insights.rhythm.empty")}</p>
+ ) : (
+ <div className="overflow-x-auto">
+ <div
+ className="grid min-w-[640px] items-center gap-1"
+ style={{ gridTemplateColumns: "3rem repeat(24, minmax(0, 1fr)) 4.5rem" }}
+ >
+ {punch.map((row, weekday) => (
+ <PunchRow
+ key={weekday}
+ label={shortDays[weekday]}
+ values={row}
+ level={level}
+ total={weekdays[weekday]}
+ highlight={weekday === topDay}
+ describe={(hour, value) =>
+ `${longDays[weekday]}, ${hourLabel(hour, lang)} — ${value.toLocaleString()}`
+ }
+ />
+ ))}
+ <span />
+ {hours.map((value, hour) => (
+ <div key={hour} className="flex h-12 items-end" aria-hidden>
+ <div
+ className="w-full rounded-t-[3px] bg-accent/60"
+ style={{ height: `${Math.max((value / maxHour) * 100, value > 0 ? 4 : 0)}%` }}
+ />
+ </div>
+ ))}
+ <span />
+ <span />
+ {hours.map((_, hour) => (
+ <span key={hour} className="text-center text-xs tabular-nums text-muted-foreground">
+ {hour % 3 === 0 ? String(hour).padStart(2, "0") : ""}
+ </span>
+ ))}
+ <span />
+ </div>
+ </div>
+ )}
+ </InsightCard>
+ );
+}
+
+function PunchRow({
+ label,
+ values,
+ level,
+ total,
+ highlight,
+ describe,
+}: {
+ label: string;
+ values: number[];
+ level: (v: number) => 0 | 1 | 2 | 3 | 4;
+ total: number;
+ highlight: boolean;
+ describe: (hour: number, value: number) => string;
+}) {
+ return (
+ <>
+ <span className={cn("text-xs", highlight ? "font-semibold text-foreground-strong" : "text-muted-foreground")}>
+ {label}
+ </span>
+ {values.map((value, hour) => (
+ <QuickTooltip key={hour} content={describe(hour, value)} side="top" className="block">
+ <span className={cn("block h-6 w-full rounded-[4px]", HEAT_LEVEL_CLASS[level(value)])} />
+ </QuickTooltip>
+ ))}
+ <span className="text-right text-xs tabular-nums text-muted-foreground">{total.toLocaleString()}</span>
+ </>
+ );
+}
+
+function WeeklyVolumeCard({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const lang = useUiLanguage();
+ const weeks = weeklyTotals(data.days, WEEKS_SHOWN, 8);
+ const max = Math.max(1, ...weeks.map((w) => w.words));
+ const best = weeks.reduce((b, w) => (w.words > b ? w.words : b), 0);
+ const monthFmt = new Intl.DateTimeFormat(lang, { month: "short" });
+
+ return (
+ <InsightCard testId="board-weekly-volume">
+ <CardTitleRow
+ title={t("board_insights.weekly.title")}
+ fact={best > 0 ? t("board_insights.weekly.best").replace("{0}", best.toLocaleString()) : undefined}
+ >
+ <p className="mt-1 text-sm text-muted-foreground">{t("board_insights.weekly.subtitle")}</p>
+ </CardTitleRow>
+ <div className="flex h-44 items-end gap-1">
+ {weeks.map((week, i) => {
+ const date = week.start ? new Date(`${week.start}T00:00:00`) : null;
+ const tip = `${week.start ? formatDay(week.start, lang) : ""} — ${t("board_insights.weekly.tooltip")
+ .replace("{0}", week.words.toLocaleString())
+ .replace("{1}", week.agentSessions.toLocaleString())}`;
+ return (
+ <QuickTooltip key={i} content={tip} side="top" className="flex h-full flex-1 flex-col justify-end">
+ <div
+ className={cn(
+ "w-full rounded-t-[4px]",
+ i === weeks.length - 1 ? "bg-accent/45" : "bg-accent",
+ )}
+ style={{ height: `${Math.max((week.words / max) * 100, week.words > 0 ? 2 : 0)}%` }}
+ />
+ <span className="mt-1.5 h-4 text-center text-xs text-muted-foreground">
+ {date && date.getDate() <= 7 ? monthFmt.format(date) : ""}
+ </span>
+ </QuickTooltip>
+ );
+ })}
+ </div>
+ </InsightCard>
+ );
+}
+
+function RecordsCard({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const lang = useUiLanguage();
+ const totalWords = data.dictation.words + data.voice.user_words;
+ const { previous, next } = milestoneProgress(totalWords);
+ const progress = next > previous ? (totalWords - previous) / (next - previous) : 0;
+ const bestWords = data.records.best_words_day;
+ const bestAgents = data.records.best_agent_day;
+ const todayWords = data.days.length ? wordsOf(data.days[data.days.length - 1]) : 0;
+
+ return (
+ <InsightCard testId="board-records">
+ <CardTitleRow title={t("board_insights.records.title")} />
+ <ul className="flex flex-col divide-y divide-border">
+ <RecordRow
+ icon={Award}
+ label={t("board_insights.records.best_words")}
+ value={bestWords ? bestWords.value.toLocaleString() : "—"}
+ sub={bestWords ? formatDay(bestWords.date, lang) : undefined}
+ />
+ <RecordRow
+ icon={Bot}
+ label={t("board_insights.records.best_agents")}
+ value={bestAgents ? bestAgents.value.toLocaleString() : "—"}
+ sub={bestAgents ? formatDay(bestAgents.date, lang) : undefined}
+ />
+ <RecordRow
+ icon={Flame}
+ label={t("board_insights.records.longest_streak")}
+ value={plural(t, "board_insights.records.days", data.streak.longest_days)}
+ />
+ <RecordRow
+ icon={CalendarDays}
+ label={t("board_insights.records.active_days")}
+ value={data.streak.active_days.toLocaleString()}
+ sub={
+ data.streak.first_day
+ ? t("board_insights.records.since").replace("{0}", formatDay(data.streak.first_day, lang))
+ : undefined
+ }
+ />
+ </ul>
+ <div className="mt-auto pt-5">
+ <div className="mb-2 flex items-baseline justify-between gap-3 text-sm">
+ <span className="font-medium text-foreground-strong">
+ {t("board_insights.records.next_milestone").replace("{0}", next.toLocaleString())}
+ </span>
+ <span className="tabular-nums text-muted-foreground">
+ {t("board_insights.records.to_go").replace("{0}", Math.max(0, next - totalWords).toLocaleString())}
+ </span>
+ </div>
+ <div className="h-2 overflow-hidden rounded-full bg-sheen/[0.06]">
+ <div className="h-full rounded-full bg-accent" style={{ width: `${Math.min(100, progress * 100)}%` }} />
+ </div>
+ {todayWords > 0 && (
+ <p className="mt-2 text-xs text-muted-foreground">
+ {t("board_insights.records.today").replace("{0}", todayWords.toLocaleString())}
+ </p>
+ )}
+ </div>
+ </InsightCard>
+ );
+}
+
+function RecordRow({
+ icon: Icon,
+ label,
+ value,
+ sub,
+}: {
+ icon: LucideIcon;
+ label: string;
+ value: string;
+ sub?: string;
+}) {
+ return (
+ <li className="flex items-center gap-3 py-2.5">
+ <Icon className="h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />
+ <div className="min-w-0 flex-1">
+ <div className="truncate text-sm text-foreground">{label}</div>
+ {sub && <div className="truncate text-xs text-muted-foreground">{sub}</div>}
+ </div>
+ <span className="shrink-0 text-base font-semibold tabular-nums text-foreground-strong">{value}</span>
+ </li>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/board/insights/SpeedGauge.tsx b/jarvis/ui/web/frontend/src/components/board/insights/SpeedGauge.tsx
new file mode 100644
index 0000000000..421f776a66
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/board/insights/SpeedGauge.tsx
@@ -0,0 +1,67 @@
+/**
+ * Half-ring gauge for speaking speed. The ring runs from 0 to a scale that
+ * always leaves room above the value; a tick marks the typing reference so the
+ * comparison is drawn, not only written.
+ */
+export function SpeedGauge({
+ wpm,
+ typingWpm,
+ centerTop,
+ centerBottom,
+}: {
+ wpm: number;
+ typingWpm: number;
+ centerTop: string;
+ centerBottom: string;
+}) {
+ const scale = Math.max(200, Math.ceil((wpm * 1.15) / 50) * 50);
+ const r = 70;
+ const cx = 90;
+ const cy = 86;
+ const point = (fraction: number, radius = r) => {
+ const angle = Math.PI * (1 - Math.min(1, Math.max(0, fraction)));
+ return { x: cx + radius * Math.cos(angle), y: cy - radius * Math.sin(angle) };
+ };
+ const arc = (fraction: number) => {
+ const end = point(fraction);
+ return `M ${cx - r} ${cy} A ${r} ${r} 0 0 1 ${end.x.toFixed(2)} ${end.y.toFixed(2)}`;
+ };
+ const tickInner = point(typingWpm / scale, r - 13);
+ const tickOuter = point(typingWpm / scale, r + 13);
+
+ return (
+ <svg viewBox="0 0 180 100" className="w-full max-w-[240px]" role="img" aria-label={`${centerTop} ${centerBottom}`}>
+ <path
+ d={arc(1)}
+ fill="none"
+ stroke="rgb(var(--sheen-rgb) / 0.08)"
+ strokeWidth={16}
+ strokeLinecap="round"
+ />
+ {wpm > 0 && (
+ <path
+ d={arc(wpm / scale)}
+ fill="none"
+ stroke="hsl(var(--accent))"
+ strokeWidth={16}
+ strokeLinecap="round"
+ />
+ )}
+ <line
+ x1={tickInner.x}
+ y1={tickInner.y}
+ x2={tickOuter.x}
+ y2={tickOuter.y}
+ stroke="hsl(var(--foreground))"
+ strokeOpacity={0.55}
+ strokeWidth={1.5}
+ />
+ <text x={cx} y={cy - 18} textAnchor="middle" className="fill-foreground-strong" fontSize={20} fontWeight={600}>
+ {centerTop}
+ </text>
+ <text x={cx} y={cy - 2} textAnchor="middle" className="fill-muted-foreground" fontSize={10}>
+ {centerBottom}
+ </text>
+ </svg>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/board/insights/StreakCalendar.tsx b/jarvis/ui/web/frontend/src/components/board/insights/StreakCalendar.tsx
new file mode 100644
index 0000000000..ec8d458a9a
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/board/insights/StreakCalendar.tsx
@@ -0,0 +1,145 @@
+import { useMemo, useState } from "react";
+import { ChevronLeft, ChevronRight } from "lucide-react";
+
+import type { InsightsDay } from "@/hooks/useBoardInsights";
+import { actionsOf, calendarWeeks, intensityLevels, wordsOf } from "@/lib/boardInsights";
+import { QuickTooltip } from "@/components/ui/tooltip";
+import { HEAT_LEVEL_CLASS } from "@/components/board/insights/primitives";
+import { useT, useUiLanguage } from "@/i18n";
+import { cn } from "@/lib/utils";
+
+/** Weeks shown at once; the arrows page through the rest of the year. */
+const PAGE_WEEKS = 22;
+
+/**
+ * Weekday rows x week columns, one square per day, shaded by how many things
+ * the user started that day. Pages back through the 53-week series.
+ */
+export function StreakCalendar({ days }: { days: readonly InsightsDay[] }) {
+ const t = useT();
+ const lang = useUiLanguage();
+ const weeks = useMemo(() => calendarWeeks(days), [days]);
+ const level = useMemo(() => intensityLevels(days.map(actionsOf)), [days]);
+ const lastStart = Math.max(0, weeks.length - PAGE_WEEKS);
+ const [start, setStart] = useState(lastStart);
+ const page = weeks.slice(start, start + PAGE_WEEKS);
+ const today = days[days.length - 1]?.date;
+
+ const monthName = useMemo(() => {
+ const fmt = new Intl.DateTimeFormat(lang, { month: "short" });
+ return (m: number) => fmt.format(new Date(2024, m, 1));
+ }, [lang]);
+ const weekdayNames = useMemo(() => {
+ const fmt = new Intl.DateTimeFormat(lang, { weekday: "short" });
+ // 2024-01-01 was a Monday.
+ return Array.from({ length: 7 }, (_, i) => fmt.format(new Date(2024, 0, 1 + i)));
+ }, [lang]);
+ const dayLabel = useMemo(() => {
+ const fmt = new Intl.DateTimeFormat(lang, { weekday: "short", day: "numeric", month: "short" });
+ return (iso: string) => fmt.format(new Date(`${iso}T00:00:00`));
+ }, [lang]);
+
+ const describe = (day: InsightsDay) => {
+ const actions = actionsOf(day);
+ if (actions === 0 && day.agent_turns === 0) {
+ return `${dayLabel(day.date)} — ${t("board_insights.calendar.nothing")}`;
+ }
+ const parts = [
+ t("board_insights.calendar.started").replace("{0}", actions.toLocaleString()),
+ ];
+ const words = wordsOf(day);
+ if (words > 0) {
+ parts.push(t("board_insights.calendar.words").replace("{0}", words.toLocaleString()));
+ }
+ return `${dayLabel(day.date)} — ${parts.join(" · ")}`;
+ };
+
+ const navButton =
+ "flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-sheen/[0.06] hover:text-foreground disabled:pointer-events-none disabled:opacity-30";
+
+ return (
+ <div className="flex min-w-0 flex-col gap-3" data-testid="board-streak-calendar">
+ <div className="grid items-center gap-1" style={{ gridTemplateColumns: `2.25rem repeat(${PAGE_WEEKS}, minmax(0, 1fr))` }}>
+ <button
+ type="button"
+ className={navButton}
+ onClick={() => setStart((s) => Math.max(0, s - PAGE_WEEKS))}
+ disabled={start === 0}
+ aria-label={t("board_insights.calendar.older")}
+ >
+ <ChevronLeft className="h-4 w-4" />
+ </button>
+ {page.map((week, i) => (
+ <div key={i} className="relative h-4 text-xs text-muted-foreground">
+ {week.monthStart !== null && (
+ <span className="absolute left-0 top-0 whitespace-nowrap">{monthName(week.monthStart)}</span>
+ )}
+ </div>
+ ))}
+ {Array.from({ length: 7 }, (_, row) => (
+ <Row
+ key={row}
+ label={row % 2 === 0 ? weekdayNames[row] : ""}
+ cells={page.map((week) => week.days[row])}
+ level={level}
+ describe={describe}
+ today={today}
+ />
+ ))}
+ </div>
+ <div className="flex items-center justify-between gap-3 text-xs text-muted-foreground">
+ <div className="flex items-center gap-1.5">
+ <span>{t("board_insights.calendar.less")}</span>
+ {([0, 1, 2, 3, 4] as const).map((l) => (
+ <span key={l} className={cn("h-3 w-3 rounded-[3px]", HEAT_LEVEL_CLASS[l])} />
+ ))}
+ <span>{t("board_insights.calendar.more")}</span>
+ </div>
+ <button
+ type="button"
+ className={navButton}
+ onClick={() => setStart((s) => Math.min(lastStart, s + PAGE_WEEKS))}
+ disabled={start >= lastStart}
+ aria-label={t("board_insights.calendar.newer")}
+ >
+ <ChevronRight className="h-4 w-4" />
+ </button>
+ </div>
+ </div>
+ );
+}
+
+function Row({
+ label,
+ cells,
+ level,
+ describe,
+ today,
+}: {
+ label: string;
+ cells: (InsightsDay | null)[];
+ level: (v: number) => 0 | 1 | 2 | 3 | 4;
+ describe: (day: InsightsDay) => string;
+ today: string | undefined;
+}) {
+ return (
+ <>
+ <span className="truncate pr-1 text-xs text-muted-foreground">{label}</span>
+ {cells.map((day, i) =>
+ day ? (
+ <QuickTooltip key={i} content={describe(day)} side="top" className="block">
+ <span
+ className={cn(
+ "block aspect-square w-full max-w-[22px] rounded-[4px]",
+ HEAT_LEVEL_CLASS[level(actionsOf(day))],
+ day.date === today && "ring-1 ring-foreground/50 ring-offset-1 ring-offset-card",
+ )}
+ />
+ </QuickTooltip>
+ ) : (
+ <span key={i} className="block aspect-square w-full max-w-[22px]" />
+ ),
+ )}
+ </>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/board/insights/UsageTab.tsx b/jarvis/ui/web/frontend/src/components/board/insights/UsageTab.tsx
new file mode 100644
index 0000000000..eb76e61d80
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/board/insights/UsageTab.tsx
@@ -0,0 +1,280 @@
+import { Bot, Mic, MessagesSquare, PhoneCall, TrendingDown, TrendingUp, type LucideIcon } from "lucide-react";
+
+import type { BoardInsights } from "@/hooks/useBoardInsights";
+import {
+ minutesSaved,
+ plural,
+ trendPercent,
+ usageMix,
+ wordsPerMinute,
+ type MixRow,
+} from "@/lib/boardInsights";
+import {
+ BigNumber,
+ CardTitleRow,
+ Eyebrow,
+ Hairline,
+ InsightCard,
+} from "@/components/board/insights/primitives";
+import { QuickTooltip } from "@/components/ui/tooltip";
+import { SpeedGauge } from "@/components/board/insights/SpeedGauge";
+import { StreakCalendar } from "@/components/board/insights/StreakCalendar";
+import { useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+
+export function UsageTab({ data }: { data: BoardInsights }) {
+ return (
+ <div className="flex flex-col gap-4">
+ <div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
+ <SpeedCard data={data} />
+ <TimeSavedCard data={data} />
+ <WordsCard data={data} />
+ </div>
+ <div className="grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)]">
+ <UsageMixCard data={data} />
+ <StreakCard data={data} />
+ </div>
+ </div>
+ );
+}
+
+function SpeedCard({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const typing = data.reference.typing_wpm;
+ const wpm = wordsPerMinute(data.dictation.words, data.dictation.seconds);
+ const ratio = typing > 0 ? wpm / typing : 0;
+ return (
+ <InsightCard testId="board-speed-card">
+ <BigNumber>{wpm > 0 ? Math.round(wpm).toLocaleString() : "—"}</BigNumber>
+ <div className="mt-2">
+ <Eyebrow hint={t("board_insights.speed.hint").replace("{0}", String(typing))}>
+ {t("board_insights.speed.label")}
+ </Eyebrow>
+ </div>
+ <div className="mt-auto flex flex-col items-center pt-4">
+ {wpm > 0 ? (
+ <>
+ <SpeedGauge
+ wpm={wpm}
+ typingWpm={typing}
+ centerTop={`${ratio.toFixed(1)}×`}
+ centerBottom={t("board_insights.speed.vs_typing")}
+ />
+ <p className="mt-1 flex items-center gap-1.5 text-xs text-muted-foreground">
+ <span aria-hidden className="h-3 w-px bg-foreground/60" />
+ {t("board_insights.speed.typing_mark").replace("{0}", String(typing))}
+ </p>
+ </>
+ ) : (
+ <p className="py-6 text-center text-sm text-muted-foreground">
+ {t("board_insights.speed.empty")}
+ </p>
+ )}
+ </div>
+ </InsightCard>
+ );
+}
+
+function TimeSavedCard({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const typing = data.reference.typing_wpm;
+ const minutes = minutesSaved(data.dictation.words, data.dictation.seconds, typing);
+ const hours = minutes / 60;
+ const spokenHours = data.dictation.seconds / 3600;
+ return (
+ <InsightCard testId="board-time-saved-card">
+ <BigNumber>
+ {data.dictation.words > 0
+ ? hours >= 10
+ ? `${Math.round(hours).toLocaleString()} h`
+ : `${hours.toFixed(1)} h`
+ : "—"}
+ </BigNumber>
+ <div className="mt-2">
+ <Eyebrow hint={t("board_insights.saved.hint").replace("{0}", String(typing))}>
+ {t("board_insights.saved.label")}
+ </Eyebrow>
+ </div>
+ <Hairline />
+ <dl className="flex flex-col gap-3 text-base">
+ <FactRow
+ value={data.dictation.dictations.toLocaleString()}
+ label={t("board_insights.saved.dictations")}
+ />
+ <FactRow
+ value={`${spokenHours >= 10 ? Math.round(spokenHours) : spokenHours.toFixed(1)} h`}
+ label={t("board_insights.saved.spoken")}
+ />
+ <FactRow
+ value={`${Math.round(typing > 0 ? data.dictation.words / typing / 60 : 0).toLocaleString()} h`}
+ label={t("board_insights.saved.typing_would_take")}
+ />
+ </dl>
+ </InsightCard>
+ );
+}
+
+function FactRow({ value, label }: { value: string; label: string }) {
+ return (
+ <div className="flex items-baseline justify-between gap-3">
+ <dt className="truncate text-muted-foreground">{label}</dt>
+ <dd className="shrink-0 font-medium tabular-nums text-foreground-strong">{value}</dd>
+ </div>
+ );
+}
+
+function WordsCard({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const dictated = data.dictation.words;
+ const spoken = data.voice.user_words;
+ const total = dictated + spoken;
+ const novels = data.reference.novel_words > 0 ? total / data.reference.novel_words : 0;
+ const trend = trendPercent(data.trend.words_30d, data.trend.words_prev_30d);
+ const dictatedShare = total > 0 ? dictated / total : 0;
+
+ return (
+ <InsightCard testId="board-words-card">
+ <div className="flex items-start justify-between gap-3">
+ <BigNumber>{total.toLocaleString()}</BigNumber>
+ {trend !== null && (
+ <QuickTooltip content={t("board_insights.words.trend_hint")} side="top" className="shrink-0">
+ <span className="inline-flex items-center gap-1 rounded-md border border-border px-2 py-0.5 text-xs font-medium tabular-nums text-foreground">
+ {trend >= 0 ? <TrendingUp className="h-3.5 w-3.5" /> : <TrendingDown className="h-3.5 w-3.5" />}
+ {t("board_insights.words.trend").replace("{0}", `${trend > 0 ? "+" : ""}${trend}`)}
+ </span>
+ </QuickTooltip>
+ )}
+ </div>
+ <div className="mt-2">
+ <Eyebrow hint={t("board_insights.words.novel_hint").replace("{0}", data.reference.novel_words.toLocaleString())}>
+ {t("board_insights.words.label")}
+ </Eyebrow>
+ </div>
+ <Hairline />
+ <p className="text-base text-foreground">
+ {total === 0
+ ? t("board_insights.words.empty")
+ : novels >= 1
+ ? t("board_insights.words.novels").replace("{0}", novels.toFixed(1))
+ : t("board_insights.words.novel_share").replace("{0}", String(Math.max(1, Math.round(novels * 100))))}
+ </p>
+ {total > 0 && (
+ <div className="mt-auto pt-4">
+ <div className="flex h-7 gap-1 overflow-hidden rounded-md text-xs font-medium">
+ {dictated > 0 && (
+ <SplitSegment
+ icon={Mic}
+ label={t("board_insights.words.dictated")}
+ share={dictatedShare}
+ className="bg-accent text-accent-foreground"
+ />
+ )}
+ {spoken > 0 && (
+ <SplitSegment
+ icon={PhoneCall}
+ label={t("board_insights.words.spoken")}
+ share={1 - dictatedShare}
+ className="bg-accent/30 text-foreground"
+ />
+ )}
+ </div>
+ <div className="mt-2 flex justify-between text-xs tabular-nums text-muted-foreground">
+ <span>{dictated.toLocaleString()}</span>
+ <span>{spoken.toLocaleString()}</span>
+ </div>
+ </div>
+ )}
+ </InsightCard>
+ );
+}
+
+function SplitSegment({
+ icon: Icon,
+ label,
+ share,
+ className,
+}: {
+ icon: LucideIcon;
+ label: string;
+ share: number;
+ className: string;
+}) {
+ // A sliver still gets room for its icon, so a small share stays legible.
+ return (
+ <div
+ className={cn("flex min-w-[28px] items-center gap-1.5 overflow-hidden rounded-md px-2", className)}
+ style={{ flexGrow: share, flexBasis: 0 }}
+ >
+ <Icon className="h-3.5 w-3.5 shrink-0" aria-label={label} />
+ {share >= 0.15 && <span className="truncate">{label}</span>}
+ </div>
+ );
+}
+
+const MIX_ICON: Record<MixRow["key"], LucideIcon> = {
+ dictations: Mic,
+ agent_sessions: Bot,
+ chat_messages: MessagesSquare,
+ voice_sessions: PhoneCall,
+};
+
+function UsageMixCard({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const rows = usageMix(data);
+ const total = rows.reduce((s, r) => s + r.count, 0);
+ return (
+ <InsightCard testId="board-usage-mix">
+ <CardTitleRow
+ title={t("board_insights.mix.title")}
+ fact={t("board_insights.mix.active_days").replace("{0}", data.streak.active_days.toLocaleString())}
+ />
+ {total === 0 ? (
+ <p className="text-sm text-muted-foreground">{t("board_insights.mix.empty")}</p>
+ ) : (
+ <ul className="flex flex-1 flex-col justify-center gap-3">
+ {rows.map((row) => {
+ const Icon = MIX_ICON[row.key];
+ const pct = Math.round(row.share * 100);
+ return (
+ <li key={row.key} className={cn("flex items-center gap-3", row.count === 0 && "opacity-50")}>
+ <Icon className="h-5 w-5 shrink-0 text-muted-foreground" aria-hidden />
+ <div className="relative h-9 w-[38%] shrink-0 overflow-hidden rounded-md bg-sheen/[0.05]">
+ <div
+ className="absolute inset-y-0 left-0 rounded-md bg-accent"
+ // Wide enough to carry its own percentage, however small the share.
+ style={{ width: row.count > 0 ? `${Math.max(row.share * 100, 18)}%` : "0%" }}
+ />
+ <span
+ className={cn(
+ "absolute inset-y-0 left-2.5 flex items-center text-sm font-semibold tabular-nums",
+ row.count > 0 ? "text-accent-foreground" : "text-muted-foreground",
+ )}
+ >
+ {pct < 1 && row.count > 0 ? "<1%" : `${pct}%`}
+ </span>
+ </div>
+ <span className="min-w-0 truncate text-sm font-medium uppercase tracking-[0.06em] text-foreground">
+ {plural(t, `board_insights.mix.${row.key}`, row.count)}
+ </span>
+ </li>
+ );
+ })}
+ </ul>
+ )}
+ </InsightCard>
+ );
+}
+
+function StreakCard({ data }: { data: BoardInsights }) {
+ const t = useT();
+ const current = data.streak.current_days;
+ return (
+ <InsightCard testId="board-streak-card">
+ <CardTitleRow
+ title={current > 0 ? plural(t, "board_insights.streak.title", current) : t("board_insights.streak.none")}
+ fact={plural(t, "board_insights.streak.longest", data.streak.longest_days)}
+ />
+ <StreakCalendar days={data.days} />
+ </InsightCard>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/board/insights/primitives.tsx b/jarvis/ui/web/frontend/src/components/board/insights/primitives.tsx
new file mode 100644
index 0000000000..e1b73a6e60
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/board/insights/primitives.tsx
@@ -0,0 +1,95 @@
+import type { ReactNode } from "react";
+import { Info } from "lucide-react";
+
+import { QuickTooltip } from "@/components/ui/tooltip";
+import { cn } from "@/lib/utils";
+
+/** The Board's one card: a quiet object on the room, padding on the root. */
+export function InsightCard({
+ className,
+ children,
+ testId,
+}: {
+ className?: string;
+ children: ReactNode;
+ testId?: string;
+}) {
+ return (
+ <section
+ data-testid={testId}
+ className={cn("flex min-w-0 flex-col rounded-lg border border-border bg-card p-5", className)}
+ >
+ {children}
+ </section>
+ );
+}
+
+/** Small uppercase caption under a headline number, with an optional hint. */
+export function Eyebrow({ children, hint }: { children: ReactNode; hint?: string }) {
+ return (
+ <div className="flex items-center gap-1.5 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">
+ <span className="truncate">{children}</span>
+ {hint && (
+ <QuickTooltip content={hint} side="top">
+ <Info className="h-3.5 w-3.5 text-foreground-faint" aria-label={hint} />
+ </QuickTooltip>
+ )}
+ </div>
+ );
+}
+
+export function BigNumber({ children, className }: { children: ReactNode; className?: string }) {
+ return (
+ <div
+ className={cn(
+ "text-2xl font-semibold tabular-nums leading-none text-foreground-strong",
+ className,
+ )}
+ >
+ {children}
+ </div>
+ );
+}
+
+/** Card title row: a heading on the left, an uppercase fact on the right. */
+export function CardTitleRow({
+ title,
+ fact,
+ children,
+}: {
+ title: ReactNode;
+ fact?: ReactNode;
+ children?: ReactNode;
+}) {
+ return (
+ <div className="mb-4 flex flex-wrap items-start justify-between gap-x-4 gap-y-2">
+ <div className="min-w-0">
+ <h2 className="text-xl font-semibold text-foreground-strong">{title}</h2>
+ {children}
+ </div>
+ {fact && (
+ <div className="pt-1.5 text-xs font-medium uppercase tracking-[0.08em] text-foreground tabular-nums">
+ {fact}
+ </div>
+ )}
+ </div>
+ );
+}
+
+export function Hairline() {
+ return <div className="my-4 h-px bg-border" />;
+}
+
+/** A loading placeholder — never a fallback number (see loading states). */
+export function SkeletonBlock({ className }: { className?: string }) {
+ return <div className={cn("animate-pulse rounded-md bg-foreground/10", className)} />;
+}
+
+/** Heat colour for an intensity level, from the one accent hue. */
+export const HEAT_LEVEL_CLASS: Record<0 | 1 | 2 | 3 | 4, string> = {
+ 0: "bg-sheen/[0.07]",
+ 1: "bg-accent/25",
+ 2: "bg-accent/45",
+ 3: "bg-accent/70",
+ 4: "bg-accent",
+};
diff --git a/jarvis/ui/web/frontend/src/hooks/useBoardInsights.ts b/jarvis/ui/web/frontend/src/hooks/useBoardInsights.ts
new file mode 100644
index 0000000000..464ea640c5
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/hooks/useBoardInsights.ts
@@ -0,0 +1,101 @@
+import { useQuery } from "@tanstack/react-query";
+
+import type { BoardCategories } from "@/hooks/useBoard";
+
+// ----------------------------------------------------------------------
+// Types (mirror the InsightsResponse schema in jarvis/ui/web/board_routes.py)
+// ----------------------------------------------------------------------
+
+export interface InsightsDay {
+ date: string; // local YYYY-MM-DD
+ dictations: number;
+ dictation_words: number;
+ voice_sessions: number;
+ voice_words: number;
+ chat_messages: number;
+ agent_sessions: number;
+ agent_turns: number;
+}
+
+export interface InsightsAgent {
+ agent: string;
+ sessions: number;
+ sessions_30d: number;
+ turns: number;
+ turns_30d: number;
+ tokens: number;
+ last_ms: number;
+}
+
+export interface InsightsChatProvider {
+ provider: string;
+ sessions: number;
+ messages: number;
+ jarvis_sessions: number;
+}
+
+export interface InsightsRecord {
+ date: string;
+ value: number;
+}
+
+export interface BoardInsights {
+ generated_at: string;
+ reference: { typing_wpm: number; novel_words: number };
+ dictation: { available: boolean; words: number; dictations: number; seconds: number };
+ voice: {
+ available: boolean;
+ sessions: number;
+ turns: number;
+ user_words: number;
+ jarvis_words: number;
+ /** Time voice sessions were OPEN (wake to hang-up), not time spent speaking. */
+ seconds: number;
+ };
+ chats: {
+ available: boolean;
+ sessions: number;
+ messages: number;
+ providers: InsightsChatProvider[];
+ };
+ agents: {
+ available: boolean;
+ sessions: number;
+ turns: number;
+ tokens: number;
+ items: InsightsAgent[];
+ };
+ days: InsightsDay[];
+ /** 7 rows, Monday first, x 24 local hours. */
+ punch_card: number[][];
+ trend: { words_30d: number; words_prev_30d: number };
+ streak: {
+ current_days: number;
+ longest_days: number;
+ active_days: number;
+ first_day: string | null;
+ };
+ records: {
+ best_words_day: InsightsRecord | null;
+ best_agent_day: InsightsRecord | null;
+ };
+ categories: BoardCategories;
+}
+
+async function fetchInsights(): Promise<BoardInsights> {
+ const res = await fetch("/api/board/insights");
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
+ return res.json();
+}
+
+export const boardInsightsQuery = {
+ queryKey: ["board", "insights"] as const,
+ queryFn: fetchInsights,
+ // The backend reuses one picture for 30 s; polling faster only re-reads it.
+ refetchInterval: 30_000,
+ staleTime: 15_000,
+};
+
+export function useBoardInsights() {
+ return useQuery(boardInsightsQuery);
+}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 3fc806cb64..8794df1e6a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -1710,6 +1710,122 @@
"group_workspaces": "Arbeitsbereiche",
"untitled_chat": "Chat ohne Titel"
},
+ "board_insights": {
+ "description": "Wie du mit {name} arbeitest, gezählt auf diesem Computer.",
+ "tabs": {
+ "usage": "Nutzung",
+ "agents": "Agenten",
+ "rhythm": "Rhythmus"
+ },
+ "speed": {
+ "label": "Wörter pro Minute",
+ "hint": "Deine Diktiergeschwindigkeit. Der Strich markiert Tippen mit {0} Wörtern pro Minute.",
+ "vs_typing": "Tippgeschwindigkeit",
+ "typing_mark": "Tippen mit {0} Wörtern pro Minute",
+ "empty": "Diktiere einmal, dann erscheint hier deine Sprechgeschwindigkeit."
+ },
+ "saved": {
+ "label": "Stunden gespart durch Sprechen",
+ "hint": "Die Zeit, die das Tippen deiner diktierten Wörter mit {0} Wörtern pro Minute dauern würde, abzüglich der Zeit, die du diktiert hast.",
+ "dictations": "Diktate",
+ "spoken": "Zeit beim Diktieren",
+ "typing_would_take": "Tippen hätte gedauert"
+ },
+ "words": {
+ "label": "Wörter an {name}",
+ "novel_hint": "Diktierte Wörter plus die Wörter aus Sprachsitzungen. Ein durchschnittlicher Roman hat etwa {0} Wörter.",
+ "trend": "{0} % ggü. letzten 30 Tagen",
+ "trend_hint": "Wörter der letzten 30 Tage im Vergleich zu den 30 Tagen davor.",
+ "novels": "Das reicht für {0} Romane.",
+ "novel_share": "Das sind bisher {0} % eines Romans.",
+ "empty": "Diktiere oder starte eine Sprachsitzung, dann summieren sich hier deine Wörter.",
+ "dictated": "Diktat",
+ "spoken": "Sprache"
+ },
+ "mix": {
+ "title": "So nutzt du {name}",
+ "active_days": "Aktive Tage | {0}",
+ "empty": "Noch nichts erfasst. Diktiere, chatte oder starte einen Agenten.",
+ "dictations": "{0} Diktate",
+ "dictations_one": "{0} Diktat",
+ "agent_sessions": "{0} Agenten-Sitzungen",
+ "agent_sessions_one": "{0} Agenten-Sitzung",
+ "chat_messages": "{0} Chat-Nachrichten",
+ "chat_messages_one": "{0} Chat-Nachricht",
+ "voice_sessions": "{0} Sprachsitzungen",
+ "voice_sessions_one": "{0} Sprachsitzung"
+ },
+ "streak": {
+ "title": "{0} Tage in Folge",
+ "title_one": "{0} Tag in Folge",
+ "none": "Noch keine Serie",
+ "longest": "Längste Serie | {0} Tage",
+ "longest_one": "Längste Serie | {0} Tag"
+ },
+ "calendar": {
+ "less": "Weniger",
+ "more": "Mehr",
+ "older": "Frühere Wochen",
+ "newer": "Spätere Wochen",
+ "nothing": "nichts",
+ "started": "{0} gestartet",
+ "words": "{0} Wörter"
+ },
+ "agents": {
+ "title": "Coding-Agenten",
+ "subtitle": "Sitzungen der Coding-CLIs auf diesem Computer, aus ihren eigenen Protokollen gelesen.",
+ "used": "{0} Agenten genutzt",
+ "used_one": "{0} Agent genutzt",
+ "range_30d": "Letzte 30 Tage",
+ "range_all": "Gesamt",
+ "col_agent": "Agent",
+ "col_share": "Anteil",
+ "col_sessions": "Sitzungen",
+ "col_turns": "Züge",
+ "col_last": "Zuletzt",
+ "empty": "Auf diesem Computer wurden noch keine Coding-Agenten-Sitzungen gefunden.",
+ "stat_sessions": "Agenten-Sitzungen",
+ "stat_sessions_30d": "Sitzungen, letzte 30 Tage",
+ "stat_tokens": "Verarbeitete Tokens",
+ "stat_busiest": "Meiste Sitzungen an einem Tag"
+ },
+ "chats": {
+ "title": "Chats",
+ "messages": "{0} Nachrichten",
+ "messages_one": "{0} Nachricht",
+ "empty": "Noch keine Chat-Nachrichten."
+ },
+ "categories": {
+ "title": "Was {name} für dich erledigt hat",
+ "subtitle": "Werkzeuge aus Sprachzügen, nach Art.",
+ "empty": "In Sprachzügen wurden noch keine Werkzeuge genutzt."
+ },
+ "rhythm": {
+ "title": "Wann du arbeitest",
+ "subtitle": "Sprachzüge, Chat-Nachrichten und Agenten-Züge nach Wochentag und Stunde.",
+ "peak": "Am meisten | {0}, {1}",
+ "empty": "Noch zu wenig Aktivität für einen Rhythmus."
+ },
+ "weekly": {
+ "title": "Wörter pro Woche",
+ "subtitle": "Diktierte und gesprochene Wörter, letzte 26 Wochen.",
+ "best": "Beste Woche | {0}",
+ "tooltip": "{0} Wörter · {1} Agenten-Sitzungen"
+ },
+ "records": {
+ "title": "Rekorde",
+ "best_words": "Meiste Wörter an einem Tag",
+ "best_agents": "Meiste Agenten-Sitzungen an einem Tag",
+ "longest_streak": "Längste Serie",
+ "active_days": "Aktive Tage",
+ "since": "seit {0}",
+ "days": "{0} Tage",
+ "days_one": "{0} Tag",
+ "next_milestone": "Nächstes Ziel: {0} Wörter",
+ "to_go": "noch {0}",
+ "today": "Heute {0} Wörter."
+ }
+ },
"board_view": {
"title": "Board",
"subtitle": "Alles, was du und {name} zusammen gemacht habt — komplett lokal.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index dcfc614a93..a171d0654a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -1743,6 +1743,122 @@
"group_workspaces": "Workspaces",
"untitled_chat": "Untitled chat"
},
+ "board_insights": {
+ "description": "How you work with {name}, counted on this computer.",
+ "tabs": {
+ "usage": "Usage",
+ "agents": "Agents",
+ "rhythm": "Rhythm"
+ },
+ "speed": {
+ "label": "Words per minute",
+ "hint": "Your dictation speed. The ring marks typing at {0} words per minute.",
+ "vs_typing": "typing speed",
+ "typing_mark": "Typing at {0} words per minute",
+ "empty": "Dictate once and your speaking speed shows up here."
+ },
+ "saved": {
+ "label": "Hours saved by speaking",
+ "hint": "The time typing your dictated words at {0} words per minute would take, minus the time you spent dictating them.",
+ "dictations": "Dictations",
+ "spoken": "Time spent dictating",
+ "typing_would_take": "Typing would have taken"
+ },
+ "words": {
+ "label": "Words you gave {name}",
+ "novel_hint": "Dictated words plus the words you said in voice sessions. An average novel has about {0} words.",
+ "trend": "{0}% vs last 30 days",
+ "trend_hint": "Words in the last 30 days compared with the 30 days before.",
+ "novels": "That's {0} novels' worth of words.",
+ "novel_share": "That's {0}% of a novel so far.",
+ "empty": "Dictate or start a voice session and your words add up here.",
+ "dictated": "Dictation",
+ "spoken": "Voice"
+ },
+ "mix": {
+ "title": "How you use {name}",
+ "active_days": "Active days | {0}",
+ "empty": "Nothing recorded yet. Dictate, chat or start an agent to fill this in.",
+ "dictations": "{0} dictations",
+ "dictations_one": "{0} dictation",
+ "agent_sessions": "{0} agent sessions",
+ "agent_sessions_one": "{0} agent session",
+ "chat_messages": "{0} chat messages",
+ "chat_messages_one": "{0} chat message",
+ "voice_sessions": "{0} voice sessions",
+ "voice_sessions_one": "{0} voice session"
+ },
+ "streak": {
+ "title": "{0}-day streak",
+ "title_one": "{0}-day streak",
+ "none": "No streak yet",
+ "longest": "Longest streak | {0} days",
+ "longest_one": "Longest streak | {0} day"
+ },
+ "calendar": {
+ "less": "Less",
+ "more": "More",
+ "older": "Earlier weeks",
+ "newer": "Later weeks",
+ "nothing": "nothing",
+ "started": "{0} started",
+ "words": "{0} words"
+ },
+ "agents": {
+ "title": "Coding agents",
+ "subtitle": "Sessions of the coding CLIs on this computer, read from their own transcripts.",
+ "used": "{0} agents used",
+ "used_one": "{0} agent used",
+ "range_30d": "Last 30 days",
+ "range_all": "All time",
+ "col_agent": "Agent",
+ "col_share": "Share",
+ "col_sessions": "Sessions",
+ "col_turns": "Turns",
+ "col_last": "Last used",
+ "empty": "No coding-agent sessions found on this computer yet.",
+ "stat_sessions": "Agent sessions",
+ "stat_sessions_30d": "Sessions, last 30 days",
+ "stat_tokens": "Tokens processed",
+ "stat_busiest": "Most sessions in a day"
+ },
+ "chats": {
+ "title": "Chats",
+ "messages": "{0} messages",
+ "messages_one": "{0} message",
+ "empty": "No chat messages yet."
+ },
+ "categories": {
+ "title": "What {name} did for you",
+ "subtitle": "Tools used during voice turns, by kind.",
+ "empty": "No tools used in voice turns yet."
+ },
+ "rhythm": {
+ "title": "When you work",
+ "subtitle": "Voice turns, chat messages and agent turns, by weekday and hour.",
+ "peak": "Busiest | {0}, {1}",
+ "empty": "Not enough activity yet to show a rhythm."
+ },
+ "weekly": {
+ "title": "Words per week",
+ "subtitle": "Dictated and spoken words, last 26 weeks.",
+ "best": "Best week | {0}",
+ "tooltip": "{0} words · {1} agent sessions"
+ },
+ "records": {
+ "title": "Records",
+ "best_words": "Most words in a day",
+ "best_agents": "Most agent sessions in a day",
+ "longest_streak": "Longest streak",
+ "active_days": "Active days",
+ "since": "since {0}",
+ "days": "{0} days",
+ "days_one": "{0} day",
+ "next_milestone": "Next: {0} words",
+ "to_go": "{0} to go",
+ "today": "{0} words today."
+ }
+ },
"board_view": {
"title": "Board",
"subtitle": "Everything you and {name} have done together — fully local.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 1840c11a3f..5703b99427 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -1710,6 +1710,122 @@
"group_workspaces": "Espacios de trabajo",
"untitled_chat": "Chat sin título"
},
+ "board_insights": {
+ "description": "Cómo trabajas con {name}, contado en este ordenador.",
+ "tabs": {
+ "usage": "Uso",
+ "agents": "Agentes",
+ "rhythm": "Ritmo"
+ },
+ "speed": {
+ "label": "Palabras por minuto",
+ "hint": "Tu velocidad de dictado. La marca indica escribir a {0} palabras por minuto.",
+ "vs_typing": "velocidad de escritura",
+ "typing_mark": "Escribir a {0} palabras por minuto",
+ "empty": "Dicta una vez y aquí aparecerá tu velocidad al hablar."
+ },
+ "saved": {
+ "label": "Horas ahorradas hablando",
+ "hint": "El tiempo que tardarías en escribir tus palabras dictadas a {0} palabras por minuto, menos el tiempo que pasaste dictando.",
+ "dictations": "Dictados",
+ "spoken": "Tiempo dictando",
+ "typing_would_take": "Escribir habría llevado"
+ },
+ "words": {
+ "label": "Palabras para {name}",
+ "novel_hint": "Palabras dictadas más las dichas en sesiones de voz. Una novela media tiene unas {0} palabras.",
+ "trend": "{0} % vs. últimos 30 días",
+ "trend_hint": "Palabras de los últimos 30 días frente a los 30 días anteriores.",
+ "novels": "Equivale a {0} novelas.",
+ "novel_share": "Llevas el {0} % de una novela.",
+ "empty": "Dicta o inicia una sesión de voz y tus palabras se sumarán aquí.",
+ "dictated": "Dictado",
+ "spoken": "Voz"
+ },
+ "mix": {
+ "title": "Cómo usas {name}",
+ "active_days": "Días activos | {0}",
+ "empty": "Aún no hay nada registrado. Dicta, chatea o inicia un agente.",
+ "dictations": "{0} dictados",
+ "dictations_one": "{0} dictado",
+ "agent_sessions": "{0} sesiones de agente",
+ "agent_sessions_one": "{0} sesión de agente",
+ "chat_messages": "{0} mensajes de chat",
+ "chat_messages_one": "{0} mensaje de chat",
+ "voice_sessions": "{0} sesiones de voz",
+ "voice_sessions_one": "{0} sesión de voz"
+ },
+ "streak": {
+ "title": "Racha de {0} días",
+ "title_one": "Racha de {0} día",
+ "none": "Aún sin racha",
+ "longest": "Racha más larga | {0} días",
+ "longest_one": "Racha más larga | {0} día"
+ },
+ "calendar": {
+ "less": "Menos",
+ "more": "Más",
+ "older": "Semanas anteriores",
+ "newer": "Semanas posteriores",
+ "nothing": "nada",
+ "started": "{0} iniciados",
+ "words": "{0} palabras"
+ },
+ "agents": {
+ "title": "Agentes de código",
+ "subtitle": "Sesiones de las CLI de código en este ordenador, leídas de sus propios registros.",
+ "used": "{0} agentes usados",
+ "used_one": "{0} agente usado",
+ "range_30d": "Últimos 30 días",
+ "range_all": "Todo",
+ "col_agent": "Agente",
+ "col_share": "Cuota",
+ "col_sessions": "Sesiones",
+ "col_turns": "Turnos",
+ "col_last": "Último uso",
+ "empty": "Aún no hay sesiones de agentes de código en este ordenador.",
+ "stat_sessions": "Sesiones de agente",
+ "stat_sessions_30d": "Sesiones, últimos 30 días",
+ "stat_tokens": "Tokens procesados",
+ "stat_busiest": "Más sesiones en un día"
+ },
+ "chats": {
+ "title": "Chats",
+ "messages": "{0} mensajes",
+ "messages_one": "{0} mensaje",
+ "empty": "Aún no hay mensajes de chat."
+ },
+ "categories": {
+ "title": "Lo que {name} hizo por ti",
+ "subtitle": "Herramientas usadas en turnos de voz, por tipo.",
+ "empty": "Aún no se usaron herramientas en turnos de voz."
+ },
+ "rhythm": {
+ "title": "Cuándo trabajas",
+ "subtitle": "Turnos de voz, mensajes de chat y turnos de agente por día y hora.",
+ "peak": "Más activo | {0}, {1}",
+ "empty": "Aún no hay actividad suficiente para mostrar un ritmo."
+ },
+ "weekly": {
+ "title": "Palabras por semana",
+ "subtitle": "Palabras dictadas y habladas, últimas 26 semanas.",
+ "best": "Mejor semana | {0}",
+ "tooltip": "{0} palabras · {1} sesiones de agente"
+ },
+ "records": {
+ "title": "Récords",
+ "best_words": "Más palabras en un día",
+ "best_agents": "Más sesiones de agente en un día",
+ "longest_streak": "Racha más larga",
+ "active_days": "Días activos",
+ "since": "desde {0}",
+ "days": "{0} días",
+ "days_one": "{0} día",
+ "next_milestone": "Siguiente: {0} palabras",
+ "to_go": "faltan {0}",
+ "today": "{0} palabras hoy."
+ }
+ },
"board_view": {
"title": "Tablero",
"subtitle": "Todo lo que tú y {name} habéis hecho juntos — totalmente local.",
diff --git a/jarvis/ui/web/frontend/src/lib/boardCsv.test.ts b/jarvis/ui/web/frontend/src/lib/boardCsv.test.ts
deleted file mode 100644
index 0f24619b09..0000000000
--- a/jarvis/ui/web/frontend/src/lib/boardCsv.test.ts
+++ /dev/null
@@ -1,199 +0,0 @@
-import { describe, expect, it } from "vitest";
-import {
- CSV_HEADER,
- boardCsv,
- boardCsvFilename,
- boardCsvRows,
- csvField,
-} from "./boardCsv";
-import type {
- BoardCategories,
- BoardHeatmap,
- BoardSummary,
-} from "@/hooks/useBoard";
-
-const summary: BoardSummary = {
- window_days: 30,
- totals: {
- tasks_completed: 12,
- tasks_failed: 1,
- voice_commands: 40,
- hours_saved: 2.5,
- activity_events: 90,
- conversation_hours: 3.25,
- user_words: 1200,
- jarvis_words: 3400,
- session_count: 8,
- active_days: 5,
- first_day: "2026-01-04",
- },
- window: {
- tasks_completed: 3,
- tasks_failed: 0,
- voice_commands: 10,
- hours_saved: 0.5,
- activity_events: 20,
- conversation_hours: 1.5,
- user_words: 300,
- jarvis_words: 800,
- session_count: 2,
- voice_first_try_rate: null,
- unique_tools: 4,
- },
- streak_days: 3,
- longest_streak: 9,
-};
-
-const heatmap: BoardHeatmap = {
- start: "2026-08-21",
- end: "2026-08-22",
- days: 2,
- cells: [
- {
- date: "2026-08-21",
- tasks_completed: 1,
- tasks_failed: 0,
- activity_events: 5,
- conversation_hours: 0.5,
- user_words: 100,
- jarvis_words: 200,
- },
- ],
-};
-
-const categories: BoardCategories = {
- window_days: 30,
- total: 3,
- categories: [
- { category: "music", count: 2 },
- { category: 'weather, "local"', count: 1 },
- ],
-};
-
-/** Minimal RFC 4180 reader, so the quoting assertions test what a reader sees. */
-function parseCsvLine(line: string): string[] {
- const fields: string[] = [];
- let field = "";
- let inQuotes = false;
- for (let i = 0; i < line.length; i++) {
- const ch = line[i];
- if (inQuotes) {
- if (ch === '"') {
- if (line[i + 1] === '"') {
- field += '"';
- i++;
- } else inQuotes = false;
- } else field += ch;
- } else if (ch === '"') inQuotes = true;
- else if (ch === ",") {
- fields.push(field);
- field = "";
- } else field += ch;
- }
- fields.push(field);
- return fields;
-}
-
-describe("csvField", () => {
- it("leaves a plain value alone", () => {
- expect(csvField("music")).toBe("music");
- expect(csvField(42)).toBe("42");
- });
-
- it("quotes a field containing a comma", () => {
- expect(csvField("weather, local")).toBe('"weather, local"');
- });
-
- it("doubles inner quotes", () => {
- expect(csvField('say "hi"')).toBe('"say ""hi"""');
- });
-
- it("quotes newlines and edge whitespace so a reader cannot silently trim", () => {
- expect(csvField("a\nb")).toBe('"a\nb"');
- expect(csvField(" padded ")).toBe('" padded "');
- });
-
- it("writes null and undefined as an empty field, never the string 'null'", () => {
- expect(csvField(null)).toBe("");
- expect(csvField(undefined)).toBe("");
- });
-});
-
-describe("boardCsvRows", () => {
- it("returns nothing when the view holds nothing", () => {
- expect(boardCsvRows({})).toEqual([]);
- });
-
- it("omits a section the view has not loaded instead of writing zeros", () => {
- const rows = boardCsvRows({ summary });
- expect(rows.some((r) => r[0] === "daily")).toBe(false);
- expect(rows.some((r) => r[0] === "categories")).toBe(false);
- });
-
- it("puts first_day in the date column, not the value column", () => {
- const row = boardCsvRows({ summary }).find((r) => r[2] === "first_day");
- expect(row).toEqual(["totals", "2026-01-04", "first_day", ""]);
- });
-
- it("writes a null rate as empty, so it cannot be read as zero", () => {
- const row = boardCsvRows({ summary }).find(
- (r) => r[0] === "window" && r[2] === "voice_first_try_rate",
- );
- expect(row?.[3]).toBe("");
- });
-
- it("emits one row per metric per day, keyed by the ISO date", () => {
- const rows = boardCsvRows({ heatmap }).filter((r) => r[0] === "daily");
- expect(rows).toHaveLength(6);
- expect(rows.every((r) => r[1] === "2026-08-21")).toBe(true);
- });
-
- it("keeps the streak values that live outside totals", () => {
- const rows = boardCsvRows({ summary });
- expect(rows).toContainEqual(["totals", "", "streak_days", 3]);
- expect(rows).toContainEqual(["totals", "", "longest_streak", 9]);
- });
-});
-
-describe("boardCsv", () => {
- it("starts with the fixed header after the BOM", () => {
- const text = boardCsv({ summary });
- expect(text.charCodeAt(0)).toBe(0xfeff);
- expect(text.slice(1).split("\r\n")[0]).toBe(CSV_HEADER.join(","));
- });
-
- it("quotes a category name containing a comma so columns do not shift", () => {
- const line = boardCsv({ categories })
- .split("\r\n")
- .find((l) => l.includes("weather"));
- expect(line).toBe('categories,,"weather, ""local""",1');
- // And a reader still sees exactly four fields, with the comma inside one.
- expect(parseCsvLine(line!)).toEqual([
- "categories",
- "",
- 'weather, "local"',
- "1",
- ]);
- });
-
- it("uses CRLF and ends with a terminating newline", () => {
- const text = boardCsv({ summary });
- expect(text.endsWith("\r\n")).toBe(true);
- expect(text.includes("\r\n")).toBe(true);
- });
-
- it("carries every loaded section in one document", () => {
- const text = boardCsv({ summary, heatmap, categories });
- for (const section of ["totals", "window", "daily", "categories"]) {
- expect(text).toContain(`\r\n${section},`);
- }
- });
-});
-
-describe("boardCsvFilename", () => {
- it("names the file with an ISO date so files sort chronologically", () => {
- expect(boardCsvFilename(new Date("2026-08-22T18:04:00Z"))).toBe(
- "jarvis-board-2026-08-22.csv",
- );
- });
-});
diff --git a/jarvis/ui/web/frontend/src/lib/boardCsv.ts b/jarvis/ui/web/frontend/src/lib/boardCsv.ts
deleted file mode 100644
index f8533b7581..0000000000
--- a/jarvis/ui/web/frontend/src/lib/boardCsv.ts
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * Serialize the Board's aggregates as CSV.
- *
- * The Board holds three shapes at once — lifetime/window totals, a day-by-day
- * series, and a category breakdown. Flattening them into one wide table would
- * need a column per metric per shape and leave most cells empty, so this emits
- * TIDY (long) rows instead: one observation per line, four fixed columns.
- *
- * section,date,metric,value
- * totals,,user_words,124503
- * daily,2026-08-22,user_words,1204
- * categories,,music,42
- *
- * That is the shape pandas pivots in one call and Excel filters natively, and
- * adding a fourth aggregate later costs a `section` value, not a schema change.
- *
- * Dates are ISO 8601 (`YYYY-MM-DD`), never the localized display format —
- * `08/22/2026` and `22.08.2026` sort as text and are read differently on every
- * machine that opens the file. The backend already speaks ISO here, so the
- * values pass through untouched.
- */
-import type {
- BoardCategories,
- BoardHeatmap,
- BoardSummary,
-} from "@/hooks/useBoard";
-
-/** The fixed header. Exported so a test pins it rather than restating it. */
-export const CSV_HEADER = ["section", "date", "metric", "value"] as const;
-
-/**
- * Quote one field per RFC 4180.
- *
- * A field is quoted when it contains a comma, a quote, a newline, or edge
- * whitespace that a reader would otherwise silently trim; inner quotes double.
- * Category names are free text and reach this function, so this is the
- * difference between a usable file and one that shifts every column after the
- * first category with a comma in it.
- */
-export function csvField(value: string | number | null | undefined): string {
- if (value === null || value === undefined) return "";
- const text = String(value);
- const needsQuotes =
- text.includes(",") ||
- text.includes('"') ||
- text.includes("\n") ||
- text.includes("\r") ||
- text !== text.trim();
- if (!needsQuotes) return text;
- return `"${text.replace(/"/g, '""')}"`;
-}
-
-export interface BoardCsvInput {
- summary?: BoardSummary;
- heatmap?: BoardHeatmap;
- categories?: BoardCategories;
-}
-
-type Row = [string, string, string, string | number];
-
-/**
- * Build the rows for whatever the view actually holds.
- *
- * Sections the view has not loaded are omitted rather than written as zeros —
- * an empty `daily` section says "not loaded", a run of zeros would claim "no
- * activity", and those are different facts.
- */
-export function boardCsvRows(input: BoardCsvInput): Row[] {
- const rows: Row[] = [];
-
- if (input.summary) {
- const { totals, window, streak_days, longest_streak, window_days } =
- input.summary;
- for (const [metric, value] of Object.entries(totals)) {
- // first_day is a date, not a measurement — it belongs in the date column.
- if (metric === "first_day") {
- if (value) rows.push(["totals", String(value), "first_day", ""]);
- continue;
- }
- rows.push(["totals", "", metric, value as number]);
- }
- rows.push(["totals", "", "streak_days", streak_days]);
- rows.push(["totals", "", "longest_streak", longest_streak]);
-
- rows.push(["window", "", "window_days", window_days]);
- for (const [metric, value] of Object.entries(window)) {
- // A null rate means "not enough data to compute", which an empty cell
- // carries correctly and a 0 would not.
- rows.push(["window", "", metric, value === null ? "" : (value as number)]);
- }
- }
-
- if (input.heatmap) {
- for (const cell of input.heatmap.cells) {
- const { date, ...metrics } = cell;
- for (const [metric, value] of Object.entries(metrics)) {
- rows.push(["daily", date, metric, value as number]);
- }
- }
- }
-
- if (input.categories) {
- for (const entry of input.categories.categories) {
- rows.push(["categories", "", entry.category, entry.count]);
- }
- }
-
- return rows;
-}
-
-/**
- * Render the full document.
- *
- * CRLF line endings are what RFC 4180 specifies and what Excel expects; every
- * other reader accepts them. The leading BOM is there so a double-clicked file
- * opens with correct umlauts in Excel — pandas strips it, so the file stays
- * usable in both places.
- */
-export function boardCsv(input: BoardCsvInput): string {
- const lines = [
- CSV_HEADER.join(","),
- ...boardCsvRows(input).map((row) => row.map(csvField).join(",")),
- ];
- return "" + lines.join("\r\n") + "\r\n";
-}
-
-/** `jarvis-board-2026-08-22.csv` — ISO in the name too, so files sort by date. */
-export function boardCsvFilename(now: Date = new Date()): string {
- const iso = now.toISOString().slice(0, 10);
- return `jarvis-board-${iso}.csv`;
-}
diff --git a/jarvis/ui/web/frontend/src/lib/boardInsights.test.ts b/jarvis/ui/web/frontend/src/lib/boardInsights.test.ts
new file mode 100644
index 0000000000..c3159eb6c1
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/boardInsights.test.ts
@@ -0,0 +1,85 @@
+import { describe, expect, it } from "vitest";
+
+import type { InsightsDay } from "@/hooks/useBoardInsights";
+import {
+ actionsOf,
+ calendarWeeks,
+ intensityLevels,
+ milestoneProgress,
+ minutesSaved,
+ peakSlot,
+ trendPercent,
+ weeklyTotals,
+} from "@/lib/boardInsights";
+
+function day(date: string, over: Partial<InsightsDay> = {}): InsightsDay {
+ return {
+ date,
+ dictations: 0,
+ dictation_words: 0,
+ voice_sessions: 0,
+ voice_words: 0,
+ chat_messages: 0,
+ agent_sessions: 0,
+ agent_turns: 0,
+ ...over,
+ };
+}
+
+describe("board insights maths", () => {
+ it("counts every started thing once per day", () => {
+ expect(
+ actionsOf(day("2026-10-01", { dictations: 3, voice_sessions: 1, chat_messages: 2, agent_sessions: 4, agent_turns: 99 })),
+ ).toBe(10);
+ });
+
+ it("splits non-zero values into quartile levels and keeps zero at level 0", () => {
+ const level = intensityLevels([0, 1, 2, 3, 4, 100]);
+ expect(level(0)).toBe(0);
+ expect(level(1)).toBe(1);
+ expect(level(100)).toBe(4);
+ });
+
+ it("lays days into Monday-first weeks with month starts", () => {
+ // 2026-09-30 is a Wednesday.
+ // The API always sends a gap-free series.
+ const dates = ["2026-09-30", "2026-10-01", "2026-10-02", "2026-10-03", "2026-10-04", "2026-10-05"];
+ const weeks = calendarWeeks(dates.map((d) => day(d)));
+ expect(weeks[0].days.slice(0, 2)).toEqual([null, null]);
+ expect(weeks[0].days[2]?.date).toBe("2026-09-30");
+ // The week holding the 1st of October is labelled October.
+ expect(weeks[0].monthStart).toBe(9);
+ expect(weeks[1].days[0]?.date).toBe("2026-10-05");
+ expect(weeks[1].days.slice(1)).toEqual(Array(6).fill(null));
+ });
+
+ it("never reports negative time saved", () => {
+ expect(minutesSaved(400, 60, 40)).toBe(9);
+ expect(minutesSaved(10, 600, 40)).toBe(0);
+ });
+
+ it("has no trend without a previous period", () => {
+ expect(trendPercent(50, 0)).toBeNull();
+ expect(trendPercent(150, 100)).toBe(50);
+ });
+
+ it("finds the busiest weekday and hour", () => {
+ const punch = Array.from({ length: 7 }, () => Array(24).fill(0));
+ punch[2][10] = 7;
+ expect(peakSlot(punch)).toEqual({ weekday: 2, hour: 10, value: 7 });
+ expect(peakSlot(Array.from({ length: 7 }, () => Array(24).fill(0)))).toBeNull();
+ });
+
+ it("sums words per week", () => {
+ const weeks = weeklyTotals(
+ [day("2026-09-28", { dictation_words: 5 }), day("2026-09-29", { voice_words: 7 })],
+ 4,
+ );
+ expect(weeks).toEqual([{ start: "2026-09-28", words: 12, agentSessions: 0 }]);
+ });
+
+ it("brackets the word count between milestones", () => {
+ expect(milestoneProgress(261_917)).toEqual({ previous: 250_000, next: 500_000 });
+ expect(milestoneProgress(0)).toEqual({ previous: 0, next: 1_000 });
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/lib/boardInsights.ts b/jarvis/ui/web/frontend/src/lib/boardInsights.ts
new file mode 100644
index 0000000000..8fdabf60df
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/boardInsights.ts
@@ -0,0 +1,225 @@
+/**
+ * Pure maths behind the Board page. No React, no fetch — every figure the
+ * page draws is derived here from the `/api/board/insights` answer, so the
+ * derivations are testable on their own and named in one place.
+ */
+import type { BoardInsights, InsightsDay } from "@/hooks/useBoardInsights";
+import { prettyProviderName } from "@/lib/prettyProviderName";
+
+/** Things the user started on a day: each dictation, voice session, chat
+ * message and coding-agent session counts once. */
+export function actionsOf(day: InsightsDay): number {
+ return day.dictations + day.voice_sessions + day.chat_messages + day.agent_sessions;
+}
+
+/** Words the user gave Jarvis on a day — dictated plus said in voice sessions. */
+export function wordsOf(day: InsightsDay): number {
+ return day.dictation_words + day.voice_words;
+}
+
+/**
+ * Intensity level 0..4 per value. 0 is "nothing"; 1..4 split the non-zero
+ * values at their quartiles, so one record day does not flatten every other
+ * day into the palest shade.
+ */
+export function intensityLevels(values: readonly number[]): (v: number) => 0 | 1 | 2 | 3 | 4 {
+ const sorted = values.filter((v) => v > 0).sort((a, b) => a - b);
+ if (sorted.length === 0) return () => 0;
+ const q = (p: number) => sorted[Math.min(sorted.length - 1, Math.floor(p * sorted.length))];
+ const [q1, q2, q3] = [q(0.25), q(0.5), q(0.75)];
+ return (v) => {
+ if (v <= 0) return 0;
+ if (v <= q1) return 1;
+ if (v <= q2) return 2;
+ if (v <= q3) return 3;
+ return 4;
+ };
+}
+
+export interface CalendarWeek {
+ /** Seven slots, Monday first; `null` pads days outside the series. */
+ days: (InsightsDay | null)[];
+ /** Set on the first week of a month: the month index 0..11. */
+ monthStart: number | null;
+}
+
+function parseDay(iso: string): Date {
+ return new Date(`${iso}T00:00:00`);
+}
+
+/** Lay the daily series into Monday-first week columns. */
+export function calendarWeeks(days: readonly InsightsDay[]): CalendarWeek[] {
+ const weeks: CalendarWeek[] = [];
+ let current: (InsightsDay | null)[] = [];
+ let lastMonth = -1;
+ let monthStart: number | null = null;
+ for (const day of days) {
+ const date = parseDay(day.date);
+ const slot = (date.getDay() + 6) % 7;
+ if (current.length === 0 && slot > 0) {
+ current = Array(slot).fill(null);
+ }
+ if (date.getMonth() !== lastMonth) {
+ lastMonth = date.getMonth();
+ monthStart = lastMonth;
+ }
+ current.push(day);
+ if (current.length === 7) {
+ weeks.push({ days: current, monthStart });
+ current = [];
+ monthStart = null;
+ }
+ }
+ if (current.length > 0) {
+ while (current.length < 7) current.push(null);
+ weeks.push({ days: current, monthStart });
+ }
+ return weeks;
+}
+
+/** Minutes saved by dictating instead of typing at `typingWpm`. Never negative. */
+export function minutesSaved(words: number, seconds: number, typingWpm: number): number {
+ if (typingWpm <= 0) return 0;
+ return Math.max(0, words / typingWpm - seconds / 60);
+}
+
+export function wordsPerMinute(words: number, seconds: number): number {
+ return seconds > 0 ? words / (seconds / 60) : 0;
+}
+
+/** Percent change, or `null` when there is nothing to compare against. */
+export function trendPercent(current: number, previous: number): number | null {
+ if (previous <= 0) return null;
+ return Math.round(((current - previous) / previous) * 100);
+}
+
+export interface MixRow {
+ key: "dictations" | "agent_sessions" | "chat_messages" | "voice_sessions";
+ count: number;
+ share: number;
+}
+
+/** How the user reaches Jarvis — every row a thing they started, by share. */
+export function usageMix(data: BoardInsights): MixRow[] {
+ const rows: Omit<MixRow, "share">[] = [
+ { key: "dictations", count: data.dictation.dictations },
+ { key: "agent_sessions", count: data.agents.sessions },
+ { key: "chat_messages", count: data.chats.messages },
+ { key: "voice_sessions", count: data.voice.sessions },
+ ];
+ const total = rows.reduce((sum, r) => sum + r.count, 0);
+ return rows
+ .map((r) => ({ ...r, share: total ? r.count / total : 0 }))
+ .sort((a, b) => b.count - a.count);
+}
+
+export interface PeakSlot {
+ weekday: number; // 0 = Monday
+ hour: number;
+ value: number;
+}
+
+export function peakSlot(punch: readonly (readonly number[])[]): PeakSlot | null {
+ let best: PeakSlot | null = null;
+ punch.forEach((row, weekday) =>
+ row.forEach((value, hour) => {
+ if (value > 0 && (!best || value > best.value)) best = { weekday, hour, value };
+ }),
+ );
+ return best;
+}
+
+export function hourTotals(punch: readonly (readonly number[])[]): number[] {
+ return Array.from({ length: 24 }, (_, h) => punch.reduce((s, row) => s + (row[h] ?? 0), 0));
+}
+
+export function weekdayTotals(punch: readonly (readonly number[])[]): number[] {
+ return punch.map((row) => row.reduce((s, v) => s + v, 0));
+}
+
+export interface WeekTotal {
+ start: string;
+ words: number;
+ agentSessions: number;
+}
+
+/**
+ * The last `count` Monday-first weeks of the series, oldest first. Leading
+ * empty weeks are dropped (down to `minimum`), so a new user's chart starts at
+ * their first week instead of a row of blanks.
+ */
+export function weeklyTotals(
+ days: readonly InsightsDay[],
+ count: number,
+ minimum = count,
+): WeekTotal[] {
+ const totals = calendarWeeks(days).slice(-count).map((week) => {
+ const present = week.days.filter((d): d is InsightsDay => d !== null);
+ return {
+ start: present[0]?.date ?? "",
+ words: present.reduce((s, d) => s + wordsOf(d), 0),
+ agentSessions: present.reduce((s, d) => s + d.agent_sessions, 0),
+ };
+ });
+ const first = totals.findIndex((w) => w.words > 0);
+ const cut = first < 0 ? 0 : Math.min(first, Math.max(0, totals.length - minimum));
+ return totals.slice(cut);
+}
+
+const MILESTONES = [
+ 1_000, 10_000, 25_000, 50_000, 100_000, 250_000, 500_000, 1_000_000, 2_500_000,
+ 5_000_000, 10_000_000,
+];
+
+/** The milestone just passed and the next one, for the words progress bar. */
+export function milestoneProgress(words: number): { previous: number; next: number } {
+ const next = MILESTONES.find((m) => m > words) ?? Math.ceil((words + 1) / 10_000_000) * 10_000_000;
+ const previous = [...MILESTONES].reverse().find((m) => m <= words) ?? 0;
+ return { previous, next };
+}
+
+const AGENT_LABELS: Record<string, string> = {
+ "claude-cli": "Claude Code",
+ "codex-cli": "Codex",
+ "agy-cli": "Antigravity",
+ "grok-cli": "Grok CLI",
+ "opencode-cli": "OpenCode",
+ "kimi-cli": "Kimi CLI",
+ "glm-cli": "GLM CLI",
+ "cursor-cli": "Cursor CLI",
+};
+
+export function agentLabel(id: string): string {
+ return AGENT_LABELS[id] ?? id.replace(/-cli$/, "");
+}
+
+const CHAT_PROVIDER_LABELS: Record<string, string> = {
+ "claude-api": "Claude",
+ "openai-codex": "Codex",
+ antigravity: "Antigravity",
+ "grok-build": "Grok Build",
+};
+
+export function chatProviderLabel(id: string): string {
+ return CHAT_PROVIDER_LABELS[id] ?? prettyProviderName(id);
+}
+
+/** Short form for big counts, in the same locale as `toLocaleString()`. */
+export function compactNumber(n: number): string {
+ return new Intl.NumberFormat(undefined, {
+ notation: n >= 10_000 ? "compact" : "standard",
+ maximumFractionDigits: n >= 10_000 ? 1 : 0,
+ }).format(n);
+}
+
+/** `{0}` substitution plus the `_one` plural key convention of the locales. */
+export function plural(t: (k: string) => string, baseKey: string, n: number): string {
+ return t(n === 1 ? `${baseKey}_one` : baseKey).replace("{0}", n.toLocaleString());
+}
+
+/** A local day as "3 Oct 2026" in the UI language. */
+export function formatDay(iso: string, lang?: string): string {
+ const d = new Date(`${iso}T00:00:00`);
+ if (Number.isNaN(d.getTime())) return iso;
+ return d.toLocaleDateString(lang, { day: "numeric", month: "short", year: "numeric" });
+}
diff --git a/jarvis/ui/web/frontend/src/views/BoardView.tsx b/jarvis/ui/web/frontend/src/views/BoardView.tsx
index ccbc18c4fb..19ad2faf21 100644
--- a/jarvis/ui/web/frontend/src/views/BoardView.tsx
+++ b/jarvis/ui/web/frontend/src/views/BoardView.tsx
@@ -1,291 +1,114 @@
import { useState } from "react";
-import { Download, Flame, Loader2, RefreshCw, Share2, Sparkles } from "lucide-react";
-import { ViewHeader } from "@/views/ChatsView";
-import { BoardCard } from "@/components/board/BoardCard";
+import { Share2 } from "lucide-react";
+
+import { PageHeader } from "@/components/layout/PageHeader";
+import { TabBar } from "@/components/layout/SectionTabBar";
+import { BoardIcon } from "@/components/icons/sectionIcons";
import { ShareDialog } from "@/components/board/ShareDialog";
-import { CategoryUsage } from "@/components/board/CategoryUsage";
-import { ActivityHeatmap, HeatmapScale } from "@/components/board/ActivityHeatmap";
-import {
- WordsTrendChart,
- TREND_JARVIS,
- TREND_YOU,
-} from "@/components/board/WordsTrendChart";
-import {
- useBoardCategories,
- useBoardHeatmap,
- useBoardRefresh,
- useBoardSummary,
-} from "@/hooks/useBoard";
-import { boardCsv, boardCsvFilename } from "@/lib/boardCsv";
-import { cn } from "@/lib/utils";
+import { UsageTab } from "@/components/board/insights/UsageTab";
+import { AgentsTab } from "@/components/board/insights/AgentsTab";
+import { RhythmTab } from "@/components/board/insights/RhythmTab";
+import { InsightCard, SkeletonBlock } from "@/components/board/insights/primitives";
+import { useBoardInsights } from "@/hooks/useBoardInsights";
+import { Button } from "@/components/ui/button";
import { useT } from "@/i18n";
-export function BoardView() {
- const t = useT();
- const summary = useBoardSummary();
- const heatmap = useBoardHeatmap(365);
- const categories = useBoardCategories();
- const refresh = useBoardRefresh();
- const [shareOpen, setShareOpen] = useState(false);
+type Tab = "usage" | "agents" | "rhythm";
- // Export exactly what the view is holding — a section that has not loaded is
- // left out of the file rather than written as zeros, because "not loaded" and
- // "no activity" are different facts.
- const canExport = Boolean(summary.data || heatmap.data || categories.data);
+const TAB_STORAGE_KEY = "jarvis.board.tab";
- function handleExportCsv() {
- const text = boardCsv({
- summary: summary.data,
- heatmap: heatmap.data,
- categories: categories.data,
- });
- const blob = new Blob([text], { type: "text/csv;charset=utf-8" });
- const url = URL.createObjectURL(blob);
- const a = document.createElement("a");
- a.href = url;
- a.download = boardCsvFilename();
- a.click();
- URL.revokeObjectURL(url);
+function readStoredTab(): Tab {
+ try {
+ const value = window.localStorage.getItem(TAB_STORAGE_KEY);
+ if (value === "usage" || value === "agents" || value === "rhythm") return value;
+ } catch {
+ // Storage blocked (private window, previews): the default tab is fine.
}
+ return "usage";
+}
- const s = summary.data;
- const userWords = s?.totals.user_words ?? 0;
- const jarvisWords = s?.totals.jarvis_words ?? 0;
- const sessions = s?.totals.session_count ?? 0;
- const convHours = s?.totals.conversation_hours ?? 0;
- const streak = s?.streak_days ?? 0;
- const longest = s?.longest_streak ?? 0;
- const activeDays = s?.totals.active_days ?? 0;
- const avgWords = sessions ? Math.round(userWords / sessions) : 0;
- const ratio = userWords ? jarvisWords / userWords : 0;
-
- const nf = (n: number) => n.toLocaleString();
- const loading = summary.isLoading;
+/**
+ * The Board: how someone works with Jarvis, from the stores the app already
+ * keeps on this computer — dictation, voice sessions, chats and the coding
+ * agents. Three tabs, each sized to read at a glance.
+ */
+export function BoardView() {
+ const t = useT();
+ const insights = useBoardInsights();
+ const [tab, setTabState] = useState<Tab>(readStoredTab);
+ const [shareOpen, setShareOpen] = useState(false);
+ const data = insights.data;
- const metrics = [
- {
- label: t("board_view.hero.you_spoke"),
- dot: TREND_YOU,
- value: loading ? "—" : nf(userWords),
- sub: t("board_view.hero.you_spoke_sub"),
- },
- {
- label: t("board_view.hero.jarvis_spoke"),
- dot: TREND_JARVIS,
- value: loading ? "—" : nf(jarvisWords),
- sub: t("board_view.hero.jarvis_spoke_sub"),
- },
- {
- label: t("board_view.hero.streak"),
- value: loading ? "—" : streak > 0 ? String(streak) : "—",
- sub:
- longest > 0
- ? plural(t, "board_view.longest_streak", longest)
- : plural(t, "board_view.hero.streak_sub", activeDays),
- },
- {
- label: t("board_view.hero.talk_time"),
- value: loading ? "—" : `${convHours.toFixed(1)} h`,
- sub: plural(t, "board_view.hero.talk_time_sub", sessions),
- },
- ];
+ const setTab = (next: Tab) => {
+ setTabState(next);
+ try {
+ window.localStorage.setItem(TAB_STORAGE_KEY, next);
+ } catch {
+ // Remembering the tab is a convenience; losing it changes nothing else.
+ }
+ };
return (
- <div className="flex h-full flex-col">
- <ViewHeader
- icon={<Sparkles className="h-4 w-4 text-primary" />}
- title={t("board_view.title")}
- subtitle={t("board_view.subtitle")}
- right={
- <div className="flex items-center gap-2">
- <button
- type="button"
+ <div className="flex h-full min-h-0 flex-col">
+ <div className="mx-auto w-full max-w-[1280px] px-6 lg:px-8">
+ <PageHeader
+ icon={<BoardIcon />}
+ title={t("board_view.title")}
+ description={t("board_insights.description")}
+ actions={
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => setShareOpen(true)}
- disabled={loading || !s}
- className={cn(
- "inline-flex items-center gap-2 rounded-lg border border-sheen/[0.08] bg-sheen/[0.03] px-3 py-1.5 text-xs font-medium transition-colors",
- "hover:border-primary/40 hover:bg-primary/[0.06]",
- (loading || !s) && "opacity-50",
- )}
- title={t("board_view.share.button_tooltip")}
+ disabled={!data}
data-testid="board-share-button"
>
- <Share2 className="h-3.5 w-3.5" />
+ <Share2 className="h-4 w-4" />
{t("board_view.share.button")}
- </button>
- <button
- type="button"
- onClick={handleExportCsv}
- disabled={!canExport}
- className={cn(
- "inline-flex items-center gap-2 rounded-lg border border-sheen/[0.08] bg-sheen/[0.03] px-3 py-1.5 text-xs font-medium transition-colors",
- "hover:border-primary/40 hover:bg-primary/[0.06]",
- !canExport && "opacity-50",
- )}
- title={
- canExport
- ? t("board_view.export.button_tooltip")
- : t("board_view.export.empty")
- }
- data-testid="board-export-csv-button"
- >
- <Download className="h-3.5 w-3.5" />
- {t("board_view.export.button")}
- </button>
- <button
- type="button"
- onClick={() => refresh.mutate()}
- disabled={refresh.isPending}
- className={cn(
- "inline-flex items-center gap-2 rounded-lg border border-sheen/[0.08] bg-sheen/[0.03] px-3 py-1.5 text-xs font-medium transition-colors",
- "hover:border-primary/40 hover:bg-primary/[0.06]",
- refresh.isPending && "opacity-60",
- )}
- title={t("board_view.refresh_tooltip")}
- >
- <RefreshCw className={cn("h-3.5 w-3.5", refresh.isPending && "animate-spin")} />
- {t("board_view.refresh")}
- </button>
- </div>
- }
- />
-
- <div className="flex-1 overflow-y-auto scrollbar-jarvis">
- <div className="mx-auto flex max-w-[1440px] flex-col gap-4 p-5 lg:gap-5 lg:p-6">
- {summary.error && (
- <div className="rounded-xl border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive">
- {t("board_view.load_error")}
- </div>
- )}
-
- {/* ── Hero band: four key numbers, hairline dividers ───────── */}
- <BoardCard glow>
- <div className="grid grid-cols-2 lg:grid-cols-4">
- {metrics.map((m, i) => (
- <Metric
- key={i}
- label={m.label}
- value={m.value}
- sub={m.sub}
- dot={m.dot}
- className={DIVIDERS[i]}
- />
- ))}
- </div>
- </BoardCard>
+ </Button>
+ }
+ tabs={
+ <TabBar
+ tabs={[
+ { id: "usage", label: t("board_insights.tabs.usage") },
+ { id: "agents", label: t("board_insights.tabs.agents") },
+ { id: "rhythm", label: t("board_insights.tabs.rhythm") },
+ ]}
+ active={tab}
+ onChange={(id) => setTab(id as Tab)}
+ />
+ }
+ />
+ </div>
- {/* Slim caption line of secondary stats. */}
- {!loading && s && (
- <p className="-mt-1 px-1 text-xs text-muted-foreground">
- {t("board_view.micro.avg_words").replace("{0}", nf(avgWords))}
- <Dot />
- {t("board_view.micro.ratio").replace("{0}", ratio.toFixed(1))}
- {s.totals.first_day && (
- <>
- <Dot />
- {t("board_view.micro.active_since").replace("{0}", formatDay(s.totals.first_day))}
- </>
- )}
- </p>
+ <div className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis">
+ <div className="mx-auto w-full max-w-[1280px] px-6 py-6 lg:px-8">
+ {insights.error && !data ? (
+ <InsightCard>
+ <p className="text-sm text-muted-foreground">{t("board_view.load_error")}</p>
+ </InsightCard>
+ ) : !data ? (
+ <BoardSkeleton />
+ ) : tab === "usage" ? (
+ <UsageTab data={data} />
+ ) : tab === "agents" ? (
+ <AgentsTab data={data} />
+ ) : (
+ <RhythmTab data={data} />
)}
-
- {/* ── Words-over-time chart + category usage ───────────────── */}
- <div className="grid grid-cols-1 gap-4 lg:grid-cols-[1.55fr_1fr] lg:gap-5">
- <BoardCard className="flex flex-col p-5">
- <div className="mb-3 flex items-center justify-between gap-3">
- <div>
- <h3 className="font-display text-sm font-semibold">
- {t("board_view.chart_title")}
- </h3>
- <p className="text-xs text-muted-foreground">
- {t("board_view.activity_subtitle")}
- </p>
- </div>
- <div className="flex items-center gap-3 text-xs text-muted-foreground">
- <LegendDot color={TREND_YOU} label={t("board_view.hero.you_spoke")} />
- <LegendDot color={TREND_JARVIS} label={t("board_view.hero.jarvis_spoke")} />
- </div>
- </div>
- <div className="h-44 lg:h-52">
- {heatmap.data ? (
- <WordsTrendChart cells={heatmap.data.cells} />
- ) : (
- <Skeleton className="h-full" />
- )}
- </div>
- </BoardCard>
-
- <BoardCard className="flex flex-col p-5">
- <div className="mb-3">
- <h3 className="font-display text-sm font-semibold">
- {t("board_view.categories_title")}
- </h3>
- <p className="text-xs text-muted-foreground">
- {t("board_view.categories_subtitle")}
- </p>
- </div>
- <div className="flex flex-1 flex-col justify-center">
- {categories.data ? (
- <CategoryUsage data={categories.data} />
- ) : (
- <div className="flex items-center gap-2 text-xs text-muted-foreground">
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
- {t("board_view.loading")}
- </div>
- )}
- </div>
- </BoardCard>
- </div>
-
- {/* ── Activity calendar ────────────────────────────────────── */}
- <BoardCard className="p-5">
- <div className="mb-4 flex flex-wrap items-center justify-between gap-3">
- <div>
- <h3 className="font-display text-sm font-semibold">
- {t("board_view.activity_title")}
- </h3>
- <p className="text-xs text-muted-foreground">
- {t("board_view.activity_heatmap_hint")}
- </p>
- </div>
- <div className="flex items-center gap-2">
- {streak > 0 && (
- <span className="inline-flex items-center gap-1 rounded-full border border-primary/30 bg-primary/[0.08] px-2.5 py-1 text-xs font-medium text-primary">
- <Flame className="h-3 w-3" />
- {plural(t, "board_view.activity_streak_badge", streak)}
- </span>
- )}
- {longest > 0 && (
- <span className="rounded-full border border-sheen/[0.08] bg-sheen/[0.03] px-2.5 py-1 text-xs text-muted-foreground">
- {plural(t, "board_view.longest_streak", longest)}
- </span>
- )}
- </div>
- </div>
- {heatmap.data ? (
- <div className="space-y-3">
- <div className="overflow-x-auto pb-1">
- <ActivityHeatmap cells={heatmap.data.cells} />
- </div>
- <HeatmapScale />
- </div>
- ) : (
- <Skeleton className="h-28" />
- )}
- </BoardCard>
</div>
</div>
- {s && (
+ {data && (
<ShareDialog
open={shareOpen}
onOpenChange={setShareOpen}
stats={{
- userWords,
- jarvisWords,
- conversationHours: convHours,
- sessionCount: sessions,
- longestStreak: longest,
+ userWords: data.dictation.words + data.voice.user_words,
+ jarvisWords: data.voice.jarvis_words,
+ conversationHours: data.voice.seconds / 3600,
+ sessionCount: data.voice.sessions,
+ longestStreak: data.streak.longest_days,
}}
/>
)}
@@ -293,75 +116,26 @@ export function BoardView() {
);
}
-// ----------------------------------------------------------------------
-// Building blocks
-// ----------------------------------------------------------------------
-
-// Per-index hairline dividers for a 2-col (mobile) / 4-col (desktop) grid.
-const DIVIDERS = [
- "",
- "border-l border-sheen/[0.06]",
- "border-t border-sheen/[0.06] lg:border-t-0 lg:border-l",
- "border-l border-t border-sheen/[0.06] lg:border-t-0",
-];
-
-function Metric({
- label,
- value,
- sub,
- dot,
- className,
-}: {
- label: string;
- value: string;
- sub?: string;
- dot?: string;
- className?: string;
-}) {
+function BoardSkeleton() {
return (
- <div className={cn("flex flex-col gap-2.5 px-5 py-5 lg:px-6", className)}>
- <div className="flex items-center gap-2 text-micro font-medium uppercase tracking-[0.14em] text-muted-foreground">
- {dot && (
- <span className="h-1.5 w-1.5 rounded-full" style={{ background: dot }} />
- )}
- <span className="truncate">{label}</span>
+ <div className="flex flex-col gap-4" data-testid="board-skeleton">
+ <div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
+ {[0, 1, 2].map((i) => (
+ <InsightCard key={i} className="h-56">
+ <SkeletonBlock className="h-7 w-24" />
+ <SkeletonBlock className="mt-3 h-3 w-36" />
+ <SkeletonBlock className="mt-auto h-20 w-full" />
+ </InsightCard>
+ ))}
</div>
- <div className="font-display text-2xl font-semibold leading-none tracking-tight tabular-nums">
- {value}
+ <div className="grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)]">
+ {[0, 1].map((i) => (
+ <InsightCard key={i} className="h-72">
+ <SkeletonBlock className="h-6 w-40" />
+ <SkeletonBlock className="mt-auto h-44 w-full" />
+ </InsightCard>
+ ))}
</div>
- {sub && <div className="truncate text-xs text-muted-foreground">{sub}</div>}
</div>
);
}
-
-function LegendDot({ color, label }: { color: string; label: string }) {
- return (
- <span className="inline-flex items-center gap-1.5">
- <span className="h-2 w-2 rounded-full" style={{ background: color }} />
- {label}
- </span>
- );
-}
-
-function Dot() {
- return <span className="px-1.5 text-muted-foreground/40">·</span>;
-}
-
-function Skeleton({ className }: { className?: string }) {
- return <div className={cn("w-full animate-pulse rounded-lg bg-sheen/[0.04]", className)} />;
-}
-
-function plural(t: (k: string) => string, baseKey: string, n: number): string {
- const key = n === 1 ? `${baseKey}_one` : baseKey;
- return t(key).replace("{0}", n.toLocaleString());
-}
-
-function formatDay(iso: string): string {
- const d = new Date(iso + "T00:00:00");
- if (Number.isNaN(d.getTime())) return iso;
- return d.toLocaleDateString(undefined, {
- day: "numeric",
- month: "short",
- year: "numeric",
- });
-}