Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

feat(app): new dashboard styles

dextmorgnd45462807fd4
diff --git a/flowsint-app/src/api/query-keys-examples.ts b/flowsint-app/src/api/query-keys-examples.ts
index 7c03792d..b8ad2aec 100644
--- a/flowsint-app/src/api/query-keys-examples.ts
+++ b/flowsint-app/src/api/query-keys-examples.ts
@@ -1,213 +1,193 @@
-// Examples of how to use the Query Key Factory with your existing hooks
-// This file demonstrates the proper usage patterns
-
-import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
-import { queryKeys } from './query-keys'
-import { analysisService } from './analysis-service'
-import { investigationService } from './investigation-service'
-import { sketchService } from './sketch-service'
-import { chatCRUDService } from './chat-service'
-import { KeyService } from './key-service'
-import { logService } from './log-service'
-import { scanService } from './scan-service'
-import { enricherService } from './enricher-service'
-
-// Example 1: Using the query keys directly
-export const useInvestigationsList = () => {
- return useQuery({
- queryKey: queryKeys.investigations.list,
- queryFn: investigationService.get
- })
-}
-
-export const useInvestigationDetail = (investigationId: string) => {
- return useQuery({
- queryKey: queryKeys.investigations.detail(investigationId),
- queryFn: () => investigationService.getById(investigationId),
- enabled: !!investigationId
- })
-}
-
-export const useInvestigationAnalyses = (investigationId: string) => {
- return useQuery({
- queryKey: queryKeys.investigations.analyses(investigationId),
- queryFn: () => analysisService.getByInvestigationId(investigationId),
- enabled: !!investigationId
- })
-}
-
-// Example 2: Using the individual key groups
-export const useSketchesList = () => {
- return useQuery({
- queryKey: queryKeys.sketches.list,
- queryFn: sketchService.get
- })
-}
-
-export const useSketchDetail = (sketchId: string) => {
- return useQuery({
- queryKey: queryKeys.sketches.detail(sketchId),
- queryFn: () => sketchService.getById(sketchId),
- enabled: !!sketchId
- })
-}
-
-export const useSketchGraph = (investigationId: string, sketchId: string) => {
- return useQuery({
- queryKey: queryKeys.sketches.graph(investigationId, sketchId),
- queryFn: () => sketchService.getById(sketchId),
- enabled: !!investigationId && !!sketchId
- })
-}
-
-// Example 3: Using with mutations and invalidation
-export const useCreateAnalysis = () => {
- const queryClient = useQueryClient()
-
- return useMutation({
- mutationFn: async (data: { title: string; investigation_id: string; content: any }) => {
- return analysisService.create(JSON.stringify(data))
- },
- onSuccess: (data, variables) => {
- // Invalidate the specific investigation's analyses
- queryClient.invalidateQueries({
- queryKey: queryKeys.investigations.analyses(variables.investigation_id)
- })
-
- // Also invalidate the general analyses list
- queryClient.invalidateQueries({
- queryKey: queryKeys.analyses.list
- })
- }
- })
-}
-
-export const useUpdateAnalysis = () => {
- const queryClient = useQueryClient()
-
- return useMutation({
- mutationFn: async ({ analysisId, data }: { analysisId: string; data: any }) => {
- return analysisService.update(analysisId, JSON.stringify(data))
- },
- onSuccess: (data, variables) => {
- // Update the cache directly for better UX
- queryClient.setQueryData(queryKeys.analyses.detail(variables.analysisId), data)
-
- // Invalidate related queries
- queryClient.invalidateQueries({
- queryKey: queryKeys.analyses.byInvestigation(data.investigation_id)
- })
- }
- })
-}
-
-// Example 4: Using with chat functionality
-export const useChatDetail = (chatId: string) => {
- return useQuery({
- queryKey: queryKeys.chats.detail(chatId),
- queryFn: () => chatCRUDService.getById(chatId),
- enabled: !!chatId
- })
-}
-
-export const useChatsByInvestigation = (investigationId: string) => {
- return useQuery({
- queryKey: queryKeys.chats.byInvestigation(investigationId),
- queryFn: () => chatCRUDService.getByInvestigationId(investigationId),
- enabled: !!investigationId
- })
-}
-
-// Example 5: Using with logs and events
-export const useLogsBySketch = (sketchId: string) => {
- return useQuery({
- queryKey: queryKeys.logs.bySketch(sketchId),
- queryFn: () => logService.get(sketchId),
- enabled: !!sketchId,
- staleTime: 30_000 // 30 seconds
- })
-}
-
-// Example 6: Using with API keys
-export const useKeysList = () => {
- return useQuery({
- queryKey: queryKeys.keys.list,
- queryFn: KeyService.get
- })
-}
-
-export const useKeyDetail = (keyId: string) => {
- return useQuery({
- queryKey: queryKeys.keys.detail(keyId),
- queryFn: () => KeyService.getById(keyId),
- enabled: !!keyId
- })
-}
-
-// Example 7: Using with scans
-export const useScanDetail = (scanId: string) => {
- return useQuery({
- queryKey: queryKeys.scans.detail(scanId),
- queryFn: () => scanService.get(scanId),
- enabled: !!scanId
- })
-}
-
-// Example 8: Using with enrichers
-export const useEnrichersList = () => {
- return useQuery({
- queryKey: queryKeys.enrichers.list,
- queryFn: enricherService.get
- })
-}
-
-// Example 9: Complex invalidation patterns
-export const useDeleteInvestigation = () => {
- const queryClient = useQueryClient()
-
- return useMutation({
- mutationFn: investigationService.delete,
- onSuccess: (data, variables) => {
- // Invalidate all investigation-related queries
- queryClient.invalidateQueries({
- queryKey: queryKeys.investigations.list
- })
-
- // Invalidate all related data
- queryClient.invalidateQueries({
- queryKey: queryKeys.investigations.detail(variables)
- })
-
- // Clear related caches
- queryClient.removeQueries({
- queryKey: queryKeys.investigations.analyses(variables)
- })
-
- queryClient.removeQueries({
- queryKey: queryKeys.investigations.sketches(variables)
- })
-
- queryClient.removeQueries({
- queryKey: queryKeys.investigations.flows(variables)
- })
- }
- })
-}
-
-// Example 10: Prefetching with query keys
-export const usePrefetchInvestigation = () => {
- const queryClient = useQueryClient()
-
- return (investigationId: string) => {
- queryClient.prefetchQuery({
- queryKey: queryKeys.investigations.detail(investigationId),
- queryFn: () => investigationService.getById(investigationId)
- })
-
- // Also prefetch related data
- queryClient.prefetchQuery({
- queryKey: queryKeys.investigations.analyses(investigationId),
- queryFn: () => analysisService.getByInvestigationId(investigationId)
- })
- }
-}
+// // Examples of how to use the Query Key Factory with your existing hooks
+// // This file demonstrates the proper usage patterns
+
+// import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
+// import { queryKeys } from './query-keys'
+// import { analysisService } from './analysis-service'
+// import { investigationService } from './investigation-service'
+// import { sketchService } from './sketch-service'
+// import { chatCRUDService } from './chat-service'
+// import { KeyService } from './key-service'
+// import { logService } from './log-service'
+// import { scanService } from './scan-service'
+// import { enricherService } from './enricher-service'
+
+// // Example 1: Using the query keys directly
+// export const useInvestigationsList = () => {
+// return useQuery({
+// queryKey: queryKeys.investigations.list,
+// queryFn: investigationService.get
+// })
+// }
+
+// export const useInvestigationDetail = (investigationId: string) => {
+// return useQuery({
+// queryKey: queryKeys.investigations.detail(investigationId),
+// queryFn: () => investigationService.getById(investigationId),
+// enabled: !!investigationId
+// })
+// }
+
+// export const useInvestigationAnalyses = (investigationId: string) => {
+// return useQuery({
+// queryKey: queryKeys.investigations.analyses(investigationId),
+// queryFn: () => analysisService.getByInvestigationId(investigationId),
+// enabled: !!investigationId
+// })
+// }
+
+// // Example 2: Using the individual key groups
+// export const useSketchesList = () => {
+// return useQuery({
+// queryKey: queryKeys.sketches.list,
+// queryFn: sketchService.get
+// })
+// }
+
+// export const useSketchDetail = (sketchId: string) => {
+// return useQuery({
+// queryKey: queryKeys.sketches.detail(sketchId),
+// queryFn: () => sketchService.getById(sketchId),
+// enabled: !!sketchId
+// })
+// }
+
+// export const useSketchGraph = (investigationId: string, sketchId: string) => {
+// return useQuery({
+// queryKey: queryKeys.sketches.graph(investigationId, sketchId),
+// queryFn: () => sketchService.getById(sketchId),
+// enabled: !!investigationId && !!sketchId
+// })
+// }
+
+// }
+
+// export const useUpdateAnalysis = () => {
+// const queryClient = useQueryClient()
+
+// return useMutation({
+// mutationFn: async ({ analysisId, data }: { analysisId: string; data: any }) => {
+// return analysisService.update(analysisId, JSON.stringify(data))
+// },
+// onSuccess: (data, variables) => {
+// // Update the cache directly for better UX
+// queryClient.setQueryData(queryKeys.analyses.detail(variables.analysisId), data)
+
+// // Invalidate related queries
+// queryClient.invalidateQueries({
+// queryKey: queryKeys.analyses.byInvestigation(data.investigation_id)
+// })
+// }
+// })
+// }
+
+// // Example 4: Using with chat functionality
+// export const useChatDetail = (chatId: string) => {
+// return useQuery({
+// queryKey: queryKeys.chats.detail(chatId),
+// queryFn: () => chatCRUDService.getById(chatId),
+// enabled: !!chatId
+// })
+// }
+
+// export const useChatsByInvestigation = (investigationId: string) => {
+// return useQuery({
+// queryKey: queryKeys.chats.byInvestigation(investigationId),
+// queryFn: () => chatCRUDService.getByInvestigationId(investigationId),
+// enabled: !!investigationId
+// })
+// }
+
+// // Example 5: Using with logs and events
+// export const useLogsBySketch = (sketchId: string) => {
+// return useQuery({
+// queryKey: queryKeys.logs.bySketch(sketchId),
+// queryFn: () => logService.get(sketchId),
+// enabled: !!sketchId,
+// staleTime: 30_000 // 30 seconds
+// })
+// }
+
+// // Example 6: Using with API keys
+// export const useKeysList = () => {
+// return useQuery({
+// queryKey: queryKeys.keys.list,
+// queryFn: KeyService.get
+// })
+// }
+
+// export const useKeyDetail = (keyId: string) => {
+// return useQuery({
+// queryKey: queryKeys.keys.detail(keyId),
+// queryFn: () => KeyService.getById(keyId),
+// enabled: !!keyId
+// })
+// }
+
+// // Example 7: Using with scans
+// export const useScanDetail = (scanId: string) => {
+// return useQuery({
+// queryKey: queryKeys.scans.detail(scanId),
+// queryFn: () => scanService.get(scanId),
+// enabled: !!scanId
+// })
+// }
+
+// // Example 8: Using with enrichers
+// export const useEnrichersList = () => {
+// return useQuery({
+// queryKey: queryKeys.enrichers.list,
+// queryFn: enricherService.get
+// })
+// }
+
+// // Example 9: Complex invalidation patterns
+// export const useDeleteInvestigation = () => {
+// const queryClient = useQueryClient()
+
+// return useMutation({
+// mutationFn: investigationService.delete,
+// onSuccess: (data, variables) => {
+// // Invalidate all investigation-related queries
+// queryClient.invalidateQueries({
+// queryKey: queryKeys.investigations.list
+// })
+
+// // Invalidate all related data
+// queryClient.invalidateQueries({
+// queryKey: queryKeys.investigations.detail(variables)
+// })
+
+// // Clear related caches
+// queryClient.removeQueries({
+// queryKey: queryKeys.investigations.analyses(variables)
+// })
+
+// queryClient.removeQueries({
+// queryKey: queryKeys.investigations.sketches(variables)
+// })
+
+// queryClient.removeQueries({
+// queryKey: queryKeys.investigations.flows(variables)
+// })
+// }
+// })
+// }
+
+// // Example 10: Prefetching with query keys
+// export const usePrefetchInvestigation = () => {
+// const queryClient = useQueryClient()
+
+// return (investigationId: string) => {
+// queryClient.prefetchQuery({
+// queryKey: queryKeys.investigations.detail(investigationId),
+// queryFn: () => investigationService.getById(investigationId)
+// })
+
+// // Also prefetch related data
+// queryClient.prefetchQuery({
+// queryKey: queryKeys.investigations.analyses(investigationId),
+// queryFn: () => analysisService.getByInvestigationId(investigationId)
+// })
+// }
+// }
diff --git a/flowsint-app/src/components/analyses/analyses-list.tsx b/flowsint-app/src/components/analyses/analyses-list.tsx
index 53cc2012..546f4be3 100644
--- a/flowsint-app/src/components/analyses/analyses-list.tsx
+++ b/flowsint-app/src/components/analyses/analyses-list.tsx
@@ -61,6 +61,7 @@ const AnalysisList = () => {
queryFn: () => analysisService.getByInvestigationId(investigationId || ''),
enabled: !!investigationId
})
+
const [searchQuery, setSearchQuery] = useState('')
diff --git a/flowsint-app/src/components/analyses/analysis-editor.tsx b/flowsint-app/src/components/analyses/analysis-editor.tsx
index 7aecf18f..33752f7e 100644
--- a/flowsint-app/src/components/analyses/analysis-editor.tsx
+++ b/flowsint-app/src/components/analyses/analysis-editor.tsx
@@ -20,7 +20,6 @@ import { useConfirm } from '../use-confirm-dialog'
import { Editor } from '@tiptap/core'
import { Link, useParams } from '@tanstack/react-router'
import { useLayoutStore } from '@/stores/layout-store'
-import default_content from './default_content.json'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import {
DropdownMenu,
@@ -30,6 +29,7 @@ import {
DropdownMenuTrigger
} from '@/components/ui/dropdown-menu'
import { queryKeys } from '@/api/query-keys'
+import { useCreateAnalysis } from '@/hooks/use-create-analysis'
interface AnalysisEditorProps {
// Core data
@@ -91,6 +91,9 @@ export const AnalysisEditor = ({
const [isEditingTitle, setIsEditingTitle] = useState(false)
const [saveStatus, setSaveStatus] = useState<'saved' | 'saving' | 'unsaved'>('saved')
// Debounced save function
+
+ const createMutation = useCreateAnalysis(routeInvestigationId, onAnalysisCreate)
+
const debouncedSave = useCallback(
debounce(() => {
if (analysis) {
@@ -126,31 +129,6 @@ export const AnalysisEditor = ({
}
}
- // Mutations
- const createMutation = useMutation({
- mutationFn: async () => {
- const newAnalysis: Partial<Analysis> = {
- title: 'Untitled Analysis',
- investigation_id: investigationId,
- content: default_content
- }
- const res = await analysisService.create(JSON.stringify(newAnalysis))
- return res
- },
- onSuccess: async () => {
- queryClient.invalidateQueries({
- queryKey: queryKeys.analyses.byInvestigation(investigationId || '')
- })
- onAnalysisCreate?.(investigationId)
- toast.success('New analysis created')
- },
- onError: (error) => {
- toast.error(
- 'Failed to create analysis: ' + (error instanceof Error ? error.message : 'Unknown error')
- )
- }
- })
-
const saveMutation = useMutation({
mutationFn: async (updated: Partial<Analysis>) => {
if (!analysis) return
diff --git a/flowsint-app/src/components/analyses/new-analysis.tsx b/flowsint-app/src/components/analyses/new-analysis.tsx
new file mode 100644
index 00000000..fa9747fd
--- /dev/null
+++ b/flowsint-app/src/components/analyses/new-analysis.tsx
@@ -0,0 +1,139 @@
+import { useState, type ReactNode } from 'react'
+import { useForm } from 'react-hook-form'
+import { useRouter, useParams } from '@tanstack/react-router'
+import { toast } from 'sonner'
+import { useMutation, useQueryClient } from '@tanstack/react-query'
+import { queryKeys } from '@/api/query-keys'
+import { Button } from '@/components/ui/button'
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ DialogTrigger
+} from '@/components/ui/dialog'
+import { Input } from '@/components/ui/input'
+import { Label } from '@/components/ui/label'
+import { analysisService } from '@/api/analysis-service'
+
+interface FormValues {
+ title: string
+}
+
+interface NewAnalysisProps {
+ children: ReactNode
+}
+
+export default function NewAnalysis({ children }: NewAnalysisProps) {
+ const [open, setOpen] = useState(false)
+ const router = useRouter()
+ const { investigationId, id: sketchId } = useParams({ strict: false })
+ const queryClient = useQueryClient()
+
+ const {
+ register,
+ handleSubmit,
+ formState: { errors, isSubmitting },
+ reset
+ } = useForm<FormValues>()
+
+ // Create sketch mutation
+ const createAnalysisMutation = useMutation({
+ mutationFn: analysisService.create,
+ onSuccess: (result) => {
+ if (result.id) {
+ toast.success('New analysis created.')
+ router.navigate({
+ to: `/dashboard/investigations/${investigationId}/analysis/${result.id}`
+ })
+ reset()
+ // Invalidate sketches list and investigation sketches
+ queryClient.invalidateQueries({
+ queryKey: queryKeys.analyses.list
+ })
+ if (investigationId) {
+ queryClient.invalidateQueries({
+ queryKey: queryKeys.investigations.analyses(investigationId)
+ })
+ }
+ if (sketchId) setOpen(false)
+ } else {
+ toast.error(result.error || 'Failed to create analysis.')
+ }
+ },
+ onError: (error) => {
+ toast.error(error.message)
+ }
+ })
+
+ async function onSubmit(data: FormValues) {
+ if (!investigationId) {
+ toast.error('An analysis must be related to an investigation.')
+ return
+ }
+
+ try {
+ const payload = {
+ ...data,
+ investigation_id: investigationId
+ }
+ await createAnalysisMutation.mutateAsync(JSON.stringify(payload))
+ } catch (error) {
+ console.error('Error creating sketch:', error)
+ }
+ }
+
+ const formContent = (
+ <form onSubmit={handleSubmit(onSubmit)}>
+ <div className="grid gap-4 py-4">
+ <div className="grid gap-2">
+ <Label htmlFor="title">Analysis name</Label>
+ <Input
+ id="title"
+ {...register('title', { required: 'Title is required' })}
+ placeholder="Fraud suspicion"
+ aria-invalid={errors.title ? 'true' : 'false'}
+ />
+ {errors.title && (
+ <p role="alert" className="text-red-600 text-sm mt-1">
+ {errors.title.message}
+ </p>
+ )}
+ </div>
+ </div>
+ <DialogFooter>
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => {
+ reset()
+ setOpen(false)
+ }}
+ disabled={isSubmitting}
+ >
+ Cancel
+ </Button>
+ <Button type="submit" disabled={isSubmitting}>
+ {isSubmitting ? 'Saving...' : 'Save'}
+ </Button>
+ </DialogFooter>
+ </form>
+ )
+
+ return (
+ <Dialog open={open} onOpenChange={setOpen}>
+ <DialogTrigger asChild>
+ <span role="button">{children}</span>
+ </DialogTrigger>
+ <DialogContent className="sm:max-w-[425px]">
+ <DialogHeader>
+ <DialogTitle>New analysis</DialogTitle>
+ <DialogDescription>Create a new blank analysis.</DialogDescription>
+ </DialogHeader>
+ {formContent}
+ </DialogContent>
+ </Dialog>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/empty-states.tsx b/flowsint-app/src/components/dashboard/empty-states.tsx
index a262b9af..eba8ffea 100644
--- a/flowsint-app/src/components/dashboard/empty-states.tsx
+++ b/flowsint-app/src/components/dashboard/empty-states.tsx
@@ -1,5 +1,7 @@
import { Button } from "@/components/ui/button"
import { Plus, Upload } from "lucide-react"
+import NewSketch from "../sketches/new-sketch"
+import NewAnalysis from "../analyses/new-analysis"
interface EmptyStateProps {
onAction?: () => void
@@ -58,10 +60,12 @@ export function EmptySketches({ onAction }: EmptyStateProps) {
<p className="text-xs text-muted-foreground text-center max-w-[200px] mb-4">
Visualize relationships between entities, infrastructure, and actors
</p>
- <Button onClick={onAction} variant="ghost" size="sm" className="h-7 text-xs gap-1.5">
- <Plus className="w-3.5 h-3.5" />
- Create sketch
- </Button>
+ <NewSketch>
+ <Button onClick={onAction} variant="ghost" size="sm" className="h-7 text-xs gap-1.5">
+ <Plus className="w-3.5 h-3.5" />
+ Create sketch
+ </Button>
+ </NewSketch>
</div>
)
}
@@ -89,10 +93,12 @@ export function EmptyAnalyses({ onAction }: EmptyStateProps) {
<p className="text-xs text-muted-foreground text-center max-w-[200px] mb-4">
Document findings, patterns, and conclusions from your investigation
</p>
- <Button onClick={onAction} variant="ghost" size="sm" className="h-7 text-xs gap-1.5">
- <Plus className="w-3.5 h-3.5" />
- Write analysis
- </Button>
+ <NewAnalysis>
+ <Button onClick={onAction} variant="ghost" size="sm" className="h-7 text-xs gap-1.5">
+ <Plus className="w-3.5 h-3.5" />
+ Write analysis
+ </Button>
+ </NewAnalysis>
</div>
)
}
diff --git a/flowsint-app/src/components/dashboard/activity-timeline.tsx b/flowsint-app/src/components/dashboard/investigation/activity-timeline.tsx
similarity index 99%
rename from flowsint-app/src/components/dashboard/activity-timeline.tsx
rename to flowsint-app/src/components/dashboard/investigation/activity-timeline.tsx
index d3d20ce2..f5d0183b 100644
--- a/flowsint-app/src/components/dashboard/activity-timeline.tsx
+++ b/flowsint-app/src/components/dashboard/investigation/activity-timeline.tsx
@@ -1,5 +1,3 @@
-"use client"
-
import { Network, FileText, Upload, AlertCircle, CheckCircle } from "lucide-react"
const activities = [
diff --git a/flowsint-app/src/components/dashboard/analyses-section.tsx b/flowsint-app/src/components/dashboard/investigation/analyses-section.tsx
similarity index 84%
rename from flowsint-app/src/components/dashboard/analyses-section.tsx
rename to flowsint-app/src/components/dashboard/investigation/analyses-section.tsx
index 1e042956..adb47779 100644
--- a/flowsint-app/src/components/dashboard/analyses-section.tsx
+++ b/flowsint-app/src/components/dashboard/investigation/analyses-section.tsx
@@ -1,10 +1,9 @@
-"use client"
-
import { Button } from "@/components/ui/button"
import { Analysis } from "@/types"
import { formatDistanceToNow } from "date-fns"
import { Plus, FileText, ChevronRight } from "lucide-react"
-import { EmptyAnalyses } from "./empty-states"
+import { EmptyAnalyses } from "../empty-states"
+import NewAnalysis from "@/components/analyses/new-analysis"
interface AnalysesSectionProps {
analyses: Analysis[]
@@ -15,10 +14,12 @@ export function AnalysesSection({ analyses }: AnalysesSectionProps) {
<section>
<div className="flex items-center justify-between mb-4">
<h2 className="text-sm font-medium text-foreground">Analyses</h2>
- <Button variant="ghost" size="sm" className="h-7 text-xs text-muted-foreground hover:text-foreground gap-1">
- <Plus className="w-3.5 h-3.5" />
- New
- </Button>
+ <NewAnalysis>
+ <Button variant="ghost" size="sm" className="h-7 text-xs text-muted-foreground hover:text-foreground gap-1">
+ <Plus className="w-3.5 h-3.5" />
+ New
+ </Button>
+ </NewAnalysis>
</div>
{analyses.length === 0 ?
diff --git a/flowsint-app/src/components/dashboard/case-header.tsx b/flowsint-app/src/components/dashboard/investigation/case-header.tsx
similarity index 50%
rename from flowsint-app/src/components/dashboard/case-header.tsx
rename to flowsint-app/src/components/dashboard/investigation/case-header.tsx
index 22e38460..2a580653 100644
--- a/flowsint-app/src/components/dashboard/case-header.tsx
+++ b/flowsint-app/src/components/dashboard/investigation/case-header.tsx
@@ -1,20 +1,23 @@
-"use client"
-
import type React from "react"
-
import { Button } from "@/components/ui/button"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
- DropdownMenuSeparator,
} from "@/components/ui/dropdown-menu"
import { MoreHorizontal, Star, Share, Trash2, Clock } from "lucide-react"
import { Investigation } from "@/types"
import { formatDistanceToNow } from "date-fns"
import { useState } from "react"
import { cn } from "@/lib/utils"
+import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
+import { useQueryClient } from "@tanstack/react-query"
+import { investigationService } from "@/api/investigation-service"
+import { useConfirm } from "@/components/use-confirm-dialog"
+import { queryKeys } from "@/api/query-keys"
+import { toast } from "sonner"
+import { Link, useRouter } from "@tanstack/react-router"
type CaseOverviewPageProps = {
investigation: Investigation
@@ -24,11 +27,55 @@ export function CaseHeader({ investigation }: CaseOverviewPageProps) {
const lastUpdated = formatDistanceToNow(new Date(investigation.last_updated_at), {
addSuffix: true
})
+ const router = useRouter()
+
+ const { confirm } = useConfirm()
+ const queryClient = useQueryClient()
+
+ const handleDeleteInvestigation = async () => {
+ const confirmed = await confirm({
+ title: 'Delete Investigation',
+ message: `Are you sure you want to delete "${investigation.name}"? This will also delete all sketches within it. This action cannot be undone.`
+ })
+
+ if (confirmed) {
+ const deletePromise = () =>
+ investigationService.delete(investigation.id).then(() => {
+ ''
+ // Invalidate the investigations list
+ queryClient.invalidateQueries({
+ queryKey: queryKeys.investigations.list
+ })
+
+ // Also remove related data from cache
+ queryClient.removeQueries({
+ queryKey: queryKeys.investigations.detail(investigation.id)
+ })
+ queryClient.removeQueries({
+ queryKey: queryKeys.investigations.sketches(investigation.id)
+ })
+ queryClient.removeQueries({
+ queryKey: queryKeys.investigations.analyses(investigation.id)
+ })
+ queryClient.removeQueries({
+ queryKey: queryKeys.investigations.flows(investigation.id)
+ })
+ router.navigate({ to: "/dashboard" })
+ })
+
+ toast.promise(deletePromise, {
+ loading: 'Deleting investigation...',
+ success: () => `Investigation "${investigation.name}" has been deleted`,
+ error: 'Failed to delete investigation'
+ })
+ }
+ }
+
return (
<div className="space-y-6 pb-6 border-b border-border">
{/* Breadcrumb - subtle */}
<div className="flex items-center gap-1.5 text-sm text-muted-foreground">
- <span className="hover:text-foreground cursor-pointer transition-colors">Cases</span>
+ <Link to={"/dashboard"} className="hover:text-foreground cursor-pointer transition-colors">Cases</Link>
<span>/</span>
<span className="text-foreground">{investigation.name}</span>
</div>
@@ -44,16 +91,16 @@ export function CaseHeader({ investigation }: CaseOverviewPageProps) {
{/* Inline properties - Notion style */}
<div className="flex items-center gap-4 text-sm">
<PropertyPill label="Status" value={investigation.status} valueClass="text-success" />
- <PropertyPill label="Priority" value="High" valueClass="text-primary" />
+ <PropertyPill label="Priority" value="Medium" valueClass="text-primary" />
<PropertyPill label="Updated" value={lastUpdated} icon={<Clock className="w-3 h-3" />} />
</div>
</div>
{/* Actions - minimal */}
<div className="flex items-center gap-1">
- <Button variant="ghost" size="sm" className="text-muted-foreground h-8 px-2">
+ {/* <Button variant="ghost" size="sm" className="text-muted-foreground h-8 px-2">
<Share className="w-4 h-4" />
- </Button>
+ </Button> */}
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="sm" className="text-muted-foreground h-8 px-2">
@@ -61,10 +108,10 @@ export function CaseHeader({ investigation }: CaseOverviewPageProps) {
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-48">
- <DropdownMenuItem>Export as PDF</DropdownMenuItem>
- <DropdownMenuItem>Duplicate</DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem className="text-destructive">
+ {/* <DropdownMenuItem>Export as PDF</DropdownMenuItem>
+ <DropdownMenuItem>Duplicate</DropdownMenuItem> */}
+ {/* <DropdownMenuSeparator /> */}
+ <DropdownMenuItem onClick={handleDeleteInvestigation} className="text-destructive">
<Trash2 className="w-4 h-4 mr-2" />
Delete
</DropdownMenuItem>
@@ -74,23 +121,26 @@ export function CaseHeader({ investigation }: CaseOverviewPageProps) {
</div>
{/* Tags row */}
- <div className="flex items-center gap-2 flex-wrap">
+ {/* <div className="flex items-center gap-2 flex-wrap">
<Tag>APT</Tag>
<Tag>Nation-State</Tag>
<Tag>Supply Chain</Tag>
<Tag>SolarWinds</Tag>
<button className="text-xs text-muted-foreground hover:text-foreground transition-colors">+ Add tag</button>
- </div>
+ </div> */}
{/* Team */}
<div className="flex items-center gap-2">
<div className="flex -space-x-1.5">
- <Avatar initials="JD" />
- <Avatar initials="SK" />
- <Avatar initials="MR" />
+ <Avatar className="h-5 w-5">
+ <AvatarImage src="https://cherry.img.pmdstatic.net/fit/https.3A.2F.2Fimg.2Egamesider.2Ecom.2Fs3.2Ffrgsg.2F1280.2Fthe-last-of-us.2Fdefault_2023-11-27_291826c8-5b2b-4928-a167-259dd0b18a7c.2Ejpeg/1200x675/quality/80/the-last-of-us-saison-2-mauvaise-nouvelle-pedro-pascal.jpg" />
+ <AvatarFallback>U</AvatarFallback>
+ </Avatar>
+ {/* <Avatar initials="SK" />
+ <Avatar initials="MR" /> */}
</div>
- <span className="text-sm text-muted-foreground">3 investigators</span>
- <button className="text-xs text-muted-foreground hover:text-foreground transition-colors ml-1">+ Invite</button>
+ <span className="text-sm text-muted-foreground">1 investigator</span>
+ {/* <button disabled className="text-xs text-muted-foreground hover:text-foreground transition-colors ml-1">+ Invite</button> */}
</div>
</div>
)
@@ -118,17 +168,9 @@ function PropertyPill({
)
}
-function Tag({ children }: { children: React.ReactNode }) {
- return <span className="px-2 py-0.5 rounded bg-secondary text-xs text-secondary-foreground">{children}</span>
-}
-
-function Avatar({ initials }: { initials: string }) {
- return (
- <div className="w-6 h-6 rounded-full bg-muted border-2 border-background flex items-center justify-center">
- <span className="text-[10px] font-medium text-muted-foreground">{initials}</span>
- </div>
- )
-}
+// function Tag({ children }: { children: React.ReactNode }) {
+// return <span className="px-2 py-0.5 rounded bg-secondary text-xs text-secondary-foreground">{children}</span>
+// }
const FavoriteButton = () => {
diff --git a/flowsint-app/src/components/dashboard/case-overview-page.tsx b/flowsint-app/src/components/dashboard/investigation/case-overview-page.tsx
similarity index 71%
rename from flowsint-app/src/components/dashboard/case-overview-page.tsx
rename to flowsint-app/src/components/dashboard/investigation/case-overview-page.tsx
index 0c18cb1c..373d7609 100644
--- a/flowsint-app/src/components/dashboard/case-overview-page.tsx
+++ b/flowsint-app/src/components/dashboard/investigation/case-overview-page.tsx
@@ -1,12 +1,11 @@
-"use client"
import { CaseHeader } from "./case-header"
-import { MetricsGrid } from "./metrics-grid"
-import { ActivityTimeline } from "./activity-timeline"
+// import { MetricsGrid } from "./metrics-grid"
+// import { ActivityTimeline } from "./activity-timeline"
import { SketchesSection } from "./sketches-section"
import { AnalysesSection } from "./analyses-section"
-import { EvidenceSection } from "./evidence-section"
-import { TasksSection } from "./tasks-section"
+// import { EvidenceSection } from "./evidence-section"
+// import { TasksSection } from "./tasks-section"
import { Investigation } from "@/types"
type CaseOverviewPageProps = {
@@ -18,20 +17,20 @@ export function CaseOverviewPage({ investigation }: CaseOverviewPageProps) {
<main className="flex-1 h-full overflow-auto">
<div className="max-w-7xl mx-auto px-8 py-8">
<CaseHeader investigation={investigation} />
- <MetricsGrid investigation={investigation} />
+ {/* <MetricsGrid investigation={investigation} /> */}
<div className="space-y-8">
<SketchesSection sketches={investigation.sketches} />
<AnalysesSection analyses={investigation.analyses} />
{/* Two column for smaller sections */}
- <div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
+ {/* <div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
<EvidenceSection />
<div className="space-y-8">
<TasksSection />
<ActivityTimeline />
</div>
- </div>
+ </div> */}
</div>
</div>
</main>
diff --git a/flowsint-app/src/components/dashboard/evidence-section.tsx b/flowsint-app/src/components/dashboard/investigation/evidence-section.tsx
similarity index 99%
rename from flowsint-app/src/components/dashboard/evidence-section.tsx
rename to flowsint-app/src/components/dashboard/investigation/evidence-section.tsx
index 3eec9e27..1e0d9e2b 100644
--- a/flowsint-app/src/components/dashboard/evidence-section.tsx
+++ b/flowsint-app/src/components/dashboard/investigation/evidence-section.tsx
@@ -1,4 +1,3 @@
-"use client"
import { Button } from "@/components/ui/button"
import { Plus, FileCode, FileImage, FileText, File } from "lucide-react"
diff --git a/flowsint-app/src/components/dashboard/investigation-skeleton.tsx b/flowsint-app/src/components/dashboard/investigation/investigation-skeleton.tsx
similarity index 100%
rename from flowsint-app/src/components/dashboard/investigation-skeleton.tsx
rename to flowsint-app/src/components/dashboard/investigation/investigation-skeleton.tsx
diff --git a/flowsint-app/src/components/dashboard/investigations-list.tsx b/flowsint-app/src/components/dashboard/investigation/investigations-list.tsx
similarity index 90%
rename from flowsint-app/src/components/dashboard/investigations-list.tsx
rename to flowsint-app/src/components/dashboard/investigation/investigations-list.tsx
index 84edd12d..9726dbc4 100644
--- a/flowsint-app/src/components/dashboard/investigations-list.tsx
+++ b/flowsint-app/src/components/dashboard/investigation/investigations-list.tsx
@@ -1,5 +1,3 @@
-"use client"
-
import { FolderOpen, MoreHorizontal, FileText, Network } from "lucide-react"
import { cn } from "@/lib/utils"
import { Link } from "@tanstack/react-router"
@@ -14,12 +12,13 @@ interface InvestigationsListProps {
setFilter: (filter: "all" | "active" | "closed") => void
casesCount: number,
activeCasesCount: number
+ search: string
}
-export function InvestigationsList({ investigations, view, filter, setFilter, casesCount, activeCasesCount }: InvestigationsListProps) {
+export function InvestigationsList({ investigations, view, filter, setFilter, casesCount, activeCasesCount, search }: InvestigationsListProps) {
const filteredInvestigations = investigations.filter((inv) => {
- if (filter === "all") return true
- return inv.status === filter
+ if (filter === "all") return inv.name.toLowerCase().includes(search.toLowerCase())
+ return inv.status === filter && inv.name.toLowerCase().includes(search.toLowerCase())
})
const filters = useMemo(() => [
@@ -58,6 +57,11 @@ export function InvestigationsList({ investigations, view, filter, setFilter, ca
</tr>
</thead>
<tbody>
+ {filteredInvestigations.length === 0 && <div className="flex items-center justify-center p-4">
+ <tr
+ className="border-b border-border last:border-0 hover:bg-muted/20 transition-colors group"
+ >No investigation found.</tr>
+ </div>}
{filteredInvestigations.map((inv) => (
<tr
key={inv.id}
@@ -97,7 +101,10 @@ export function InvestigationsList({ investigations, view, filter, setFilter, ca
</table>
</div>
) : (
- <div className="grid grid-cols-2 gap-3">
+ <div className="grid grid-cols-3 gap-3">
+ {filteredInvestigations.length === 0 && <div>
+ No investigation found.
+ </div>}
{filteredInvestigations.map((inv) => (
<Link
to="/dashboard/investigations/$investigationId"
diff --git a/flowsint-app/src/components/dashboard/investigation/metrics-grid.tsx b/flowsint-app/src/components/dashboard/investigation/metrics-grid.tsx
new file mode 100644
index 00000000..1570d781
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/investigation/metrics-grid.tsx
@@ -0,0 +1,37 @@
+import { Network, FileText, Users, Shield, Paperclip, CheckCircle } from "lucide-react"
+import { Investigation } from "@/types"
+import { useMemo } from "react"
+import { cn } from "@/lib/utils"
+
+type CaseOverviewPageProps = {
+ investigation: Investigation
+}
+export function MetricsGrid({ investigation }: CaseOverviewPageProps) {
+ const sketchCount = investigation.sketches?.length || 0
+ const analysisCount = investigation.analyses?.length || 0
+ const metrics = useMemo(() => [
+ { label: "Sketches", value: sketchCount, icon: Network },
+ { label: "Analyses", value: analysisCount, icon: FileText },
+ { label: "Entities", value: "_", icon: Users },
+ { label: "Relations", value: "_", icon: Shield },
+ // { label: "Files", value: "34", icon: Paperclip },
+ // { label: "Tasks", value: "6/15", icon: CheckCircle },
+ ], [sketchCount, analysisCount])
+
+ return (
+ <div className={cn("grid border grid-cols-3 gap-px bg-border rounded-lg overflow-hidden my-6", `md:grid-cols-${metrics.length}`)} >
+ {
+ metrics.map((metric) => (
+ <div
+ key={metric.label}
+ className="bg-background px-4 py-4 flex flex-col items-center text-center transition-colors cursor-default"
+ >
+ <metric.icon className="w-4 h-4 text-muted-foreground mb-2" />
+ <span className="text-xl font-semibold text-foreground">{metric.value}</span>
+ <span className="text-xs text-muted-foreground mt-0.5">{metric.label}</span>
+ </div>
+ ))
+ }
+ </ div>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/sketches-section.tsx b/flowsint-app/src/components/dashboard/investigation/sketches-section.tsx
similarity index 89%
rename from flowsint-app/src/components/dashboard/sketches-section.tsx
rename to flowsint-app/src/components/dashboard/investigation/sketches-section.tsx
index 684cb431..6c521a5a 100644
--- a/flowsint-app/src/components/dashboard/sketches-section.tsx
+++ b/flowsint-app/src/components/dashboard/investigation/sketches-section.tsx
@@ -1,11 +1,11 @@
-"use client"
import { Button } from "@/components/ui/button"
import { Plus, ArrowUpRight } from "lucide-react"
-import { EmptySketches } from "./empty-states"
+import { EmptySketches } from "../empty-states"
import { Sketch } from "@/types"
import { formatDistanceToNow } from "date-fns"
import { Link } from "@tanstack/react-router"
+import NewSketch from "@/components/sketches/new-sketch"
interface SketchesSectionProps {
sketches: Sketch[]
@@ -15,14 +15,16 @@ interface SketchesSectionProps {
export function SketchesSection({ sketches }: SketchesSectionProps) {
const isEmpty = sketches.length === 0
return (
- <section>
+ <section className="my-4">
<div className="flex items-center justify-between mb-4">
<h2 className="text-sm font-medium text-foreground">Sketches</h2>
{!isEmpty && (
- <Button variant="ghost" size="sm" className="h-7 text-xs text-muted-foreground hover:text-foreground gap-1">
- <Plus className="w-3.5 h-3.5" />
- New
- </Button>
+ <NewSketch>
+ <Button variant="ghost" size="sm" className="h-7 text-xs text-muted-foreground hover:text-foreground gap-1">
+ <Plus className="w-3.5 h-3.5" />
+ New
+ </Button>
+ </NewSketch>
)}
</div>
diff --git a/flowsint-app/src/components/dashboard/tasks-section.tsx b/flowsint-app/src/components/dashboard/investigation/tasks-section.tsx
similarity index 99%
rename from flowsint-app/src/components/dashboard/tasks-section.tsx
rename to flowsint-app/src/components/dashboard/investigation/tasks-section.tsx
index 5f76e347..b6ff129a 100644
--- a/flowsint-app/src/components/dashboard/tasks-section.tsx
+++ b/flowsint-app/src/components/dashboard/investigation/tasks-section.tsx
@@ -1,4 +1,3 @@
-"use client"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
diff --git a/flowsint-app/src/components/dashboard/metrics-grid.tsx b/flowsint-app/src/components/dashboard/metrics-grid.tsx
deleted file mode 100644
index 18800112..00000000
--- a/flowsint-app/src/components/dashboard/metrics-grid.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { Network, FileText, Users, Shield, Paperclip, CheckCircle } from "lucide-react"
-import { Investigation } from "@/types"
-import { useMemo } from "react"
-
-type CaseOverviewPageProps = {
- investigation: Investigation
-}
-export function MetricsGrid({ investigation }: CaseOverviewPageProps) {
- const sketchCount = investigation.sketches?.length || 0
- const analysisCount = investigation.analyses?.length || 0
- const metrics = useMemo(() => [
- { label: "Sketches", value: sketchCount, icon: Network },
- { label: "Analyses", value: analysisCount, icon: FileText },
- { label: "Entities", value: "247", icon: Users },
- { label: "IOCs", value: "89", icon: Shield },
- { label: "Files", value: "34", icon: Paperclip },
- { label: "Tasks", value: "6/15", icon: CheckCircle },
- ], [sketchCount, analysisCount])
-
- return (
- <div className="grid border grid-cols-3 md:grid-cols-6 gap-px bg-border rounded-lg overflow-hidden my-6">
- {metrics.map((metric) => (
- <div
- key={metric.label}
- className="bg-background px-4 py-4 flex flex-col items-center text-center transition-colors cursor-default"
- >
- <metric.icon className="w-4 h-4 text-muted-foreground mb-2" />
- <span className="text-xl font-semibold text-foreground">{metric.value}</span>
- <span className="text-xs text-muted-foreground mt-0.5">{metric.label}</span>
- </div>
- ))}
- </div>
- )
-}
diff --git a/flowsint-app/src/components/dashboard/dashboard-header.tsx b/flowsint-app/src/components/dashboard/overview/dashboard-header.tsx
similarity index 59%
rename from flowsint-app/src/components/dashboard/dashboard-header.tsx
rename to flowsint-app/src/components/dashboard/overview/dashboard-header.tsx
index 00e72494..0e06764d 100644
--- a/flowsint-app/src/components/dashboard/dashboard-header.tsx
+++ b/flowsint-app/src/components/dashboard/overview/dashboard-header.tsx
@@ -1,14 +1,17 @@
-"use client"
import { Plus, LayoutGrid, List, Search } from "lucide-react"
import { Button } from "@/components/ui/button"
+import NewInvestigation from "@/components/investigations/new-investigation"
+import { Input } from "@/components/ui/input"
interface DashboardHeaderProps {
view: "grid" | "list"
setView: (view: "grid" | "list") => void
+ search: string
+ setSearch: (val: string) => void
}
-export function DashboardHeader({ view, setView }: DashboardHeaderProps) {
+export function DashboardHeader({ view, setView, search, setSearch }: DashboardHeaderProps) {
return (
<div className="space-y-8">
<div className="flex items-start justify-between">
@@ -16,16 +19,19 @@ export function DashboardHeader({ view, setView }: DashboardHeaderProps) {
<h1 className="text-2xl font-semibold text-foreground">Investigations</h1>
<p className="text-sm text-muted-foreground mt-1">Manage and track your OSINT investigations</p>
</div>
- <Button size="sm" className="gap-1.5">
- <Plus className="w-4 h-4" />
- New Investigation
- </Button>
+ <NewInvestigation noDropDown>
+ <Button size="sm" className="gap-1.5">
+ <Plus className="w-4 h-4" />
+ New Investigation
+ </Button>
+ </NewInvestigation>
</div>
<div className="flex items-center justify-between">
<div className="relative">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
- <input
+ <Input
+ value={search} onChange={(e) => setSearch(e.target.value)}
type="text"
placeholder="Search investigations..."
className="w-72 h-9 pl-9 pr-3 text-sm bg-muted/50 border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/60"
@@ -34,21 +40,19 @@ export function DashboardHeader({ view, setView }: DashboardHeaderProps) {
<div className="flex items-center gap-1 p-1 bg-muted/50 rounded-md">
<button
onClick={() => setView("list")}
- className={`p-1.5 rounded transition-colors ${
- view === "list"
- ? "bg-background shadow-sm text-foreground"
- : "text-muted-foreground hover:text-foreground"
- }`}
+ className={`p-1.5 rounded transition-colors ${view === "list"
+ ? "bg-background shadow-sm text-foreground"
+ : "text-muted-foreground hover:text-foreground"
+ }`}
>
<List className="w-4 h-4" />
</button>
<button
onClick={() => setView("grid")}
- className={`p-1.5 rounded transition-colors ${
- view === "grid"
- ? "bg-background shadow-sm text-foreground"
- : "text-muted-foreground hover:text-foreground"
- }`}
+ className={`p-1.5 rounded transition-colors ${view === "grid"
+ ? "bg-background shadow-sm text-foreground"
+ : "text-muted-foreground hover:text-foreground"
+ }`}
>
<LayoutGrid className="w-4 h-4" />
</button>
diff --git a/flowsint-app/src/components/dashboard/dashboard-page.tsx b/flowsint-app/src/components/dashboard/overview/dashboard-page.tsx
similarity index 59%
rename from flowsint-app/src/components/dashboard/dashboard-page.tsx
rename to flowsint-app/src/components/dashboard/overview/dashboard-page.tsx
index 6b051a1a..df160646 100644
--- a/flowsint-app/src/components/dashboard/dashboard-page.tsx
+++ b/flowsint-app/src/components/dashboard/overview/dashboard-page.tsx
@@ -1,19 +1,19 @@
-"use client"
import { useState } from "react"
import { DashboardHeader } from "./dashboard-header"
-import { DashboardStats } from "./dashboard-stats"
-import { InvestigationsList } from "./investigations-list"
-import { RecentActivity } from "./recent-activity"
+// import { DashboardStats } from "./dashboard-stats"
+import { InvestigationsList } from "../investigation/investigations-list"
+// import { RecentActivity } from "./recent-activity"
import { queryKeys } from "@/api/query-keys"
import { useQuery } from "@tanstack/react-query"
import { investigationService } from "@/api/investigation-service"
import { Investigation } from "@/types"
-import { InvestigationSkeleton } from "./investigation-skeleton"
+import { InvestigationSkeleton } from "../investigation/investigation-skeleton"
export function DashboardPage() {
const [view, setView] = useState<"grid" | "list">("list")
const [filter, setFilter] = useState<"all" | "active" | "closed">("all")
+ const [search, setSearch] = useState<string>("")
const {
data: investigations,
@@ -35,15 +35,15 @@ export function DashboardPage() {
return (
<main className="flex-1 h-full overflow-auto">
<div className="max-w-7xl mx-auto px-8 py-8">
- <DashboardHeader view={view} setView={setView} />
- <DashboardStats casesCount={casesCount} activeCasesCount={activeCasesCount} />
+ <DashboardHeader search={search} setSearch={setSearch} view={view} setView={setView} />
+ {/* <DashboardStats casesCount={casesCount} activeCasesCount={activeCasesCount} /> */}
<div className="mt-10 grid grid-cols-1 lg:grid-cols-3 gap-8">
- <div className="lg:col-span-2">
- <InvestigationsList casesCount={casesCount} activeCasesCount={activeCasesCount} investigations={investigations} view={view} filter={filter} setFilter={setFilter} />
+ <div className="lg:col-span-3">
+ <InvestigationsList search={search} casesCount={casesCount} activeCasesCount={activeCasesCount} investigations={investigations} view={view} filter={filter} setFilter={setFilter} />
</div>
- <div>
+ {/* <div>
<RecentActivity />
- </div>
+ </div> */}
</div>
</div>
</main>
diff --git a/flowsint-app/src/components/dashboard/dashboard-stats.tsx b/flowsint-app/src/components/dashboard/overview/dashboard-stats.tsx
similarity index 99%
rename from flowsint-app/src/components/dashboard/dashboard-stats.tsx
rename to flowsint-app/src/components/dashboard/overview/dashboard-stats.tsx
index d52cee62..ef8c658e 100644
--- a/flowsint-app/src/components/dashboard/dashboard-stats.tsx
+++ b/flowsint-app/src/components/dashboard/overview/dashboard-stats.tsx
@@ -1,8 +1,6 @@
import { FolderOpen, FileText, Network, Clock } from "lucide-react"
import { useMemo } from "react"
-
-
type DashboardStatsProps = {
casesCount: number,
activeCasesCount: number,
diff --git a/flowsint-app/src/components/dashboard/recent-activity.tsx b/flowsint-app/src/components/dashboard/overview/recent-activity.tsx
similarity index 100%
rename from flowsint-app/src/components/dashboard/recent-activity.tsx
rename to flowsint-app/src/components/dashboard/overview/recent-activity.tsx
diff --git a/flowsint-app/src/components/flows/test-flow.tsx b/flowsint-app/src/components/flows/test-flow.tsx
index 3376a1f8..9cd2be62 100644
--- a/flowsint-app/src/components/flows/test-flow.tsx
+++ b/flowsint-app/src/components/flows/test-flow.tsx
@@ -1,6 +1,6 @@
import { memo } from 'react'
import { Dialog, DialogContent, DialogDescription, DialogTitle } from '../ui/dialog'
-import { DynamicForm } from '../graphs/dynamic-form'
+import { DynamicForm } from '../sketches/dynamic-form'
interface TestFlowProps {
open: boolean
diff --git a/flowsint-app/src/components/investigations/investigation-list.tsx b/flowsint-app/src/components/investigations/investigation-list.tsx
index e6a1bf3b..d1f13aa6 100644
--- a/flowsint-app/src/components/investigations/investigation-list.tsx
+++ b/flowsint-app/src/components/investigations/investigation-list.tsx
@@ -1,20 +1,12 @@
import { investigationService } from '@/api/investigation-service'
import type { Investigation } from '@/types/investigation'
-import { useQuery, useQueryClient } from '@tanstack/react-query'
-import type { Sketch } from '@/types/sketch'
+import { useQuery } from '@tanstack/react-query'
import NewInvestigation from './new-investigation'
-import { Button } from '../ui/button'
-import { Input } from '../ui/input'
import { cn } from '@/lib/utils'
import { Link } from '@tanstack/react-router'
import { SkeletonList } from '../shared/skeleton-list'
-import { useConfirm } from '@/components/use-confirm-dialog'
-import { Home, FolderOpen, Search, Settings, Plus, ChevronDown } from "lucide-react"
-import { toast } from 'sonner'
-import { sketchService } from '@/api/sketch-service'
-import { useState, useMemo } from 'react'
+import { FolderOpen, Plus } from "lucide-react"
import { queryKeys } from '@/api/query-keys'
-import { useMutation } from '@tanstack/react-query'
import ErrorState from '../shared/error-state'
@@ -23,24 +15,6 @@ const InvestigationList = () => {
queryKey: queryKeys.investigations.list,
queryFn: investigationService.get
})
- const { confirm } = useConfirm()
- const [searchQuery, setSearchQuery] = useState('')
- const queryClient = useQueryClient()
-
- const filteredInvestigations = useMemo(() => {
- if (!data) return []
- if (!searchQuery.trim()) return data
-
- const query = searchQuery.toLowerCase().trim()
- return data.filter((investigation: Investigation) => {
- const matchesInvestigation = investigation.name.toLowerCase().includes(query)
- const matchesSketches = investigation.sketches?.some((sketch) =>
- sketch.title.toLowerCase().includes(query)
- )
- return matchesInvestigation || matchesSketches
- })
- }, [data, searchQuery])
-
if (isLoading)
return (
@@ -57,30 +31,6 @@ const InvestigationList = () => {
)
return (
<div className="w-full h-full bg-card flex flex-col overflow-hidden">
- {/* Workspace selector */}
- {/* <div className="px-3 py-3">
- <button className="w-full flex items-center justify-between px-2 py-1.5 rounded hover:bg-sidebar-accent transition-colors">
- <div className="flex items-center gap-2">
- <div className="w-5 h-5 rounded bg-primary/80 flex items-center justify-center text-[10px] font-semibold text-primary-foreground">
- F
- </div>
- <span className="text-sm font-medium text-sidebar-foreground">Flowsint</span>
- </div>
- <ChevronDown className="w-3.5 h-3.5 text-muted-foreground" />
- </button>
- </div>
-
- <nav className="px-2 space-y-0.5">
- <Link to="/">
- <NavItem icon={Home} label="Home" active={true} />
- </Link>
- <NavItem icon={Search} label="Search" shortcut="⌘K" />
- <NavItem icon={Settings} label="Settings" />
- </nav> */}
-
- {/* Divider */}
- {/* <div className="mx-3 my-3 border-t border-sidebar-border" /> */}
-
<div className="px-2 my-2 flex-1 overflow-auto">
<div className="flex items-center justify-between px-2 mb-1 group">
<span className="text-xs font-medium text-muted-foreground">Cases</span>
@@ -92,7 +42,7 @@ const InvestigationList = () => {
</div>
<div className="mx-1 my-1 border-t border-sidebar-border/30" />
<div className="space-y-0.5">
- {filteredInvestigations.map((caseItem: Investigation) => (
+ {data.map((caseItem: Investigation) => (
<Link
to="/dashboard/investigations/$investigationId"
params={{
@@ -124,31 +74,4 @@ const InvestigationList = () => {
)
}
-export default InvestigationList
-
-function NavItem({
- icon: Icon,
- label,
- active,
- shortcut,
-}: {
- icon: React.ElementType
- label: string
- active?: boolean
- shortcut?: string
-}) {
- return (
- <div
- className={cn(
- "w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm transition-colors cursor-pointer",
- active
- ? "bg-muted text-sidebar-foreground"
- : "text-muted-foreground hover:bg-muted/40 hover:text-sidebar-foreground",
- )}
- >
- <Icon className="w-4 h-4 opacity-60" />
- <span className="flex-1 text-left">{label}</span>
- {shortcut && <span className="text-[10px] text-muted-foreground/60">{shortcut}</span>}
- </div>
- )
-}
\ No newline at end of file
+export default InvestigationList
\ No newline at end of file
diff --git a/flowsint-app/src/components/investigations/sketch-list.tsx b/flowsint-app/src/components/investigations/sketch-list.tsx
index 74978006..1b089c14 100644
--- a/flowsint-app/src/components/investigations/sketch-list.tsx
+++ b/flowsint-app/src/components/investigations/sketch-list.tsx
@@ -6,7 +6,7 @@ import { FolderOpen, PlusIcon, Waypoints } from 'lucide-react'
import { Input } from '../ui/input'
import { Link, useParams } from '@tanstack/react-router'
import { SkeletonList } from '../shared/skeleton-list'
-import NewSketch from '../graphs/new-sketch'
+import NewSketch from '../sketches/new-sketch'
import { useState, useMemo } from 'react'
import { queryKeys } from '@/api/query-keys'
import ErrorState from '../shared/error-state'
diff --git a/flowsint-app/src/components/layout/root.layout.tsx b/flowsint-app/src/components/layout/root.layout.tsx
index 82b5d946..6aa636d1 100644
--- a/flowsint-app/src/components/layout/root.layout.tsx
+++ b/flowsint-app/src/components/layout/root.layout.tsx
@@ -9,8 +9,8 @@ import { useLayoutStore } from '@/stores/layout-store'
import NotesPanel from '../analyses/notes-panel'
import { useKeyboardShortcut } from '@/hooks/use-keyboard-shortcut'
import { useParams } from '@tanstack/react-router'
-import DetailsPanel from '../graphs/details-panel/details-panel'
-import EdgeDetailsPanel from '../graphs/details-panel/edge-details-panel'
+import DetailsPanel from '../sketches/details-panel/details-panel'
+import EdgeDetailsPanel from '../sketches/details-panel/edge-details-panel'
import { useGraphStore } from '@/stores/graph-store'
interface LayoutProps {
diff --git a/flowsint-app/src/components/layout/secondary-navigation.tsx b/flowsint-app/src/components/layout/secondary-navigation.tsx
index c2a1c322..e88667be 100644
--- a/flowsint-app/src/components/layout/secondary-navigation.tsx
+++ b/flowsint-app/src/components/layout/secondary-navigation.tsx
@@ -1,6 +1,6 @@
import { useLocation, useParams } from '@tanstack/react-router'
import InvestigationList from '../investigations/investigation-list'
-import GraphNavigation from '../graphs/graph-navigation'
+import GraphNavigation from '../sketches/graph-navigation'
import FlowNavigation from '../flows/flow-navigation'
import SketchList from '../investigations/sketch-list'
import AnalysesList from '../analyses/analyses-list'
diff --git a/flowsint-app/src/components/layout/sketch-selector.tsx b/flowsint-app/src/components/layout/sketch-selector.tsx
index 2e1905eb..49fe3860 100644
--- a/flowsint-app/src/components/layout/sketch-selector.tsx
+++ b/flowsint-app/src/components/layout/sketch-selector.tsx
@@ -11,7 +11,7 @@ import { useNavigate, useParams } from '@tanstack/react-router'
import { investigationService } from '@/api/investigation-service'
import { analysisService } from '@/api/analysis-service'
import { Waypoints, FileText, Search, ChevronDown, Plus, ArrowLeft, Home } from 'lucide-react'
-import NewSketch from '@/components/graphs/new-sketch'
+import NewSketch from '@/components/sketches/new-sketch'
import { queryKeys } from '@/api/query-keys'
export default function CaseSelector() {
diff --git a/flowsint-app/src/components/layout/status-bar.tsx b/flowsint-app/src/components/layout/status-bar.tsx
index 73e0955b..1cb9def5 100644
--- a/flowsint-app/src/components/layout/status-bar.tsx
+++ b/flowsint-app/src/components/layout/status-bar.tsx
@@ -2,7 +2,7 @@ import { Button } from '@/components/ui/button'
import { Terminal, Unlock } from 'lucide-react'
import { ModeToggle } from '../mode-toggle'
import { useLayoutStore } from '@/stores/layout-store'
-import Legend from '../graphs/legend'
+import Legend from '../sketches/legend'
import { Link, useParams } from '@tanstack/react-router'
import InfoDialog from './info'
import { memo } from 'react'
diff --git a/flowsint-app/src/components/layout/top-navbar.tsx b/flowsint-app/src/components/layout/top-navbar.tsx
index b16c1793..123389f7 100644
--- a/flowsint-app/src/components/layout/top-navbar.tsx
+++ b/flowsint-app/src/components/layout/top-navbar.tsx
@@ -7,7 +7,7 @@ import { Switch } from '../ui/switch'
import { Label } from '../ui/label'
import { useLayoutStore } from '@/stores/layout-store'
import { Button } from '@/components/ui/button'
-import { ImportSheet } from '../graphs/import-sheet'
+import { ImportSheet } from '../sketches/import-sheet'
import {
DropdownMenu,
DropdownMenuContent,
diff --git a/flowsint-app/src/components/graphs/add-item-dialog.tsx b/flowsint-app/src/components/sketches/add-item-dialog.tsx
similarity index 99%
rename from flowsint-app/src/components/graphs/add-item-dialog.tsx
rename to flowsint-app/src/components/sketches/add-item-dialog.tsx
index f38f0213..0abea67e 100644
--- a/flowsint-app/src/components/graphs/add-item-dialog.tsx
+++ b/flowsint-app/src/components/sketches/add-item-dialog.tsx
@@ -8,7 +8,7 @@ import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@/compone
import { type ActionItem, type FormField, findActionItemByKey } from '@/lib/action-items'
import { Card, CardContent } from '@/components/ui/card'
import { AnimatePresence, motion } from 'framer-motion'
-import { DynamicForm } from '@/components/graphs/dynamic-form'
+import { DynamicForm } from '@/components/sketches/dynamic-form'
import { Badge } from '@/components/ui/badge'
import { useGraphStore } from '@/stores/graph-store'
import { sketchService } from '@/api/sketch-service'
diff --git a/flowsint-app/src/components/graphs/background-context-menu.tsx b/flowsint-app/src/components/sketches/background-context-menu.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/background-context-menu.tsx
rename to flowsint-app/src/components/sketches/background-context-menu.tsx
diff --git a/flowsint-app/src/components/graphs/create-relation.tsx b/flowsint-app/src/components/sketches/create-relation.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/create-relation.tsx
rename to flowsint-app/src/components/sketches/create-relation.tsx
diff --git a/flowsint-app/src/components/graphs/details-panel/details-panel.tsx b/flowsint-app/src/components/sketches/details-panel/details-panel.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/details-panel/details-panel.tsx
rename to flowsint-app/src/components/sketches/details-panel/details-panel.tsx
diff --git a/flowsint-app/src/components/graphs/details-panel/edge-details-panel.tsx b/flowsint-app/src/components/sketches/details-panel/edge-details-panel.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/details-panel/edge-details-panel.tsx
rename to flowsint-app/src/components/sketches/details-panel/edge-details-panel.tsx
diff --git a/flowsint-app/src/components/graphs/details-panel/neighbors.tsx b/flowsint-app/src/components/sketches/details-panel/neighbors.tsx
similarity index 97%
rename from flowsint-app/src/components/graphs/details-panel/neighbors.tsx
rename to flowsint-app/src/components/sketches/details-panel/neighbors.tsx
index 947af987..58202956 100644
--- a/flowsint-app/src/components/graphs/details-panel/neighbors.tsx
+++ b/flowsint-app/src/components/sketches/details-panel/neighbors.tsx
@@ -38,6 +38,7 @@ const NeighborsGraph = memo(
backgroundColor="transparent"
instanceId="neighbors"
allowForces={true}
+ autoZoomOnNode={false}
/>
</>
)}
diff --git a/flowsint-app/src/components/graphs/details-panel/node-editor-modal.tsx b/flowsint-app/src/components/sketches/details-panel/node-editor-modal.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/details-panel/node-editor-modal.tsx
rename to flowsint-app/src/components/sketches/details-panel/node-editor-modal.tsx
diff --git a/flowsint-app/src/components/graphs/details-panel/relationships.tsx b/flowsint-app/src/components/sketches/details-panel/relationships.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/details-panel/relationships.tsx
rename to flowsint-app/src/components/sketches/details-panel/relationships.tsx
diff --git a/flowsint-app/src/components/graphs/draggable-card.tsx b/flowsint-app/src/components/sketches/draggable-card.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/draggable-card.tsx
rename to flowsint-app/src/components/sketches/draggable-card.tsx
diff --git a/flowsint-app/src/components/graphs/draggable-item.tsx b/flowsint-app/src/components/sketches/draggable-item.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/draggable-item.tsx
rename to flowsint-app/src/components/sketches/draggable-item.tsx
diff --git a/flowsint-app/src/components/graphs/dynamic-form.tsx b/flowsint-app/src/components/sketches/dynamic-form.tsx
similarity index 99%
rename from flowsint-app/src/components/graphs/dynamic-form.tsx
rename to flowsint-app/src/components/sketches/dynamic-form.tsx
index c214cff2..a0fc0b5b 100644
--- a/flowsint-app/src/components/graphs/dynamic-form.tsx
+++ b/flowsint-app/src/components/sketches/dynamic-form.tsx
@@ -20,7 +20,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover
import { Calendar } from '@/components/ui/calendar'
import { cn } from '@/lib/utils'
import type { FormField } from '@/lib/action-items'
-import { MetadataField } from '@/components/graphs/metadata-field'
+import { MetadataField } from '@/components/sketches/metadata-field'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
import { toast } from 'sonner'
diff --git a/flowsint-app/src/components/graphs/edge-context-menu.tsx b/flowsint-app/src/components/sketches/edge-context-menu.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/edge-context-menu.tsx
rename to flowsint-app/src/components/sketches/edge-context-menu.tsx
diff --git a/flowsint-app/src/components/graphs/empty-state.tsx b/flowsint-app/src/components/sketches/empty-state.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/empty-state.tsx
rename to flowsint-app/src/components/sketches/empty-state.tsx
diff --git a/flowsint-app/src/components/graphs/filters.tsx b/flowsint-app/src/components/sketches/filters.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/filters.tsx
rename to flowsint-app/src/components/sketches/filters.tsx
diff --git a/flowsint-app/src/components/graphs/graph-loader.tsx b/flowsint-app/src/components/sketches/graph-loader.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/graph-loader.tsx
rename to flowsint-app/src/components/sketches/graph-loader.tsx
diff --git a/flowsint-app/src/components/graphs/graph-main.tsx b/flowsint-app/src/components/sketches/graph-main.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/graph-main.tsx
rename to flowsint-app/src/components/sketches/graph-main.tsx
diff --git a/flowsint-app/src/components/graphs/graph-navigation.tsx b/flowsint-app/src/components/sketches/graph-navigation.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/graph-navigation.tsx
rename to flowsint-app/src/components/sketches/graph-navigation.tsx
diff --git a/flowsint-app/src/components/graphs/graph-viewer.tsx b/flowsint-app/src/components/sketches/graph-viewer.tsx
similarity index 99%
rename from flowsint-app/src/components/graphs/graph-viewer.tsx
rename to flowsint-app/src/components/sketches/graph-viewer.tsx
index b0a0156b..53da0829 100644
--- a/flowsint-app/src/components/graphs/graph-viewer.tsx
+++ b/flowsint-app/src/components/sketches/graph-viewer.tsx
@@ -37,6 +37,7 @@ interface GraphViewerProps {
allowLasso?: boolean
sketchId?: string // Add sketchId for saving node positions
allowForces?: boolean
+ autoZoomOnNode?: boolean
}
// Graph viewer specific colors
@@ -136,7 +137,8 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
instanceId,
allowLasso = false,
sketchId,
- allowForces = false
+ allowForces = false,
+ autoZoomOnNode = true
}) => {
const [containerSize, setContainerSize] = useState({ width: 0, height: 0 })
const isSelectorModeActive = useGraphControls((s) => s.isSelectorModeActive)
@@ -580,7 +582,7 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
const isMultiSelect = event.ctrlKey || event.shiftKey
if (autoZoomOnCurrentNode && !isMultiSelect && node?.x && node?.y && graphRef.current) {
setTimeout(() => {
- if (graphRef.current && typeof graphRef.current.centerAt === 'function') {
+ if (graphRef.current && autoZoomOnNode && typeof graphRef.current.centerAt === 'function') {
graphRef.current.centerAt(node.x, node.y, 400)
if (typeof graphRef.current.zoom === 'function') {
graphRef.current.zoom(6, 400)
@@ -589,7 +591,7 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
}, 100)
}
},
- [onNodeClick, autoZoomOnCurrentNode]
+ [onNodeClick, autoZoomOnCurrentNode, autoZoomOnNode]
)
const handleNodeRightClick = useCallback(
diff --git a/flowsint-app/src/components/graphs/import-preview.tsx b/flowsint-app/src/components/sketches/import-preview.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/import-preview.tsx
rename to flowsint-app/src/components/sketches/import-preview.tsx
diff --git a/flowsint-app/src/components/graphs/import-sheet.tsx b/flowsint-app/src/components/sketches/import-sheet.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/import-sheet.tsx
rename to flowsint-app/src/components/sketches/import-sheet.tsx
diff --git a/flowsint-app/src/components/graphs/index.tsx b/flowsint-app/src/components/sketches/index.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/index.tsx
rename to flowsint-app/src/components/sketches/index.tsx
diff --git a/flowsint-app/src/components/graphs/items-panel.tsx b/flowsint-app/src/components/sketches/items-panel.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/items-panel.tsx
rename to flowsint-app/src/components/sketches/items-panel.tsx
diff --git a/flowsint-app/src/components/graphs/launch-enricher.tsx b/flowsint-app/src/components/sketches/launch-enricher.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/launch-enricher.tsx
rename to flowsint-app/src/components/sketches/launch-enricher.tsx
diff --git a/flowsint-app/src/components/graphs/legend.tsx b/flowsint-app/src/components/sketches/legend.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/legend.tsx
rename to flowsint-app/src/components/sketches/legend.tsx
diff --git a/flowsint-app/src/components/graphs/merge-nodes.tsx b/flowsint-app/src/components/sketches/merge-nodes.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/merge-nodes.tsx
rename to flowsint-app/src/components/sketches/merge-nodes.tsx
diff --git a/flowsint-app/src/components/graphs/metadata-field.tsx b/flowsint-app/src/components/sketches/metadata-field.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/metadata-field.tsx
rename to flowsint-app/src/components/sketches/metadata-field.tsx
diff --git a/flowsint-app/src/components/graphs/minimap.tsx b/flowsint-app/src/components/sketches/minimap.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/minimap.tsx
rename to flowsint-app/src/components/sketches/minimap.tsx
diff --git a/flowsint-app/src/components/graphs/new-sketch.tsx b/flowsint-app/src/components/sketches/new-sketch.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/new-sketch.tsx
rename to flowsint-app/src/components/sketches/new-sketch.tsx
diff --git a/flowsint-app/src/components/graphs/node-actions.tsx b/flowsint-app/src/components/sketches/node-actions.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/node-actions.tsx
rename to flowsint-app/src/components/sketches/node-actions.tsx
diff --git a/flowsint-app/src/components/graphs/node-context-menu.tsx b/flowsint-app/src/components/sketches/node-context-menu.tsx
similarity index 99%
rename from flowsint-app/src/components/graphs/node-context-menu.tsx
rename to flowsint-app/src/components/sketches/node-context-menu.tsx
index 8037b5ea..c755d26b 100644
--- a/flowsint-app/src/components/graphs/node-context-menu.tsx
+++ b/flowsint-app/src/components/sketches/node-context-menu.tsx
@@ -13,7 +13,7 @@ import { useLaunchFlow } from '@/hooks/use-launch-flow'
import { useLaunchEnricher } from '@/hooks/use-launch-enricher'
import { useParams } from '@tanstack/react-router'
import { capitalizeFirstLetter } from '@/lib/utils'
-import NodeActions from '@/components/graphs/node-actions'
+import NodeActions from '@/components/sketches/node-actions'
import BaseContextMenu from '@/components/xyflow/context-menu'
import { useGraphStore } from '@/stores/graph-store'
import { CopyButton } from '../copy'
diff --git a/flowsint-app/src/components/graphs/nodes-panel.tsx b/flowsint-app/src/components/sketches/nodes-panel.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/nodes-panel.tsx
rename to flowsint-app/src/components/sketches/nodes-panel.tsx
diff --git a/flowsint-app/src/components/graphs/save-status-indicator.tsx b/flowsint-app/src/components/sketches/save-status-indicator.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/save-status-indicator.tsx
rename to flowsint-app/src/components/sketches/save-status-indicator.tsx
diff --git a/flowsint-app/src/components/graphs/selected-items-panel.tsx b/flowsint-app/src/components/sketches/selected-items-panel.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/selected-items-panel.tsx
rename to flowsint-app/src/components/sketches/selected-items-panel.tsx
diff --git a/flowsint-app/src/components/graphs/selectors/lasso.tsx b/flowsint-app/src/components/sketches/selectors/lasso.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/selectors/lasso.tsx
rename to flowsint-app/src/components/sketches/selectors/lasso.tsx
diff --git a/flowsint-app/src/components/graphs/selectors/rectangle.tsx b/flowsint-app/src/components/sketches/selectors/rectangle.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/selectors/rectangle.tsx
rename to flowsint-app/src/components/sketches/selectors/rectangle.tsx
diff --git a/flowsint-app/src/components/graphs/settings.tsx b/flowsint-app/src/components/sketches/settings.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/settings.tsx
rename to flowsint-app/src/components/sketches/settings.tsx
diff --git a/flowsint-app/src/components/graphs/toolbar.tsx b/flowsint-app/src/components/sketches/toolbar.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/toolbar.tsx
rename to flowsint-app/src/components/sketches/toolbar.tsx
diff --git a/flowsint-app/src/components/graphs/view-toggle.tsx b/flowsint-app/src/components/sketches/view-toggle.tsx
similarity index 99%
rename from flowsint-app/src/components/graphs/view-toggle.tsx
rename to flowsint-app/src/components/sketches/view-toggle.tsx
index ee1bf067..d2523708 100644
--- a/flowsint-app/src/components/graphs/view-toggle.tsx
+++ b/flowsint-app/src/components/sketches/view-toggle.tsx
@@ -1,4 +1,3 @@
-"use client"
import { List, ArrowRightLeft, MapPin, ChevronDown } from "lucide-react"
import {
diff --git a/flowsint-app/src/components/graphs/webgl/components/lod-indicator.tsx b/flowsint-app/src/components/sketches/webgl/components/lod-indicator.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/components/lod-indicator.tsx
rename to flowsint-app/src/components/sketches/webgl/components/lod-indicator.tsx
diff --git a/flowsint-app/src/components/graphs/webgl/constants.ts b/flowsint-app/src/components/sketches/webgl/constants.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/constants.ts
rename to flowsint-app/src/components/sketches/webgl/constants.ts
diff --git a/flowsint-app/src/components/graphs/webgl/exports.ts b/flowsint-app/src/components/sketches/webgl/exports.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/exports.ts
rename to flowsint-app/src/components/sketches/webgl/exports.ts
diff --git a/flowsint-app/src/components/graphs/webgl/hooks/use-force-simulation.ts b/flowsint-app/src/components/sketches/webgl/hooks/use-force-simulation.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/hooks/use-force-simulation.ts
rename to flowsint-app/src/components/sketches/webgl/hooks/use-force-simulation.ts
diff --git a/flowsint-app/src/components/graphs/webgl/hooks/use-graph-interactions.ts b/flowsint-app/src/components/sketches/webgl/hooks/use-graph-interactions.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/hooks/use-graph-interactions.ts
rename to flowsint-app/src/components/sketches/webgl/hooks/use-graph-interactions.ts
diff --git a/flowsint-app/src/components/graphs/webgl/hooks/use-graph-renderer.ts b/flowsint-app/src/components/sketches/webgl/hooks/use-graph-renderer.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/hooks/use-graph-renderer.ts
rename to flowsint-app/src/components/sketches/webgl/hooks/use-graph-renderer.ts
diff --git a/flowsint-app/src/components/graphs/webgl/hooks/use-pixi-app.ts b/flowsint-app/src/components/sketches/webgl/hooks/use-pixi-app.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/hooks/use-pixi-app.ts
rename to flowsint-app/src/components/sketches/webgl/hooks/use-pixi-app.ts
diff --git a/flowsint-app/src/components/graphs/webgl/hooks/use-zoom-pan.ts b/flowsint-app/src/components/sketches/webgl/hooks/use-zoom-pan.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/hooks/use-zoom-pan.ts
rename to flowsint-app/src/components/sketches/webgl/hooks/use-zoom-pan.ts
diff --git a/flowsint-app/src/components/graphs/webgl/index.tsx b/flowsint-app/src/components/sketches/webgl/index.tsx
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/index.tsx
rename to flowsint-app/src/components/sketches/webgl/index.tsx
diff --git a/flowsint-app/src/components/graphs/webgl/renderers/edge-renderer.ts b/flowsint-app/src/components/sketches/webgl/renderers/edge-renderer.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/renderers/edge-renderer.ts
rename to flowsint-app/src/components/sketches/webgl/renderers/edge-renderer.ts
diff --git a/flowsint-app/src/components/graphs/webgl/renderers/label-renderer.ts b/flowsint-app/src/components/sketches/webgl/renderers/label-renderer.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/renderers/label-renderer.ts
rename to flowsint-app/src/components/sketches/webgl/renderers/label-renderer.ts
diff --git a/flowsint-app/src/components/graphs/webgl/renderers/node-renderer.ts b/flowsint-app/src/components/sketches/webgl/renderers/node-renderer.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/renderers/node-renderer.ts
rename to flowsint-app/src/components/sketches/webgl/renderers/node-renderer.ts
diff --git a/flowsint-app/src/components/graphs/webgl/types/graph.types.ts b/flowsint-app/src/components/sketches/webgl/types/graph.types.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/types/graph.types.ts
rename to flowsint-app/src/components/sketches/webgl/types/graph.types.ts
diff --git a/flowsint-app/src/components/graphs/webgl/utils/color-utils.ts b/flowsint-app/src/components/sketches/webgl/utils/color-utils.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/utils/color-utils.ts
rename to flowsint-app/src/components/sketches/webgl/utils/color-utils.ts
diff --git a/flowsint-app/src/components/graphs/webgl/utils/label-decluttering.ts b/flowsint-app/src/components/sketches/webgl/utils/label-decluttering.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/utils/label-decluttering.ts
rename to flowsint-app/src/components/sketches/webgl/utils/label-decluttering.ts
diff --git a/flowsint-app/src/components/graphs/webgl/utils/texture-cache.ts b/flowsint-app/src/components/sketches/webgl/utils/texture-cache.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/utils/texture-cache.ts
rename to flowsint-app/src/components/sketches/webgl/utils/texture-cache.ts
diff --git a/flowsint-app/src/components/graphs/webgl/utils/visibility-calculator.ts b/flowsint-app/src/components/sketches/webgl/utils/visibility-calculator.ts
similarity index 100%
rename from flowsint-app/src/components/graphs/webgl/utils/visibility-calculator.ts
rename to flowsint-app/src/components/sketches/webgl/utils/visibility-calculator.ts
diff --git a/flowsint-app/src/hooks/use-create-analysis.ts b/flowsint-app/src/hooks/use-create-analysis.ts
new file mode 100644
index 00000000..7dc51772
--- /dev/null
+++ b/flowsint-app/src/hooks/use-create-analysis.ts
@@ -0,0 +1,35 @@
+import { analysisService } from "@/api/analysis-service"
+import { Analysis } from "@/types"
+import { useMutation, useQueryClient } from "@tanstack/react-query"
+import default_content from '@/components/analyses/default_content.json'
+import { queryKeys } from "@/api/query-keys"
+import { toast } from "sonner"
+
+export const useCreateAnalysis = (investigationId: string, onAnalysisCreate?: any) => {
+
+ const queryClient = useQueryClient()
+
+ return useMutation({
+ mutationFn: async () => {
+ const newAnalysis: Partial<Analysis> = {
+ title: 'Untitled Analysis',
+ investigation_id: investigationId,
+ content: default_content
+ }
+ const res = await analysisService.create(JSON.stringify(newAnalysis))
+ return res
+ },
+ onSuccess: async () => {
+ queryClient.invalidateQueries({
+ queryKey: queryKeys.analyses.byInvestigation(investigationId || '')
+ })
+ onAnalysisCreate?.(investigationId)
+ toast.success('New analysis created')
+ },
+ onError: (error) => {
+ toast.error(
+ 'Failed to create analysis: ' + (error instanceof Error ? error.message : 'Unknown error')
+ )
+ }
+ })
+}
\ No newline at end of file
diff --git a/flowsint-app/src/hooks/use-layout.ts b/flowsint-app/src/hooks/use-layout.ts
index 58459d3e..201c8a06 100644
--- a/flowsint-app/src/hooks/use-layout.ts
+++ b/flowsint-app/src/hooks/use-layout.ts
@@ -20,6 +20,7 @@ export function useLayout({
onProgress,
}: UseLayoutProps) {
const workerRef = useRef<Worker | null>(null)
+ const setNodes = useGraphStore(s => s.setNodes)
const nodes = useGraphStore(s => s.nodes)
const edges = useGraphStore(s => s.edges)
@@ -56,7 +57,7 @@ export function useLayout({
} else if (event.data.type === 'complete') {
const { nodes: layoutedNodes } = event.data.result
- // Apply the calculated positions to the graph nodes
+ // // Apply the calculated positions to the graph nodes
layoutedNodes.forEach((layoutedNode: any) => {
const graphNode = nodes.find((n: any) => n.id === layoutedNode.id) as any
if (graphNode && layoutedNode.x !== undefined && layoutedNode.y !== undefined) {
@@ -66,7 +67,7 @@ export function useLayout({
graphNode.fy = layoutedNode.y
}
})
-
+ setNodes(layoutedNodes)
// Save all node positions
saveAllNodePositions(nodes, true)
diff --git a/flowsint-app/src/routes/_auth.dashboard.index.tsx b/flowsint-app/src/routes/_auth.dashboard.index.tsx
index 0265c91f..78bd8ced 100644
--- a/flowsint-app/src/routes/_auth.dashboard.index.tsx
+++ b/flowsint-app/src/routes/_auth.dashboard.index.tsx
@@ -1,6 +1,6 @@
import { createFileRoute } from '@tanstack/react-router'
-import { InvestigationSkeleton } from '@/components/dashboard/investigation-skeleton'
-import { DashboardPage } from '@/components/dashboard/dashboard-page'
+import { InvestigationSkeleton } from '@/components/dashboard/investigation/investigation-skeleton'
+import { DashboardPage } from '@/components/dashboard/overview/dashboard-page'
export const Route = createFileRoute('/_auth/dashboard/')({
component: Page,
diff --git a/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx b/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx
index 647b1a7a..6ba73a7d 100644
--- a/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx
+++ b/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx
@@ -1,5 +1,5 @@
import { createFileRoute, Link, useLoaderData } from '@tanstack/react-router'
-import GraphPanel from '@/components/graphs'
+import GraphPanel from '@/components/sketches'
import { sketchService } from '@/api/sketch-service'
import { useQuery } from '@tanstack/react-query'
import Loader from '@/components/loader'
diff --git a/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx b/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx
index dbd0a756..164708ce 100644
--- a/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx
+++ b/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx
@@ -3,7 +3,7 @@ import { investigationService } from '@/api/investigation-service'
import { analysisService } from '@/api/analysis-service'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { toast } from 'sonner'
-import { CaseOverviewPage } from "@/components/dashboard/case-overview-page"
+import { CaseOverviewPage } from "@/components/dashboard/investigation/case-overview-page"
function InvestigationSkeleton() {