feat(usage-analytics): add profile hero with stats and token heat map#4009
feat(usage-analytics): add profile hero with stats and token heat map#4009IamCoder18 wants to merge 1 commit into
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryAll five previously reported issues are resolved in the latest commit: the Previously Reported Issues — All Resolved ✓
Files Reviewed (5 files)
Reviewed by claude-4.6-sonnet-20260217 · 721,665 tokens Review guidance: REVIEW.md from base branch |
3f1a578 to
aaf2b06
Compare
aaf2b06 to
7355f35
Compare
7355f35 to
15c7f25
Compare
Add UsageProfileHero component above existing Usage page contents for personal context only. Includes: - ProfileHeader: centered circular avatar with initials, display name, and "Personal usage" handle - UsageProfileStats: 4-KPI grid showing lifetime tokens, peak tokens, current streak, and longest streak - TokenActivityHeatmap: GitHub-style daily grid with 30d/90d/1y range toggle, intensity-based tile coloring, and tooltips on all days Adds getProfile tRPC procedure querying MICRODOLLAR_USAGE_DAILY for lifetime totals (SUM/MAX) and last 365 days of daily activity. Streaks are computed client-side from daily activity with GitHub-style semantics (current streak = consecutive active days ending today).
15c7f25 to
c429337
Compare
This is ready to review with "No Issues Found" by the review bot |
|
Thank you for the contribution. Out of curiosity, how did you verify the Snowflake schema, and how did you test the feature? |
Hi! I tried to get a mock Snowflake, but it seemed too complex, so I just hard coded the function that gets the data from Snowflake to test the UI. I hope that's ok! |
|
Thanks for the contribution. Even though we may have the It'd be good if you could highlight in your PR description that you weren't able to test the feature, since the current one makes it look like you tested and verified everything. |
Summary
This PR adds a visually polished, profile-led usage hero component at the top of the personal Usage analytics page to drive user shareability and marketing value. The existing detailed analytics dashboard remains unchanged below it.
Closes #4010
Frontend Additions:
"Personal usage"handle.tabular-nums.Architectural / Backend Changes:
usageAnalytics.getProfiletRPC procedure reading directly from the SnowflakeMICRODOLLAR_USAGE_DAILYtable.organization_id = '') to calculate lifetimeSUM(total_tokens)andMAX(total_tokens).Reference (from X)
Verification
Verified
/usageVisual Changes
Reviewer Notes
apps/web/DESIGN.md. Uses core semantic tokens (background,card,border,muted) and shadcn primitives (Card,Tooltip,Tabs). Yellow-green usage has been kept minimal and restricted to minor accents per design skill constraints.