Clear and reset only the visualizer, not the packet feed

This commit is contained in:
Jack Kingsman
2026-02-16 18:00:03 -08:00
parent 3042beaf27
commit de7ab37998
3 changed files with 12 additions and 24 deletions
+1 -6
View File
@@ -543,12 +543,7 @@ export function App() {
</div> </div>
} }
> >
<VisualizerView <VisualizerView packets={rawPackets} contacts={contacts} config={config} />
packets={rawPackets}
contacts={contacts}
config={config}
onClearPackets={() => setRawPackets([])}
/>
</Suspense> </Suspense>
) : activeConversation.type === 'raw' ? ( ) : activeConversation.type === 'raw' ? (
<> <>
@@ -859,7 +859,6 @@ interface PacketVisualizer3DProps {
config: RadioConfig | null; config: RadioConfig | null;
fullScreen?: boolean; fullScreen?: boolean;
onFullScreenChange?: (fullScreen: boolean) => void; onFullScreenChange?: (fullScreen: boolean) => void;
onClearPackets?: () => void;
} }
export function PacketVisualizer3D({ export function PacketVisualizer3D({
@@ -868,7 +867,6 @@ export function PacketVisualizer3D({
config, config,
fullScreen, fullScreen,
onFullScreenChange, onFullScreenChange,
onClearPackets,
}: PacketVisualizer3DProps) { }: PacketVisualizer3DProps) {
const containerRef = useRef<HTMLDivElement>(null); const containerRef = useRef<HTMLDivElement>(null);
const rendererRef = useRef<THREE.WebGLRenderer | null>(null); const rendererRef = useRef<THREE.WebGLRenderer | null>(null);
@@ -1641,21 +1639,23 @@ export function PacketVisualizer3D({
Oooh Big Stretch! Oooh Big Stretch!
</button> </button>
<button <button
onClick={() => { onClick={() => data.clearAndReset()}
data.clearAndReset();
onClearPackets?.();
}}
className="mt-1 px-3 py-1.5 bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-500 rounded text-xs transition-colors" className="mt-1 px-3 py-1.5 bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-500 rounded text-xs transition-colors"
title="Clear all nodes, links, and packets - reset to initial state" title="Clear all nodes and links from the visualization - packets are preserved"
> >
Clear &amp; Reset Clear &amp; Reset
</button> </button>
</div> </div>
</> </>
)} )}
<div className={!showControls ? '' : 'border-t border-border pt-2 mt-1 flex flex-col gap-2'}> <div
className={!showControls ? '' : 'border-t border-border pt-2 mt-1 flex flex-col gap-2'}
>
<label className="flex items-center gap-2 cursor-pointer"> <label className="flex items-center gap-2 cursor-pointer">
<Checkbox checked={showControls} onCheckedChange={(c) => setShowControls(c === true)} /> <Checkbox
checked={showControls}
onCheckedChange={(c) => setShowControls(c === true)}
/>
<span title="Toggle legends and controls visibility">Show controls</span> <span title="Toggle legends and controls visibility">Show controls</span>
</label> </label>
{onFullScreenChange && ( {onFullScreenChange && (
+2 -9
View File
@@ -9,10 +9,9 @@ interface VisualizerViewProps {
packets: RawPacket[]; packets: RawPacket[];
contacts: Contact[]; contacts: Contact[];
config: RadioConfig | null; config: RadioConfig | null;
onClearPackets?: () => void;
} }
export function VisualizerView({ packets, contacts, config, onClearPackets }: VisualizerViewProps) { export function VisualizerView({ packets, contacts, config }: VisualizerViewProps) {
const [fullScreen, setFullScreen] = useState(false); const [fullScreen, setFullScreen] = useState(false);
return ( return (
@@ -30,12 +29,7 @@ export function VisualizerView({ packets, contacts, config, onClearPackets }: Vi
<TabsTrigger value="packets">Packet Feed</TabsTrigger> <TabsTrigger value="packets">Packet Feed</TabsTrigger>
</TabsList> </TabsList>
<TabsContent value="visualizer" className="flex-1 m-0 overflow-hidden"> <TabsContent value="visualizer" className="flex-1 m-0 overflow-hidden">
<PacketVisualizer3D <PacketVisualizer3D packets={packets} contacts={contacts} config={config} />
packets={packets}
contacts={contacts}
config={config}
onClearPackets={onClearPackets}
/>
</TabsContent> </TabsContent>
<TabsContent value="packets" className="flex-1 m-0 overflow-hidden"> <TabsContent value="packets" className="flex-1 m-0 overflow-hidden">
<RawPacketList packets={packets} /> <RawPacketList packets={packets} />
@@ -58,7 +52,6 @@ export function VisualizerView({ packets, contacts, config, onClearPackets }: Vi
config={config} config={config}
fullScreen={fullScreen} fullScreen={fullScreen}
onFullScreenChange={setFullScreen} onFullScreenChange={setFullScreen}
onClearPackets={onClearPackets}
/> />
</div> </div>