From 3346a2077db3511807a7c5b19c2d9af929ef53ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20G=C3=B3mez?= Date: Sun, 21 Dec 2025 20:29:32 +0100 Subject: [PATCH] feat(req): add --view flag for list/compact display mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add -v, --view flag to req command - Remove UI toggle controls from ReqViewer header - View mode is now set via command flag instead of runtime toggle - Update man page with new flag documentation and example 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/components/ReqViewer.tsx | 83 +++++------------------------------- src/lib/req-parser.ts | 16 +++++++ src/types/man.ts | 6 +++ 3 files changed, 32 insertions(+), 73 deletions(-) diff --git a/src/components/ReqViewer.tsx b/src/components/ReqViewer.tsx index c78d22c..69a0255 100644 --- a/src/components/ReqViewer.tsx +++ b/src/components/ReqViewer.tsx @@ -16,9 +16,6 @@ import { Loader2, Mail, Send, - List, - Rows3, - Braces, } from "lucide-react"; import { Virtuoso } from "react-virtuoso"; import { useReqTimeline } from "@/hooks/useReqTimeline"; @@ -76,10 +73,7 @@ import { resolveFilterAliases, getTagValues } from "@/lib/nostr-utils"; import { useNostrEvent } from "@/hooks/useNostrEvent"; import { cn } from "@/lib/utils"; import { MemoizedCompactEventRow } from "./nostr/CompactEventRow"; -import { MemoizedJsonEventRow } from "./nostr/JsonEventRow"; - -// View mode type -type ViewMode = "list" | "compact" | "json"; +import type { ViewMode } from "@/lib/req-parser"; // Memoized FeedEvent to prevent unnecessary re-renders during scroll const MemoizedFeedEvent = memo( @@ -91,6 +85,7 @@ interface ReqViewerProps { filter: NostrFilter; relays?: string[]; closeOnEose?: boolean; + view?: ViewMode; nip05Authors?: string[]; nip05PTags?: string[]; needsAccount?: boolean; @@ -643,6 +638,7 @@ export default function ReqViewer({ filter, relays, closeOnEose = false, + view = "list", nip05Authors, nip05PTags, needsAccount = false, @@ -756,7 +752,6 @@ export default function ReqViewer({ const [exportFilename, setExportFilename] = useState(""); const [isExporting, setIsExporting] = useState(false); const [exportProgress, setExportProgress] = useState(0); - const [viewMode, setViewMode] = useState("list"); // Freeze timeline after EOSE to prevent auto-scrolling on new events const [freezePoint, setFreezePoint] = useState(null); @@ -1115,61 +1110,6 @@ export default function ReqViewer({ - {/* View Mode Toggle */} -
- - - - - List view - - - - - - Compact view - - - - - - JSON view - -
- {/* Query (Clickable) */}