Repository navigation
Conversation
Adds a "Model share" card between the heatmap and the model table: one stacked band of the total tokens by model — the four largest named, every remaining model merged into one grey "other" segment — with the hovered/focused segment's name and percentage in the caption below (largest segment when nothing is hovered). The band reuses the tooltip idiom already in the heatmap card (local state, position: fixed, .tsd-tooltip) and draws only with theme tokens this file already uses; the theme has four categorical hues, which is why rows past the fourth merge into a single segment. Segments are focusable (role="button", tabIndex 0) and carry an aria-label with their percentage; shareHint explains the top-4 rule to screen readers.
Collaborator
Author
|
Superseded by #4, which reworks this card and merged as This PR's approach was dropped (it put the share bar in a separate block and relied on a native Kept closed as a record; no code from this branch should be merged. |
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.
What
Adds a Model share card to the settings section, between the yearly heatmap and the By model table: one stacked band of the total tokens per model — the four largest named, every remaining model merged into a single grey other segment — with the hovered/focused segment's name and percentage in the caption underneath (the largest segment when nothing is hovered).
Why
The table already answers "how many tokens per model", but the split is only visible by reading down the share column and adding it up mentally. One band answers "which model dominates, and by how much" at a glance —
deepseek-flash 88.1%is one line instead of four table rows.How it is wired
StatsDashboardrendersh(ModelShareCard, { rows: data.byModel, currency })right afterHeatmapCard. No host change, no new endpoint, no new dependency — it consumes thebyModelrowsusage/queryalready returns ({ key, totalTokens, inputTokens, outputTokens, cost }).modelShares(rows, limit)folds those rows into segments (key, label, tokens, input, output, cost, ratio, color): top N bytotalTokens, every remaining row aggregated into one__other__segment.total === 0renders nothing, same asHeatmapCardon empty days; rows without tokens are dropped and junk rows cannot throw.HeatmapCardidiom exactly — local{ key, left, top }state fromgetBoundingClientRect(),position: fixed, the shared.tsd-tooltipattranslate(-50%, -110%). No new tooltip mechanism.--dsw-static-deepseek-500,--dsw-static-green-500,--dsw-static-deepseek-300,--dsw-alias-state-warn-primary);--dsw-alias-border-l3(grey) marks other. That scarcity is why the band names four models rather than, say, eight.role="button",tabIndex: 0, with anaria-labelof "name, percentage"; hover and focus drive the same tooltip; the band isrole="group"labelled byshareHint, which states the top-4 / other rule; focus gets the same 2px--dsw-alias-state-business-primaryoutline used elsewhere in this file.modelShare/shareHint/shareOtheradded to both theZHandENdictionaries.Verification
npm run build→lib/client/index.js(223,104 bytes, id derived as before);node --checkclean.npm test→ 77/77 pass (the existing suite).tests/*.test.jscoverssrc/host/*and the build script only — so the aggregation was checked out of tree: the two pure helpers were read out ofsrc/client/index.jsand evaluated in plain node, 21 assertions (top-4 + merge, ratio sum = 1, other-segment aggregation, zero/absent/junk rows, custom limit, name shortening). Happy to promote that totests/client-model-share.test.jsif you want a gate in the repo — it would need the same "treat the source as text" trickscripts/build-client.jsalready uses, since the single-file body is not importable.usage) and the slot id (token-stats), so I did not. The card is a port of the one my fork already ships in the same theme — say the word and I will attach a screenshot (or a recording of the hover/focus behaviour).One file,
+172/-0, no build or manifest changes.