Skip to content

Commit 333e1e4

Browse files
committed
fix: prevent token stats overflow in narrow windows
- Removed flex-wrap from token stats container to keep items on single line - Added flexShrink: 0 to prevent badge and stats from shrinking - Added whiteSpace: nowrap to maintain single-line display - Grouped cost badge and token stats in separate container for better layout control - Added minWidth: 0 to parent container for proper text truncation This fixes the UI overflow issue where the price would break into two lines and overflow the gray box in narrow window widths.
1 parent 643da52 commit 333e1e4

File tree

1 file changed

+39
-23
lines changed

1 file changed

+39
-23
lines changed

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,33 +1122,49 @@ export const ChatRowContent = ({
11221122
msUserSelect: "none",
11231123
}}
11241124
onClick={handleToggleExpand}>
1125-
<div style={{ display: "flex", alignItems: "center", gap: "10px", flexGrow: 1 }}>
1125+
<div
1126+
style={{
1127+
display: "flex",
1128+
alignItems: "center",
1129+
gap: "10px",
1130+
flexGrow: 1,
1131+
minWidth: 0,
1132+
}}>
11261133
{icon}
11271134
{title}
1128-
<VSCodeBadge
1129-
style={{ opacity: cost !== null && cost !== undefined && cost > 0 ? 1 : 0 }}>
1130-
${Number(cost || 0)?.toFixed(4)}
1131-
</VSCodeBadge>
1132-
{hasTokenData && (
1133-
<div
1134-
className="flex items-center gap-1 flex-wrap"
1135-
style={{ opacity: hasTokenData ? 1 : 0 }}>
1136-
<span
1137-
style={{
1138-
fontSize: "12px",
1139-
color: "var(--vscode-descriptionForeground)",
1140-
}}>
1141-
{tokenStats.input}
1142-
</span>
1143-
<span
1135+
<div style={{ display: "flex", alignItems: "center", gap: "8px", flexShrink: 0 }}>
1136+
<VSCodeBadge
1137+
style={{
1138+
opacity: cost !== null && cost !== undefined && cost > 0 ? 1 : 0,
1139+
flexShrink: 0,
1140+
}}>
1141+
${Number(cost || 0)?.toFixed(4)}
1142+
</VSCodeBadge>
1143+
{hasTokenData && (
1144+
<div
1145+
className="flex items-center gap-1"
11441146
style={{
1145-
fontSize: "12px",
1146-
color: "var(--vscode-descriptionForeground)",
1147+
opacity: hasTokenData ? 1 : 0,
1148+
flexShrink: 0,
1149+
whiteSpace: "nowrap",
11471150
}}>
1148-
{tokenStats.output}
1149-
</span>
1150-
</div>
1151-
)}
1151+
<span
1152+
style={{
1153+
fontSize: "12px",
1154+
color: "var(--vscode-descriptionForeground)",
1155+
}}>
1156+
{tokenStats.input}
1157+
</span>
1158+
<span
1159+
style={{
1160+
fontSize: "12px",
1161+
color: "var(--vscode-descriptionForeground)",
1162+
}}>
1163+
{tokenStats.output}
1164+
</span>
1165+
</div>
1166+
)}
1167+
</div>
11521168
</div>
11531169
<span className={`codicon codicon-chevron-${isExpanded ? "up" : "down"}`}></span>
11541170
</div>

0 commit comments

Comments
 (0)