Skip to content

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

feat(app): case management and activity monitoring

dextmorgnae5e8c2c00c1
diff --git a/flowsint-app/src/components/dashboard/activity-timeline.tsx b/flowsint-app/src/components/dashboard/activity-timeline.tsx
new file mode 100644
index 00000000..d3d20ce2
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/activity-timeline.tsx
@@ -0,0 +1,68 @@
+"use client"
+
+import { Network, FileText, Upload, AlertCircle, CheckCircle } from "lucide-react"
+
+const activities = [
+ {
+ id: 1,
+ action: "created sketch",
+ subject: "Infrastructure mapping v3",
+ user: "John",
+ time: "2h ago",
+ icon: Network,
+ },
+ {
+ id: 2,
+ action: "updated analysis",
+ subject: "C2 Communication Patterns",
+ user: "Sarah",
+ time: "4h ago",
+ icon: FileText,
+ },
+ {
+ id: 3,
+ action: "uploaded",
+ subject: "network_capture_nov28.pcap",
+ user: "Mike",
+ time: "6h ago",
+ icon: Upload,
+ },
+ {
+ id: 4,
+ action: "changed priority to",
+ subject: "High",
+ user: "John",
+ time: "1d ago",
+ icon: AlertCircle,
+ },
+ {
+ id: 5,
+ action: "completed",
+ subject: "Initial triage review",
+ user: "Sarah",
+ time: "2d ago",
+ icon: CheckCircle,
+ },
+]
+
+export function ActivityTimeline() {
+ return (
+ <section>
+ <h3 className="text-sm font-medium text-foreground mb-3">Activity</h3>
+ <div className="space-y-2">
+ {activities.map((activity) => (
+ <div key={activity.id} className="flex items-start gap-3 py-2 text-sm">
+ <activity.icon className="w-4 h-4 text-muted-foreground mt-0.5 shrink-0" />
+ <div className="flex-1 min-w-0">
+ <span className="text-muted-foreground">
+ <span className="text-foreground">{activity.user}</span> {activity.action}{" "}
+ <span className="text-foreground">{activity.subject}</span>
+ </span>
+ <span className="text-muted-foreground/60 ml-2">{activity.time}</span>
+ </div>
+ </div>
+ ))}
+ </div>
+ </section>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/analyses-section.tsx b/flowsint-app/src/components/dashboard/analyses-section.tsx
new file mode 100644
index 00000000..1e042956
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/analyses-section.tsx
@@ -0,0 +1,54 @@
+"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"
+
+interface AnalysesSectionProps {
+ analyses: Analysis[]
+}
+
+export function AnalysesSection({ analyses }: AnalysesSectionProps) {
+ return (
+ <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>
+ </div>
+
+ {analyses.length === 0 ?
+ <div className="border border-dashed rounded-md">
+ <EmptyAnalyses />
+ </div> :
+ <div className="space-y-1">
+ {analyses.map((analysis) => (
+ <div
+ key={analysis.id}
+ className="group flex items-start gap-3 p-3 -mx-3 rounded-lg hover:bg-secondary/50 transition-colors cursor-pointer"
+ >
+ <FileText className="w-4 h-4 text-muted-foreground mt-0.5 shrink-0" />
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-2 mb-0.5">
+ <h4 className="font-medium text-foreground text-sm truncate">{analysis.title}</h4>
+ </div>
+ <p className="text-xs text-muted-foreground line-clamp-1">{analysis.description}</p>
+ <div className="flex items-center gap-2 mt-1 text-xs text-muted-foreground/70">
+ <span>{analysis.owner_id}</span>
+ <span>·</span>
+ <span>{formatDistanceToNow(new Date(analysis.last_updated_at), {
+ addSuffix: true
+ })}</span>
+ </div>
+ </div>
+ <ChevronRight className="w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5" />
+ </div>
+ ))}
+ </div>}
+ </section>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/analysis-cards.tsx b/flowsint-app/src/components/dashboard/analysis-cards.tsx
deleted file mode 100644
index 64ee27db..00000000
--- a/flowsint-app/src/components/dashboard/analysis-cards.tsx
+++ /dev/null
@@ -1,169 +0,0 @@
-import { useQuery } from '@tanstack/react-query'
-import { analysisService } from '@/api/analysis-service'
-import { Link } from '@tanstack/react-router'
-import { Card, CardContent } from '@/components/ui/card'
-import { Button } from '@/components/ui/button'
-import { Badge } from '@/components/ui/badge'
-import { Skeleton } from '@/components/ui/skeleton'
-import { FileText, Plus, Clock } from 'lucide-react'
-import { formatDistanceToNow } from 'date-fns'
-
-interface AnalysisCardProps {
- analysis: any
-}
-
-function AnalysisCard({ analysis }: AnalysisCardProps) {
- return (
- <Link
- to="/dashboard/investigations/$investigationId/$type/$id"
- params={{
- investigationId: analysis.investigation_id || '',
- type: 'analysis',
- id: analysis.id
- }}
- className="block"
- >
- <Card className="hover:shadow-lg py-4 transition-all duration-200 cursor-pointer group border-2 hover:border-primary/20">
- <CardContent className="h-full flex flex-col">
- {/* Header with title and type */}
- <div className="flex items-start justify-between mb-3">
- <div className="flex items-center gap-3 flex-1 min-w-0">
- <div className="w-8 h-8 bg-green-100 dark:bg-green-900/20 rounded-lg flex items-center justify-center flex-shrink-0">
- <FileText className="w-4 h-4 text-green-600 dark:text-green-400" />
- </div>
- <div className="flex-1 min-w-0">
- <h3 className="font-semibold text-sm truncate group-hover:text-green-600 dark:group-hover:text-green-400 transition-colors">
- {analysis.title}
- </h3>
- <p className="text-xs text-muted-foreground">Analysis document</p>
- </div>
- </div>
- <Badge variant="secondary" className="text-xs flex-shrink-0 ml-2">
- Doc
- </Badge>
- </div>
-
- {/* Description */}
- <div className="flex-1 mb-3 min-w-0">
- <p className="text-xs text-muted-foreground line-clamp-2">
- {analysis.description || 'No description available'}
- </p>
- </div>
-
- {/* Footer with timestamp */}
- <div className="mt-auto">
- <div className="flex items-center gap-2 text-xs text-muted-foreground">
- <Clock className="w-3 h-3" />
- <span>
- Updated{' '}
- {formatDistanceToNow(new Date(analysis.last_updated_at), { addSuffix: true })}
- </span>
- </div>
- </div>
- </CardContent>
- </Card>
- </Link>
- )
-}
-
-function AnalysisCardsSkeleton() {
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <Skeleton className="h-6 w-6" />
- <Skeleton className="h-6 w-48" />
- </div>
- <Skeleton className="h-8 w-24" />
- </div>
- <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
- {Array.from({ length: 8 }).map((_, i) => (
- <Card key={i} className="w-full">
- <CardContent className="p-4 h-full flex flex-col">
- <div className="flex items-start justify-between mb-3">
- <div className="flex items-center gap-3">
- <Skeleton className="w-8 h-8 rounded-lg" />
- <div className="flex-1">
- <Skeleton className="h-4 w-32 mb-1" />
- <Skeleton className="h-3 w-20" />
- </div>
- </div>
- <Skeleton className="h-5 w-8" />
- </div>
- <div className="flex-1 mb-3">
- <Skeleton className="h-3 w-full mb-1" />
- <Skeleton className="h-3 w-3/4" />
- </div>
- <div className="mt-auto">
- <Skeleton className="h-3 w-24" />
- </div>
- </CardContent>
- </Card>
- ))}
- </div>
- </div>
- )
-}
-
-export function AnalysisCards() {
- const { data: analyses, isLoading } = useQuery({
- queryKey: ['analyses', 'dashboard'],
- queryFn: analysisService.get
- })
-
- if (isLoading) {
- return <AnalysisCardsSkeleton />
- }
-
- if (!analyses || analyses.length === 0) {
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <FileText className="h-6 w-6 text-muted-foreground" />
- <h2 className="text-xl font-semibold">Recent Analyses</h2>
- </div>
- <Button size="sm" variant="outline">
- <Plus className="w-4 h-4 mr-2" />
- New analysis
- </Button>
- </div>
- <div className="text-center py-12">
- <FileText className="h-12 w-12 text-muted-foreground mx-auto mb-4" />
- <h3 className="text-lg font-semibold mb-2">No analyses yet</h3>
- <p className="text-muted-foreground mb-4">
- Create your first analysis to start documenting your findings.
- </p>
- <Button>
- <Plus className="w-4 h-4 mr-2" />
- Create Analysis
- </Button>
- </div>
- </div>
- )
- }
-
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <FileText className="h-6 w-6 text-muted-foreground" />
- <h2 className="text-xl font-semibold">Recent Analyses</h2>
- <span className="text-sm text-muted-foreground">{analyses.length} analyses</span>
- </div>
- <div className="flex items-center gap-2">
- <Button size="sm" variant="outline">
- <Plus className="w-4 h-4 mr-2" />
- New analysis
- </Button>
- </div>
- </div>
-
- <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
- {analyses.slice(0, 8).map((analysis: any) => (
- <AnalysisCard key={analysis.id} analysis={analysis} />
- ))}
- </div>
- </div>
- )
-}
diff --git a/flowsint-app/src/components/dashboard/case-header.tsx b/flowsint-app/src/components/dashboard/case-header.tsx
new file mode 100644
index 00000000..22e38460
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/case-header.tsx
@@ -0,0 +1,141 @@
+"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"
+
+type CaseOverviewPageProps = {
+ investigation: Investigation
+}
+
+export function CaseHeader({ investigation }: CaseOverviewPageProps) {
+ const lastUpdated = formatDistanceToNow(new Date(investigation.last_updated_at), {
+ addSuffix: true
+ })
+ 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>
+ <span>/</span>
+ <span className="text-foreground">{investigation.name}</span>
+ </div>
+
+ {/* Title row */}
+ <div className="flex items-start justify-between gap-4">
+ <div className="space-y-2 flex-1">
+ <div className="flex items-center gap-3">
+ <h1 className="text-2xl font-semibold text-foreground tracking-tight">{investigation.name}</h1>
+ <FavoriteButton />
+ </div>
+
+ {/* 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="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">
+ <Share className="w-4 h-4" />
+ </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" size="sm" className="text-muted-foreground h-8 px-2">
+ <MoreHorizontal className="w-4 h-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-48">
+ <DropdownMenuItem>Export as PDF</DropdownMenuItem>
+ <DropdownMenuItem>Duplicate</DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem className="text-destructive">
+ <Trash2 className="w-4 h-4 mr-2" />
+ Delete
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ </div>
+
+ {/* Tags row */}
+ <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>
+
+ {/* Team */}
+ <div className="flex items-center gap-2">
+ <div className="flex -space-x-1.5">
+ <Avatar initials="JD" />
+ <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>
+ </div>
+ </div>
+ )
+}
+
+function PropertyPill({
+ label,
+ value,
+ valueClass = "text-foreground",
+ icon,
+}: {
+ label: string
+ value: string
+ valueClass?: string
+ icon?: React.ReactNode
+}) {
+ return (
+ <div className="flex items-center gap-1.5">
+ <span className="text-muted-foreground/60 font-normal">{label}</span>
+ <span className={`flex items-center gap-1 font-medium ${valueClass}`}>
+ {icon}
+ {value}
+ </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>
+}
+
+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>
+ )
+}
+
+
+const FavoriteButton = () => {
+ const [fav, setFav] = useState<boolean>(false)
+ return (
+ <button onClick={() => setFav(!fav)} className={cn("text-muted-foreground hover:text-warning transition-colors")}>
+ <Star className={cn("w-4 h-4", fav && "text-warning fill-warning")} />
+ </button>
+ )
+}
\ No newline at end of file
diff --git a/flowsint-app/src/components/dashboard/case-overview-page.tsx b/flowsint-app/src/components/dashboard/case-overview-page.tsx
new file mode 100644
index 00000000..0c18cb1c
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/case-overview-page.tsx
@@ -0,0 +1,39 @@
+"use client"
+
+import { CaseHeader } from "./case-header"
+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 { Investigation } from "@/types"
+
+type CaseOverviewPageProps = {
+ investigation: Investigation
+}
+export function CaseOverviewPage({ investigation }: CaseOverviewPageProps) {
+
+ return (
+ <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} />
+
+ <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">
+ <EvidenceSection />
+ <div className="space-y-8">
+ <TasksSection />
+ <ActivityTimeline />
+ </div>
+ </div>
+ </div>
+ </div>
+ </main>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/dashboard-header.tsx b/flowsint-app/src/components/dashboard/dashboard-header.tsx
new file mode 100644
index 00000000..00e72494
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/dashboard-header.tsx
@@ -0,0 +1,59 @@
+"use client"
+
+import { Plus, LayoutGrid, List, Search } from "lucide-react"
+import { Button } from "@/components/ui/button"
+
+interface DashboardHeaderProps {
+ view: "grid" | "list"
+ setView: (view: "grid" | "list") => void
+}
+
+export function DashboardHeader({ view, setView }: DashboardHeaderProps) {
+ return (
+ <div className="space-y-8">
+ <div className="flex items-start justify-between">
+ <div>
+ <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>
+ </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
+ 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"
+ />
+ </div>
+ <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"
+ }`}
+ >
+ <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"
+ }`}
+ >
+ <LayoutGrid className="w-4 h-4" />
+ </button>
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/dashboard-page.tsx b/flowsint-app/src/components/dashboard/dashboard-page.tsx
new file mode 100644
index 00000000..6b051a1a
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/dashboard-page.tsx
@@ -0,0 +1,51 @@
+"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 { 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"
+
+export function DashboardPage() {
+ const [view, setView] = useState<"grid" | "list">("list")
+ const [filter, setFilter] = useState<"all" | "active" | "closed">("all")
+
+ const {
+ data: investigations,
+ isLoading,
+ // error,
+ // refetch
+ } = useQuery({
+ queryKey: queryKeys.investigations.dashboard,
+ queryFn: investigationService.get,
+ })
+
+ if (isLoading) {
+ return <InvestigationSkeleton />
+ }
+
+ const casesCount = investigations.length ?? 0 as number
+ const activeCasesCount = investigations.filter((i: Investigation) => i.status === "active").length ?? 0 as number
+
+ 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} />
+ <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>
+ <div>
+ <RecentActivity />
+ </div>
+ </div>
+ </div>
+ </main>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/dashboard-stats.tsx b/flowsint-app/src/components/dashboard/dashboard-stats.tsx
new file mode 100644
index 00000000..d52cee62
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/dashboard-stats.tsx
@@ -0,0 +1,37 @@
+import { FolderOpen, FileText, Network, Clock } from "lucide-react"
+import { useMemo } from "react"
+
+
+
+type DashboardStatsProps = {
+ casesCount: number,
+ activeCasesCount: number,
+}
+
+export function DashboardStats({ casesCount, activeCasesCount }: DashboardStatsProps) {
+
+ const stats = useMemo(() => [
+ { label: "Total Cases", value: casesCount, icon: FolderOpen },
+ { label: "Active", value: activeCasesCount, icon: Clock },
+ { label: "Analyses", value: "67", icon: FileText },
+ { label: "Entities", value: "1,247", icon: Network },
+ ], [casesCount, activeCasesCount])
+
+ return (
+ <div className="grid grid-cols-4 gap-4 mt-8">
+ {stats.map((stat) => (
+ <div key={stat.label} className="px-4 py-3 border border-border rounded-lg bg-card/30">
+ <div className="flex items-center gap-3">
+ <div className="p-2 rounded-md bg-muted/50">
+ <stat.icon className="w-4 h-4 text-muted-foreground" />
+ </div>
+ <div>
+ <p className="text-xl font-semibold text-foreground">{stat.value}</p>
+ <p className="text-xs text-muted-foreground">{stat.label}</p>
+ </div>
+ </div>
+ </div>
+ ))}
+ </div>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/empty-states.tsx b/flowsint-app/src/components/dashboard/empty-states.tsx
new file mode 100644
index 00000000..a262b9af
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/empty-states.tsx
@@ -0,0 +1,192 @@
+import { Button } from "@/components/ui/button"
+import { Plus, Upload } from "lucide-react"
+
+interface EmptyStateProps {
+ onAction?: () => void
+}
+
+export function EmptyInvestigations({ onAction }: EmptyStateProps) {
+ return (
+ <div className="flex flex-col items-center justify-center py-16 px-4">
+ {/* Minimal folder illustration */}
+ <div className="w-16 h-16 mb-6 text-muted-foreground/30">
+ <svg viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M8 16C8 13.7909 9.79086 12 12 12H24L28 16H52C54.2091 16 56 17.7909 56 20V48C56 50.2091 54.2091 52 52 52H12C9.79086 52 8 50.2091 8 48V16Z"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ <path
+ d="M28 32L32 36L36 32"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ <path d="M32 24V36" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ </svg>
+ </div>
+ <h3 className="text-sm font-medium text-foreground mb-1">No investigations yet</h3>
+ <p className="text-sm text-muted-foreground text-center max-w-[240px] mb-5">
+ Create your first investigation to start tracking threats and entities
+ </p>
+ <Button onClick={onAction} size="sm" className="h-8 text-xs gap-1.5">
+ <Plus className="w-3.5 h-3.5" />
+ New Investigation
+ </Button>
+ </div>
+ )
+}
+
+export function EmptySketches({ onAction }: EmptyStateProps) {
+ return (
+ <div className="flex flex-col items-center justify-center py-12 px-4 border border-dashed border-border rounded-lg">
+ {/* Minimal graph/network illustration */}
+ <div className="w-14 h-14 mb-5 text-muted-foreground/30">
+ <svg viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="28" cy="14" r="6" stroke="currentColor" strokeWidth="2" />
+ <circle cx="14" cy="42" r="6" stroke="currentColor" strokeWidth="2" />
+ <circle cx="42" cy="42" r="6" stroke="currentColor" strokeWidth="2" />
+ <path d="M24 19L17 36" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ <path d="M32 19L39 36" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ <path d="M20 42H36" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ </svg>
+ </div>
+ <h3 className="text-sm font-medium text-foreground mb-1">No sketches</h3>
+ <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>
+ </div>
+ )
+}
+
+export function EmptyAnalyses({ onAction }: EmptyStateProps) {
+ return (
+ <div className="flex flex-col items-center justify-center py-10 px-4">
+ {/* Minimal document illustration */}
+ <div className="w-12 h-12 mb-4 text-muted-foreground/30">
+ <svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M12 6H30L38 14V42C38 43.1046 37.1046 44 36 44H12C10.8954 44 10 43.1046 10 42V8C10 6.89543 10.8954 6 12 6Z"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ <path d="M30 6V14H38" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
+ <path d="M16 24H32" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ <path d="M16 30H28" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ <path d="M16 36H24" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ </svg>
+ </div>
+ <h3 className="text-sm font-medium text-foreground mb-1">No analyses</h3>
+ <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>
+ </div>
+ )
+}
+
+export function EmptyEvidence({ onAction }: EmptyStateProps) {
+ return (
+ <div className="flex flex-col items-center justify-center py-10 px-4 border border-dashed border-border rounded-lg">
+ {/* Minimal upload/file illustration */}
+ <div className="w-12 h-12 mb-4 text-muted-foreground/30">
+ <svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <rect x="8" y="8" width="32" height="32" rx="4" stroke="currentColor" strokeWidth="2" />
+ <path d="M24 18V30" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ <path
+ d="M18 24L24 18L30 24"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ </div>
+ <h3 className="text-sm font-medium text-foreground mb-1">No evidence</h3>
+ <p className="text-xs text-muted-foreground text-center max-w-[180px] mb-4">
+ Upload files, screenshots, or artifacts related to this case
+ </p>
+ <Button onClick={onAction} variant="ghost" size="sm" className="h-7 text-xs gap-1.5">
+ <Upload className="w-3.5 h-3.5" />
+ Upload files
+ </Button>
+ </div>
+ )
+}
+
+export function EmptyTasks({ onAction }: EmptyStateProps) {
+ return (
+ <div className="flex flex-col items-center justify-center py-8 px-4">
+ {/* Minimal checklist illustration */}
+ <div className="w-10 h-10 mb-3 text-muted-foreground/30">
+ <svg viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <rect x="6" y="8" width="6" height="6" rx="1" stroke="currentColor" strokeWidth="2" />
+ <path d="M16 11H34" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ <rect x="6" y="18" width="6" height="6" rx="1" stroke="currentColor" strokeWidth="2" />
+ <path d="M16 21H28" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ <rect x="6" y="28" width="6" height="6" rx="1" stroke="currentColor" strokeWidth="2" />
+ <path d="M16 31H24" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ </svg>
+ </div>
+ <h3 className="text-xs font-medium text-foreground mb-0.5">No tasks</h3>
+ <p className="text-xs text-muted-foreground text-center mb-3">Track work for this case</p>
+ <Button onClick={onAction} variant="ghost" size="sm" className="h-6 text-xs px-2 gap-1">
+ <Plus className="w-3 h-3" />
+ Add task
+ </Button>
+ </div>
+ )
+}
+
+export function EmptyActivity() {
+ return (
+ <div className="flex flex-col items-center justify-center py-8 px-4">
+ {/* Minimal timeline/clock illustration */}
+ <div className="w-10 h-10 mb-3 text-muted-foreground/30">
+ <svg viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="20" cy="20" r="14" stroke="currentColor" strokeWidth="2" />
+ <path
+ d="M20 12V20L26 24"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ </div>
+ <h3 className="text-xs font-medium text-foreground mb-0.5">No activity yet</h3>
+ <p className="text-xs text-muted-foreground text-center max-w-[160px]">Actions on this case will appear here</p>
+ </div>
+ )
+}
+
+export function EmptySearchResults() {
+ return (
+ <div className="flex flex-col items-center justify-center py-16 px-4">
+ {/* Minimal search illustration */}
+ <div className="w-14 h-14 mb-5 text-muted-foreground/30">
+ <svg viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="24" cy="24" r="14" stroke="currentColor" strokeWidth="2" />
+ <path d="M34 34L46 46" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ <path d="M18 24H30" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ </svg>
+ </div>
+ <h3 className="text-sm font-medium text-foreground mb-1">No results found</h3>
+ <p className="text-sm text-muted-foreground text-center max-w-[220px]">
+ Try adjusting your search or filters to find what you're looking for
+ </p>
+ </div>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/evidence-section.tsx b/flowsint-app/src/components/dashboard/evidence-section.tsx
new file mode 100644
index 00000000..3eec9e27
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/evidence-section.tsx
@@ -0,0 +1,39 @@
+"use client"
+
+import { Button } from "@/components/ui/button"
+import { Plus, FileCode, FileImage, FileText, File } from "lucide-react"
+
+const evidence = [
+ { id: 1, name: "network_capture_nov28.pcap", size: "245 MB", icon: FileCode },
+ { id: 2, name: "malware_sample_hash.zip", size: "12.4 MB", icon: File },
+ { id: 3, name: "screenshot_c2_panel.png", size: "2.1 MB", icon: FileImage },
+ { id: 4, name: "threat_intel_report.pdf", size: "4.8 MB", icon: FileText },
+ { id: 5, name: "memory_dump_srv01.raw", size: "8.2 GB", icon: FileCode },
+]
+
+export function EvidenceSection() {
+ return (
+ <section>
+ <div className="flex items-center justify-between mb-4">
+ <h2 className="text-sm font-medium text-foreground">Evidence & Files</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" />
+ Upload
+ </Button>
+ </div>
+
+ <div className="space-y-0.5">
+ {evidence.map((item) => (
+ <div
+ key={item.id}
+ className="group flex items-center gap-3 p-2 -mx-2 rounded hover:bg-secondary/50 transition-colors cursor-pointer"
+ >
+ <item.icon className="w-4 h-4 text-muted-foreground shrink-0" />
+ <span className="flex-1 text-sm text-foreground truncate">{item.name}</span>
+ <span className="text-xs text-muted-foreground">{item.size}</span>
+ </div>
+ ))}
+ </div>
+ </section>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/investigation-analyses.tsx b/flowsint-app/src/components/dashboard/investigation-analyses.tsx
deleted file mode 100644
index d5c376fe..00000000
--- a/flowsint-app/src/components/dashboard/investigation-analyses.tsx
+++ /dev/null
@@ -1,172 +0,0 @@
-import { useQuery } from '@tanstack/react-query'
-import { analysisService } from '@/api/analysis-service'
-import { Link } from '@tanstack/react-router'
-import { Card, CardContent } from '@/components/ui/card'
-import { Button } from '@/components/ui/button'
-import { Badge } from '@/components/ui/badge'
-import { Skeleton } from '@/components/ui/skeleton'
-import { FileText, Plus, Clock } from 'lucide-react'
-import { formatDistanceToNow } from 'date-fns'
-
-interface InvestigationAnalysesProps {
- investigationId: string
-}
-
-function AnalysisCard({ analysis, investigationId }: { analysis: any; investigationId: string }) {
- return (
- <Link
- to="/dashboard/investigations/$investigationId/$type/$id"
- params={{
- investigationId: investigationId,
- type: 'analysis',
- id: analysis.id
- }}
- className="block"
- >
- <Card className="hover:shadow-lg py-4 transition-all duration-200 cursor-pointer group border-2 hover:border-primary/20">
- <CardContent className="h-full flex flex-col">
- {/* Header with title and type */}
- <div className="flex items-start justify-between mb-3">
- <div className="flex items-center gap-3 flex-1 min-w-0">
- <div className="w-8 h-8 bg-green-100 dark:bg-green-900/20 rounded-lg flex items-center justify-center flex-shrink-0">
- <FileText className="w-4 h-4 text-green-600 dark:text-green-400" />
- </div>
- <div className="flex-1 min-w-0">
- <h3 className="font-semibold text-sm truncate group-hover:text-green-600 dark:group-hover:text-green-400 transition-colors">
- {analysis.title}
- </h3>
- <p className="text-xs text-muted-foreground">Analysis document</p>
- </div>
- </div>
- <Badge variant="secondary" className="text-xs flex-shrink-0 ml-2">
- Doc
- </Badge>
- </div>
-
- {/* Description */}
- <div className="flex-1 mb-3 min-w-0">
- <p className="text-xs text-muted-foreground line-clamp-2">
- {analysis.description || 'No description available'}
- </p>
- </div>
-
- {/* Footer with timestamp */}
- <div className="mt-auto">
- <div className="flex items-center gap-2 text-xs text-muted-foreground">
- <Clock className="w-3 h-3" />
- <span>
- Updated{' '}
- {formatDistanceToNow(new Date(analysis.last_updated_at), { addSuffix: true })}
- </span>
- </div>
- </div>
- </CardContent>
- </Card>
- </Link>
- )
-}
-
-function InvestigationAnalysesSkeleton() {
- return (
- <div className="space-y-4 @container">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <Skeleton className="h-6 w-6" />
- <Skeleton className="h-6 w-48" />
- </div>
- <Skeleton className="h-8 w-24" />
- </div>
- <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
- {Array.from({ length: 8 }).map((_, i) => (
- <Card key={i} className="w-full">
- <CardContent className="p-4 h-full flex flex-col">
- <div className="flex items-start justify-between mb-3">
- <div className="flex items-center gap-3">
- <Skeleton className="w-8 h-8 rounded-lg" />
- <div className="flex-1">
- <Skeleton className="h-4 w-32 mb-1" />
- <Skeleton className="h-3 w-20" />
- </div>
- </div>
- <Skeleton className="h-5 w-8" />
- </div>
- <div className="flex-1 mb-3">
- <Skeleton className="h-3 w-full mb-1" />
- <Skeleton className="h-3 w-3/4" />
- </div>
- <div className="mt-auto">
- <Skeleton className="h-3 w-24" />
- </div>
- </CardContent>
- </Card>
- ))}
- </div>
- </div>
- )
-}
-
-export function InvestigationAnalyses({ investigationId }: InvestigationAnalysesProps) {
- const { data: analyses, isLoading } = useQuery({
- queryKey: ['analyses', 'investigation', investigationId],
- queryFn: () => analysisService.getByInvestigationId(investigationId),
- staleTime: 30000, // 30 seconds
- refetchOnWindowFocus: false,
- refetchOnMount: false
- })
-
- if (isLoading) {
- return <InvestigationAnalysesSkeleton />
- }
-
- if (!analyses || analyses.length === 0) {
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <FileText className="h-6 w-6 text-muted-foreground" />
- <h2 className="text-xl font-semibold">Analyses</h2>
- </div>
- <Button size="sm" variant="outline">
- <Plus className="w-4 h-4 mr-2" />
- New analysis
- </Button>
- </div>
- <div className="text-center py-12">
- <FileText className="h-12 w-12 text-muted-foreground mx-auto mb-4" />
- <h3 className="text-lg font-semibold mb-2">No analyses yet</h3>
- <p className="text-muted-foreground mb-4">
- Create your first analysis to start documenting your findings.
- </p>
- <Button>
- <Plus className="w-4 h-4 mr-2" />
- Create Analysis
- </Button>
- </div>
- </div>
- )
- }
-
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <FileText className="h-6 w-6 text-muted-foreground" />
- <h2 className="text-xl font-semibold">Analyses</h2>
- <span className="text-sm text-muted-foreground">{analyses.length} analyses</span>
- </div>
- <div className="flex items-center gap-2">
- <Button size="sm" variant="outline">
- <Plus className="w-4 h-4 mr-2" />
- New analysis
- </Button>
- </div>
- </div>
-
- <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
- {analyses.slice(0, 8).map((analysis: any) => (
- <AnalysisCard key={analysis.id} analysis={analysis} investigationId={investigationId} />
- ))}
- </div>
- </div>
- )
-}
diff --git a/flowsint-app/src/components/dashboard/investigation-cards.tsx b/flowsint-app/src/components/dashboard/investigation-cards.tsx
deleted file mode 100644
index 8cc7c5c1..00000000
--- a/flowsint-app/src/components/dashboard/investigation-cards.tsx
+++ /dev/null
@@ -1,223 +0,0 @@
-import { useQuery } from '@tanstack/react-query'
-import { investigationService } from '@/api/investigation-service'
-import { Link } from '@tanstack/react-router'
-import { Card, CardContent } from '@/components/ui/card'
-import { Button } from '@/components/ui/button'
-import { Badge } from '@/components/ui/badge'
-import { Skeleton } from '@/components/ui/skeleton'
-import { FolderOpen, Plus, Clock, FileText, BarChart3, Search } from 'lucide-react'
-import { formatDistanceToNow } from 'date-fns'
-import NewInvestigation from '@/components/investigations/new-investigation'
-import { queryKeys } from '@/api/query-keys'
-import ErrorState from '@/components/shared/error-state'
-
-interface InvestigationCardProps {
- investigation: any
-}
-
-function InvestigationCard({ investigation }: InvestigationCardProps) {
- const sketchCount = investigation.sketches?.length || 0
- const analysisCount = investigation.analyses?.length || 0
- const totalItems = sketchCount + analysisCount
-
- return (
- <Link
- to="/dashboard/investigations/$investigationId"
- params={{ investigationId: investigation.id }}
- className="block"
- >
- <Card className="hover:shadow-lg py-4 transition-all duration-200 cursor-pointer group border hover:border-primary/20">
- <CardContent className="h-full flex flex-col">
- {/* Header with title and count */}
- <div className="flex items-start justify-between mb-3">
- <div className="flex items-center gap-3 flex-1 min-w-0">
- <div className="w-8 h-8 bg-primary/10 rounded-lg flex items-center justify-center flex-shrink-0">
- <Search className="w-4 h-4 text-primary" />
- </div>
- <div className="flex-1 min-w-0">
- <h3 className="font-semibold text-sm truncate group-hover:text-primary transition-colors">
- {investigation.name}
- </h3>
- <p className="text-xs text-muted-foreground">{totalItems} items</p>
- </div>
- </div>
- <Badge variant="secondary" className="text-xs flex-shrink-0 ml-2">
- {totalItems}
- </Badge>
- </div>
-
- {/* Stats row */}
- <div className="flex items-center gap-4 text-xs text-muted-foreground mb-3">
- <div className="flex items-center gap-1">
- <BarChart3 className="w-3 h-3" />
- <span>{sketchCount} graphs</span>
- </div>
- <div className="flex items-center gap-1">
- <FileText className="w-3 h-3" />
- <span>{analysisCount} docs</span>
- </div>
- </div>
-
- {/* Footer with timestamp */}
- <div className="mt-auto">
- <div className="flex items-center gap-2 text-xs text-muted-foreground">
- <Clock className="w-3 h-3" />
- <span>
- Updated{' '}
- {formatDistanceToNow(new Date(investigation.last_updated_at), { addSuffix: true })}
- </span>
- </div>
- </div>
- </CardContent>
- </Card>
- </Link>
- )
-}
-
-function InvestigationCardsSkeleton() {
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <Skeleton className="h-6 w-6" />
- <Skeleton className="h-6 w-48" />
- </div>
- <Skeleton className="h-8 w-24" />
- </div>
- <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
- {Array.from({ length: 8 }).map((_, i) => (
- <Card key={i} className="w-full">
- <CardContent className="p-4 h-full flex flex-col">
- <div className="flex items-start justify-between mb-3">
- <div className="flex items-center gap-3">
- <Skeleton className="w-8 h-8 rounded-lg" />
- <div className="flex-1">
- <Skeleton className="h-4 w-32 mb-1" />
- <Skeleton className="h-3 w-16" />
- </div>
- </div>
- <Skeleton className="h-5 w-8" />
- </div>
- <div className="flex gap-4 mb-3">
- <Skeleton className="h-3 w-16" />
- <Skeleton className="h-3 w-16" />
- </div>
- <div className="mt-auto">
- <Skeleton className="h-3 w-24" />
- </div>
- </CardContent>
- </Card>
- ))}
- </div>
- </div>
- )
-}
-
-export function InvestigationCards() {
- const {
- data: investigations,
- isLoading,
- error,
- refetch
- } = useQuery({
- queryKey: queryKeys.investigations.dashboard,
- queryFn: investigationService.get,
- })
-
- if (isLoading) {
- return <InvestigationCardsSkeleton />
- }
-
- if (error) {
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <Search className="h-6 w-6 text-muted-foreground" />
- <h2 className="text-xl font-semibold">Investigations</h2>
- </div>
- <div className="flex items-center gap-2">
- <Button disabled size="sm">
- <Plus className="w-4 h-4 mr-2" />
- New Investigation
- </Button>
- </div>
- </div>
- <ErrorState
- title="Couldn't load investigations"
- description="Something went wrong while fetching data. Please try again."
- error={error}
- onRetry={() => refetch()}
- />
- </div>
- )
- }
-
- if (!investigations || investigations.length === 0) {
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <Search className="h-6 w-6 text-muted-foreground" />
- <h2 className="text-xl font-semibold">Investigations</h2>
- </div>
- <NewInvestigation noDropDown>
- <Button size="sm">
- <Plus className="w-4 h-4 mr-2" />
- New Investigation
- </Button>
- </NewInvestigation>
- </div>
-
- {/* Compact dashed card empty state */}
- <Card className="border-dashed">
- <CardContent className="p-6">
- <div className="w-full flex flex-col items-center text-center gap-3">
- <div className="w-10 h-10 rounded-lg bg-muted flex items-center justify-center">
- <FolderOpen className="h-5 w-5 text-muted-foreground" />
- </div>
- <div className="text-base font-medium">No investigations yet</div>
- <div className="text-sm text-muted-foreground max-w-md">
- Create an investigation to group graphs and analyses by case or topic.
- </div>
- <NewInvestigation noDropDown>
- <Button>
- <Plus className="w-4 h-4 mr-2" />
- Create investigation
- </Button>
- </NewInvestigation>
- </div>
- </CardContent>
- </Card>
- </div>
- )
- }
-
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <Search className="h-6 w-6 text-muted-foreground" />
- <h2 className="text-xl font-semibold">Investigations</h2>
- <span className="text-sm text-muted-foreground">
- {investigations.length} investigations
- </span>
- </div>
- <div className="flex items-center gap-2">
- <NewInvestigation noDropDown>
- <Button size="sm" data-tour-id="create-investigation">
- <Plus className="w-4 h-4 mr-2" />
- New Investigation
- </Button>
- </NewInvestigation>
- </div>
- </div>
-
- <div className="grid grid-cols-1 cq-xs:grid-cols-2 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4" data-tour-id="investigation-list">
- {investigations.slice(0, 8).map((investigation: any) => (
- <InvestigationCard key={investigation.id} investigation={investigation} />
- ))}
- </div>
- </div>
- )
-}
diff --git a/flowsint-app/src/components/dashboard/investigation-skeleton.tsx b/flowsint-app/src/components/dashboard/investigation-skeleton.tsx
index 2f0a0671..f4508190 100644
--- a/flowsint-app/src/components/dashboard/investigation-skeleton.tsx
+++ b/flowsint-app/src/components/dashboard/investigation-skeleton.tsx
@@ -2,95 +2,95 @@ import { Skeleton } from '@/components/ui/skeleton'
import { Card, CardContent, CardHeader } from '@/components/ui/card'
export function InvestigationSkeleton() {
- return (
- <div className="h-full w-full px-4 py-12 bg-background overflow-auto">
- <div
- className="max-w-4xl mx-auto flex flex-col gap-12 items-center justify-start"
- style={{ containerType: 'inline-size' }}
- >
- {/* Recent Investigations Skeleton */}
- <div className="w-full space-y-4">
- <div className="flex items-center justify-between">
- <Skeleton className="h-7 w-48" />
- <Skeleton className="h-9 w-28" />
- </div>
- <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
- {[...Array(2)].map((_, i) => (
- <Card key={i} className="p-4">
- <div className="space-y-3">
- <div className="flex items-center justify-between">
- <Skeleton className="h-5 w-32" />
- <Skeleton className="h-4 w-20" />
- </div>
- <Skeleton className="h-4 w-full" />
- <Skeleton className="h-4 w-3/4" />
- <div className="flex items-center gap-2">
- <Skeleton className="h-4 w-4" />
- <Skeleton className="h-4 w-24" />
- </div>
+ return (
+ <div className="h-full w-full px-4 py-12 bg-background overflow-auto">
+ <div
+ className="max-w-6xl mx-auto flex flex-col gap-12 items-center justify-start"
+ style={{ containerType: 'inline-size' }}
+ >
+ {/* Recent Investigations Skeleton */}
+ <div className="w-full space-y-4">
+ <div className="flex items-center justify-between">
+ <Skeleton className="h-7 w-48" />
+ <Skeleton className="h-9 w-28" />
+ </div>
+ <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
+ {[...Array(2)].map((_, i) => (
+ <Card key={i} className="p-4">
+ <div className="space-y-3">
+ <div className="flex items-center justify-between">
+ <Skeleton className="h-5 w-32" />
+ <Skeleton className="h-4 w-20" />
+ </div>
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-3/4" />
+ <div className="flex items-center gap-2">
+ <Skeleton className="h-4 w-4" />
+ <Skeleton className="h-4 w-24" />
+ </div>
+ </div>
+ </Card>
+ ))}
+ </div>
</div>
- </Card>
- ))}
- </div>
- </div>
- {/* Get Started Section Skeleton */}
- <div className="w-full space-y-4">
- <Skeleton className="h-7 w-48" />
- <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
- {[...Array(3)].map((_, i) => (
- <Card key={i}>
- <CardHeader className="flex flex-row items-center gap-3 pb-2">
- <Skeleton className="h-9 w-9 rounded-lg" />
- <Skeleton className="h-6 w-32" />
- </CardHeader>
- <CardContent>
- <Skeleton className="h-4 w-full mb-2" />
- <Skeleton className="h-4 w-3/4" />
- </CardContent>
- </Card>
- ))}
- </div>
- </div>
+ {/* Get Started Section Skeleton */}
+ <div className="w-full space-y-4">
+ <Skeleton className="h-7 w-48" />
+ <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
+ {[...Array(3)].map((_, i) => (
+ <Card key={i}>
+ <CardHeader className="flex flex-row items-center gap-3 pb-2">
+ <Skeleton className="h-9 w-9 rounded-lg" />
+ <Skeleton className="h-6 w-32" />
+ </CardHeader>
+ <CardContent>
+ <Skeleton className="h-4 w-full mb-2" />
+ <Skeleton className="h-4 w-3/4" />
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+ </div>
- {/* Discover Section Skeleton */}
- <div className="w-full space-y-4">
- <Skeleton className="h-7 w-48" />
- <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
- {[...Array(2)].map((_, i) => (
- <Card key={i}>
- <CardHeader className="flex flex-row items-center gap-3 pb-2">
- <Skeleton className="h-9 w-9 rounded-lg" />
- <Skeleton className="h-6 w-40" />
- </CardHeader>
- <CardContent>
- <Skeleton className="h-4 w-full mb-2" />
- <Skeleton className="h-4 w-3/4" />
- </CardContent>
- </Card>
- ))}
- </div>
- </div>
+ {/* Discover Section Skeleton */}
+ <div className="w-full space-y-4">
+ <Skeleton className="h-7 w-48" />
+ <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
+ {[...Array(2)].map((_, i) => (
+ <Card key={i}>
+ <CardHeader className="flex flex-row items-center gap-3 pb-2">
+ <Skeleton className="h-9 w-9 rounded-lg" />
+ <Skeleton className="h-6 w-40" />
+ </CardHeader>
+ <CardContent>
+ <Skeleton className="h-4 w-full mb-2" />
+ <Skeleton className="h-4 w-3/4" />
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+ </div>
- {/* Useful Resources Skeleton */}
- <div className="w-full space-y-4">
- <Skeleton className="h-7 w-48" />
- <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
- {[...Array(2)].map((_, i) => (
- <Card key={i}>
- <CardHeader className="flex flex-row items-center gap-3 pb-2">
- <Skeleton className="h-9 w-9 rounded-lg" />
- <Skeleton className="h-6 w-40" />
- </CardHeader>
- <CardContent>
- <Skeleton className="h-4 w-full mb-2" />
- <Skeleton className="h-4 w-3/4" />
- </CardContent>
- </Card>
- ))}
- </div>
+ {/* Useful Resources Skeleton */}
+ <div className="w-full space-y-4">
+ <Skeleton className="h-7 w-48" />
+ <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
+ {[...Array(2)].map((_, i) => (
+ <Card key={i}>
+ <CardHeader className="flex flex-row items-center gap-3 pb-2">
+ <Skeleton className="h-9 w-9 rounded-lg" />
+ <Skeleton className="h-6 w-40" />
+ </CardHeader>
+ <CardContent>
+ <Skeleton className="h-4 w-full mb-2" />
+ <Skeleton className="h-4 w-3/4" />
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+ </div>
+ </div>
</div>
- </div>
- </div>
- )
+ )
}
diff --git a/flowsint-app/src/components/dashboard/investigation-sketches.tsx b/flowsint-app/src/components/dashboard/investigation-sketches.tsx
deleted file mode 100644
index bbf31e35..00000000
--- a/flowsint-app/src/components/dashboard/investigation-sketches.tsx
+++ /dev/null
@@ -1,198 +0,0 @@
-import { useQuery } from '@tanstack/react-query'
-import { investigationService } from '@/api/investigation-service'
-import { Link } from '@tanstack/react-router'
-import { Card, CardContent } from '@/components/ui/card'
-import { Button } from '@/components/ui/button'
-import { Badge } from '@/components/ui/badge'
-import { Skeleton } from '@/components/ui/skeleton'
-import { BarChart3, Plus, Clock } from 'lucide-react'
-import { formatDistanceToNow } from 'date-fns'
-import NewSketch from '@/components/graphs/new-sketch'
-import ErrorState from '@/components/shared/error-state'
-
-interface InvestigationSketchesProps {
- investigationId: string
- title: string
-}
-
-function SketchCard({ sketch, investigationId }: { sketch: any; investigationId: string }) {
- return (
- <Link
- to="/dashboard/investigations/$investigationId/$type/$id"
- params={{
- investigationId: investigationId,
- type: 'graph',
- id: sketch.id
- }}
- className="block"
- >
- <Card className="hover:shadow-lg py-4 transition-all duration-200 cursor-pointer group border-2 hover:border-primary/20">
- <CardContent className="h-full flex flex-col">
- {/* Header with title and type */}
- <div className="flex items-start justify-between mb-3">
- <div className="flex items-center gap-3 flex-1 min-w-0">
- <div className="w-8 h-8 bg-blue-100 dark:bg-blue-900/20 rounded-lg flex items-center justify-center flex-shrink-0">
- <BarChart3 className="w-4 h-4 text-blue-600 dark:text-blue-400" />
- </div>
- <div className="flex-1 min-w-0">
- <h3 className="font-semibold text-sm truncate group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">
- {sketch.title}
- </h3>
- <p className="text-xs text-muted-foreground">Graph sketch</p>
- </div>
- </div>
- <Badge variant="secondary" className="text-xs flex-shrink-0 ml-2">
- Graph
- </Badge>
- </div>
-
- {/* Description */}
- <div className="flex-1 mb-3 min-w-0">
- <p className="text-xs text-muted-foreground line-clamp-2">
- {sketch.description || 'No description available'}
- </p>
- </div>
-
- {/* Footer with timestamp */}
- <div className="mt-auto">
- <div className="flex items-center gap-2 text-xs text-muted-foreground">
- <Clock className="w-3 h-3" />
- <span>
- Updated {formatDistanceToNow(new Date(sketch.last_updated_at), { addSuffix: true })}
- </span>
- </div>
- </div>
- </CardContent>
- </Card>
- </Link>
- )
-}
-
-function InvestigationSketchesSkeleton() {
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <Skeleton className="h-6 w-6" />
- <Skeleton className="h-6 w-48" />
- </div>
- <Skeleton className="h-8 w-24" />
- </div>
- <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
- {Array.from({ length: 8 }).map((_, i) => (
- <Card key={i} className="w-full">
- <CardContent className="p-4 h-full flex flex-col">
- <div className="flex items-start justify-between mb-3">
- <div className="flex items-center gap-3">
- <Skeleton className="w-8 h-8 rounded-lg" />
- <div className="flex-1">
- <Skeleton className="h-4 w-32 mb-1" />
- <Skeleton className="h-3 w-20" />
- </div>
- </div>
- <Skeleton className="h-5 w-8" />
- </div>
- <div className="flex-1 mb-3">
- <Skeleton className="h-3 w-full mb-1" />
- <Skeleton className="h-3 w-3/4" />
- </div>
- <div className="mt-auto">
- <Skeleton className="h-3 w-24" />
- </div>
- </CardContent>
- </Card>
- ))}
- </div>
- </div>
- )
-}
-
-export function InvestigationSketches({ investigationId, title }: InvestigationSketchesProps) {
- const {
- data: investigation,
- isLoading,
- error,
- refetch
- } = useQuery({
- queryKey: ['investigation', 'sketches', investigationId],
- queryFn: () => investigationService.getById(investigationId),
- staleTime: 30000, // 30 seconds
- refetchOnWindowFocus: false,
- refetchOnMount: false
- })
-
- if (isLoading) {
- return <InvestigationSketchesSkeleton />
- }
-
- if (error) {
- return (
- <ErrorState
- title="Couldn't load sketches"
- description="Something went wrong while fetching data. Please try again."
- error={error}
- onRetry={() => refetch()}
- />
- )
- }
-
- const sketches = investigation?.sketches || []
-
- if (sketches.length === 0) {
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <BarChart3 className="h-6 w-6 text-muted-foreground" />
- <h2 className="text-xl font-semibold">Sketches</h2>
- </div>
- <NewSketch>
- <Button size="sm">
- <Plus className="w-4 h-4 mr-2" />
- New Sketch
- </Button>
- </NewSketch>
- </div>
- <div className="text-center py-12">
- <BarChart3 className="h-12 w-12 text-muted-foreground mx-auto mb-4" />
- <h3 className="text-lg font-semibold mb-2">No sketches yet</h3>
- <p className="text-muted-foreground mb-4">
- Create your first sketch to start visualizing your investigation data.
- </p>
- <NewSketch>
- <Button>
- <Plus className="w-4 h-4 mr-2" />
- Create Sketch
- </Button>
- </NewSketch>
- </div>
- </div>
- )
- }
-
- return (
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <BarChart3 className="h-6 w-6 text-muted-foreground" />
- <h2 className="text-xl font-semibold">{title}</h2>
- <span className="text-sm text-muted-foreground">{sketches.length} sketches</span>
- </div>
- <div className="flex items-center gap-2">
- <NewSketch>
- <Button size="sm">
- <Plus className="w-4 h-4 mr-2" />
- New Sketch
- </Button>
- </NewSketch>
- </div>
- </div>
-
- <div className="grid grid-cols-1 cq-sm:grid-cols-2 cq-md:grid-cols-3 cq-lg:grid-cols-4 cq-xl:grid-cols-5 gap-4">
- {sketches.slice(0, 8).map((sketch: any) => (
- <SketchCard key={sketch.id} sketch={sketch} investigationId={investigationId} />
- ))}
- </div>
- </div>
- )
-}
diff --git a/flowsint-app/src/components/dashboard/investigations-list.tsx b/flowsint-app/src/components/dashboard/investigations-list.tsx
new file mode 100644
index 00000000..84edd12d
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/investigations-list.tsx
@@ -0,0 +1,167 @@
+"use client"
+
+import { FolderOpen, MoreHorizontal, FileText, Network } from "lucide-react"
+import { cn } from "@/lib/utils"
+import { Link } from "@tanstack/react-router"
+import { Investigation } from "@/types"
+import { formatDistanceToNow } from "date-fns"
+import { useMemo } from "react"
+
+interface InvestigationsListProps {
+ investigations: Investigation[]
+ view: "grid" | "list"
+ filter: "all" | "active" | "closed"
+ setFilter: (filter: "all" | "active" | "closed") => void
+ casesCount: number,
+ activeCasesCount: number
+}
+
+export function InvestigationsList({ investigations, view, filter, setFilter, casesCount, activeCasesCount }: InvestigationsListProps) {
+ const filteredInvestigations = investigations.filter((inv) => {
+ if (filter === "all") return true
+ return inv.status === filter
+ })
+
+ const filters = useMemo(() => [
+ { label: "All", value: "all", count: casesCount },
+ { label: "Active", value: "active", count: activeCasesCount },
+ { label: "Closed", value: "closed", count: casesCount - activeCasesCount },
+ ], [casesCount, activeCasesCount])
+
+ return (
+ <div>
+ <div className="flex items-center gap-1 mb-4">
+ {filters.map((f) => (
+ <button
+ key={f.value}
+ onClick={() => setFilter(f.value as "all" | "active" | "closed")}
+ className={cn(
+ "px-3 py-1.5 text-sm rounded-md transition-colors",
+ filter === f.value ? "bg-muted text-foreground" : "text-muted-foreground hover:text-foreground",
+ )}
+ >
+ {f.label}
+ <span className="ml-1.5 text-xs opacity-60">{f.count}</span>
+ </button>
+ ))}
+ </div>
+
+ {view === "list" ? (
+ <div className="border border-border rounded-lg overflow-hidden">
+ <table className="w-full">
+ <thead>
+ <tr className="border-b border-border bg-muted/30">
+ <th className="text-left text-xs font-medium text-muted-foreground px-4 py-2.5">Name</th>
+ <th className="text-left text-xs font-medium text-muted-foreground px-4 py-2.5 w-24">Status</th>
+ <th className="text-left text-xs font-medium text-muted-foreground px-4 py-2.5 w-28">Updated</th>
+ <th className="w-10"></th>
+ </tr>
+ </thead>
+ <tbody>
+ {filteredInvestigations.map((inv) => (
+ <tr
+ key={inv.id}
+ className="border-b border-border last:border-0 hover:bg-muted/20 transition-colors group"
+ >
+ <td className="px-4 py-3">
+ <Link
+ to="/dashboard/investigations/$investigationId"
+ params={{ investigationId: inv.id }}
+ className="block"
+ >
+ <div className="flex items-center gap-3">
+ <FolderOpen className="w-4 h-4 text-muted-foreground shrink-0" />
+ <div className="min-w-0">
+ <p className="text-sm font-medium text-foreground truncate">{inv.name}</p>
+ <p className="text-xs text-muted-foreground truncate">{inv.description}</p>
+ </div>
+ </div>
+ </Link>
+ </td>
+ <td className="px-4 py-3">
+ <StatusBadge status={inv.status} />
+ </td>
+ <td className="px-4 py-3">
+ <span className="text-xs text-muted-foreground">{formatDistanceToNow(new Date(inv.last_updated_at), {
+ addSuffix: true
+ })}</span>
+ </td>
+ <td className="px-4 py-3">
+ <button className="p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity">
+ <MoreHorizontal className="w-4 h-4 text-muted-foreground" />
+ </button>
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </div>
+ ) : (
+ <div className="grid grid-cols-2 gap-3">
+ {filteredInvestigations.map((inv) => (
+ <Link
+ to="/dashboard/investigations/$investigationId"
+ params={{ investigationId: inv.id }}
+ className="block p-4 border border-border rounded-lg hover:border-muted-foreground/30 transition-colors group"
+ >
+ <div className="flex items-start justify-between mb-3">
+ <div className="flex items-center gap-2">
+ <FolderOpen className="w-4 h-4 text-muted-foreground" />
+ <StatusBadge status={inv.status} />
+ </div>
+ <button className="p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity">
+ <MoreHorizontal className="w-4 h-4 text-muted-foreground" />
+ </button>
+ </div>
+ <h3 className="text-sm font-medium text-foreground mb-1 truncate">{inv.name}</h3>
+ <p className="text-xs text-muted-foreground mb-4 line-clamp-2">{inv.description}</p>
+ <div className="flex items-center justify-between">
+ <div className="flex items-center gap-3 text-xs text-muted-foreground">
+ <span className="flex items-center gap-1">
+ <Network className="w-3 h-3" /> {inv.sketches.length}
+ </span>
+ <span className="flex items-center gap-1">
+ <FileText className="w-3 h-3" /> {inv.analyses.length}
+ </span>
+ </div>
+ {/* <div className="flex -space-x-1">
+ {inv.investigators.map((initials, i) => (
+ <div
+ key={i}
+ className="w-5 h-5 rounded-full bg-muted border border-background flex items-center justify-center"
+ >
+ <span className="text-[9px] font-medium text-muted-foreground">{initials}</span>
+ </div>
+ ))}
+ </div> */}
+ </div>
+ </Link>
+ ))}
+ </div>
+ )}
+ </div>
+ )
+}
+
+function StatusBadge({ status }: { status: string }) {
+ return (
+ <span
+ className={cn(
+ "inline-flex items-center gap-1.5 text-xs",
+ status === "active" && "text-success",
+ status === "closed" && "text-muted-foreground",
+ status === "on-hold" && "text-warning",
+ )}
+ >
+ <span
+ className={cn(
+ "w-1.5 h-1.5 rounded-full",
+ status === "active" && "bg-success",
+ status === "closed" && "bg-muted-foreground/50",
+ status === "on-hold" && "bg-warning",
+ )}
+ />
+ {status === "on-hold" ? "On Hold" : status.charAt(0).toUpperCase() + status.slice(1)}
+ </span>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/main-chart.tsx b/flowsint-app/src/components/dashboard/main-chart.tsx
deleted file mode 100644
index 85b83910..00000000
--- a/flowsint-app/src/components/dashboard/main-chart.tsx
+++ /dev/null
@@ -1,265 +0,0 @@
-import * as React from 'react'
-import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
-
-import { useIsMobile } from '@/hooks/use-mobile'
-import {
- Card,
- CardAction,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle
-} from '@/components/ui/card'
-import {
- ChartConfig,
- ChartContainer,
- ChartTooltip,
- ChartTooltipContent
-} from '@/components/ui/chart'
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue
-} from '@/components/ui/select'
-import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'
-
-export const description = 'An interactive area chart'
-
-const chartData = [
- { date: '2024-04-01', desktop: 222, mobile: 150 },
- { date: '2024-04-02', desktop: 97, mobile: 180 },
- { date: '2024-04-03', desktop: 167, mobile: 120 },
- { date: '2024-04-04', desktop: 242, mobile: 260 },
- { date: '2024-04-05', desktop: 373, mobile: 290 },
- { date: '2024-04-06', desktop: 301, mobile: 340 },
- { date: '2024-04-07', desktop: 245, mobile: 180 },
- { date: '2024-04-08', desktop: 409, mobile: 320 },
- { date: '2024-04-09', desktop: 59, mobile: 110 },
- { date: '2024-04-10', desktop: 261, mobile: 190 },
- { date: '2024-04-11', desktop: 327, mobile: 350 },
- { date: '2024-04-12', desktop: 292, mobile: 210 },
- { date: '2024-04-13', desktop: 342, mobile: 380 },
- { date: '2024-04-14', desktop: 137, mobile: 220 },
- { date: '2024-04-15', desktop: 120, mobile: 170 },
- { date: '2024-04-16', desktop: 138, mobile: 190 },
- { date: '2024-04-17', desktop: 446, mobile: 360 },
- { date: '2024-04-18', desktop: 364, mobile: 410 },
- { date: '2024-04-19', desktop: 243, mobile: 180 },
- { date: '2024-04-20', desktop: 89, mobile: 150 },
- { date: '2024-04-21', desktop: 137, mobile: 200 },
- { date: '2024-04-22', desktop: 224, mobile: 170 },
- { date: '2024-04-23', desktop: 138, mobile: 230 },
- { date: '2024-04-24', desktop: 387, mobile: 290 },
- { date: '2024-04-25', desktop: 215, mobile: 250 },
- { date: '2024-04-26', desktop: 75, mobile: 130 },
- { date: '2024-04-27', desktop: 383, mobile: 420 },
- { date: '2024-04-28', desktop: 122, mobile: 180 },
- { date: '2024-04-29', desktop: 315, mobile: 240 },
- { date: '2024-04-30', desktop: 454, mobile: 380 },
- { date: '2024-05-01', desktop: 165, mobile: 220 },
- { date: '2024-05-02', desktop: 293, mobile: 310 },
- { date: '2024-05-03', desktop: 247, mobile: 190 },
- { date: '2024-05-04', desktop: 385, mobile: 420 },
- { date: '2024-05-05', desktop: 481, mobile: 390 },
- { date: '2024-05-06', desktop: 498, mobile: 520 },
- { date: '2024-05-07', desktop: 388, mobile: 300 },
- { date: '2024-05-08', desktop: 149, mobile: 210 },
- { date: '2024-05-09', desktop: 227, mobile: 180 },
- { date: '2024-05-10', desktop: 293, mobile: 330 },
- { date: '2024-05-11', desktop: 335, mobile: 270 },
- { date: '2024-05-12', desktop: 197, mobile: 240 },
- { date: '2024-05-13', desktop: 197, mobile: 160 },
- { date: '2024-05-14', desktop: 448, mobile: 490 },
- { date: '2024-05-15', desktop: 473, mobile: 380 },
- { date: '2024-05-16', desktop: 338, mobile: 400 },
- { date: '2024-05-17', desktop: 499, mobile: 420 },
- { date: '2024-05-18', desktop: 315, mobile: 350 },
- { date: '2024-05-19', desktop: 235, mobile: 180 },
- { date: '2024-05-20', desktop: 177, mobile: 230 },
- { date: '2024-05-21', desktop: 82, mobile: 140 },
- { date: '2024-05-22', desktop: 81, mobile: 120 },
- { date: '2024-05-23', desktop: 252, mobile: 290 },
- { date: '2024-05-24', desktop: 294, mobile: 220 },
- { date: '2024-05-25', desktop: 201, mobile: 250 },
- { date: '2024-05-26', desktop: 213, mobile: 170 },
- { date: '2024-05-27', desktop: 420, mobile: 460 },
- { date: '2024-05-28', desktop: 233, mobile: 190 },
- { date: '2024-05-29', desktop: 78, mobile: 130 },
- { date: '2024-05-30', desktop: 340, mobile: 280 },
- { date: '2024-05-31', desktop: 178, mobile: 230 },
- { date: '2024-06-01', desktop: 178, mobile: 200 },
- { date: '2024-06-02', desktop: 470, mobile: 410 },
- { date: '2024-06-03', desktop: 103, mobile: 160 },
- { date: '2024-06-04', desktop: 439, mobile: 380 },
- { date: '2024-06-05', desktop: 88, mobile: 140 },
- { date: '2024-06-06', desktop: 294, mobile: 250 },
- { date: '2024-06-07', desktop: 323, mobile: 370 },
- { date: '2024-06-08', desktop: 385, mobile: 320 },
- { date: '2024-06-09', desktop: 438, mobile: 480 },
- { date: '2024-06-10', desktop: 155, mobile: 200 },
- { date: '2024-06-11', desktop: 92, mobile: 150 },
- { date: '2024-06-12', desktop: 492, mobile: 420 },
- { date: '2024-06-13', desktop: 81, mobile: 130 },
- { date: '2024-06-14', desktop: 426, mobile: 380 },
- { date: '2024-06-15', desktop: 307, mobile: 350 },
- { date: '2024-06-16', desktop: 371, mobile: 310 },
- { date: '2024-06-17', desktop: 475, mobile: 520 },
- { date: '2024-06-18', desktop: 107, mobile: 170 },
- { date: '2024-06-19', desktop: 341, mobile: 290 },
- { date: '2024-06-20', desktop: 408, mobile: 450 },
- { date: '2024-06-21', desktop: 169, mobile: 210 },
- { date: '2024-06-22', desktop: 317, mobile: 270 },
- { date: '2024-06-23', desktop: 480, mobile: 530 },
- { date: '2024-06-24', desktop: 132, mobile: 180 },
- { date: '2024-06-25', desktop: 141, mobile: 190 },
- { date: '2024-06-26', desktop: 434, mobile: 380 },
- { date: '2024-06-27', desktop: 448, mobile: 490 },
- { date: '2024-06-28', desktop: 149, mobile: 200 },
- { date: '2024-06-29', desktop: 103, mobile: 160 },
- { date: '2024-06-30', desktop: 446, mobile: 400 }
-]
-
-const chartConfig = {
- visitors: {
- label: 'Visitors'
- },
- desktop: {
- label: 'Desktop',
- color: 'var(--primary)'
- },
- mobile: {
- label: 'Mobile',
- color: 'var(--primary)'
- }
-} satisfies ChartConfig
-
-export function ChartAreaInteractive() {
- const isMobile = useIsMobile()
- const [timeRange, setTimeRange] = React.useState('90d')
-
- React.useEffect(() => {
- if (isMobile) {
- setTimeRange('7d')
- }
- }, [isMobile])
-
- const filteredData = chartData.filter((item) => {
- const date = new Date(item.date)
- const referenceDate = new Date('2024-06-30')
- let daysToSubtract = 90
- if (timeRange === '30d') {
- daysToSubtract = 30
- } else if (timeRange === '7d') {
- daysToSubtract = 7
- }
- const startDate = new Date(referenceDate)
- startDate.setDate(startDate.getDate() - daysToSubtract)
- return date >= startDate
- })
-
- return (
- <Card className="@container/card">
- <CardHeader>
- <CardTitle>Total Visitors</CardTitle>
- <CardDescription>
- <span className="hidden @[540px]/card:block">Total for the last 3 months</span>
- <span className="@[540px]/card:hidden">Last 3 months</span>
- </CardDescription>
- <CardAction>
- <ToggleGroup
- type="single"
- value={timeRange}
- onValueChange={setTimeRange}
- variant="outline"
- className="hidden *:data-[slot=toggle-group-item]:!px-4 @[767px]/card:flex"
- >
- <ToggleGroupItem value="90d">Last 3 months</ToggleGroupItem>
- <ToggleGroupItem value="30d">Last 30 days</ToggleGroupItem>
- <ToggleGroupItem value="7d">Last 7 days</ToggleGroupItem>
- </ToggleGroup>
- <Select value={timeRange} onValueChange={setTimeRange}>
- <SelectTrigger
- className="flex w-40 **:data-[slot=select-value]:block **:data-[slot=select-value]:truncate @[767px]/card:hidden"
- size="sm"
- aria-label="Select a value"
- >
- <SelectValue placeholder="Last 3 months" />
- </SelectTrigger>
- <SelectContent className="rounded-xl">
- <SelectItem value="90d" className="rounded-lg">
- Last 3 months
- </SelectItem>
- <SelectItem value="30d" className="rounded-lg">
- Last 30 days
- </SelectItem>
- <SelectItem value="7d" className="rounded-lg">
- Last 7 days
- </SelectItem>
- </SelectContent>
- </Select>
- </CardAction>
- </CardHeader>
- <CardContent className="px-2 pt-4 sm:px-6 sm:pt-6">
- <ChartContainer config={chartConfig} className="aspect-auto h-[250px] w-full">
- <AreaChart data={filteredData}>
- <defs>
- <linearGradient id="fillDesktop" x1="0" y1="0" x2="0" y2="1">
- <stop offset="5%" stopColor="var(--color-desktop)" stopOpacity={1.0} />
- <stop offset="95%" stopColor="var(--color-desktop)" stopOpacity={0.1} />
- </linearGradient>
- <linearGradient id="fillMobile" x1="0" y1="0" x2="0" y2="1">
- <stop offset="5%" stopColor="var(--color-mobile)" stopOpacity={0.8} />
- <stop offset="95%" stopColor="var(--color-mobile)" stopOpacity={0.1} />
- </linearGradient>
- </defs>
- <CartesianGrid vertical={false} />
- <XAxis
- dataKey="date"
- tickLine={false}
- axisLine={false}
- tickMargin={8}
- minTickGap={32}
- tickFormatter={(value) => {
- const date = new Date(value)
- return date.toLocaleDateString('en-US', {
- month: 'short',
- day: 'numeric'
- })
- }}
- />
- <ChartTooltip
- cursor={false}
- content={
- <ChartTooltipContent
- labelFormatter={(value) => {
- return new Date(value).toLocaleDateString('en-US', {
- month: 'short',
- day: 'numeric'
- })
- }}
- indicator="dot"
- />
- }
- />
- <Area
- dataKey="mobile"
- type="natural"
- fill="url(#fillMobile)"
- stroke="var(--color-mobile)"
- stackId="a"
- />
- <Area
- dataKey="desktop"
- type="natural"
- fill="url(#fillDesktop)"
- stroke="var(--color-desktop)"
- stackId="a"
- />
- </AreaChart>
- </ChartContainer>
- </CardContent>
- </Card>
- )
-}
diff --git a/flowsint-app/src/components/dashboard/metrics-grid.tsx b/flowsint-app/src/components/dashboard/metrics-grid.tsx
new file mode 100644
index 00000000..18800112
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/metrics-grid.tsx
@@ -0,0 +1,34 @@
+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/recent-activity.tsx b/flowsint-app/src/components/dashboard/recent-activity.tsx
new file mode 100644
index 00000000..7557f09e
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/recent-activity.tsx
@@ -0,0 +1,61 @@
+import { FileText, Network, Upload, UserPlus, CheckCircle } from "lucide-react"
+
+const activities = [
+ {
+ icon: FileText,
+ text: "New analysis added to APT-29 Campaign",
+ time: "2 hours ago",
+ },
+ {
+ icon: Network,
+ text: "Sketch updated in Ransomware Incident",
+ time: "5 hours ago",
+ },
+ {
+ icon: Upload,
+ text: "Evidence uploaded to Data Breach case",
+ time: "Yesterday",
+ },
+ {
+ icon: UserPlus,
+ text: "Sarah Kim joined Phishing Investigation",
+ time: "2 days ago",
+ },
+ {
+ icon: CheckCircle,
+ text: "Phishing Investigation Q4 closed",
+ time: "3 days ago",
+ },
+ {
+ icon: FileText,
+ text: "Draft analysis saved in Insider Threat",
+ time: "4 days ago",
+ },
+]
+
+export function RecentActivity() {
+ return (
+ <div>
+ <h2 className="text-sm font-medium text-foreground mb-4">Recent Activity</h2>
+ <div className="space-y-1">
+ {activities.map((activity, i) => (
+ <div
+ key={i}
+ className="flex items-start gap-3 px-3 py-2.5 rounded-md hover:bg-muted/30 transition-colors cursor-pointer"
+ >
+ <div className="p-1.5 rounded bg-muted/50 mt-0.5">
+ <activity.icon className="w-3 h-3 text-muted-foreground" />
+ </div>
+ <div className="flex-1 min-w-0">
+ <p className="text-sm text-foreground leading-snug">{activity.text}</p>
+ <p className="text-xs text-muted-foreground mt-0.5">{activity.time}</p>
+ </div>
+ </div>
+ ))}
+ </div>
+ <button className="w-full mt-3 py-2 text-xs text-muted-foreground hover:text-foreground transition-colors">
+ View all activity
+ </button>
+ </div>
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/recent-investigations.tsx b/flowsint-app/src/components/dashboard/recent-investigations.tsx
deleted file mode 100644
index b38f0e1b..00000000
--- a/flowsint-app/src/components/dashboard/recent-investigations.tsx
+++ /dev/null
@@ -1,110 +0,0 @@
-import { PlusCircle } from 'lucide-react'
-import { Link } from '@tanstack/react-router'
-import { Button } from '@/components/ui/button'
-import { formatDistanceToNow } from 'date-fns'
-import { investigationService } from '@/api/investigation-service'
-import { useQuery } from '@tanstack/react-query'
-import { Skeleton } from '@/components/ui/skeleton'
-import ErrorState from '@/components/shared/error-state'
-
-function LoadingSkeleton() {
- return (
- <div className="w-full mt-2">
- <Skeleton className="h-7 w-48 mb-2" />
- <div className="border-b border-border mb-2" />
- <div className="flex flex-col gap-2">
- {Array.from({ length: 3 }).map((_, i) => (
- <div key={i} className="flex items-center justify-between px-4 py-3">
- <div className="flex items-center gap-3">
- <Skeleton className="h-10 w-10 rounded-lg" />
- <div className="flex flex-col gap-2">
- <Skeleton className="h-5 w-32" />
- <Skeleton className="h-4 w-24" />
- </div>
- </div>
- <Skeleton className="h-8 w-16" />
- </div>
- ))}
- </div>
- </div>
- )
-}
-
-export function RecentInvestigations() {
- const {
- data: investigations = [],
- isLoading,
- error,
- refetch
- } = useQuery({
- queryKey: ['recent-investigations'],
- queryFn: () => investigationService.get()
- })
-
- if (isLoading) {
- return <LoadingSkeleton />
- }
-
- if (error) {
- return (
- <ErrorState
- title="Couldn't load recent investigations"
- description="Something went wrong while fetching data. Please try again."
- error={error}
- onRetry={() => refetch()}
- />
- )
- }
-
- if (!investigations?.length) {
- return (
- <div className="w-full mt-2">
- <h2 className="text-xl font-bold mb-2 text-foreground">Recent investigations</h2>
- <div className="border-b border-border mb-2" />
- <div className="flex items-center gap-3 px-2 py-3">
- <span className="bg-muted rounded-full p-2">
- <PlusCircle className="w-5 h-5 text-muted-foreground" />
- </span>
- <span className="text-foreground font-medium">No recent investigations</span>
- </div>
- </div>
- )
- }
-
- return (
- <div className="w-full mt-2">
- <h2 className="text-xl font-bold mb-2 text-foreground">
- Recent investigations ({investigations.length})
- </h2>
- <div className="border-b border-border mb-2" />
- <div className="flex flex-col gap-2">
- {investigations.slice(0, 5).map((investigation) => (
- <Link
- key={investigation.id}
- to="/dashboard/investigations/$investigationId"
- params={{ investigationId: investigation.id }}
- className="flex items-center justify-between px-4 py-3 rounded-lg hover:bg-muted/50 transition-colors"
- >
- <div className="flex items-center gap-3">
- <span className="bg-muted rounded-lg p-2">
- <PlusCircle className="w-4 h-4 text-muted-foreground" />
- </span>
- <div className="flex flex-col">
- <span className="font-medium text-foreground">{investigation.name}</span>
- <span className="text-sm text-muted-foreground">
- Updated{' '}
- {formatDistanceToNow(new Date(investigation.last_updated_at), {
- addSuffix: true
- })}
- </span>
- </div>
- </div>
- <Button variant="ghost" size="sm">
- Open
- </Button>
- </Link>
- ))}
- </div>
- </div>
- )
-}
diff --git a/flowsint-app/src/components/dashboard/section-cards.tsx b/flowsint-app/src/components/dashboard/section-cards.tsx
deleted file mode 100644
index 81fd1183..00000000
--- a/flowsint-app/src/components/dashboard/section-cards.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-import { TrendingUp, TrendingDown } from 'lucide-react'
-import { Badge } from '@/components/ui/badge'
-import {
- Card,
- CardAction,
- CardDescription,
- CardFooter,
- CardHeader,
- CardTitle
-} from '@/components/ui/card'
-
-export function SectionCards() {
- return (
- <div className="*:data-[slot=card]:from-primary/5 *:data-[slot=card]:to-card dark:*:data-[slot=card]:bg-card grid grid-cols-1 gap-4 *:data-[slot=card]:bg-gradient-to-t *:data-[slot=card]:shadow-xs @xl/main:grid-cols-2 @2xl/main:grid-cols-4 @5xl/main:grid-cols-4">
- <Card className="@container/card">
- <CardHeader>
- <CardDescription>Total items</CardDescription>
- <CardTitle className="text-2xl font-semibold tabular-nums @[250px]/card:text-3xl">
- 127981
- </CardTitle>
- <CardAction>
- <Badge variant="outline">
- <TrendingUp />
- +12.5%
- </Badge>
- </CardAction>
- </CardHeader>
- <CardFooter className="flex-col items-start gap-1.5 text-sm">
- <div className="line-clamp-1 flex gap-2 font-medium">
- Trending up this month <TrendingUp className="size-4" />
- </div>
- <div className="text-muted-foreground">Discovered assets for the last 6 months</div>
- </CardFooter>
- </Card>
- <Card className="@container/card">
- <CardHeader>
- <CardDescription>New assets</CardDescription>
- <CardTitle className="text-2xl font-semibold tabular-nums @[250px]/card:text-3xl">
- 1234
- </CardTitle>
- <CardAction>
- <Badge variant="outline">
- <TrendingDown />
- -20%
- </Badge>
- </CardAction>
- </CardHeader>
- <CardFooter className="flex-col items-start gap-1.5 text-sm">
- <div className="line-clamp-1 flex gap-2 font-medium">
- Down 20% this period <TrendingDown className="size-4" />
- </div>
- <div className="text-muted-foreground">Newly discovered assets</div>
- </CardFooter>
- </Card>
- <Card className="@container/card">
- <CardHeader>
- <CardDescription>Active Accounts</CardDescription>
- <CardTitle className="text-2xl font-semibold tabular-nums @[250px]/card:text-3xl">
- 45,678
- </CardTitle>
- <CardAction>
- <Badge variant="outline">
- <TrendingUp />
- +12.5%
- </Badge>
- </CardAction>
- </CardHeader>
- <CardFooter className="flex-col items-start gap-1.5 text-sm">
- <div className="line-clamp-1 flex gap-2 font-medium">
- Strong user retention <TrendingUp className="size-4" />
- </div>
- <div className="text-muted-foreground">Engagement exceed targets</div>
- </CardFooter>
- </Card>
- <Card className="@container/card">
- <CardHeader>
- <CardDescription>Growth Rate</CardDescription>
- <CardTitle className="text-2xl font-semibold tabular-nums @[250px]/card:text-3xl">
- 4.5%
- </CardTitle>
- <CardAction>
- <Badge variant="outline">
- <TrendingUp />
- +4.5%
- </Badge>
- </CardAction>
- </CardHeader>
- <CardFooter className="flex-col items-start gap-1.5 text-sm">
- <div className="line-clamp-1 flex gap-2 font-medium">
- Steady performance increase <TrendingUp className="size-4" />
- </div>
- <div className="text-muted-foreground">Meets growth projections</div>
- </CardFooter>
- </Card>
- </div>
- )
-}
diff --git a/flowsint-app/src/components/dashboard/sketches-section.tsx b/flowsint-app/src/components/dashboard/sketches-section.tsx
new file mode 100644
index 00000000..684cb431
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/sketches-section.tsx
@@ -0,0 +1,79 @@
+"use client"
+
+import { Button } from "@/components/ui/button"
+import { Plus, ArrowUpRight } from "lucide-react"
+import { EmptySketches } from "./empty-states"
+import { Sketch } from "@/types"
+import { formatDistanceToNow } from "date-fns"
+import { Link } from "@tanstack/react-router"
+
+interface SketchesSectionProps {
+ sketches: Sketch[]
+}
+
+
+export function SketchesSection({ sketches }: SketchesSectionProps) {
+ const isEmpty = sketches.length === 0
+ return (
+ <section>
+ <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>
+ )}
+ </div>
+
+ {isEmpty ? (
+ <EmptySketches onAction={() => console.log("Create sketch")} />
+ ) : (
+ <div className="grid grid-cols-2 md:grid-cols-4 gap-3">
+ {sketches.map((sketch) => (
+ <Link
+ to="/dashboard/investigations/$investigationId/$type/$id"
+ params={{
+ investigationId: sketch.investigation_id as string,
+ type: "graph",
+ id: sketch.id
+ }}
+ key={sketch.id}
+ className="group block p-4 rounded-lg border border-border hover:border-primary/30 transition-colors cursor-pointer"
+ >
+ <div className="h-24 rounded bg-secondary/50 mb-3 flex items-center justify-center relative overflow-hidden">
+ <svg className="w-full h-full opacity-40" viewBox="0 0 120 60">
+ <line x1="20" y1="30" x2="60" y2="20" stroke="currentColor" strokeWidth="1" className="text-border" />
+ <line
+ x1="60"
+ y1="20"
+ x2="100"
+ y2="35"
+ stroke="currentColor"
+ strokeWidth="1"
+ className="text-border"
+ />
+ <line x1="20" y1="30" x2="50" y2="45" stroke="currentColor" strokeWidth="1" className="text-border" />
+ <circle cx="20" cy="30" r="4" fill="currentColor" className="text-muted-foreground" />
+ <circle cx="60" cy="20" r="5" fill="currentColor" className="text-muted-foreground" />
+ <circle cx="100" cy="35" r="4" fill="currentColor" className="text-muted-foreground" />
+ <circle cx="50" cy="45" r="3" fill="currentColor" className="text-muted-foreground" />
+ </svg>
+ <ArrowUpRight className="absolute top-2 right-2 w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity" />
+ </div>
+
+ <h4 className="font-medium text-foreground text-sm mb-1">{sketch.title}</h4>
+ <p className="text-xs text-muted-foreground line-clamp-2 mb-2">{sketch.description ? sketch.description : <span className="italic">No description provided.</span>}</p>
+ <div className="flex items-center justify-between text-xs text-muted-foreground">
+ <span>{formatDistanceToNow(new Date(sketch.last_updated_at), {
+ addSuffix: true
+ })}</span>
+ </div>
+ </Link>
+ ))}
+ </div>
+ )
+ }
+ </section >
+ )
+}
diff --git a/flowsint-app/src/components/dashboard/tasks-section.tsx b/flowsint-app/src/components/dashboard/tasks-section.tsx
new file mode 100644
index 00000000..5f76e347
--- /dev/null
+++ b/flowsint-app/src/components/dashboard/tasks-section.tsx
@@ -0,0 +1,72 @@
+"use client"
+
+import { Button } from "@/components/ui/button"
+import { Checkbox } from "@/components/ui/checkbox"
+import { Plus } from "lucide-react"
+import { cn } from "@/lib/utils"
+import { useState } from "react"
+
+
+type Task = {
+ id: number,
+ title: string,
+ assignee: string,
+ dueDate: string, completed: boolean
+
+}
+
+const tasksData = [
+ { id: 1, title: "Complete malware reverse engineering", assignee: "SK", dueDate: "Dec 1", completed: false },
+ { id: 2, title: "Document C2 infrastructure", assignee: "JD", dueDate: "Dec 2", completed: false },
+ { id: 3, title: "Correlate IOCs with threat intel", assignee: "MR", dueDate: "Dec 3", completed: false },
+ { id: 4, title: "Initial triage review", assignee: "SK", dueDate: "Nov 26", completed: true },
+ { id: 5, title: "Collect network artifacts", assignee: "MR", dueDate: "Nov 25", completed: true },
+]
+
+export function TasksSection() {
+ const [tasks, setTasks] = useState<Task[]>(tasksData)
+ return (
+ <section>
+ <div className="flex items-center justify-between mb-3">
+ <div className="flex items-center gap-2">
+ <h3 className="text-sm font-medium text-foreground">Tasks</h3>
+ <span className="text-xs text-muted-foreground">2/5</span>
+ </div>
+ <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" />
+ Add
+ </Button>
+ </div>
+
+ <div className="space-y-1">
+ {tasks.map((task) => (
+ <div key={task.id} className={cn("flex items-center gap-3 py-1.5", task.completed && "opacity-50")}>
+ <Checkbox
+ checked={task.completed}
+ onCheckedChange={(checked: boolean | "indeterminate") =>
+ setTasks((prev) =>
+ prev.map((t) =>
+ t.id === task.id ? { ...t, completed: Boolean(checked) } : t
+ )
+ )
+ }
+ className="w-4 h-4 rounded border-muted-foreground/40 data-[state=checked]:bg-muted data-[state=checked]:border-muted"
+ />
+ <span
+ className={cn(
+ "flex-1 text-sm",
+ task.completed ? "text-muted-foreground line-through" : "text-foreground",
+ )}
+ >
+ {task.title}
+ </span>
+ <div className="w-5 h-5 rounded-full bg-secondary flex items-center justify-center shrink-0">
+ <span className="text-[9px] text-muted-foreground">{task.assignee}</span>
+ </div>
+ </div>
+ ))}
+ </div>
+ </section>
+ )
+}
+
diff --git a/flowsint-app/src/components/graphs/graph-viewer.tsx b/flowsint-app/src/components/graphs/graph-viewer.tsx
index 9b4acef8..b0a0156b 100644
--- a/flowsint-app/src/components/graphs/graph-viewer.tsx
+++ b/flowsint-app/src/components/graphs/graph-viewer.tsx
@@ -412,8 +412,6 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
try {
await applyLayout({
layoutType,
- nodes: graphData.nodes,
- edges: graphData.links,
})
// Zoom to fit after layout is complete
diff --git a/flowsint-app/src/components/investigations/investigation-list.tsx b/flowsint-app/src/components/investigations/investigation-list.tsx
index fd48683e..e6a1bf3b 100644
--- a/flowsint-app/src/components/investigations/investigation-list.tsx
+++ b/flowsint-app/src/components/investigations/investigation-list.tsx
@@ -4,26 +4,12 @@ import { useQuery, useQueryClient } from '@tanstack/react-query'
import type { Sketch } from '@/types/sketch'
import NewInvestigation from './new-investigation'
import { Button } from '../ui/button'
-import {
- MoreVertical,
- PlusIcon,
- Trash2,
- Waypoints,
- ChevronRight,
- ChevronDown,
- Search
-} from 'lucide-react'
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 {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger
-} from '../ui/dropdown-menu'
+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'
@@ -31,202 +17,6 @@ import { queryKeys } from '@/api/query-keys'
import { useMutation } from '@tanstack/react-query'
import ErrorState from '../shared/error-state'
-// Tree node component for investigations and sketches
-const TreeNode = ({
- item,
- level = 0,
- isExpanded,
- onToggle,
- isActive,
- onDelete,
- children,
- isClickable = true
-}: {
- item: { id: string; name: string; type: 'investigation' | 'sketch' }
- level?: number
- isExpanded?: boolean
- onToggle?: () => void
- isActive?: boolean
- onDelete?: (e: React.MouseEvent) => void
- children?: React.ReactNode
- isClickable?: boolean
-}) => {
- const isInvestigation = item.type === 'investigation'
- const hasChildren = isInvestigation && children
- const canExpand = isInvestigation && hasChildren
-
- const handleToggle = (e: React.MouseEvent) => {
- e.preventDefault()
- e.stopPropagation()
- onToggle?.()
- }
-
- const handleDelete = (e: React.MouseEvent) => {
- e.preventDefault()
- e.stopPropagation()
- onDelete?.(e)
- }
-
- const handleDropdownClick = (e: React.MouseEvent) => {
- e.preventDefault()
- e.stopPropagation()
- }
-
- return (
- <div className="w-full">
- <div
- className={cn(
- 'flex items-center group gap-2 px-3 py-2 hover:bg-muted/50 transition-colors',
- isActive && 'bg-muted',
- level > 0 && 'pl-4',
- !isClickable && 'cursor-default'
- )}
- style={{ paddingLeft: `${12 + level * 16}px` }}
- >
- {/* Expand/collapse button for investigations */}
- {canExpand && (
- <Button
- variant="ghost"
- size="icon"
- className="h-4 w-4 p-0 hover:bg-transparent"
- onClick={handleToggle}
- >
- {isExpanded ? (
- <ChevronDown className="h-3 w-3" />
- ) : (
- <ChevronRight className="h-3 w-3" />
- )}
- </Button>
- )}
-
- {/* Icon */}
- {isInvestigation ? (
- <Search className="h-4 w-4 text-muted-foreground" />
- ) : (
- <Waypoints className="h-4 w-4 text-muted-foreground" />
- )}
-
- {/* Name */}
- <span className="flex-1 text-sm truncate font-medium">{item.name}</span>
-
- {/* Actions */}
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <div>
- <Button
- variant="ghost"
- size="icon"
- className="h-6 w-6 group-hover:opacity-100 opacity-0 transition-all duration-100"
- onClick={handleDropdownClick}
- >
- <MoreVertical className="h-4 w-4" />
- </Button>
- </div>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem variant="destructive" onClick={handleDelete}>
- <Trash2 className="h-4 w-4 mr-2" />
- Delete {isInvestigation ? 'Investigation' : 'Sketch'}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
-
- {/* Children */}
- {canExpand && isExpanded && <div className="w-full">{children}</div>}
- </div>
- )
-}
-
-export const SketchListItem = ({
- sketch,
- investigationId,
- refetch
-}: {
- sketch: Sketch
- investigationId: string
- refetch: () => void
-}) => {
- const { confirm } = useConfirm()
- const queryClient = useQueryClient()
-
- // Delete sketch mutation
- const deleteSketchMutation = useMutation({
- mutationFn: sketchService.delete,
- onSuccess: () => {
- // Invalidate all related queries
- queryClient.invalidateQueries({
- queryKey: queryKeys.investigations.list
- })
- queryClient.invalidateQueries({
- queryKey: queryKeys.investigations.detail(investigationId)
- })
- queryClient.invalidateQueries({
- queryKey: queryKeys.investigations.sketches(investigationId)
- })
- queryClient.invalidateQueries({
- queryKey: queryKeys.sketches.list
- })
- queryClient.invalidateQueries({
- queryKey: queryKeys.sketches.detail(sketch.id)
- })
- queryClient.invalidateQueries({
- queryKey: queryKeys.sketches.graph(investigationId, sketch.id)
- })
- // Also invalidate dashboard queries
- queryClient.invalidateQueries({
- queryKey: queryKeys.investigations.dashboard
- })
- // Ensure parent lists refresh
- try {
- refetch()
- } catch {}
- },
- onError: (error) => {
- console.error('Error deleting sketch:', error)
- }
- })
-
- const handleDelete = async (e: React.MouseEvent) => {
- e.preventDefault()
- e.stopPropagation()
-
- const confirmed = await confirm({
- title: 'Delete Sketch',
- message: `Are you sure you want to delete "${sketch.title}"? This action cannot be undone.`
- })
-
- if (confirmed) {
- toast.promise(deleteSketchMutation.mutateAsync(sketch.id), {
- loading: 'Deleting sketch...',
- success: () => `Sketch "${sketch.title}" has been deleted`,
- error: 'Failed to delete sketch'
- })
- }
- }
-
- return (
- <Link
- to="/dashboard/investigations/$investigationId/$type/$id"
- params={{
- investigationId: investigationId,
- type: 'graph',
- id: sketch.id
- }}
- id={sketch.id}
- >
- {({ isActive }) => (
- <TreeNode
- item={{ id: sketch.id, name: sketch.title, type: 'sketch' }}
- level={1}
- isActive={isActive}
- onDelete={handleDelete}
- isClickable={false}
- />
- )}
- </Link>
- )
-}
const InvestigationList = () => {
const { data, isLoading, error, refetch } = useQuery({
@@ -235,7 +25,6 @@ const InvestigationList = () => {
})
const { confirm } = useConfirm()
const [searchQuery, setSearchQuery] = useState('')
- const [expandedNodes, setExpandedNodes] = useState<Set<string>>(new Set())
const queryClient = useQueryClient()
const filteredInvestigations = useMemo(() => {
@@ -252,58 +41,11 @@ const InvestigationList = () => {
})
}, [data, searchQuery])
- const toggleNode = (nodeId: string) => {
- setExpandedNodes((prev) => {
- const newSet = new Set(prev)
- if (newSet.has(nodeId)) {
- newSet.delete(nodeId)
- } else {
- newSet.add(nodeId)
- }
- return newSet
- })
- }
-
- const handleDeleteInvestigation = async (investigation: Investigation, e: React.MouseEvent) => {
- e.preventDefault()
- e.stopPropagation()
-
- 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)
- })
- })
-
- toast.promise(deletePromise, {
- loading: 'Deleting investigation...',
- success: () => `Investigation "${investigation.name}" has been deleted`,
- error: 'Failed to delete investigation'
- })
- }
- }
+ if (isLoading)
+ return (
+ <SkeletonList rowCount={6} />
+ )
if (error)
return (
<ErrorState
@@ -315,92 +57,98 @@ const InvestigationList = () => {
)
return (
<div className="w-full h-full bg-card flex flex-col overflow-hidden">
- <div className="p-2 flex items-center gap-2 border-b">
- <NewInvestigation noDropDown>
- <Button variant="ghost" size="icon" className="h-7 w-7">
- <PlusIcon className="h-4 w-4" />
- </Button>
- </NewInvestigation>
- <Input
- type="search"
- className="h-7"
- placeholder="Search..."
- value={searchQuery}
- onChange={(e) => setSearchQuery(e.target.value)}
- />
+ {/* 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>
- {isLoading ? (
- <div className="p-2">
- <SkeletonList rowCount={7} />
+ <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>
+ <NewInvestigation noDropDown>
+ <button className="p-1 rounded hover:bg-muted transition-colors opacity-0 group-hover:opacity-100">
+ <Plus className="w-3.5 h-3.5 text-muted-foreground" />
+ </button>
+ </NewInvestigation>
</div>
- ) : filteredInvestigations.length > 0 ? (
- <div className="overflow-auto">
- {filteredInvestigations.map((investigation: Investigation) => {
- const isExpanded = expandedNodes.has(investigation.id)
- const hasSketches = investigation.sketches && investigation.sketches.length > 0
-
- return (
- <div key={investigation.id} className="w-full">
- <Link
- to="/dashboard/investigations/$investigationId"
- params={{
- investigationId: investigation.id
- }}
- >
- {({ isActive }) => (
- <TreeNode
- item={{
- id: investigation.id,
- name: investigation.name,
- type: 'investigation'
- }}
- isExpanded={isExpanded}
- onToggle={() => toggleNode(investigation.id)}
- isActive={isActive}
- onDelete={(e) => handleDeleteInvestigation(investigation, e)}
- isClickable={false}
- >
- {hasSketches ? (
- investigation.sketches!.map((sketch: Sketch) => (
- <SketchListItem
- refetch={refetch}
- key={sketch.id}
- sketch={sketch}
- investigationId={investigation.id}
- />
- ))
- ) : (
- <div className="ml-8 px-3 py-2 text-sm text-muted-foreground">
- No sketches
- </div>
- )}
- </TreeNode>
+ <div className="mx-1 my-1 border-t border-sidebar-border/30" />
+ <div className="space-y-0.5">
+ {filteredInvestigations.map((caseItem: Investigation) => (
+ <Link
+ to="/dashboard/investigations/$investigationId"
+ params={{
+ investigationId: caseItem.id
+ }}
+ >
+ <button
+ className={cn(
+ "w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm transition-colors text-left group",
+ "text-muted-foreground hover:bg-muted hover:text-sidebar-foreground"
+ )}
+ >
+ <FolderOpen className="w-4 h-4 shrink-0 opacity-60" />
+ <span className="truncate flex-1">{caseItem.name}</span>
+ <span
+ className={cn(
+ "w-1.5 h-1.5 rounded-full shrink-0",
+ caseItem.status === "active" && "bg-success",
+ caseItem.status === "closed" && "bg-muted-foreground/50",
+ caseItem.status === "on-hold" && "bg-warning",
)}
- </Link>
- </div>
- )
- })}
- </div>
- ) : (
- <div className="flex-1 p-4">
- <div className="h-full w-full rounded-lg border border-dashed bg-muted/30 flex flex-col items-center justify-center text-center gap-3 p-6">
- <div className="text-sm font-medium">No investigations yet</div>
- <div className="text-xs text-muted-foreground max-w-xs">
- Create an investigation to organize your graphs and notes by case, incident, or
- research topic.
- </div>
- <NewInvestigation noDropDown>
- <Button size="sm">
- <PlusIcon className="w-4 h-4 mr-2" />
- Create investigation
- </Button>
- </NewInvestigation>
- </div>
+ />
+ </button>
+ </Link>
+ ))}
</div>
- )}
- </div>
+ </div>
+ </div >
)
}
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
diff --git a/flowsint-app/src/components/investigations/sketch-list.tsx b/flowsint-app/src/components/investigations/sketch-list.tsx
index 97a7bff7..74978006 100644
--- a/flowsint-app/src/components/investigations/sketch-list.tsx
+++ b/flowsint-app/src/components/investigations/sketch-list.tsx
@@ -2,15 +2,15 @@ import { investigationService } from '@/api/investigation-service'
import { useQuery } from '@tanstack/react-query'
import type { Sketch } from '@/types/sketch'
import { Button } from '../ui/button'
-import { PlusIcon, Waypoints } from 'lucide-react'
+import { FolderOpen, PlusIcon, Waypoints } from 'lucide-react'
import { Input } from '../ui/input'
-import { useParams } from '@tanstack/react-router'
+import { Link, useParams } from '@tanstack/react-router'
import { SkeletonList } from '../shared/skeleton-list'
import NewSketch from '../graphs/new-sketch'
-import { SketchListItem } from './investigation-list'
import { useState, useMemo } from 'react'
import { queryKeys } from '@/api/query-keys'
import ErrorState from '../shared/error-state'
+import { cn } from '@/lib/utils'
const SketchList = () => {
const { investigationId } = useParams({ strict: false })
@@ -65,14 +65,34 @@ const SketchList = () => {
<SkeletonList rowCount={7} />
</div>
) : filteredSketches.length > 0 ? (
- <ul>
+ <ul className="p-2">
{filteredSketches.map((sketch: Sketch) => (
- <SketchListItem
- refetch={refetch}
- key={sketch.id}
- sketch={sketch}
- investigationId={investigation.id}
- />
+ <Link
+ to="/dashboard/investigations/$investigationId/$type/$id"
+ params={{
+ investigationId: sketch.investigation_id,
+ type: "graph",
+ id: sketch.id
+ }}
+ >
+ <button
+ className={cn(
+ "w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm transition-colors text-left group",
+ "text-muted-foreground hover:bg-muted hover:text-sidebar-foreground"
+ )}
+ >
+ <FolderOpen className="w-4 h-4 shrink-0 opacity-60" />
+ <span className="truncate flex-1">{sketch.title}</span>
+ <span
+ className={cn(
+ "w-1.5 h-1.5 rounded-full shrink-0",
+ sketch.status === "active" && "bg-success",
+ sketch.status === "closed" && "bg-muted-foreground/50",
+ sketch.status === "on-hold" && "bg-warning",
+ )}
+ />
+ </button>
+ </Link>
))}
</ul>
) : (
diff --git a/flowsint-app/src/hooks/use-layout.ts b/flowsint-app/src/hooks/use-layout.ts
index 2933484d..58459d3e 100644
--- a/flowsint-app/src/hooks/use-layout.ts
+++ b/flowsint-app/src/hooks/use-layout.ts
@@ -1,5 +1,6 @@
import { useCallback, useRef, useEffect } from 'react'
-import { GraphNode, GraphEdge } from '@/types'
+import { GraphNode } from '@/types'
+import { useGraphStore } from '@/stores/graph-store';
interface UseLayoutProps {
forceSettings: any
@@ -10,8 +11,6 @@ interface UseLayoutProps {
interface LayoutOptions {
layoutType: 'force' | 'hierarchy'
- nodes: GraphNode[]
- edges: GraphEdge[]
}
export function useLayout({
@@ -21,6 +20,8 @@ export function useLayout({
onProgress,
}: UseLayoutProps) {
const workerRef = useRef<Worker | null>(null)
+ const nodes = useGraphStore(s => s.nodes)
+ const edges = useGraphStore(s => s.edges)
// Initialize worker once
useEffect(() => {
@@ -28,7 +29,6 @@ export function useLayout({
new URL('../workers/layout.worker.ts', import.meta.url),
{ type: 'module' }
)
-
return () => {
// Cleanup worker on unmount
workerRef.current?.terminate()
@@ -36,7 +36,7 @@ export function useLayout({
}, [])
const applyLayout = useCallback(
- async ({ layoutType, nodes, edges }: LayoutOptions) => {
+ async ({ layoutType }: LayoutOptions) => {
if (!workerRef.current) {
throw new Error('Layout worker not initialized')
}
diff --git a/flowsint-app/src/routeTree.gen.ts b/flowsint-app/src/routeTree.gen.ts
index 3be142c4..e4b02c71 100644
--- a/flowsint-app/src/routeTree.gen.ts
+++ b/flowsint-app/src/routeTree.gen.ts
@@ -18,7 +18,6 @@ import { Route as AuthDashboardRouteImport } from './routes/_auth.dashboard'
import { Route as AuthDashboardIndexRouteImport } from './routes/_auth.dashboard.index'
import { Route as AuthDashboardVaultRouteImport } from './routes/_auth.dashboard.vault'
import { Route as AuthDashboardToolsRouteImport } from './routes/_auth.dashboard.tools'
-import { Route as AuthDashboardInvestigationsIndexRouteImport } from './routes/_auth.dashboard.investigations.index'
import { Route as AuthDashboardFlowsIndexRouteImport } from './routes/_auth.dashboard.flows.index'
import { Route as AuthDashboardCustomTypesIndexRouteImport } from './routes/_auth.dashboard.custom-types.index'
import { Route as AuthDashboardFlowsFlowIdRouteImport } from './routes/_auth.dashboard.flows.$flowId'
@@ -70,12 +69,6 @@ const AuthDashboardToolsRoute = AuthDashboardToolsRouteImport.update({
path: '/tools',
getParentRoute: () => AuthDashboardRoute,
} as any)
-const AuthDashboardInvestigationsIndexRoute =
- AuthDashboardInvestigationsIndexRouteImport.update({
- id: '/investigations/',
- path: '/investigations/',
- getParentRoute: () => AuthDashboardRoute,
- } as any)
const AuthDashboardFlowsIndexRoute = AuthDashboardFlowsIndexRouteImport.update({
id: '/flows/',
path: '/flows/',
@@ -125,7 +118,6 @@ export interface FileRoutesByFullPath {
'/dashboard/flows/$flowId': typeof AuthDashboardFlowsFlowIdRoute
'/dashboard/custom-types': typeof AuthDashboardCustomTypesIndexRoute
'/dashboard/flows': typeof AuthDashboardFlowsIndexRoute
- '/dashboard/investigations': typeof AuthDashboardInvestigationsIndexRoute
'/dashboard/investigations/$investigationId': typeof AuthDashboardInvestigationsInvestigationIdIndexRoute
'/dashboard/investigations/$investigationId/$type/$id': typeof AuthDashboardInvestigationsInvestigationIdTypeIdRoute
}
@@ -141,7 +133,6 @@ export interface FileRoutesByTo {
'/dashboard/flows/$flowId': typeof AuthDashboardFlowsFlowIdRoute
'/dashboard/custom-types': typeof AuthDashboardCustomTypesIndexRoute
'/dashboard/flows': typeof AuthDashboardFlowsIndexRoute
- '/dashboard/investigations': typeof AuthDashboardInvestigationsIndexRoute
'/dashboard/investigations/$investigationId': typeof AuthDashboardInvestigationsInvestigationIdIndexRoute
'/dashboard/investigations/$investigationId/$type/$id': typeof AuthDashboardInvestigationsInvestigationIdTypeIdRoute
}
@@ -160,7 +151,6 @@ export interface FileRoutesById {
'/_auth/dashboard/flows/$flowId': typeof AuthDashboardFlowsFlowIdRoute
'/_auth/dashboard/custom-types/': typeof AuthDashboardCustomTypesIndexRoute
'/_auth/dashboard/flows/': typeof AuthDashboardFlowsIndexRoute
- '/_auth/dashboard/investigations/': typeof AuthDashboardInvestigationsIndexRoute
'/_auth/dashboard/investigations/$investigationId/': typeof AuthDashboardInvestigationsInvestigationIdIndexRoute
'/_auth/dashboard/investigations/$investigationId/$type/$id': typeof AuthDashboardInvestigationsInvestigationIdTypeIdRoute
}
@@ -179,7 +169,6 @@ export interface FileRouteTypes {
| '/dashboard/flows/$flowId'
| '/dashboard/custom-types'
| '/dashboard/flows'
- | '/dashboard/investigations'
| '/dashboard/investigations/$investigationId'
| '/dashboard/investigations/$investigationId/$type/$id'
fileRoutesByTo: FileRoutesByTo
@@ -195,7 +184,6 @@ export interface FileRouteTypes {
| '/dashboard/flows/$flowId'
| '/dashboard/custom-types'
| '/dashboard/flows'
- | '/dashboard/investigations'
| '/dashboard/investigations/$investigationId'
| '/dashboard/investigations/$investigationId/$type/$id'
id:
@@ -213,7 +201,6 @@ export interface FileRouteTypes {
| '/_auth/dashboard/flows/$flowId'
| '/_auth/dashboard/custom-types/'
| '/_auth/dashboard/flows/'
- | '/_auth/dashboard/investigations/'
| '/_auth/dashboard/investigations/$investigationId/'
| '/_auth/dashboard/investigations/$investigationId/$type/$id'
fileRoutesById: FileRoutesById
@@ -291,13 +278,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthDashboardToolsRouteImport
parentRoute: typeof AuthDashboardRoute
}
- '/_auth/dashboard/investigations/': {
- id: '/_auth/dashboard/investigations/'
- path: '/investigations'
- fullPath: '/dashboard/investigations'
- preLoaderRoute: typeof AuthDashboardInvestigationsIndexRouteImport
- parentRoute: typeof AuthDashboardRoute
- }
'/_auth/dashboard/flows/': {
id: '/_auth/dashboard/flows/'
path: '/flows'
@@ -351,7 +331,6 @@ interface AuthDashboardRouteChildren {
AuthDashboardFlowsFlowIdRoute: typeof AuthDashboardFlowsFlowIdRoute
AuthDashboardCustomTypesIndexRoute: typeof AuthDashboardCustomTypesIndexRoute
AuthDashboardFlowsIndexRoute: typeof AuthDashboardFlowsIndexRoute
- AuthDashboardInvestigationsIndexRoute: typeof AuthDashboardInvestigationsIndexRoute
AuthDashboardInvestigationsInvestigationIdIndexRoute: typeof AuthDashboardInvestigationsInvestigationIdIndexRoute
AuthDashboardInvestigationsInvestigationIdTypeIdRoute: typeof AuthDashboardInvestigationsInvestigationIdTypeIdRoute
}
@@ -364,7 +343,6 @@ const AuthDashboardRouteChildren: AuthDashboardRouteChildren = {
AuthDashboardFlowsFlowIdRoute: AuthDashboardFlowsFlowIdRoute,
AuthDashboardCustomTypesIndexRoute: AuthDashboardCustomTypesIndexRoute,
AuthDashboardFlowsIndexRoute: AuthDashboardFlowsIndexRoute,
- AuthDashboardInvestigationsIndexRoute: AuthDashboardInvestigationsIndexRoute,
AuthDashboardInvestigationsInvestigationIdIndexRoute:
AuthDashboardInvestigationsInvestigationIdIndexRoute,
AuthDashboardInvestigationsInvestigationIdTypeIdRoute:
diff --git a/flowsint-app/src/routes/_auth.dashboard.custom-types.index.tsx b/flowsint-app/src/routes/_auth.dashboard.custom-types.index.tsx
index 39fffdcd..402c025b 100644
--- a/flowsint-app/src/routes/_auth.dashboard.custom-types.index.tsx
+++ b/flowsint-app/src/routes/_auth.dashboard.custom-types.index.tsx
@@ -11,7 +11,6 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { customTypeService, CustomType } from '@/api/custom-type-service'
import ErrorState from '@/components/shared/error-state'
import { toast } from 'sonner'
-import { useState } from 'react'
import { useConfirm } from '@/components/use-confirm-dialog'
import { PageLayout } from '@/components/layout/page-layout'
diff --git a/flowsint-app/src/routes/_auth.dashboard.index.tsx b/flowsint-app/src/routes/_auth.dashboard.index.tsx
index 2d253771..0265c91f 100644
--- a/flowsint-app/src/routes/_auth.dashboard.index.tsx
+++ b/flowsint-app/src/routes/_auth.dashboard.index.tsx
@@ -1,45 +1,14 @@
import { createFileRoute } from '@tanstack/react-router'
import { InvestigationSkeleton } from '@/components/dashboard/investigation-skeleton'
-import { InvestigationCards } from '@/components/dashboard/investigation-cards'
-// import { AnalysisCards } from '@/components/dashboard/analysis-cards';
+import { DashboardPage } from '@/components/dashboard/dashboard-page'
export const Route = createFileRoute('/_auth/dashboard/')({
- component: DashboardPage,
+ component: Page,
pendingComponent: InvestigationSkeleton
})
-function DashboardPage() {
+function Page() {
return (
- <div className="h-full w-full bg-background overflow-y-auto" data-tour-id="welcome">
- {/* Main Content */}
- <div className="max-w-7xl mx-auto p-8 space-y-12" style={{ containerType: 'inline-size' }}>
- {/* Investigation Cards */}
- {/* <div className="flex flex-1 flex-col">
- <div className="@container/main px-6 flex flex-1 flex-col gap-2">
- <div className="flex flex-col gap-4 py-4 md:gap-6 md:py-6">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <h2 className="text-2xl font-semibold">Welcome back</h2>
- </div>
- <NewInvestigation noDropDown>
- <Button size="sm">
- <Plus className="w-4 h-4 mr-2" />
- New Investigation
- </Button>
- </NewInvestigation>
- </div>
- <SectionCards />
- <div>
- <ChartAreaInteractive />
- </div>
- </div>
- </div>
- </div> */}
- <InvestigationCards />
-
- {/* Analysis Cards */}
- {/* <AnalysisCards /> */}
- </div>
- </div>
+ <DashboardPage />
)
}
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 c7df7bd6..647b1a7a 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
@@ -32,6 +32,7 @@ const GraphPageContent = () => {
refetch
} = useQuery({
queryKey: ['investigations', investigationId, type, id, 'data'],
+ // @ts-ignore
queryFn: () => services[type](id),
enabled: ['graph', 'analysis'].includes(type),
// refetchInterval: 5000,
@@ -46,10 +47,8 @@ const GraphPageContent = () => {
useEffect(() => {
const refetchWithCallback = async (onSuccess?: () => void) => {
- const result = await refetch()
- // Execute callback after refetch completes and data is updated
+ await refetch()
if (onSuccess) {
- // Small delay to ensure React Query has updated the data in the store
setTimeout(() => {
onSuccess()
}, 100)
@@ -80,6 +79,7 @@ const GraphPageContent = () => {
export const Route = createFileRoute('/_auth/dashboard/investigations/$investigationId/$type/$id')({
loader: async ({ params: { id, type, investigationId } }) => {
+ // @ts-ignore
const sketch = await services[type](id)
return { params: { id, type, investigationId }, sketch }
},
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 d2fefb7e..dbd0a756 100644
--- a/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx
+++ b/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx
@@ -1,30 +1,10 @@
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { investigationService } from '@/api/investigation-service'
import { analysisService } from '@/api/analysis-service'
-import { Button } from '@/components/ui/button'
-import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'
-import { Badge } from '@/components/ui/badge'
-import { Separator } from '@/components/ui/separator'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger
-} from '@/components/ui/dropdown-menu'
-import {
- Plus,
- Calendar,
- User,
- FileText,
- BarChart3,
- Clock,
- ChevronDown,
- Waypoints
-} from 'lucide-react'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { toast } from 'sonner'
-import { formatDistanceToNow } from 'date-fns'
-import NewSketch from '@/components/graphs/new-sketch'
+import { CaseOverviewPage } from "@/components/dashboard/case-overview-page"
+
function InvestigationSkeleton() {
return (
@@ -110,260 +90,7 @@ function InvestigationPage() {
}
})
- const sketchCount = investigation.sketches?.length || 0
- const analysisCount = investigation.analyses?.length || 0
- const lastUpdated = formatDistanceToNow(new Date(investigation.last_updated_at), {
- addSuffix: true
- })
-
return (
- <div className="h-full w-full bg-background overflow-y-auto">
- <div className="max-w-7xl mx-auto p-8 space-y-8">
- {/* Header Section */}
- <div className="space-y-4">
- <div className="flex items-start justify-between">
- <div className="space-y-2">
- <h1 className="text-3xl font-bold tracking-tight">{investigation.name}</h1>
- <p className="text-lg text-muted-foreground max-w-2xl">
- {investigation.description || 'No description provided'}
- </p>
- </div>
- <div className="flex items-center gap-3">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <div>
- <Button className="gap-2" disabled={createAnalysisMutation.isPending}>
- New
- <ChevronDown className="h-4 w-4" />
- </Button>
- </div>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <NewSketch>
- <DropdownMenuItem onSelect={(e) => e.preventDefault()}>
- <BarChart3 className="h-4 w-4 mr-2" />
- New Sketch
- </DropdownMenuItem>
- </NewSketch>
- <DropdownMenuItem
- onClick={() => createAnalysisMutation.mutate()}
- disabled={createAnalysisMutation.isPending}
- >
- <FileText className="h-4 w-4 mr-2" />
- New analysis
- {createAnalysisMutation.isPending && (
- <span className="ml-2 text-xs text-muted-foreground">Creating...</span>
- )}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
-
- <div className="flex items-center gap-6 text-sm text-muted-foreground">
- <div className="flex items-center gap-2">
- <Calendar className="h-4 w-4" />
- <span>
- Created{' '}
- {formatDistanceToNow(new Date(investigation.created_at), { addSuffix: true })}
- </span>
- </div>
- <div className="flex items-center gap-2">
- <Clock className="h-4 w-4" />
- <span>Updated {lastUpdated}</span>
- </div>
- <div className="flex items-center gap-2">
- <User className="h-4 w-4" />
- <span>
- {investigation.owner
- ? `${investigation.owner.first_name || ''} ${investigation.owner.last_name || ''}`.trim() ||
- 'Unknown'
- : 'Unknown'}
- </span>
- </div>
- <Badge variant={investigation.status === 'active' ? 'default' : 'secondary'}>
- {investigation.status}
- </Badge>
- </div>
- </div>
-
- {/* Stats Cards */}
- <div className="grid grid-cols-1 md:grid-cols-3 gap-6">
- <Card>
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
- <CardTitle className="text-sm font-medium">Total Sketches</CardTitle>
- <BarChart3 className="h-4 w-4 text-muted-foreground" />
- </CardHeader>
- <CardContent>
- <div className="text-2xl font-bold">{sketchCount}</div>
- <p className="text-xs text-muted-foreground">Visual data representations</p>
- </CardContent>
- </Card>
-
- <Card>
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
- <CardTitle className="text-sm font-medium">Total Analyses</CardTitle>
- <FileText className="h-4 w-4 text-muted-foreground" />
- </CardHeader>
- <CardContent>
- <div className="text-2xl font-bold">{analysisCount}</div>
- <p className="text-xs text-muted-foreground">Documented findings</p>
- </CardContent>
- </Card>
-
- <Card>
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
- <CardTitle className="text-sm font-medium">Last Activity</CardTitle>
- <Clock className="h-4 w-4 text-muted-foreground" />
- </CardHeader>
- <CardContent>
- <div className="text-2xl font-bold">{lastUpdated}</div>
- <p className="text-xs text-muted-foreground">Since last update</p>
- </CardContent>
- </Card>
- </div>
-
- <Separator />
-
- {/* Content Sections */}
- <div className="space-y-12">
- {/* Sketches Section */}
- <div className="space-y-6">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <BarChart3 className="h-6 w-6 text-muted-foreground" />
- <h2 className="text-xl font-semibold">Sketches</h2>
- <Badge variant="outline" className="ml-2">
- {sketchCount}
- </Badge>
- </div>
- </div>
-
- {sketchCount === 0 ? (
- <Card className="border-dashed">
- <CardContent className="flex flex-col items-center justify-center py-8">
- <BarChart3 className="h-12 w-12 text-muted-foreground mb-3" />
- <h3 className="text-lg font-semibold mb-2">No sketches yet</h3>
- <p className="text-muted-foreground mb-4 text-center max-w-md">
- Create your first sketch to start visualizing your investigation data and
- building relationships between entities.
- </p>
- </CardContent>
- </Card>
- ) : (
- <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
- {investigation.sketches?.slice(0, 8).map((sketch: any) => (
- <Card
- onClick={() =>
- navigate({
- to: '/dashboard/investigations/$investigationId/$type/$id',
- params: {
- investigationId: investigation.id,
- type: 'graph',
- id: sketch.id
- }
- })
- }
- className="hover:shadow-lg py-4 transition-all duration-200 cursor-pointer group border hover:border-primary/20"
- >
- <CardHeader>
- <CardTitle>{sketch.title}</CardTitle>
- <CardDescription className='mt-2'>{Boolean(sketch.description) ? sketch.description : <span>No description provided</span>}</CardDescription>
- </CardHeader>
- <CardFooter>
- <div className="flex items-center gap-2 text-xs text-muted-foreground">
- <Clock className="w-3 h-3" />
- <span>
- Updated{' '}
- {formatDistanceToNow(new Date(sketch.last_updated_at), {
- addSuffix: true
- })}
- </span>
- </div>
- </CardFooter>
- </Card>
- ))}
- </div>
- )}
- </div>
-
- {/* Analyses Section */}
- <div className="space-y-6">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <FileText className="h-6 w-6 text-muted-foreground" />
- <h2 className="text-xl font-semibold">Analyses</h2>
- <Badge variant="outline" className="ml-2">
- {analysisCount}
- </Badge>
- </div>
- </div>
-
- {analysisCount === 0 ? (
- <Card className="border-dashed">
- <CardContent className="flex flex-col items-center justify-center py-8">
- <FileText className="h-12 w-12 text-muted-foreground mb-3" />
- <h3 className="text-lg font-semibold mb-2">No analyses yet</h3>
- <p className="text-muted-foreground mb-4 text-center max-w-md">
- Create your first analysis to start documenting your findings, observations, and
- investigative notes.
- </p>
- <Button
- onClick={() => createAnalysisMutation.mutate()}
- disabled={createAnalysisMutation.isPending}
- className="gap-2"
- >
- <Plus className="h-4 w-4" />
- Create analysis
- </Button>
- </CardContent>
- </Card>
- ) : (
- <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
- {investigation.analyses?.slice(0, 8).map((analysis: any) => (
- <Card
- key={analysis.id}
- className="group py-2 relative overflow-hidden cursor-pointer hover:shadow-xl border border-border hover:border-secondary"
- onClick={() =>
- navigate({
- to: '/dashboard/investigations/$investigationId/$type/$id',
- params: {
- investigationId: investigation.id,
- type: 'analysis',
- id: analysis.id
- }
- })
- }
- >
- <CardContent className="p-6 relative">
- <div className="space-y-3">
- <h4 className="font-semibold text-gray-900 dark:text-gray-100 line-clamp-1 group-hover:text-emerald-700 dark:group-hover:text-emerald-300 transition-colors">
- {analysis.title}
- </h4>
- <p className="text-sm text-gray-600 dark:text-gray-400 line-clamp-2 leading-relaxed">
- {analysis.description || 'No description provided'}
- </p>
- </div>
-
- <div className="mt-4 pt-4 border-t border-emerald-200/50 dark:border-emerald-800/30">
- <div className="flex items-center justify-between text-xs text-gray-500 dark:text-gray-400">
- <span className="flex items-center gap-1">
- <Clock className="h-3 w-3" />
- {formatDistanceToNow(new Date(analysis.last_updated_at), {
- addSuffix: true
- })}
- </span>
- <div className="w-2 h-2 rounded-full bg-emerald-400 animate-pulse" />
- </div>
- </div>
- </CardContent>
- </Card>
- ))}
- </div>
- )}
- </div>
- </div>
- </div>
- </div>
+ <CaseOverviewPage investigation={investigation} />
)
}
diff --git a/flowsint-app/src/routes/_auth.dashboard.investigations.index.tsx b/flowsint-app/src/routes/_auth.dashboard.investigations.index.tsx
deleted file mode 100644
index d072428f..00000000
--- a/flowsint-app/src/routes/_auth.dashboard.investigations.index.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { createFileRoute } from '@tanstack/react-router'
-import { InvestigationSkeleton } from '@/components/dashboard/investigation-skeleton'
-import { InvestigationCards } from '@/components/dashboard/investigation-cards'
-import { AnalysisCards } from '@/components/dashboard/analysis-cards'
-
-export const Route = createFileRoute('/_auth/dashboard/investigations/')({
- component: InvestigationPage,
- pendingComponent: InvestigationSkeleton
-})
-
-function InvestigationPage() {
- return (
- <div className="h-full w-full bg-background overflow-y-auto">
- {/* Main Content */}
- <div className="max-w-7xl mx-auto p-8 space-y-12">
- {/* Investigation Cards */}
- <InvestigationCards />
-
- {/* Analysis Cards */}
- <AnalysisCards />
- </div>
- </div>
- )
-}
diff --git a/flowsint-app/src/styles.css b/flowsint-app/src/styles.css
index 9faf8bb8..7705d557 100644
--- a/flowsint-app/src/styles.css
+++ b/flowsint-app/src/styles.css
@@ -41,8 +41,10 @@
/* Appliquer sur toute la page */
body {
- scrollbar-width: thin; /* Firefox */
- scrollbar-color: #888 transparent; /* Firefox */
+ scrollbar-width: thin;
+ /* Firefox */
+ scrollbar-color: #888 transparent;
+ /* Firefox */
}
body::-webkit-scrollbar {
@@ -449,6 +451,12 @@ html {
--shadow-lg: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 4px 6px -2px hsl(0 0% 0% / 0.10);
--shadow-xl: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 8px 10px -2px hsl(0 0% 0% / 0.10);
--shadow-2xl: 0px 4px 8px -1px hsl(0 0% 0% / 0.25);
+ --success: oklch(0.6 0.12 145);
+ --warning: oklch(0.7 0.12 80);
+ --info: oklch(0.6 0.1 240);
+ --dot-color: oklch(0.3 0.002 260);
+ --dot-size: 1px;
+ --dot-spacing: 24px;
}
.dark {
@@ -550,6 +558,12 @@ html {
--shadow-xl: var(--shadow-xl);
--shadow-2xl: var(--shadow-2xl);
--xy-edge-label-background-color: var(--background) !important;
+ --color-success: var(--success);
+ --color-warning: var(--warning);
+ --color-info: var(--info);
+ --dot-color: var(--dot-color);
+ --dot-size: var(--dot-size);
+ --dot-spacing: var(--dot-spacing);
}
.minimal-tiptap-editor .ProseMirror {
@@ -840,4 +854,4 @@ body {
width: 100%;
transform-origin: top left;
touch-action: none;
-}
+}
\ No newline at end of file