Xp history chart sparkline on agent detail page using 7 day xp snapshots #424
Open
clintjeff2 wants to merge 2 commits into
Conversation
…t-detail-page Add 7-day XP sparkline to agent detail page
|
Contributor
Author
|
@leocagli, review and merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Motivation
Description
lib/agents/xp-history-chart.tswithbuildSevenDayXpSnapshots(events, now)to aggregate earned XP into seven UTC daily snapshots andgetLevelProgress(totalXp, level)to compute bounded progress percentages.app/agents/[id]/page.tsxto fetchGET /api/agents/[id]/xp/history, derivetotalXp,level,xpToNext, compute snapshots and progress, and render anXP Growthcard with a levelBadge, total XP, XP-to-next display, a progress bar, and a fixed-height SVGXpSparkline.lib/agents/xp-history-chart.test.tscovering padding for <7 days, exactly 7-day aggregation, decay-event exclusion, and bounded progress calculation.Testing
npx eslint 'app/agents/[id]/page.tsx' lib/agents/xp-history-chart.ts lib/agents/xp-history-chart.test.tsand addressed a single unused-import warning.npm test -- --run lib/agents/xp-history-chart.test.tsand all tests passed (3tests).npm run buildwhich failed in this environment because Next failed to fetch Google Fonts fromfonts.googleapis.com.npx tsc --noEmitwhich failed in this environment due to existing missing type dependencies (lru-cache,@wagmi/connectors).Closes #194