Fix types and imports across the board

This commit is contained in:
2025-06-15 11:53:26 +02:00
parent 7e6d7df06e
commit 233ffa0c76
11 changed files with 32 additions and 92 deletions

View File

@@ -3,8 +3,8 @@ import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { Toaster } from "@/components/ui/toaster"; import { Toaster } from "@/components/ui/toaster";
import Index from "./pages/Index"; import Index from "./pages/Index";
import RegionPage from "./pages/RegionPage"; import { RegionPage } from "./pages/RegionPage";
import SystemView from "./pages/SystemView"; import { SystemView } from "./pages/SystemView";
import NotFound from "./pages/NotFound"; import NotFound from "./pages/NotFound";
import "./App.css"; import "./App.css";

View File

@@ -21,5 +21,3 @@ export const CleanModeToggle = ({ cleanMode, onToggle }: CleanModeToggleProps) =
</div> </div>
); );
}; };
export default CleanModeToggle;

View File

@@ -57,5 +57,3 @@ export const Header = ({ title, breadcrumbs = [] }: HeaderProps) => {
</div> </div>
); );
}; };
export default Header;

View File

@@ -324,5 +324,3 @@ export const RegionMap = ({ regionName, focusSystem, isCompact = false }: Region
</div> </div>
); );
}; };
export default RegionMap;

View File

@@ -2,22 +2,13 @@
import { Card, CardContent } from "@/components/ui/card"; import { Card, CardContent } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { Zap, Shield, Coins, HelpCircle } from "lucide-react"; import { Zap, Shield, Coins, HelpCircle } from "lucide-react";
import { Signature } from "./SystemTracker";
interface SignatureItem {
collectionId: string;
collectionName: string;
id: string;
signame: string;
sysid: string;
system: string;
type: string;
}
interface SignatureCardProps { interface SignatureCardProps {
signature: SignatureItem; signature: Signature;
} }
const SignatureCard = ({ signature }: SignatureCardProps) => { export const SignatureCard = ({ signature }: SignatureCardProps) => {
const getTypeIcon = (type: string) => { const getTypeIcon = (type: string) => {
const lowerType = type.toLowerCase(); const lowerType = type.toLowerCase();
if (lowerType.includes('combat')) return <Zap className="h-4 w-4" />; if (lowerType.includes('combat')) return <Zap className="h-4 w-4" />;
@@ -73,5 +64,3 @@ const SignatureCard = ({ signature }: SignatureCardProps) => {
</Card> </Card>
); );
}; };
export default SignatureCard;

View File

@@ -1,25 +1,12 @@
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { Zap, Shield, Coins, HelpCircle, Clock, AlertTriangle, Skull } from "lucide-react"; import { Zap, Shield, Coins, HelpCircle, Clock, AlertTriangle, Skull } from "lucide-react";
import { Signature } from "@/components/SystemTracker";
interface SignatureItem {
collectionId: string;
collectionName: string;
id: string;
identifier: string;
signame: string;
sysid: string;
system: string;
type: string;
updated?: string;
created?: string;
dangerous?: boolean;
}
interface SignatureListItemProps { interface SignatureListItemProps {
signature: SignatureItem; signature: Signature;
} }
const SignatureListItem = ({ signature }: SignatureListItemProps) => { export const SignatureListItem = ({ signature }: SignatureListItemProps) => {
const getTypeIcon = (type: string) => { const getTypeIcon = (type: string) => {
const lowerType = type.toLowerCase(); const lowerType = type.toLowerCase();
if (lowerType.includes("combat")) return <Zap className="h-4 w-4" />; if (lowerType.includes("combat")) return <Zap className="h-4 w-4" />;
@@ -80,9 +67,8 @@ const SignatureListItem = ({ signature }: SignatureListItemProps) => {
return ( return (
<div <div
className={`flex items-center justify-between p-4 border-b border-slate-700 hover:bg-slate-800/40 transition-colors ${ className={`flex items-center justify-between p-4 border-b border-slate-700 hover:bg-slate-800/40 transition-colors ${oldEntry ? "opacity-50" : ""
oldEntry ? "opacity-50" : "" }`}
}`}
> >
<div className="flex items-center gap-4 flex-1"> <div className="flex items-center gap-4 flex-1">
{/* Type Badge - Most Important */} {/* Type Badge - Most Important */}
@@ -132,5 +118,3 @@ const SignatureListItem = ({ signature }: SignatureListItemProps) => {
</div> </div>
); );
}; };
export default SignatureListItem;

View File

@@ -5,13 +5,13 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { RefreshCw, AlertCircle, Radar } from "lucide-react"; import { RefreshCw, AlertCircle, Radar } from "lucide-react";
import SignatureListItem from "./SignatureListItem"; import { SignatureListItem } from "@/components/SignatureListItem";
import { toast } from "@/hooks/use-toast"; import { toast } from "@/hooks/use-toast";
interface SignatureItem { export interface Signature {
collectionId: string; collectionId?: string;
collectionName: string; collectionName?: string;
id: string; id?: string;
identifier: string; identifier: string;
signame: string; signame: string;
sysid: string; sysid: string;
@@ -20,20 +20,18 @@ interface SignatureItem {
updated?: string; updated?: string;
created?: string; created?: string;
dangerous?: boolean; dangerous?: boolean;
scanned?: string;
} }
interface ApiResponse { interface ApiResponse {
items: SignatureItem[]; items: Signature[];
} }
interface SystemTrackerProps { interface SystemTrackerProps {
system: string; system: string;
} }
const SystemTracker = ({ system }: SystemTrackerProps) => { export const SystemTracker = ({ system }: SystemTrackerProps) => {
const queryClient = useQueryClient();
// Query to get signatures for the current system with polling
const { const {
data: signaturesData, data: signaturesData,
refetch: refetchSignatures, refetch: refetchSignatures,
@@ -178,5 +176,3 @@ const SystemTracker = ({ system }: SystemTrackerProps) => {
</div> </div>
); );
}; };
export default SystemTracker;

View File

@@ -1,6 +1,5 @@
import { GalaxyMap } from '../components/GalaxyMap'; import { GalaxyMap } from '../components/GalaxyMap';
import Header from '../components/Header'; import { Header } from '../components/Header';
const Index = () => { const Index = () => {
return ( return (

View File

@@ -5,7 +5,7 @@ import { Button } from '@/components/ui/button';
import { ArrowLeft } from 'lucide-react'; import { ArrowLeft } from 'lucide-react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
const RegionPage = () => { export const RegionPage = () => {
const { region } = useParams<{ region: string }>(); const { region } = useParams<{ region: string }>();
const navigate = useNavigate(); const navigate = useNavigate();
@@ -29,5 +29,3 @@ const RegionPage = () => {
return <RegionMap regionName={region} />; return <RegionMap regionName={region} />;
}; };
export default RegionPage;

View File

@@ -10,18 +10,9 @@ import { Header } from "@/components/Header";
import { parseSignature, parseScannedPercentage } from "@/utils/signatureParser"; import { parseSignature, parseScannedPercentage } from "@/utils/signatureParser";
import { getSystemId } from "@/utils/systemApi"; import { getSystemId } from "@/utils/systemApi";
import pb from "@/lib/pocketbase"; import pb from "@/lib/pocketbase";
import { Signature } from "@/components/SystemTracker";
interface Signature { export const SystemView = () => {
identifier: string;
type: string;
name: string;
system: string;
sysid: string;
dangerous?: boolean;
scanned?: string;
}
const SystemView = () => {
const { system, region } = useParams(); const { system, region } = useParams();
const navigate = useNavigate(); const navigate = useNavigate();
const queryClient = useQueryClient(); const queryClient = useQueryClient();
@@ -48,7 +39,7 @@ const SystemView = () => {
if (newScannedPercentage > existingScannedPercentage) { if (newScannedPercentage > existingScannedPercentage) {
await pb.collection('signature').update(existingRecord.id, { await pb.collection('signature').update(existingRecord.id, {
name: signature.name, name: signature.signame,
type: signature.type, type: signature.type,
dangerous: signature.dangerous, dangerous: signature.dangerous,
scanned: signature.scanned scanned: signature.scanned
@@ -62,7 +53,7 @@ const SystemView = () => {
await pb.collection('signature').create({ await pb.collection('signature').create({
system: signature.system, system: signature.system,
identifier: signature.identifier, identifier: signature.identifier,
name: signature.name, name: signature.signame,
type: signature.type, type: signature.type,
dangerous: signature.dangerous, dangerous: signature.dangerous,
scanned: signature.scanned scanned: signature.scanned
@@ -224,5 +215,3 @@ const SystemView = () => {
</div> </div>
); );
}; };
export default SystemView;

View File

@@ -1,13 +1,4 @@
import { Signature } from "@/components/SystemTracker";
interface Signature {
identifier: string;
type: string;
name: string;
system: string;
sysid: string;
dangerous?: boolean;
scanned?: string;
}
export const parseSignature = (text: string): Omit<Signature, 'system' | 'sysid'> | null => { export const parseSignature = (text: string): Omit<Signature, 'system' | 'sysid'> | null => {
const parts = text.split('\t'); const parts = text.split('\t');
@@ -22,7 +13,7 @@ export const parseSignature = (text: string): Omit<Signature, 'system' | 'sysid'
return { return {
identifier: parts[0], identifier: parts[0],
type: parts[2], type: parts[2],
name: parts[3], signame: parts[3],
scanned: parts.length > 4 ? parts[4] : undefined, scanned: parts.length > 4 ? parts[4] : undefined,
dangerous: false // TODO: Implement dangerous signature detection dangerous: false // TODO: Implement dangerous signature detection
}; };