From 974889f9de2e03796ad2c898ea5ee57e29d7ba7b Mon Sep 17 00:00:00 2001 From: Scrum4Me Agent <30029041+madhura68@users.noreply.github.com> Date: Wed, 6 May 2026 03:15:24 +0200 Subject: [PATCH] =?UTF-8?q?feat(ST-vmc7vpps):=20insights=20page=20?= =?UTF-8?q?=E2=80=94=20TokenUsageCard=20integreren?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Voeg getTokenStats + TokenUsageCard imports toe aan insights/page.tsx. tokenStats apart awaiten na activeSprints (kan niet in dezelfde Promise.all). TokenUsageCard-sectie toegevoegd na AgentThroughputCard. Co-Authored-By: Claude Sonnet 4.6 --- app/(app)/insights/page.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/(app)/insights/page.tsx b/app/(app)/insights/page.tsx index 77164d5..39244b7 100644 --- a/app/(app)/insights/page.tsx +++ b/app/(app)/insights/page.tsx @@ -7,6 +7,7 @@ import { getBurndownData } from '@/lib/insights/burndown' import { getSprintStatusBreakdown } from '@/lib/insights/sprint-status' import { getVerifyResultStats, getAlignmentTrend } from '@/lib/insights/verify-stats' import { getJobsPerDay } from '@/lib/insights/agent-throughput' +import { getTokenStats } from '@/lib/insights/token-stats' import { getVelocity } from '@/lib/insights/velocity' import { getBacklogHealth } from '@/lib/insights/backlog-health' import { SprintInfoStrip } from './components/sprint-info-strip' @@ -15,6 +16,7 @@ import { SprintStatusDonut } from './components/sprint-status-donut' import { PlanQualityCard } from './components/plan-quality' import { AlignmentTrend } from './components/alignment-trend' import { AgentThroughputCard } from './components/agent-throughput' +import { TokenUsageCard } from './components/token-usage' import { VelocityChart } from './components/velocity-chart' import { BacklogHealthCard } from './components/backlog-health' @@ -76,6 +78,11 @@ export default async function InsightsPage({ searchParams }: InsightsPageProps) getBacklogHealth(userId), ]) + const activeSprintId = activeSprints.find(s => s.product.id === filterProductId)?.id ?? '' + const tokenStats = await (activeSprints.length > 0 && filterProductId + ? getTokenStats(userId, activeSprintId) + : Promise.resolve({ kpi: { totalTokens: 0, totalCostUsd: 0, avgCostPerJob: 0, jobCount: 0 }, jobs: [] })) + // Date.now is an impure call but used once per request — safe in a Server Component. // eslint-disable-next-line react-hooks/purity const nowMs = Date.now() @@ -142,6 +149,12 @@ export default async function InsightsPage({ searchParams }: InsightsPageProps) /> + {/* Token usage */} +
+

Token gebruik

+ +
+ {/* Velocity */}

Velocity