diff --git a/apps/yaak-proxy/components/FlowCard.tsx b/apps/yaak-proxy/components/FlowCard.tsx
index 78abde9bd..2fba503c7 100644
--- a/apps/yaak-proxy/components/FlowCard.tsx
+++ b/apps/yaak-proxy/components/FlowCard.tsx
@@ -132,7 +132,6 @@ function FlowRequestHalf({ flow }: { flow: Flow }) {
tab: {
value: REQUEST_TAB_COOKIES,
label: "Cookies",
- empty: sentCount === 0,
rightSlot: ,
},
content: ,
@@ -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: (
+
+
+ Name
+
+
+
+
+ Accept
+
+
+ ,
+ );
+}
+
+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("[&_td]:py-0.5");
+ expect(markup).toContain("[&_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()).toContain(
+ 'data-density="compact"',
+ );
+ });
+});
diff --git a/packages/ui/src/components/Table.tsx b/packages/ui/src/components/Table.tsx
index 64138e9e9..361ba09d5 100644
--- a/packages/ui/src/components/Table.tsx
+++ b/packages/ui/src/components/Table.tsx
@@ -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}
diff --git a/packages/ui/src/components/http/HttpRequestPaneView.tsx b/packages/ui/src/components/http/HttpRequestPaneView.tsx
index 56a6fd619..c9db8acdd 100644
--- a/packages/ui/src/components/http/HttpRequestPaneView.tsx
+++ b/packages/ui/src/components/http/HttpRequestPaneView.tsx
@@ -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 ? : null,
},
{
value: REQUEST_TAB_PARAMS,
rightSlot: ,
label: "Params",
- empty: dimEmptyTabs && paramPairs.length === 0,
},
...(headersTabs ?? [
{
value: REQUEST_TAB_HEADERS,
label: "Headers",
- empty: dimEmptyTabs && headerCount === 0,
rightSlot: ,
},
]),
@@ -221,7 +215,6 @@ export function HttpRequestPaneView({
[
authTabs,
bodyTab,
- dimEmptyTabs,
extraTabs,
headerCount,
headersTabs,
diff --git a/packages/ui/src/components/http/HttpResponsePaneView.tsx b/packages/ui/src/components/http/HttpResponsePaneView.tsx
index 11b8e2aa5..bb3f547b8 100644
--- a/packages/ui/src/components/http/HttpResponsePaneView.tsx
+++ b/packages/ui/src/components/http/HttpResponsePaneView.tsx
@@ -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 ? (
) : (
@@ -209,7 +200,6 @@ export function HttpResponsePaneView({
{
value: RESPONSE_TAB_COOKIES,
label: "Cookies",
- empty: dimEmptyTabs && cookieCount === 0,
rightSlot: requestShownApart ? (
) : cookieCounts.sent > 0 || cookieCounts.received > 0 ? (
@@ -220,7 +210,6 @@ export function HttpResponsePaneView({
];
}, [
cookieCounts,
- dimEmptyTabs,
extraTabs,
mimeType,
onCopyAsCurl,
diff --git a/packages/ui/src/components/tabs/Tabs.tsx b/packages/ui/src/components/tabs/Tabs.tsx
index 541117c8b..cf9b79f99 100644
--- a/packages/ui/src/components/tabs/Tabs.tsx
+++ b/packages/ui/src/components/tabs/Tabs.tsx
@@ -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;
- /** 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 ? (
) : (
-