Compact CSV tables, and stop dimming empty tabs in Yaak Proxy

The shared Table gains a density prop; the CSV viewer uses compact,
bringing its rows from about 38px to about 25px with the header to
match. Every other table keeps its spacing.

The proxy no longer reads empty tabs in the subtlest colour: every
inactive tab label is one colour and the count badge alone says a tab
has content. dimEmptyTabs leaves both shared panes and the empty option
leaves Tabs, since nothing else used them. The harness gains a TSV
fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Gregory SchierandClaude Opus 5.5 authored and Stetta task tk_mw9vgwsgiachkwju committed 2026-11-10 10:52:36 -07:00
1 parent 529be76378
commit 700003e9a2
8 files changed
+72 -38

No files matched your search

-4
View File
@@ -132,7 +132,6 @@ function FlowRequestHalf({ flow }: { flow: Flow }) {
tab: {
value: REQUEST_TAB_COOKIES,
label: "Cookies",
empty: sentCount === 0,
rightSlot: <CountBadge count={sentCount} />,
},
content: <ResponseCookies response={cookies} side="sent" />,
@@ -154,7 +153,6 @@ function FlowRequestHalf({ flow }: { flow: Flow }) {
className="px-3"
request={request}
fullHeight
dimEmptyTabs
forceUpdateKey={`${flow.updatedAt}.${body.data == null ? "" : "loaded"}`}
tabsStorageKey="proxy_request_tabs"
bodyLoader={loader}
@@ -232,7 +230,6 @@ function FlowResponseHalf({ flow, className }: { flow: Flow; className: string }
tab: {
value: RESPONSE_TAB_MESSAGES,
label: messagesLabel,
empty: flow.messageCount === 0,
rightSlot: (
<CountBadge
count={flow.messageCount}
@@ -263,7 +260,6 @@ function FlowResponseHalf({ flow, className }: { flow: Flow; className: string }
<HttpResponsePaneView
bare
requestShownApart
dimEmptyTabs
className={classNames(className, "border-border-subtle")}
response={response}
body={loader}
+20
View File
@@ -81,6 +81,12 @@ const csvResponse = [
"2,grace@example.com,team,2026-10-14",
"3,linus@example.com,free,2026-11-02",
].join("\n");
const tsvResponse = [
"sku\tname\tstock\tnote",
"A-100\tDesk lamp\t42\tWarm white, dimmable, ships with a long braided fabric cable",
"A-101\tMonitor arm\t7\t",
"A-102\tKeyboard tray\t0\tBack in stock next week",
].join("\n");
const multipartBoundary = "yaakBoundary7MA4YWxk";
const multipartRequest = [
`--${multipartBoundary}`,
@@ -238,6 +244,20 @@ export const fixtures: FlowFixture[] = [
requestBody: body(""),
responseBody: body(csvResponse),
},
{
label: "TSV GET",
flow: {
...base,
id: "fl_tsv",
url: "https://api.example.com/inventory.tsv",
contentType: "text/tab-separated-values",
requestHeaders: [{ name: "Accept", value: "text/tab-separated-values" }],
responseHeaders: [{ name: "Content-Type", value: "text/tab-separated-values" }],
responseSize: tsvResponse.length,
},
requestBody: body(""),
responseBody: body(tsvResponse),
},
{
label: "Multipart POST",
flow: {
+43
View File
@@ -0,0 +1,43 @@
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, test } from "vite-plus/test";
import { Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow } from "./Table";
import { CsvViewerInner } from "./viewers/CsvViewer";
function table(density?: "default" | "compact") {
return renderToStaticMarkup(
<Table density={density}>
<TableHead>
<TableRow>
<TableHeaderCell>Name</TableHeaderCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell>Accept</TableCell>
</TableRow>
</TableBody>
</Table>,
);
}
describe("Table density", () => {
test("a compact table trims its cells' and header's padding", () => {
const markup = table("compact");
expect(markup).toContain('data-density="compact"');
expect(markup).toContain("[&amp;_td]:py-0.5");
expect(markup).toContain("[&amp;_th]:py-0.5");
});
test("other tables keep their spacing", () => {
const markup = table();
expect(markup).toContain('data-density="default"');
expect(markup).not.toContain("py-0.5");
expect(markup).toContain("py-2");
});
test("the CSV viewer's table is compact", () => {
expect(renderToStaticMarkup(<CsvViewerInner text={"a,b\n1,2"} />)).toContain(
'data-density="compact"',
);
});
});
+6
View File
@@ -6,11 +6,14 @@ export function Table({
children,
className,
scrollable,
density = "default",
style,
}: {
children: ReactNode;
className?: string;
scrollable?: boolean;
/** Compact rows, as dense as the proxy's flow list, for tables of data rather than settings */
density?: "default" | "compact";
style?: React.CSSProperties;
}) {
return (
@@ -21,7 +24,10 @@ export function Table({
"w-full text-sm mb-auto min-w-full max-w-full",
"border-separate border-spacing-0",
scrollable && "[&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10",
// Overrides the cells' own padding, which outranks theirs as it names the table too
density === "compact" && "[&_td]:py-0.5 [&_th]:py-0.5",
)}
data-density={density}
>
{children}
</table>
@@ -109,8 +109,6 @@ export interface HttpRequestPaneViewProps {
/** Replaces the URL bar, as the proxy's card shows a captured request's method and URL */
urlLine?: ReactNode;
/** Tabs with nothing in them read in the subtlest colour */
dimEmptyTabs?: boolean;
/**
* The tab to open on for a request with no tab of its own; with it, a tab chosen for one
* request doesn't carry to the next
@@ -166,7 +164,6 @@ export function HttpRequestPaneView({
authContent,
extraTabs,
urlLine,
dimEmptyTabs = false,
defaultTab,
onTabChange,
}: HttpRequestPaneViewProps) {
@@ -190,20 +187,17 @@ export function HttpRequestPaneView({
bodyTab ?? {
value: REQUEST_TAB_BODY,
label: bodyTypeLabel(request.bodyType, request.contentType),
empty: dimEmptyTabs && request.bodyType == null,
rightSlot: numParams > 0 ? <CountBadge count={numParams} /> : null,
},
{
value: REQUEST_TAB_PARAMS,
rightSlot: <CountBadge count={paramPairs.length} />,
label: "Params",
empty: dimEmptyTabs && paramPairs.length === 0,
},
...(headersTabs ?? [
{
value: REQUEST_TAB_HEADERS,
label: "Headers",
empty: dimEmptyTabs && headerCount === 0,
rightSlot: <CountBadge count={headerCount} />,
},
]),
@@ -221,7 +215,6 @@ export function HttpRequestPaneView({
[
authTabs,
bodyTab,
dimEmptyTabs,
extraTabs,
headerCount,
headersTabs,
@@ -80,8 +80,6 @@ export interface HttpResponsePaneViewProps {
requestShownApart?: boolean;
/** Drawn inside a card the app draws, without a card of its own */
bare?: boolean;
/** Tabs with nothing in them read in the subtlest colour */
dimEmptyTabs?: boolean;
/**
* The tab to open on for a key with no tab of its own; with it, a tab chosen under one key
* doesn't carry to the next
@@ -117,7 +115,6 @@ export function HttpResponsePaneView({
renderCopyButton,
requestShownApart = false,
bare = false,
dimEmptyTabs = false,
defaultTab,
onTabChange,
}: HttpResponsePaneViewProps) {
@@ -163,17 +160,12 @@ export function HttpResponsePaneView({
: []),
];
const noBody = response == null || (response.contentLength ?? 0) === 0;
const headerCount = response?.headers.length ?? 0;
const cookieCount = requestShownApart
? cookieCounts.received
: cookieCounts.sent + cookieCounts.received;
return [
onViewModeChange == null && itemsAfter.length === 0
? { value: RESPONSE_TAB_BODY, label: "Response", empty: dimEmptyTabs && noBody }
? { value: RESPONSE_TAB_BODY, label: "Response" }
: {
value: RESPONSE_TAB_BODY,
empty: dimEmptyTabs && noBody,
options: {
value: viewMode,
onChange: (v: string | null) => onViewModeChange?.(v === "raw" ? "raw" : "pretty"),
@@ -199,7 +191,6 @@ export function HttpResponsePaneView({
{
value: RESPONSE_TAB_HEADERS,
label: "Headers",
empty: dimEmptyTabs && headerCount === 0,
rightSlot: requestShownApart ? (
<CountBadge count={headerCount} />
) : (
@@ -209,7 +200,6 @@ export function HttpResponsePaneView({
{
value: RESPONSE_TAB_COOKIES,
label: "Cookies",
empty: dimEmptyTabs && cookieCount === 0,
rightSlot: requestShownApart ? (
<CountBadge count={cookieCounts.received} />
) : cookieCounts.sent > 0 || cookieCounts.received > 0 ? (
@@ -220,7 +210,6 @@ export function HttpResponsePaneView({
];
}, [
cookieCounts,
dimEmptyTabs,
extraTabs,
mimeType,
onCopyAsCurl,
+1 -14
View File
@@ -41,8 +41,6 @@ export type TabItem =
value: string;
label: string;
hidden?: boolean;
/** Nothing in it: the label reads in the subtlest colour */
empty?: boolean;
leftSlot?: ReactNode;
rightSlot?: ReactNode;
}
@@ -59,8 +57,6 @@ export type TabItem =
export interface TabOptionsItem {
value: string;
options: Omit<RadioDropdownProps, "children">;
/** Nothing in it: the label reads in the subtlest colour */
empty?: boolean;
leftSlot?: ReactNode;
rightSlot?: ReactNode;
}
@@ -515,15 +511,7 @@ function TabButton({
) : "options" in tab ? (
<TabOptionsButton tab={tab} buttonProps={btnProps} isActive={isActive} />
) : (
<Button
leftSlot={tab.leftSlot}
rightSlot={tab.rightSlot}
{...btnProps}
className={classNames(
btnProps.className,
!isActive && "empty" in tab && tab.empty && "text-text-subtlest!",
)}
>
<Button leftSlot={tab.leftSlot} rightSlot={tab.rightSlot} {...btnProps}>
{"label" in tab && tab.label ? tab.label : tab.value}
</Button>
);
@@ -596,7 +584,6 @@ function TabOptionsButton({
</div>
}
{...buttonProps}
className={classNames(buttonProps.className, !isActive && tab.empty && "text-text-subtlest!")}
>
{option && "shortLabel" in option && option.shortLabel
? option.shortLabel
@@ -31,7 +31,7 @@ export function CsvViewerInner({ text, className }: { text: string | null; class
return (
<div className="overflow-auto h-full">
<Table className={classNames(className, "text-sm")}>
<Table density="compact" className={classNames(className, "text-sm")}>
<TableHead>
<TableRow>
{columnIndexes.map((columnIndex) => (