fix(findings): wrap toolbar actions and restore scrollable packet viewer

- Allow the findings filter/action bar to wrap so selection badges no longer clip right-side buttons.
- Pass explicit maxHeight to PacketCodeEditor in HttpCodeBlock so long headers no longer hide or disable scrolling for response bodies.
- Add Load More pagination for truncated request/response bodies inside FindingReproductionPanel.

Fixes #221
This commit is contained in:
ji ruo committed 2026-12-03 19:16:08 +08:00
1 parent dea5385661
commit 73e51e4658
4 files changed
+53 -16

No files matched your search

@@ -1048,8 +1048,8 @@ export default function FindingsPage() {
})}
</div>
<div className="scrollbar-none flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-1">
<InputGroup className="w-72 shrink-0">
<div className="flex min-w-0 flex-wrap items-center gap-2">
<InputGroup className="w-56 shrink-0 sm:w-64">
<InputGroupInput
type="search"
value={search}
@@ -1150,9 +1150,9 @@ export default function FindingsPage() {
</SelectContent>
</Select>
<div className="ml-auto flex shrink-0 items-center gap-3">
<div className="ml-auto flex flex-wrap items-center gap-2">
{selectedIds.size > 0 && (
<span className="text-xs text-muted-foreground tabular-nums">
<span className="whitespace-nowrap text-muted-foreground text-xs tabular-nums">
{ui("screen.7ecf1cde648680")}
{selectedIds.size} {ui("screen.f004f1d84cf962")}
</span>
@@ -115,6 +115,7 @@ function PacketDisclosure({
const [detail, setDetail] = React.useState<FindingTrafficDetail | null>(null);
const [error, setError] = React.useState("");
const [repeaterBusy, setRepeaterBusy] = React.useState(false);
const [loadingMore, setLoadingMore] = React.useState(false);
const router = useRouter();
React.useEffect(() => {
@@ -164,6 +165,23 @@ function PacketDisclosure({
}
}
async function loadMore(side: "request" | "response") {
if (!detail || !bindingId) return;
setLoadingMore(true);
try {
const next = await api.findingTrafficBody(findingId, bindingId, side, detail[side].next_offset, contextTask);
setDetail((prev) =>
prev?.binding.id === bindingId
? { ...prev, [side]: { ...next, content: prev[side].content + next.content } }
: prev,
);
} catch (e) {
toast.error((e as Error).message);
} finally {
setLoadingMore(false);
}
}
return (
<div className="mt-3 border-t pt-3">
<div className="flex flex-wrap gap-2">
@@ -214,14 +232,29 @@ function PacketDisclosure({
{formatCapturedAt(detail.binding.snapshot.captured_at, ui) || ui("screen.664939a1fa2ef7")}
</span>
</div>
<div>
<p className="mb-1 text-[11px] text-muted-foreground">{ui("screen.719dd828ca88c8")}</p>
<HttpCodeBlock raw={packetText(detail, "request")} />
</div>
<div>
<p className="mb-1 text-[11px] text-muted-foreground">{ui("screen.946902266aa212")}</p>
<HttpCodeBlock raw={packetText(detail, "response")} />
</div>
{(["request", "response"] as const).map((side) => (
<div key={side} className="space-y-1.5">
<div className="flex flex-wrap items-center justify-between gap-2">
<p className="text-[11px] text-muted-foreground">
{side === "request" ? ui("screen.719dd828ca88c8") : ui("screen.946902266aa212")}
{detail[side].truncated ? ui("screen.941cfd217649c4") : ""}
</p>
{detail[side].truncated && !detail[side].binary ? (
<Button
type="button"
variant="outline"
size="sm"
className="h-6 text-[11px]"
disabled={loadingMore}
onClick={() => void loadMore(side)}
>
{ui("screen.0cf86a8078ea27")}
</Button>
) : null}
</div>
<HttpCodeBlock raw={packetText(detail, side)} />
</div>
))}
</div>
) : null}
</div>
+3 -3
View File
@@ -288,7 +288,7 @@ export function HttpCodeBlock({ raw }: { raw: string }) {
return (
<div className="relative mx-3 my-4 flex min-h-0 flex-col overflow-hidden rounded-md border bg-background shadow-xs">
<div className="absolute top-2 right-2 flex items-center gap-0.5 rounded-md border bg-background/95 p-0.5 shadow-xs">
<div className="absolute top-2 right-2 z-10 flex items-center gap-0.5 rounded-md border bg-background/95 p-0.5 shadow-xs">
<Tooltip>
<TooltipTrigger asChild>
<Button
@@ -323,8 +323,8 @@ export function HttpCodeBlock({ raw }: { raw: string }) {
</TooltipContent>
</Tooltip>
</div>
<div className="min-h-0 max-h-[calc(100vh-15rem)] flex-1 min-w-0 overflow-hidden bg-background">
<PacketCodeEditor value={value} readOnly wrapLines={wrapLines} />
<div className="min-h-0 min-w-0 flex-1 bg-background">
<PacketCodeEditor value={value} readOnly wrapLines={wrapLines} maxHeight="calc(100vh - 15rem)" />
</div>
<div className="flex items-center gap-2 border-t bg-muted/20 px-2 py-1">
<SearchIcon className="size-3.5 shrink-0 text-muted-foreground" />
+5 -1
View File
@@ -37,6 +37,7 @@ const packetTheme = EditorView.theme(
{
"&": { height: "100%", backgroundColor: "transparent", color: "var(--foreground)" },
".cm-scroller": {
minHeight: 0,
overflow: "auto",
fontFamily: "var(--font-mono)",
fontSize: "0.75rem",
@@ -65,12 +66,14 @@ export function PacketCodeEditor({
readOnly = false,
wrapLines = true,
ariaLabel,
maxHeight,
}: {
value: string;
onChange?: (value: string) => void;
readOnly?: boolean;
wrapLines?: boolean;
ariaLabel?: string;
maxHeight?: string;
}) {
const { ui } = useUITranslation();
@@ -96,6 +99,7 @@ export function PacketCodeEditor({
syntaxHighlighting(defaultHighlightStyle),
syntaxHighlighting(packetHighlight),
packetTheme,
...(maxHeight ? [EditorView.theme({ "&": { height: "auto", maxHeight } })] : []),
...(wrapLines ? [EditorView.lineWrapping] : []),
EditorView.editable.of(!readOnly),
EditorState.readOnly.of(readOnly),
@@ -114,7 +118,7 @@ export function PacketCodeEditor({
viewRef.current = null;
view.destroy();
};
}, [ariaLabel, readOnly, wrapLines]);
}, [ariaLabel, maxHeight, readOnly, wrapLines]);
React.useEffect(() => {
const view = viewRef.current;