A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
feat(app): check chat key exists
dextmorgn4d9793260414
diff --git a/flowsint-app/src/api/key-service.ts b/flowsint-app/src/api/key-service.tsindex a30195dd..d8c7ed6a 100644--- a/flowsint-app/src/api/key-service.ts+++ b/flowsint-app/src/api/key-service.ts@@ -1,6 +1,6 @@import { fetchWithAuth } from './api'-export const KeyService = {+export const keyService = {get: () => fetchWithAuth(`/api/keys`, { method: 'GET' }),getById: (key_id: string) => fetchWithAuth(`/api/keys/${key_id}`, { method: 'GET' }),create: (data: { name: string; key: string }) =>@@ -8,5 +8,6 @@ export const KeyService = {method: 'POST',body: JSON.stringify(data)}),+ chatKeyExists: () => fetchWithAuth(`/api/keys/chat-key-exists`, { method: 'GET' }),deleteById: (key_id: string) => fetchWithAuth(`/api/keys/${key_id}`, { method: 'DELETE' })}diff --git a/flowsint-app/src/api/query-keys-examples.ts b/flowsint-app/src/api/query-keys-examples.tsindex b8ad2aec..2e915880 100644--- a/flowsint-app/src/api/query-keys-examples.ts+++ b/flowsint-app/src/api/query-keys-examples.ts@@ -7,7 +7,7 @@// import { investigationService } from './investigation-service'// import { sketchService } from './sketch-service'// import { chatCRUDService } from './chat-service'-// import { KeyService } from './key-service'+// import { keyService } from './key-service'// import { logService } from './log-service'// import { scanService } from './scan-service'// import { enricherService } from './enricher-service'@@ -112,14 +112,14 @@// export const useKeysList = () => {// return useQuery({// queryKey: queryKeys.keys.list,-// queryFn: KeyService.get+// queryFn: keyService.get// })// }// export const useKeyDetail = (keyId: string) => {// return useQuery({// queryKey: queryKeys.keys.detail(keyId),-// queryFn: () => KeyService.getById(keyId),+// queryFn: () => keyService.getById(keyId),// enabled: !!keyId// })// }diff --git a/flowsint-app/src/api/scan-service.ts b/flowsint-app/src/api/scan-service.tsindex 02834543..2806d7b4 100644--- a/flowsint-app/src/api/scan-service.ts+++ b/flowsint-app/src/api/scan-service.ts@@ -1,7 +1,7 @@import { fetchWithAuth } from './api'export const scanService = {- get: (scan_id: string) => fetchWithAuth(`/api/scans/${scan_id}`, { method: 'GET' }),+ getById: (scan_id: string) => fetchWithAuth(`/api/scans/${scan_id}`, { method: 'GET' }),delete: (scan_id: string) => fetchWithAuth(`/api/scans/${scan_id}`, { method: 'DELETE' }),getSketchScans: (sketch_id: string) =>fetchWithAuth(`/api/scans/sketch/${sketch_id}`, { method: 'GET' }),diff --git a/flowsint-app/src/components/chat/chat-inactive.tsx b/flowsint-app/src/components/chat/chat-inactive.tsxnew file mode 100644index 00000000..c5c6fc8c--- /dev/null+++ b/flowsint-app/src/components/chat/chat-inactive.tsx@@ -0,0 +1,31 @@+import { Link } from '@tanstack/react-router'+import { KeyRound, X } from 'lucide-react'+import { Button } from '@/components/ui/button'++export default function ChatInactive({ onClose }: { onClose: any }) {+ return (+ <div className="flex flex-col h-full items-center justify-center relative py-16 px-4">+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6 absolute top-3 right-3"+ onClick={onClose}+ >+ <X className="h-4 w-4" />+ </Button>+ <div className="w-14 h-14 mb-5 text-muted-foreground/30">+ <KeyRound className="w-full h-full" strokeWidth={1.5} />+ </div>+ <h3 className="text-sm font-medium text-foreground mb-1">API key required</h3>+ <p className="text-sm text-muted-foreground text-center max-w-[260px] mb-5">+ Add a <code className="text-xs bg-muted px-1.5! py-0.5! rounded">MISTRAL_API_KEY</code> in+ your vault to start using the chat assistant+ </p>+ <Link to="/dashboard/vault">+ <Button size="sm" className="h-8 text-xs gap-1.5">+ Go to Vault+ </Button>+ </Link>+ </div>+ )+}diff --git a/flowsint-app/src/components/chat/floating-chat.tsx b/flowsint-app/src/components/chat/floating-chat.tsxindex 8c611acb..f62190e8 100644--- a/flowsint-app/src/components/chat/floating-chat.tsx+++ b/flowsint-app/src/components/chat/floating-chat.tsx@@ -14,6 +14,8 @@ import ChatHistory from './chat-history'import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip'import { CopyButton } from '../copy'import type { UIMessage } from 'ai'+import { useIsChatActive } from '@/hooks/use-is-chat-active'+import ChatInactive from './chat-inactive'function FloatingChat() {const bottomRef = useRef<HTMLDivElement>(null)@@ -33,6 +35,8 @@ function FloatingChat() {currentChatId} = useChat()+ const { exists: isChatActive } = useIsChatActive()+const isStreaming = status === 'streaming' || status === 'submitted'const { isMac } = useKeyboardShortcut({@@ -94,136 +98,147 @@ function FloatingChat() {{isOpenChat && (<div className="fixed bottom-12 overflow-hidden rounded-2xl right-4 shadow-xl z-50"><ResizableChat minWidth={400} minHeight={400} maxWidth={800} maxHeight={800}>- <Card className="overflow-hidden backdrop-blur! bg-background/90 rounded-2xl gap-0 py-0 h-full">- {view === 'history' ? (- <ChatHistory- setView={setView}- deleteChatMutation={deleteChatMutation}- handleCreateNewChat={handleCreateNewChat}- />- ) : (- <>- <div className="flex items-center justify-between h-10 p-3 border-b">- <div className="flex w-full items-center justify-between gap-1">- <div className="flex items-center gap-2 truncate text-ellipsis">- <Button- variant="ghost"- size="icon"- className="h-6 w-6"- //@ts-ignore- onClick={handleCreateNewChat}- title="Create new chat"- >- <Plus className="h-3 w-3" />- </Button>- <span className="text-sm opacity-60 truncate text-ellipsis">- {currentChat?.title}- </span>- </div>- <div className="flex items-center gap-2">- <Button- variant="ghost"- size="icon"- className="h-6 w-6"- //@ts-ignore- onClick={() => setView('history')}- title="Create new chat"- >- <History className="h-3 w-3 opacity-60" />- </Button>- <Button variant="ghost" size="icon" className="h-6 w-6" onClick={closeChat}>- <X className="h-4 w-4" />- </Button>+ {isChatActive ? (+ <Card className="overflow-hidden backdrop-blur! bg-background/90 rounded-2xl gap-0 py-0 h-full">+ {view === 'history' ? (+ <ChatHistory+ setView={setView}+ deleteChatMutation={deleteChatMutation}+ handleCreateNewChat={handleCreateNewChat}+ />+ ) : (+ <>+ <div className="flex items-center justify-between h-10 p-3 border-b">+ <div className="flex w-full items-center justify-between gap-1">+ <div className="flex items-center gap-2 truncate text-ellipsis">+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6"+ //@ts-ignore+ onClick={handleCreateNewChat}+ title="Create new chat"+ >+ <Plus className="h-3 w-3" />+ </Button>+ <span className="text-sm opacity-60 truncate text-ellipsis">+ {currentChat?.title}+ </span>+ </div>+ <div className="flex items-center gap-2">+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6"+ //@ts-ignore+ onClick={() => setView('history')}+ title="Create new chat"+ >+ <History className="h-3 w-3 opacity-60" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6"+ onClick={closeChat}+ >+ <X className="h-4 w-4" />+ </Button>+ </div></div></div>- </div>- {/* Content */}- <div className="flex flex-col flex-1 overflow-auto">- {isLoadingChat ? (- <ChatSkeleton />- ) : hasMessages ? (- <div className="grow p-4 flex flex-col gap-2">- {messages.map((message: UIMessage) => (- <ChatMessageComponent key={message.id} message={message} />- ))}- <div ref={bottomRef} />- </div>- ) : null}- {!hasMessages && !isLoadingChat && (- <div className="flex-1 flex flex-col items-center justify-center p-8 text-center text-muted-foreground">- {!currentChatId ? (- <>- <div className="relative mb-6">- <div className="absolute inset-0 bg-linear-to-r from-primary/20 to-primary/10 rounded-full blur-xl animate-pulse"></div>- <div className="relative bg-linear-to-br from-primary/10 to-primary/5 rounded-full p-4 border border-primary/20">- <img- src="/icon.png"- alt="Flowsint"- className="h-12 w-12 object-cover"- />+ {/* Content */}+ <div className="flex flex-col flex-1 overflow-auto">+ {isLoadingChat ? (+ <ChatSkeleton />+ ) : hasMessages ? (+ <div className="grow p-4 flex flex-col gap-2">+ {messages.map((message: UIMessage) => (+ <ChatMessageComponent key={message.id} message={message} />+ ))}+ <div ref={bottomRef} />+ </div>+ ) : null}+ {!hasMessages && !isLoadingChat && (+ <div className="flex-1 flex flex-col items-center justify-center p-8 text-center text-muted-foreground">+ {!currentChatId ? (+ <>+ <div className="relative mb-6">+ <div className="absolute inset-0 bg-linear-to-r from-primary/20 to-primary/10 rounded-full blur-xl animate-pulse"></div>+ <div className="relative bg-linear-to-br from-primary/10 to-primary/5 rounded-full p-4 border border-primary/20">+ <img+ src="/icon.png"+ alt="Flowsint"+ className="h-12 w-12 object-cover"+ />+ </div></div>- </div>- <div className="space-y-2 max-w-sm">- <h3 className="text-lg font-semibold text-foreground">- No conversations yet- </h3>- <p className="text-sm opacity-70">- Start chatting with AI to analyze your investigation data and get- insights. Your conversation history will appear here.- </p>- </div>- <div className="mt-6">- <Button- variant="outline"- size="sm"- onClick={handleCreateNewChat}- className="bg-linear-to-r from-primary/10 to-primary/5 border-primary/20 hover:from-primary/20 hover:to-primary/10"- >- Start your first chat- </Button>- </div>- </>- ) : (- <>- <div className="space-y-2 max-w-sm">- <h3 className="text-lg font-semibold text-foreground">- Start your conversation with{' '}- <span className="text-primary">Flo</span>- </h3>- <p className="text-sm opacity-70">- Ask me anything about your investigation. Here are some examples:- </p>- </div>- <div className="mt-6 space-y-3 max-w-md">- <div className="text-xs space-y-1">- <p className="font-medium text-left">Analysis & Insights</p>- <ul className="space-y-1 text-left opacity-60">- <li>• "Analyze the connections between these entities"</li>- <li>• "What patterns do you see in this data?"</li>- <li>• "Summarize the key findings from this investigation"</li>- </ul>+ <div className="space-y-2 max-w-sm">+ <h3 className="text-lg font-semibold text-foreground">+ No conversations yet+ </h3>+ <p className="text-sm opacity-70">+ Start chatting with AI to analyze your investigation data and get+ insights. Your conversation history will appear here.+ </p></div>- <div className="text-xs space-y-1">- <p className="font-medium text-left">Investigation Help</p>- <ul className="space-y-1 text-left opacity-60">- <li>• "Suggest next steps for this investigation"</li>- <li>• "What should I look for next?"</li>- <li>• "Help me organize this investigation"</li>- </ul>+ <div className="mt-6">+ <Button+ variant="outline"+ size="sm"+ onClick={handleCreateNewChat}+ className="bg-linear-to-r from-primary/10 to-primary/5 border-primary/20 hover:from-primary/20 hover:to-primary/10"+ >+ Start your first chat+ </Button></div>- </div>- </>- )}- </div>- )}- </div>- <div className="border-t">- <ChatPanel onSend={sendMessage} isLoading={isStreaming} />- </div>- </>- )}- </Card>+ </>+ ) : (+ <>+ <div className="space-y-2 max-w-sm">+ <h3 className="text-lg font-semibold text-foreground">+ Start your conversation with{' '}+ <span className="text-primary">Flo</span>+ </h3>+ <p className="text-sm opacity-70">+ Ask me anything about your investigation. Here are some examples:+ </p>+ </div>+ <div className="mt-6 space-y-3 max-w-md">+ <div className="text-xs space-y-1">+ <p className="font-medium text-left">Analysis & Insights</p>+ <ul className="space-y-1 text-left opacity-60">+ <li>• "Analyze the connections between these entities"</li>+ <li>• "What patterns do you see in this data?"</li>+ <li>• "Summarize the key findings from this investigation"</li>+ </ul>+ </div>+ <div className="text-xs space-y-1">+ <p className="font-medium text-left">Investigation Help</p>+ <ul className="space-y-1 text-left opacity-60">+ <li>• "Suggest next steps for this investigation"</li>+ <li>• "What should I look for next?"</li>+ <li>• "Help me organize this investigation"</li>+ </ul>+ </div>+ </div>+ </>+ )}+ </div>+ )}+ </div>+ <div className="border-t">+ <ChatPanel onSend={sendMessage} isLoading={isStreaming} />+ </div>+ </>+ )}+ </Card>+ ) : (+ <Card className="overflow-hidden backdrop-blur! bg-background/90 rounded-2xl gap-0 py-0 h-full">+ <ChatInactive onClose={closeChat} />+ </Card>+ )}</ResizableChat></div>)}diff --git a/flowsint-app/src/components/flows/params-dialog.tsx b/flowsint-app/src/components/flows/params-dialog.tsxindex 54b0830c..6702f02c 100644--- a/flowsint-app/src/components/flows/params-dialog.tsx+++ b/flowsint-app/src/components/flows/params-dialog.tsx@@ -8,7 +8,7 @@ import { Input } from '../ui/input'import KeySelector from '../keys/key-select'import { type Key } from '@/types/key'import { useQuery } from '@tanstack/react-query'-import { KeyService } from '@/api/key-service'+import { keyService } from '@/api/key-service'import { Tabs, TabsList, TabsTrigger, TabsContent } from '../ui/tabs'import { MemoizedMarkdown } from '../chat/memoized-markdown'import { cn } from '@/lib/utils'@@ -39,7 +39,7 @@ const ParamsDialog = () => {// Fetch keys to convert between IDs and Key objectsconst { data: keys = [] } = useQuery<Key[]>({queryKey: ['keys'],- queryFn: () => KeyService.get()+ queryFn: () => keyService.get()})const handleSave = useCallback(async () => {diff --git a/flowsint-app/src/components/keys/key-select.tsx b/flowsint-app/src/components/keys/key-select.tsxindex 751f79bf..645ba630 100644--- a/flowsint-app/src/components/keys/key-select.tsx+++ b/flowsint-app/src/components/keys/key-select.tsx@@ -6,7 +6,7 @@ import {SelectTrigger,SelectValue} from '@/components/ui/select'-import { KeyService } from '@/api/key-service'+import { keyService } from '@/api/key-service'import { type Key as KeyType } from '@/types/key'export default function KeySelector({@@ -19,7 +19,7 @@ export default function KeySelector({// Fetch keysconst { data: keys = [], isLoading } = useQuery<KeyType[]>({queryKey: ['keys'],- queryFn: () => KeyService.get()+ queryFn: () => keyService.get()})const handleValueChange = (keyId: string) => {diff --git a/flowsint-app/src/components/layout/log-panel.tsx b/flowsint-app/src/components/layout/log-panel.tsxindex f2c722be..8e7a7b03 100644--- a/flowsint-app/src/components/layout/log-panel.tsx+++ b/flowsint-app/src/components/layout/log-panel.tsx@@ -43,12 +43,8 @@ export const LogPanel = memo(() => {}return (- <div className="h-full overflow-hidden border-t p-2">- <TerminalLogViewer- logs={logs}- onRefresh={refetch}- onClear={handleDeleteLogs}- />+ <div className="h-full overflow-hidden border-t">+ <TerminalLogViewer logs={logs} onRefresh={refetch} onClear={handleDeleteLogs} /></div>)})diff --git a/flowsint-app/src/components/layout/status-bar.tsx b/flowsint-app/src/components/layout/status-bar.tsxindex db2a8a15..9880a4ad 100644--- a/flowsint-app/src/components/layout/status-bar.tsx+++ b/flowsint-app/src/components/layout/status-bar.tsx@@ -1,34 +1,74 @@import { Button } from '@/components/ui/button'-import { Terminal, Unlock } from 'lucide-react'+import { Terminal, Unlock, Zap, ZapOff } from 'lucide-react'import { ModeToggle } from '../mode-toggle'import { useLayoutStore } from '@/stores/layout-store'-import Legend from '../sketches/graph/components/legend'import { Link, useParams } from '@tanstack/react-router'import InfoDialog from './info'import { memo } from 'react'import { isMac } from '@/lib/utils'-+import { useQuery } from '@tanstack/react-query'+import { scanService } from '@/api/scan-service'+import { cn } from '@/utils/cn'+import { CONFIG } from '@/config'export const StatusBar = memo(() => {const { id: sketch_id } = useParams({ strict: false })const isOpenConsole = useLayoutStore((s) => s.isOpenConsole)const toggleConsole = useLayoutStore((s) => s.toggleConsole)+ const { data: scans, isLoading } = useQuery({+ queryKey: ['scans', 'list'],+ queryFn: () => scanService.getSketchScans(sketch_id as string),+ enabled: !!sketch_id,+ refetchInterval: 2500+ // refetchInterval: (data) => {+ // // @ts-ignore+ // const hasPending = Array.isArray(data) && data?.some((scan) => scan.status === 'PENDING')+ // return hasPending ? 2000 : false+ // }+ })++ const pending =+ (Array.isArray(scans) && scans?.some((scan) => scan.status === 'PENDING')) || false+return (<div className="flex items-center bg-card h-8 px-2 text-xs text-muted-foreground">- <div className="flex items-center gap-2">+ <div className="flex items-center gap-1">{sketch_id && (- <Button- variant="ghost"- size="sm"- className="h-6 gap-1 text-xs hover:bg-accent"- onClick={toggleConsole}- >- <Terminal strokeWidth={1.4} className="h-3 w-3" />- <span>- Console {isOpenConsole ? '(Open)' : ''}{' '}- <span className="text-[.7rem] opacity-60">({isMac ? '⌘' : 'ctrl'}D)</span>- </span>- </Button>+ <>+ <Button+ variant="ghost"+ size="sm"+ className="h-6 gap-1 text-xs hover:bg-accent"+ onClick={toggleConsole}+ >+ <Terminal strokeWidth={1.4} className="h-3 w-3" />+ <span>+ Console {isOpenConsole ? '(Open)' : ''}{' '}+ <span className="text-[.7rem] opacity-60">({isMac ? '⌘' : 'ctrl'}D)</span>+ </span>+ </Button>+ {CONFIG.SCANS_LIST_FEATURE_FLAG && (+ <Button+ variant="ghost"+ size="sm"+ className={cn('h-5 gap-1 text-xs hover:bg-accent')}+ onClick={toggleConsole}+ >+ {pending ? (+ <Zap strokeWidth={1.4} className="h-3 w-3 text-primary" />+ ) : (+ <ZapOff strokeWidth={1.4} className="h-3 w-3" />+ )}+ <span>+ Scans{' '}+ <span className="text-xs opacity-80">+ {isLoading ? '(-)' : `(${scans?.length ?? 0})`}+ </span>+ </span>+ {pending && <span className="h-2.5 w-2.5 rounded-full bg-primary animate-pulse" />}+ </Button>+ )}+ </>)}</div><div className="flex-1"></div>diff --git a/flowsint-app/src/components/map/map.tsx b/flowsint-app/src/components/map/map.tsxindex 27449826..3f8e9415 100644--- a/flowsint-app/src/components/map/map.tsx+++ b/flowsint-app/src/components/map/map.tsx@@ -1,25 +1,20 @@import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'import { useQuery } from '@tanstack/react-query'-import Map, { Layer, Popup, Source } from 'react-map-gl/maplibre'+import Map, { Marker, Popup } from 'react-map-gl/maplibre'import maplibregl from 'maplibre-gl'import 'maplibre-gl/dist/maplibre-gl.css'import { useTheme } from '../theme-provider'-import { Globe, Map as MapIcon, MapPin } from 'lucide-react'+import { Globe, MapPin } from 'lucide-react'import LoadingSpinner from '@/components/shared/loader'import { preloadImage, getCachedImage } from '@/components/sketches/graph/utils/image-cache'import { useGraphControls } from '@/stores/graph-controls-store'import { useGraphStore } from '@/stores/graph-store'import { Switch } from '../ui/switch'import { Label } from '../ui/label'-import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/select'import type { MapRef } from 'react-map-gl/maplibre'import type {- GeoJSONSource,- MapMouseEvent,- StyleImageInterface,StyleSpecification} from 'maplibre-gl'-import type { FeatureCollection, Point } from 'geojson'export type LocationPoint = {nodeId?: string@@ -85,75 +80,6 @@ function resolveMapStyle(return VECTOR_STYLES[variant][theme]}-function createPulsingDot(isDark: boolean): StyleImageInterface {- const size = 100- const canvas = document.createElement('canvas')- canvas.width = size- canvas.height = size- const context = canvas.getContext('2d')!- let animationTime = 0-- return {- width: size,- height: size,- data: new Uint8Array(size * size * 4),- onAdd(this: StyleImageInterface & { map?: maplibregl.Map }) {- this.map = undefined- },- render(this: StyleImageInterface & { map?: maplibregl.Map }) {- const duration = 1500- animationTime = (animationTime + 1) % duration-- const t = animationTime / duration- const radius = (size / 2) * 0.3- const outerRadius = (size / 2) * 0.3 + 15 * t- const opacity = 1 - t-- context.clearRect(0, 0, size, size)-- // Outer pulsing ring- context.beginPath()- context.arc(size / 2, size / 2, outerRadius, 0, Math.PI * 2)- const ringColor = isDark- ? `rgba(99, 102, 241, ${opacity * 0.4})`- : `rgba(79, 70, 229, ${opacity * 0.4})`- context.strokeStyle = ringColor- context.lineWidth = 2.5- context.stroke()-- // Inner solid dot- context.beginPath()- context.arc(size / 2, size / 2, radius, 0, Math.PI * 2)- const gradient = context.createRadialGradient(- size / 2,- size / 2,- 0,- size / 2,- size / 2,- radius- )- if (isDark) {- gradient.addColorStop(0, 'rgba(129, 140, 248, 1)')- gradient.addColorStop(1, 'rgba(99, 102, 241, 1)')- } else {- gradient.addColorStop(0, 'rgba(99, 102, 241, 1)')- gradient.addColorStop(1, 'rgba(67, 56, 202, 1)')- }- context.fillStyle = gradient- context.fill()-- // Bright center highlight- context.beginPath()- context.arc(size / 2 - radius * 0.2, size / 2 - radius * 0.2, radius * 0.35, 0, Math.PI * 2)- context.fillStyle = 'rgba(255, 255, 255, 0.3)'- context.fill()-- this.data = context.getImageData(0, 0, size, size).data as unknown as Uint8Array- return true // Repaint every frame- }- }-}-function useResolvedTheme() {const { theme } = useTheme()const [resolved, setResolved] = useState<'dark' | 'light'>(() => {@@ -196,8 +122,9 @@ export const MapFromAddress: React.FC<MapFromAddressProps> = ({const [isGlobe, setIsGlobe] = useState(true)const isGlobeRef = useRef(true)const [styleVariant, setStyleVariant] = useState<MapStyleVariant>('standard')- const pulsingDotRef = useRef<StyleImageInterface | null>(null)+ const [zoomLevel, setZoomLevel] = useState(2)const isDarkStyle = resolvedTheme === 'dark' || styleVariant === 'satellite'+ const showDetails = zoomLevel >= 6// Geocodingconst locationsToGeocode = locations.filter(@@ -265,70 +192,21 @@ export const MapFromAddress: React.FC<MapFromAddressProps> = ({const DEFAULT_MARKER_COLOR = '#6366f1'- // Build GeoJSON- const geojson = useMemo<FeatureCollection<Point>>(- () => ({- type: 'FeatureCollection',- features: validLocations.map((loc) => {- const lat = Number(loc.coordinates!.lat)- const lon = Number(loc.coordinates!.lon)- const color = loc.color || DEFAULT_MARKER_COLOR- const nodeType = loc.nodeType || ''- return {- type: 'Feature' as const,- properties: {- nodeId: loc.nodeId || '',- label: loc.label || loc.address || `${lat.toFixed(6)}, ${lon.toFixed(6)}`,- color,- icon: nodeType ? `marker-icon-${nodeType}` : '',- hasIcon: nodeType ? 'true' : 'false',- nodeType- },- geometry: {- type: 'Point' as const,- coordinates: [lon, lat]- }- }- })- }),- [validLocations]- )-- // Generate and register icon images for each unique node type- const registerMapImages = useCallback(async () => {- const map = mapRef.current?.getMap()- if (!map) return-- // Register pulsing dot- if (map.hasImage('pulsing-dot')) {- map.removeImage('pulsing-dot')- }- pulsingDotRef.current = createPulsingDot(isDarkStyle)- map.addImage('pulsing-dot', pulsingDotRef.current)-- // Collect unique node types from locations+ // Preload icons for all unique node types+ const [iconsReady, setIconsReady] = useState(false)+ useEffect(() => {const uniqueTypes = new Set<string>()validLocations.forEach((loc) => {if (loc.nodeType) uniqueTypes.add(loc.nodeType)})-- // Preload and register each icon via the shared image-cache- const promises = Array.from(uniqueTypes).map(async (nodeType) => {- const imageId = `marker-icon-${nodeType}`- if (map.hasImage(imageId)) map.removeImage(imageId)- try {- const img = await preloadImage(nodeType, '#ffffff')- if (!map.hasImage(imageId)) {- map.addImage(imageId, img, { sdf: false })- }- } catch (err) {- console.warn(`[map] Failed to load icon for type: ${nodeType}`, err)- }- })-- await Promise.all(promises)- map.triggerRepaint()- }, [isDarkStyle, validLocations])+ if (uniqueTypes.size === 0) {+ setIconsReady(true)+ return+ }+ Promise.all(+ Array.from(uniqueTypes).map((t) => preloadImage(t, '#ffffff'))+ ).then(() => setIconsReady(true)).catch(() => setIconsReady(true))+ }, [validLocations])// Fly to markers on data loaduseEffect(() => {@@ -360,57 +238,29 @@ export const MapFromAddress: React.FC<MapFromAddressProps> = ({}}, [validLocations, zoom, centerOnFirst])- // Handle click on clusters and pointsconst setCurrentNodeId = useGraphStore((s) => s.setCurrentNodeId)- const onClick = useCallback(- (e: MapMouseEvent) => {- const map = mapRef.current?.getMap()- if (!map) return-- // Check for cluster click- const clusterFeatures = map.queryRenderedFeatures(e.point, { layers: ['clusters'] })- if (clusterFeatures.length > 0) {- const feature = clusterFeatures[0]- const clusterId = feature.properties?.cluster_id- const source = map.getSource('locations') as GeoJSONSource- source.getClusterExpansionZoom(clusterId).then((expansionZoom) => {- const geo = feature.geometry as Point- map.flyTo({- center: geo.coordinates as [number, number],- zoom: expansionZoom,- duration: 500- })- })- return- }-- // Check for unclustered point click- const pointFeatures = map.queryRenderedFeatures(e.point, {- layers: ['unclustered-point', 'unclustered-point-icon']+ const onMarkerClick = useCallback(+ (loc: typeof validLocations[number]) => {+ const lat = Number(loc.coordinates!.lat)+ const lon = Number(loc.coordinates!.lon)+ if (loc.nodeId) setCurrentNodeId(loc.nodeId)+ setPopupInfo({+ lng: lon,+ lat,+ label: loc.label || loc.address || `${lat.toFixed(6)}, ${lon.toFixed(6)}`,+ color: loc.color || DEFAULT_MARKER_COLOR,+ nodeType: loc.nodeType || ''})- if (pointFeatures.length > 0) {- const feature = pointFeatures[0]- const geo = feature.geometry as Point- const nodeId = feature.properties?.nodeId- if (nodeId) setCurrentNodeId(nodeId)- setPopupInfo({- lng: geo.coordinates[0],- lat: geo.coordinates[1],- label: feature.properties?.label || '',- color: feature.properties?.color || '#6366f1',- nodeType: feature.properties?.nodeType || ''- })- return- }-- // Click elsewhere → dismiss popup and deselect- setPopupInfo(null)- setCurrentNodeId(null)},[setCurrentNodeId])+ const onMapClick = useCallback(() => {+ setPopupInfo(null)+ setCurrentNodeId(null)+ }, [setCurrentNodeId])+const applyProjection = useCallback(() => {const map = mapRef.current?.getMap()if (!map) return@@ -429,29 +279,11 @@ export const MapFromAddress: React.FC<MapFromAddressProps> = ({const onMapLoad = useCallback(() => {const map = mapRef.current?.getMap()if (!map) return- registerMapImages()applyProjection()map.on('style.load', () => {- registerMapImages()applyProjection()})- // Handle missing images on-demand to avoid race conditions- map.on('styleimagemissing', async (e: { id: string }) => {- const id = e.id- if (id === 'pulsing-dot' || map.hasImage(id)) return- const match = id.match(/^marker-icon-(.+)$/)- if (!match) return- const nodeType = match[1]- try {- const img = await preloadImage(nodeType, '#ffffff')- if (!map.hasImage(id)) {- map.addImage(id, img, { sdf: false })- }- } catch {- // Icon not available, ignore silently- }- })- }, [registerMapImages, applyProjection])+ }, [applyProjection])// Wire up zoom actions to the shared toolbar controlsconst setActions = useGraphControls((s) => s.setActions)@@ -590,98 +422,54 @@ export const MapFromAddress: React.FC<MapFromAddressProps> = ({}}style={{ width: '100%', height: '100%' }}mapStyle={mapStyle}- onClick={onClick}+ onClick={onMapClick}onLoad={onMapLoad}- interactiveLayerIds={['clusters', 'unclustered-point', 'unclustered-point-icon']}+ onZoom={(e) => setZoomLevel(e.viewState.zoom)}cursor="auto"attributionControl={false}>- <Source- id="locations"- type="geojson"- data={geojson}- cluster={true}- clusterMaxZoom={14}- clusterRadius={50}- >- {/* Cluster circles */}- <Layer- id="clusters"- type="circle"- filter={['has', 'point_count']}- paint={{- 'circle-color': [- 'step',- ['get', 'point_count'],- '#e8713a', // primary- 10,- '#d4622e', // primary darker- 50,- '#c05524' // primary darkest- ],- 'circle-radius': ['step', ['get', 'point_count'], 18, 10, 24, 50, 32],- 'circle-stroke-width': 2,- 'circle-stroke-color': isDarkStyle- ? 'rgba(255, 255, 255, 0.15)'- : 'rgba(0, 0, 0, 0.1)'- }}- />-- {/* Cluster count labels */}- <Layer- id="cluster-count"- type="symbol"- filter={['has', 'point_count']}- layout={{- 'text-field': '{point_count_abbreviated}',- 'text-font': ['Open Sans Bold'],- 'text-size': 13- }}- paint={{- 'text-color': '#ffffff'- }}- />-- {/* Unclustered point outer glow */}- <Layer- id="unclustered-point-glow"- type="circle"- filter={['!', ['has', 'point_count']]}- paint={{- 'circle-radius': 18,- 'circle-color': ['get', 'color'],- 'circle-opacity': 0.2,- 'circle-blur': 0.6- }}- />-- {/* Unclustered point solid circle */}- <Layer- id="unclustered-point"- type="circle"- filter={['!', ['has', 'point_count']]}- paint={{- 'circle-radius': 12,- 'circle-color': ['get', 'color'],- 'circle-stroke-width': 2,- 'circle-stroke-color': isDarkStyle- ? 'rgba(255, 255, 255, 0.25)'- : 'rgba(255, 255, 255, 0.8)'- }}- />-- {/* Icon overlay on points that have icons */}- <Layer- id="unclustered-point-icon"- type="symbol"- filter={['all', ['!', ['has', 'point_count']], ['==', ['get', 'hasIcon'], 'true']]}- layout={{- 'icon-image': ['get', 'icon'],- 'icon-size': 0.6,- 'icon-allow-overlap': true- }}- />- </Source>+ {validLocations.map((loc, i) => {+ const lat = Number(loc.coordinates!.lat)+ const lon = Number(loc.coordinates!.lon)+ const color = loc.color || DEFAULT_MARKER_COLOR+ const cachedImg = showDetails && loc.nodeType ? getCachedImage(loc.nodeType, '#ffffff') : undefined+ const dotSize = showDetails ? 24 : 10+ const glowSize = showDetails ? 36 : 16+ return (+ <Marker+ key={loc.nodeId || `${lat}-${lon}-${i}`}+ longitude={lon}+ latitude={lat}+ anchor="center"+ onClick={(e) => {+ e.originalEvent.stopPropagation()+ onMarkerClick(loc)+ }}+ >+ <div+ className="cursor-pointer"+ style={{+ width: dotSize,+ height: dotSize,+ borderRadius: '50%',+ background: color,+ border: showDetails+ ? `2px solid ${isDarkStyle ? 'rgba(255,255,255,0.25)' : 'rgba(255,255,255,0.8)'}`+ : 'none',+ boxShadow: `0 0 ${showDetails ? 12 : 6}px ${color}66`,+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ transition: 'width 0.2s, height 0.2s, box-shadow 0.2s'+ }}+ >+ {cachedImg && (+ <img src={cachedImg.src} width={14} height={14} alt="" />+ )}+ </div>+ </Marker>+ )+ })}{popupInfo && (<Popupdiff --git a/flowsint-app/src/components/terminal/terminal-log-viewer.tsx b/flowsint-app/src/components/terminal/terminal-log-viewer.tsxindex 9adea839..8ea604da 100644--- a/flowsint-app/src/components/terminal/terminal-log-viewer.tsx+++ b/flowsint-app/src/components/terminal/terminal-log-viewer.tsx@@ -19,11 +19,7 @@ interface TerminalLogViewerProps {onClear?: () => void}-export const TerminalLogViewer = ({- logs,- onRefresh,- onClear-}: TerminalLogViewerProps) => {+export const TerminalLogViewer = ({ logs, onRefresh, onClear }: TerminalLogViewerProps) => {const terminalRef = useRef<TerminalHandle>(null)const previousLogsRef = useRef<LogEntry[]>([])const isInitializedRef = useRef(false)@@ -49,11 +45,7 @@ export const TerminalLogViewer = ({} else {// Write all existing logslogsRef.current.forEach((log) => {- const formattedLog = formatLogEntry(- log.created_at,- log.type,- log.payload.message- )+ const formattedLog = formatLogEntry(log.created_at, log.type, log.payload.message)terminalRef.current?.write(formattedLog)})}@@ -84,11 +76,7 @@ export const TerminalLogViewer = ({console.log('[TerminalLogViewer] Writing new logs', newLogs.length)newLogs.forEach((log) => {- const formattedLog = formatLogEntry(- log.created_at,- log.type,- log.payload.message- )+ const formattedLog = formatLogEntry(log.created_at, log.type, log.payload.message)terminalRef.current?.write(formattedLog)})}@@ -103,11 +91,7 @@ export const TerminalLogViewer = ({} else {// Write all current logscurrentLogs.forEach((log) => {- const formattedLog = formatLogEntry(- log.created_at,- log.type,- log.payload.message- )+ const formattedLog = formatLogEntry(log.created_at, log.type, log.payload.message)terminalRef.current?.write(formattedLog)})}@@ -128,7 +112,7 @@ export const TerminalLogViewer = ({}, [onRefresh])return (- <div className="h-full flex flex-col relative bg-background rounded-lg overflow-hidden border border-border/50">+ <div className="h-full flex flex-col relative bg-background overflow-hidden">{/* Terminal */}<div className="flex-1 min-h-0"><XTermTerminal@@ -158,7 +142,6 @@ export const TerminalLogViewer = ({><Trash2 className="w-3.5 h-3.5 opacity-60" strokeWidth={1.7} /></Button>-</div></div>)diff --git a/flowsint-app/src/config.ts b/flowsint-app/src/config.tsindex e3d51b68..551e7156 100644--- a/flowsint-app/src/config.ts+++ b/flowsint-app/src/config.ts@@ -1,3 +1,4 @@export const CONFIG = {- ENRICHER_TEMPLATES_FEATURE_FLAG: false+ ENRICHER_TEMPLATES_FEATURE_FLAG: false,+ SCANS_LIST_FEATURE_FLAG: false}diff --git a/flowsint-app/src/hooks/use-is-chat-active.ts b/flowsint-app/src/hooks/use-is-chat-active.tsnew file mode 100644index 00000000..fcbddb94--- /dev/null+++ b/flowsint-app/src/hooks/use-is-chat-active.ts@@ -0,0 +1,18 @@+import { keyService } from '@/api/key-service'+import { useQuery } from '@tanstack/react-query'++interface ActiveChatState {+ exists: boolean+}++export const useIsChatActive = () => {+ const { data: status, isLoading } = useQuery<ActiveChatState>({+ queryKey: ['is_chat_active'],+ queryFn: keyService.chatKeyExists,+ refetchOnMount: true+ })+ return {+ exists: status?.exists,+ isLoading+ }+}diff --git a/flowsint-app/src/hooks/use-launch-enricher.ts b/flowsint-app/src/hooks/use-launch-enricher.tsindex 2ea039b4..aa8e9dd1 100644--- a/flowsint-app/src/hooks/use-launch-enricher.ts+++ b/flowsint-app/src/hooks/use-launch-enricher.ts@@ -2,10 +2,13 @@ import { toast } from 'sonner'import { useConfirm } from '@/components/use-confirm-dialog'import { enricherService } from '@/api/enricher-service'import { useLayoutStore } from '@/stores/layout-store'+import { useQueryClient } from '@tanstack/react-query'+import { queryKeys } from '@/api/query-keys'export function useLaunchEnricher(askUser: boolean = false) {const { confirm } = useConfirm()- const openClonsole = useLayoutStore(s => s.openConsole)+ const openClonsole = useLayoutStore((s) => s.openConsole)+ const queryClient = useQueryClient()const launchEnricher = async (node_ids: string[],@@ -28,7 +31,10 @@ export function useLaunchEnricher(askUser: boolean = false) {`Enricher ${enricherName} has been launched on ${count} node${count > 1 ? 's' : ''}.`,error: () => `An error occurred launching enricher.`})- // openClonsole()+ queryClient.invalidateQueries({+ queryKey: queryKeys.scans.list+ })+ openClonsole()return}return {diff --git a/flowsint-app/src/hooks/use-launch-flow.ts b/flowsint-app/src/hooks/use-launch-flow.tsindex c067fb07..8520a52d 100644--- a/flowsint-app/src/hooks/use-launch-flow.ts+++ b/flowsint-app/src/hooks/use-launch-flow.ts@@ -8,17 +8,20 @@ import { useLayoutStore } from '@/stores/layout-store'export function useLaunchFlow(askUser: boolean = false) {const { confirm } = useConfirm()const queryClient = useQueryClient()- const openClonsole = useLayoutStore(s => s.openConsole)+ const openClonsole = useLayoutStore((s) => s.openConsole)// Launch flow mutationconst launchFlowMutation = useMutation({mutationFn: ({ flowId, body }: { flowId: string; body: BodyInit }) =>flowService.launch(flowId, body),onSuccess: (_, variables) => {- // openClonsole()+ openClonsole()queryClient.invalidateQueries({queryKey: queryKeys.flows.detail(variables.flowId)})+ queryClient.invalidateQueries({+ queryKey: queryKeys.scans.list+ })},onError: (error) => {console.error('Error launching flow:', error)@@ -43,8 +46,7 @@ export function useLaunchFlow(askUser: boolean = false) {toast.promise(launchFlowMutation.mutateAsync({ flowId: flow_id, body }), {loading: 'Loading...',- success: () =>- `Flow ${flow_id} has been launched on ${count} node${count > 1 ? 's' : ''}.`,+ success: () => `Flow ${flow_id} has been launched on ${count} node${count > 1 ? 's' : ''}.`,error: () => `An error occurred launching flow.`})returndiff --git a/flowsint-app/src/routes/_auth.dashboard.vault.tsx b/flowsint-app/src/routes/_auth.dashboard.vault.tsxindex c24696f8..ec9e3eb1 100644--- a/flowsint-app/src/routes/_auth.dashboard.vault.tsx+++ b/flowsint-app/src/routes/_auth.dashboard.vault.tsx@@ -1,7 +1,7 @@import { createFileRoute } from '@tanstack/react-router'import { useState } from 'react'import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'-import { KeyService } from '../api/key-service'+import { keyService } from '../api/key-service'import { Button } from '../components/ui/button'import { Input } from '../components/ui/input'import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../components/ui/card'@@ -51,12 +51,12 @@ function VaultPage() {refetch} = useQuery<KeyType[]>({queryKey: queryKeys.keys.list,- queryFn: () => KeyService.get()+ queryFn: () => keyService.get()})// Create key mutationconst createKeyMutation = useMutation({- mutationFn: KeyService.create,+ mutationFn: keyService.create,onSuccess: () => {queryClient.invalidateQueries({ queryKey: queryKeys.keys.list })setIsAddDialogOpen(false)@@ -72,7 +72,7 @@ function VaultPage() {// Delete key mutationconst deleteKeyMutation = useMutation({- mutationFn: KeyService.deleteById,+ mutationFn: keyService.deleteById,onSuccess: () => {queryClient.invalidateQueries({ queryKey: queryKeys.keys.list })toast.success('API key deleted successfully!')@@ -125,191 +125,189 @@ function VaultPage() {Add API Key</Button></DialogTrigger>- <DialogContent className="sm:max-w-[425px]">- <DialogHeader>- <DialogTitle>Add API Key</DialogTitle>- <DialogDescription>- Add a new API key with a custom name. Your keys are encrypted and stored securely.- </DialogDescription>- </DialogHeader>- <div className="grid gap-4 py-4">- <div className="grid gap-2">- <Label htmlFor="keyName">Key Name</Label>- <Input- id="keyName"- placeholder="e.g., OpenAI, GitHub, Shodan..."- value={keyName}- onChange={(e) => setKeyName(e.target.value)}- />- </div>- <div className="grid gap-2">- <Label htmlFor="apiKey">API Key</Label>- <Input- id="apiKey"- type="password"- placeholder="Enter your API key"- value={apiKey}- onChange={(e) => setApiKey(e.target.value)}- />- </div>+ <DialogContent className="sm:max-w-[425px]">+ <DialogHeader>+ <DialogTitle>Add API Key</DialogTitle>+ <DialogDescription>+ Add a new API key with a custom name. Your keys are encrypted and stored securely.+ </DialogDescription>+ </DialogHeader>+ <div className="grid gap-4 py-4">+ <div className="grid gap-2">+ <Label htmlFor="keyName">Key Name</Label>+ <Input+ id="keyName"+ placeholder="e.g., OpenAI, GitHub, Shodan..."+ value={keyName}+ onChange={(e) => setKeyName(e.target.value)}+ /></div>- <DialogFooter>- <Button- variant="outline"- onClick={() => setIsAddDialogOpen(false)}- disabled={createKeyMutation.isPending}- >- Cancel- </Button>- <Button- onClick={handleAddKey}- disabled={createKeyMutation.isPending || !keyName.trim() || !apiKey.trim()}- >- {createKeyMutation.isPending && <Loader2 className="w-4 h-4 mr-2 animate-spin" />}- Add Key- </Button>- </DialogFooter>- </DialogContent>+ <div className="grid gap-2">+ <Label htmlFor="apiKey">API Key</Label>+ <Input+ id="apiKey"+ type="password"+ placeholder="Enter your API key"+ value={apiKey}+ onChange={(e) => setApiKey(e.target.value)}+ />+ </div>+ </div>+ <DialogFooter>+ <Button+ variant="outline"+ onClick={() => setIsAddDialogOpen(false)}+ disabled={createKeyMutation.isPending}+ >+ Cancel+ </Button>+ <Button+ onClick={handleAddKey}+ disabled={createKeyMutation.isPending || !keyName.trim() || !apiKey.trim()}+ >+ {createKeyMutation.isPending && <Loader2 className="w-4 h-4 mr-2 animate-spin" />}+ Add Key+ </Button>+ </DialogFooter>+ </DialogContent></Dialog>}><div className="w-full">- {keys.length === 0 ? (- <Card className="border-2 border-dashed border-primary/20 bg-gradient-to-br from-primary/5 via-background to-accent/5">- <CardContent className="flex flex-col items-center justify-center py-20 px-8">- <div className="text-center space-y-4 max-w-md">- <h3 className="text-2xl font-bold bg-gradient-to-r from-foreground to-foreground/70 bg-clip-text text-transparent">- Your Vault is Empty- </h3>- <p className="text-muted-foreground text-lg leading-relaxed">- Add your first API key to unlock the power of third-party services in your- investigations.- </p>-- <div className="flex flex-wrap justify-center gap-3 pt-4 pb-6">- <Badge- variant="secondary"- className="bg-primary/10 text-primary border-primary/20 px-4 py-2"- >- <Zap className="w-4 h-4 mr-2" />- Fast Setup- </Badge>- <Badge- variant="secondary"- className="bg-emerald-500/10 text-emerald-700 border-emerald-200/40 px-4 py-2"- >- <Lock className="w-4 h-4 mr-2" />- Encrypted- </Badge>- <Badge- variant="secondary"- className="bg-violet-500/10 text-violet-700 border-violet-200/40 px-4 py-2"- >- <Sparkles className="w-4 h-4 mr-2" />- Secure- </Badge>- </div>+ {keys.length === 0 ? (+ <Card className="border-2 border-dashed border-primary/20 bg-gradient-to-br from-primary/5 via-background to-accent/5">+ <CardContent className="flex flex-col items-center justify-center py-20 px-8">+ <div className="text-center space-y-4 max-w-md">+ <h3 className="text-2xl font-bold bg-gradient-to-r from-foreground to-foreground/70 bg-clip-text text-transparent">+ Your Vault is Empty+ </h3>+ <p className="text-muted-foreground text-lg leading-relaxed">+ Add your first API key to unlock the power of third-party services in your+ investigations.+ </p>- <Button onClick={() => setIsAddDialogOpen(true)}>- <Plus className="w-4 h-4 mr-2" />- Add Your First Key- </Button>- </div>- </CardContent>- </Card>- ) : (- <Card className="overflow-hidden border bg-gradient-to-br from-background to-muted/20">- <CardHeader className="border-b">- <div className="flex items-center justify-between">- <CardTitle className="flex items-center gap-3 text-xl">- <div className="p-2 bg-primary rounded-lg">- <Shield className="w-5 h-5 text-white" strokeWidth={1.9} />- </div>- API Keys- </CardTitle>- <Badge variant="secondary" className="px-3 py-1">- {keys.length} {keys.length === 1 ? 'key' : 'keys'}+ <div className="flex flex-wrap justify-center gap-3 pt-4 pb-6">+ <Badge+ variant="secondary"+ className="bg-primary/10 text-primary border-primary/20 px-4 py-2"+ >+ <Zap className="w-4 h-4 mr-2" />+ Fast Setup+ </Badge>+ <Badge+ variant="secondary"+ className="bg-emerald-500/10 text-emerald-700 border-emerald-200/40 px-4 py-2"+ >+ <Lock className="w-4 h-4 mr-2" />+ Encrypted+ </Badge>+ <Badge+ variant="secondary"+ className="bg-violet-500/10 text-violet-700 border-violet-200/40 px-4 py-2"+ >+ <Sparkles className="w-4 h-4 mr-2" />+ Secure</Badge></div>- <CardDescription className="text-base mt-2">- Your encrypted API keys for external services. These keys will be available for- your investigations.- </CardDescription>- </CardHeader>- <CardContent className="p-0">- <Table>- <TableHeader>- <TableRow className="border-b bg-muted/30">- <TableHead className="py-4 px-6 text-sm font-semibold w-2/5">- <div className="flex items-center gap-2">- <Key className="w-4 h-4" />- Name- </div>- </TableHead>- <TableHead className="py-4 text-sm font-semibold w-1/3">- <div className="flex items-center gap-2">- <Clock className="w-4 h-4" />- Created- </div>- </TableHead>- <TableHead className="py-4 px-6 text-sm font-semibold text-right w-1/5">- Actions- </TableHead>- </TableRow>- </TableHeader>- <TableBody>- {keys.map((key: KeyType) => (- <TableRow- key={key.id}- className="group hover:bg-gradient-to-r hover:from-primary/5 hover:to-accent/5 transition-all duration-200 border-b border-border/50"- >- <TableCell className="py-5 px-6">- <div className="flex items-center gap-4">- <div className="p-2 bg-gradient-to-r from-primary/10 to-accent/10 border border-primary/20 rounded-lg group-hover:scale-110 transition-transform duration-200">- <Key className="w-4 h-4 text-primary" />- </div>- <div>- <div className="font-semibold text-foreground group-hover:text-primary transition-colors">- {key.name}- </div>- <div className="text-sm text-muted-foreground">- Encrypted & Secure- </div>- </div>++ <Button onClick={() => setIsAddDialogOpen(true)}>+ <Plus className="w-4 h-4 mr-2" />+ Add Your First Key+ </Button>+ </div>+ </CardContent>+ </Card>+ ) : (+ <Card className="overflow-hidden border bg-gradient-to-br from-background to-muted/20">+ <CardHeader className="border-b">+ <div className="flex items-center justify-between">+ <CardTitle className="flex items-center gap-3 text-xl">+ <div className="p-2 bg-primary rounded-lg">+ <Shield className="w-5 h-5 text-white" strokeWidth={1.9} />+ </div>+ API Keys+ </CardTitle>+ <Badge variant="secondary" className="px-3 py-1">+ {keys.length} {keys.length === 1 ? 'key' : 'keys'}+ </Badge>+ </div>+ <CardDescription className="text-base mt-2">+ Your encrypted API keys for external services. These keys will be available for your+ investigations.+ </CardDescription>+ </CardHeader>+ <CardContent className="p-0">+ <Table>+ <TableHeader>+ <TableRow className="border-b bg-muted/30">+ <TableHead className="py-4 px-6 text-sm font-semibold w-2/5">+ <div className="flex items-center gap-2">+ <Key className="w-4 h-4" />+ Name+ </div>+ </TableHead>+ <TableHead className="py-4 text-sm font-semibold w-1/3">+ <div className="flex items-center gap-2">+ <Clock className="w-4 h-4" />+ Created+ </div>+ </TableHead>+ <TableHead className="py-4 px-6 text-sm font-semibold text-right w-1/5">+ Actions+ </TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {keys.map((key: KeyType) => (+ <TableRow+ key={key.id}+ className="group hover:bg-gradient-to-r hover:from-primary/5 hover:to-accent/5 transition-all duration-200 border-b border-border/50"+ >+ <TableCell className="py-5 px-6">+ <div className="flex items-center gap-4">+ <div className="p-2 bg-gradient-to-r from-primary/10 to-accent/10 border border-primary/20 rounded-lg group-hover:scale-110 transition-transform duration-200">+ <Key className="w-4 h-4 text-primary" /></div>- </TableCell>- <TableCell className="py-5">- <div className="flex items-center gap-2 text-sm">- <div className="p-1.5 bg-muted rounded-full">- <Clock className="w-3 h-3 text-muted-foreground" />+ <div>+ <div className="font-semibold text-foreground group-hover:text-primary transition-colors">+ {key.name}</div>- <span className="text-muted-foreground">- {new Date(key.created_at).toLocaleDateString('en-US', {- year: 'numeric',- month: 'short',- day: 'numeric'- })}- </span>+ <div className="text-sm text-muted-foreground">Encrypted & Secure</div></div>- </TableCell>- <TableCell className="text-right py-5 px-6">- <Button- variant="ghost"- size="icon"- className="text-destructive hover:text-destructive hover:bg-destructive/10"- onClick={() => handleDeleteKey(key.id, key.name)}- disabled={deleteKeyMutation.isPending}- >- <Trash2 className="w-4 h-4" />- </Button>- </TableCell>- </TableRow>- ))}- </TableBody>- </Table>- </CardContent>- </Card>- )}+ </div>+ </TableCell>+ <TableCell className="py-5">+ <div className="flex items-center gap-2 text-sm">+ <div className="p-1.5 bg-muted rounded-full">+ <Clock className="w-3 h-3 text-muted-foreground" />+ </div>+ <span className="text-muted-foreground">+ {new Date(key.created_at).toLocaleDateString('en-US', {+ year: 'numeric',+ month: 'short',+ day: 'numeric'+ })}+ </span>+ </div>+ </TableCell>+ <TableCell className="text-right py-5 px-6">+ <Button+ variant="ghost"+ size="icon"+ className="text-destructive hover:text-destructive hover:bg-destructive/10"+ onClick={() => handleDeleteKey(key.id, key.name)}+ disabled={deleteKeyMutation.isPending}+ >+ <Trash2 className="w-4 h-4" />+ </Button>+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </CardContent>+ </Card>+ )}</div></PageLayout>)