Skip to content

Commit ed754d8

Browse files
authored
🤖 fix: match token count text size to surrounding elements (#737)
_Generated with `mux`_ Token count display used `text-xs` (12px) while neighboring controls use `text-[11px]`. Updated both the loading fallback and display component to match.
1 parent f1ce064 commit ed754d8

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/browser/App.stories.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,18 @@ export const ActiveWorkspaceWithChat: Story = {
541541
projects,
542542
workspaces,
543543
apiOverrides: {
544+
tokenizer: {
545+
countTokens: () => Promise.resolve(42),
546+
countTokensBatch: (_model, texts) => Promise.resolve(texts.map(() => 42)),
547+
calculateStats: () =>
548+
Promise.resolve({
549+
consumers: [],
550+
totalTokens: 0,
551+
model: "mock-model",
552+
tokenizerName: "mock-tokenizer",
553+
usageHistory: [],
554+
}),
555+
},
544556
providers: {
545557
setProviderConfig: () => Promise.resolve({ success: true, data: undefined }),
546558
list: () => Promise.resolve(["anthropic", "openai", "xai"]),
@@ -1246,6 +1258,13 @@ main
12461258
})
12471259
);
12481260

1261+
// Pre-fill input with text so token count is visible
1262+
localStorage.setItem(
1263+
`input:${workspaceId}`,
1264+
"Add OAuth2 support with Google and GitHub providers"
1265+
);
1266+
localStorage.setItem(`model:${workspaceId}`, "anthropic:claude-sonnet-4-5");
1267+
12491268
initialized.current = true;
12501269
}
12511270

src/browser/components/ChatInput/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
879879
<Suspense
880880
fallback={
881881
<div
882-
className="text-muted flex items-center gap-1 text-xs"
882+
className="text-muted flex items-center gap-1 text-[11px]"
883883
data-component="TokenEstimate"
884884
>
885885
<span>Calculating tokens…</span>
@@ -940,7 +940,7 @@ const TokenCountDisplay: React.FC<{ reader: TokenCountReader }> = ({ reader }) =
940940
return null;
941941
}
942942
return (
943-
<div className="text-muted flex items-center gap-1 text-xs" data-component="TokenEstimate">
943+
<div className="text-muted flex items-center gap-1 text-[11px]" data-component="TokenEstimate">
944944
<span>{tokens.toLocaleString()} tokens</span>
945945
</div>
946946
);

0 commit comments

Comments
 (0)