Skip to content

Commit e89cd7b

Browse files
committed
fix: Hide "API Request" text when container width is limited
- Wrapped API Request text in a span with class api-request-text - Added responsive CSS to hide text on narrow screens (< 400px) - Added container query support for more precise control - Maintains visibility of cost badge and token statistics - Prevents text truncation issues in narrow windows
1 parent 643da52 commit e89cd7b

File tree

2 files changed

+73
-24
lines changed

2 files changed

+73
-24
lines changed

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

Lines changed: 53 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,33 +1122,62 @@ 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}
1127-
{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
1134+
<span
1135+
className="api-request-text"
1136+
style={{
1137+
display: "inline-block",
1138+
fontWeight: "bold",
1139+
color: "var(--vscode-foreground)",
1140+
whiteSpace: "nowrap",
1141+
overflow: "hidden",
1142+
textOverflow: "ellipsis",
1143+
flexShrink: 1,
1144+
minWidth: 0,
1145+
}}>
1146+
{title}
1147+
</span>
1148+
<div style={{ display: "flex", alignItems: "center", gap: "8px", flexShrink: 0 }}>
1149+
<VSCodeBadge
1150+
style={{
1151+
opacity: cost !== null && cost !== undefined && cost > 0 ? 1 : 0,
1152+
flexShrink: 0,
1153+
}}>
1154+
${Number(cost || 0)?.toFixed(4)}
1155+
</VSCodeBadge>
1156+
{hasTokenData && (
1157+
<div
1158+
className="flex items-center gap-1"
11441159
style={{
1145-
fontSize: "12px",
1146-
color: "var(--vscode-descriptionForeground)",
1160+
opacity: hasTokenData ? 1 : 0,
1161+
flexShrink: 0,
1162+
whiteSpace: "nowrap",
11471163
}}>
1148-
{tokenStats.output}
1149-
</span>
1150-
</div>
1151-
)}
1164+
<span
1165+
style={{
1166+
fontSize: "12px",
1167+
color: "var(--vscode-descriptionForeground)",
1168+
}}>
1169+
{tokenStats.input}
1170+
</span>
1171+
<span
1172+
style={{
1173+
fontSize: "12px",
1174+
color: "var(--vscode-descriptionForeground)",
1175+
}}>
1176+
{tokenStats.output}
1177+
</span>
1178+
</div>
1179+
)}
1180+
</div>
11521181
</div>
11531182
<span className={`codicon codicon-chevron-${isExpanded ? "up" : "down"}`}></span>
11541183
</div>

webview-ui/src/index.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,4 +486,24 @@ input[cmdk-input]:focus {
486486
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
487487
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
488488
transition-duration: 150ms;
489+
490+
/* Hide API Request text when container is too narrow */
491+
@media (max-width: 400px) {
492+
.api-request-text {
493+
display: none !important;
494+
}
495+
}
496+
497+
/* Alternative: Use container query for more precise control */
498+
@supports (container-type: inline-size) {
499+
.api-request-container {
500+
container-type: inline-size;
501+
}
502+
503+
@container (max-width: 350px) {
504+
.api-request-text {
505+
display: none !important;
506+
}
507+
}
508+
}
489509
}

0 commit comments

Comments
 (0)