From 739f8fea3ab366aa9dd85cb479b459f71ed59361 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Mon, 16 Jun 2025 18:10:32 +0200 Subject: [PATCH] Implement an export button for debugging --- src/components/SystemTracker.tsx | 38 ++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/components/SystemTracker.tsx b/src/components/SystemTracker.tsx index ae5e134..30e52d2 100644 --- a/src/components/SystemTracker.tsx +++ b/src/components/SystemTracker.tsx @@ -2,12 +2,13 @@ import { useQuery } from "@tanstack/react-query"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; -import { RefreshCw, AlertCircle, Radar } from "lucide-react"; +import { RefreshCw, AlertCircle, Radar, Download } from "lucide-react"; import { SignatureCategories } from "@/components/SignatureCategories"; import { useSignatureCategories } from "@/hooks/useSignatureCategories"; import { toast } from "@/hooks/use-toast"; import { CleanModeToggle } from "@/components/CleanModeToggle"; import pb from "@/lib/pocketbase"; +import { SigviewRecord as Signature } from "@/lib/pbtypes"; interface SystemTrackerProps { system: string; @@ -25,7 +26,7 @@ export const SystemTracker = ({ system, cleanMode, onCleanModeToggle }: SystemTr queryKey: ['signatures', system], queryFn: async () => { if (!system) return null; - return pb.collection('sigview').getFullList({ batch: 1000, filter: `(system='${system}')` }); + return pb.collection('sigview').getFullList({ batch: 1000, filter: `(system='${system}')` }); }, enabled: !!system, refetchInterval: 5000, // Poll every 5 seconds @@ -39,6 +40,31 @@ export const SystemTracker = ({ system, cleanMode, onCleanModeToggle }: SystemTr }); }; + const handleExport = () => { + const exportText = signatures + .map(sig => [ + sig.identifier, + '', // Empty field (part[1] in parseSignature) + sig.type || '', + sig.signame || '', + sig.scanned || '' + ].join('\t')) + .join('\n'); + + navigator.clipboard.writeText(exportText).then(() => { + toast({ + title: "Exported", + description: "Signatures copied to clipboard in EVE format", + }); + }).catch(() => { + toast({ + title: "Export Failed", + description: "Failed to copy to clipboard", + variant: "destructive" + }); + }); + }; + const signatures = signaturesData || []; const isLoading = signaturesLoading; @@ -80,6 +106,14 @@ export const SystemTracker = ({ system, cleanMode, onCleanModeToggle }: SystemTr Total: {signatures.length} +