mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-13 12:13:42 +01:00
Columns keep fixed widths, Path included, and the list scrolls sideways with the header in step instead of dropping columns or capping Host. Resize handles sit on every column boundary, a double-click resets one, and a third click on a sorted header goes back to start time, with empty values sorting lowest. The search box takes up to 44rem and wraps over the list while focused, its completions as wide as it. The list/detail handle fills the gutter. Native title tooltips become Yaak's tooltip, shared buttons gain an opt-in for it, and folder and program rows in the sidebar get Reveal in Finder and Copy path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
1.8 KiB
TypeScript
60 lines
1.8 KiB
TypeScript
import { formatSize } from "@yaakapp-internal/lib/formatSize";
|
|
import {
|
|
Banner,
|
|
CONTROL_TOOLTIP_DELAY,
|
|
EmptyStateText,
|
|
LoadingIcon,
|
|
Tooltip,
|
|
} from "@yaakapp-internal/ui";
|
|
import type { HttpBodyResult } from "@yaakapp-internal/ui/httpTypes";
|
|
import type { ReactNode } from "react";
|
|
import type { FlowBodyData } from "../lib/flowViews";
|
|
|
|
interface Props {
|
|
/** The request body as the engine's body RPC returned it */
|
|
body: HttpBodyResult<FlowBodyData | null>;
|
|
/** The shared editor for the body's type */
|
|
editor: ReactNode;
|
|
/** The proxy's own viewer, for a body that isn't text; null for one that is */
|
|
binaryViewer: ReactNode | null;
|
|
/** Bytes of the request body on the wire */
|
|
requestSize: number;
|
|
}
|
|
|
|
/**
|
|
* The request half's Body tab: the body in its editor, or why it isn't there yet. A body that
|
|
* failed to load says why, as the response's viewer does, rather than reading as no body.
|
|
*/
|
|
export function FlowRequestBody({ body, editor, binaryViewer, requestSize }: Props) {
|
|
if (body.error != null) {
|
|
return (
|
|
<Banner color="danger" className="text-sm">
|
|
{body.error.message}
|
|
</Banner>
|
|
);
|
|
}
|
|
if (body.isLoading) {
|
|
return (
|
|
<EmptyStateText>
|
|
<LoadingIcon />
|
|
</EmptyStateText>
|
|
);
|
|
}
|
|
if (binaryViewer != null) return binaryViewer;
|
|
if (body.data?.truncated) {
|
|
return (
|
|
<div className="h-full grid grid-rows-[auto_minmax(0,1fr)]">
|
|
<Banner color="notice" className="text-sm mb-2">
|
|
<Tooltip wrap content="The app sent all of it" delay={CONTROL_TOOLTIP_DELAY}>
|
|
<span>
|
|
First {formatSize(body.data.storedSize)} of {formatSize(requestSize)} kept
|
|
</span>
|
|
</Tooltip>
|
|
</Banner>
|
|
<div className="min-h-0">{editor}</div>
|
|
</div>
|
|
);
|
|
}
|
|
return editor;
|
|
}
|