A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
feat: side panel
dextmorgn852b290ac460
diff --git a/flowsint-web/next.config.js b/flowsint-web/next.config.jsindex 52a13a9d..9ee78ea8 100644--- a/flowsint-web/next.config.js+++ b/flowsint-web/next.config.js@@ -3,6 +3,7 @@ const nextConfig = {output: "standalone",experimental: {authInterrupts: true,+ reactCompiler: true,},images: {remotePatterns: [diff --git a/flowsint-web/package.json b/flowsint-web/package.jsonindex bb07497b..b5734efb 100644--- a/flowsint-web/package.json+++ b/flowsint-web/package.json@@ -60,6 +60,7 @@"@tiptap/starter-kit": "^2.11.5","@xyflow/react": "^12.5.4","ai": "^4.1.34",+ "babel-plugin-react-compiler": "^19.0.0-beta-e993439-20250328","class-variance-authority": "^0.7.1","clsx": "^2.1.1","cmdk": "1.0.0",diff --git a/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/individuals/route.ts b/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/individuals/route.tsindex 8d738edc..0c5b2fa9 100644--- a/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/individuals/route.ts+++ b/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/individuals/route.ts@@ -1,8 +1,13 @@import { createClient } from "@/lib/supabase/server"-import { NextResponse } from "next/server"+import { NextRequest, NextResponse } from "next/server"-export async function GET(_: Request, { params }: { params: Promise<{ investigation_id: string }> }) {+export async function GET(request: NextRequest, { params }: { params: Promise<{ investigation_id: string }> }) {const { investigation_id } = await params+ let size = request.nextUrl.searchParams.get("size") || 10+ let page = request.nextUrl.searchParams.get("page") || 1+ let includeEmails = request.nextUrl.searchParams.get("includeEmails") || false+ let includePhones = request.nextUrl.searchParams.get("includePhones") || false+try {const supabase = await createClient()const {@@ -14,10 +19,13 @@ export async function GET(_: Request, { params }: { params: Promise<{ investigat}const { data: individuals, error } = await supabase.from('individuals')- .select(`- *- `)+ .select([`*`,+ includeEmails && "emails(email)",+ includePhones && "phone_numbers(phone_number)",+ ].filter(Boolean).join(', '), { count: "exact" })+ .order("created_at", { ascending: false }).eq("investigation_id", investigation_id)+ // .range()if (error) {return NextResponse.json({ error: error.message }, { status: 500 })diff --git a/flowsint-web/src/app/dashboard/entities/data.json b/flowsint-web/src/app/dashboard/entities/data.jsondeleted file mode 100644index 13ff0365..00000000--- a/flowsint-web/src/app/dashboard/entities/data.json+++ /dev/null@@ -1,614 +0,0 @@-[- {- "id": 1,- "header": "Cover page",- "type": "Cover page",- "status": "In Process",- "target": "18",- "limit": "5",- "reviewer": "Eddie Lake"- },- {- "id": 2,- "header": "Table of contents",- "type": "Table of contents",- "status": "Done",- "target": "29",- "limit": "24",- "reviewer": "Eddie Lake"- },- {- "id": 3,- "header": "Executive summary",- "type": "Narrative",- "status": "Done",- "target": "10",- "limit": "13",- "reviewer": "Eddie Lake"- },- {- "id": 4,- "header": "Technical approach",- "type": "Narrative",- "status": "Done",- "target": "27",- "limit": "23",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 5,- "header": "Design",- "type": "Narrative",- "status": "In Process",- "target": "2",- "limit": "16",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 6,- "header": "Capabilities",- "type": "Narrative",- "status": "In Process",- "target": "20",- "limit": "8",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 7,- "header": "Integration with existing systems",- "type": "Narrative",- "status": "In Process",- "target": "19",- "limit": "21",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 8,- "header": "Innovation and Advantages",- "type": "Narrative",- "status": "Done",- "target": "25",- "limit": "26",- "reviewer": "Assign reviewer"- },- {- "id": 9,- "header": "Overview of EMR's Innovative Solutions",- "type": "Technical content",- "status": "Done",- "target": "7",- "limit": "23",- "reviewer": "Assign reviewer"- },- {- "id": 10,- "header": "Advanced Algorithms and Machine Learning",- "type": "Narrative",- "status": "Done",- "target": "30",- "limit": "28",- "reviewer": "Assign reviewer"- },- {- "id": 11,- "header": "Adaptive Communication Protocols",- "type": "Narrative",- "status": "Done",- "target": "9",- "limit": "31",- "reviewer": "Assign reviewer"- },- {- "id": 12,- "header": "Advantages Over Current Technologies",- "type": "Narrative",- "status": "Done",- "target": "12",- "limit": "0",- "reviewer": "Assign reviewer"- },- {- "id": 13,- "header": "Past Performance",- "type": "Narrative",- "status": "Done",- "target": "22",- "limit": "33",- "reviewer": "Assign reviewer"- },- {- "id": 14,- "header": "Customer Feedback and Satisfaction Levels",- "type": "Narrative",- "status": "Done",- "target": "15",- "limit": "34",- "reviewer": "Assign reviewer"- },- {- "id": 15,- "header": "Implementation Challenges and Solutions",- "type": "Narrative",- "status": "Done",- "target": "3",- "limit": "35",- "reviewer": "Assign reviewer"- },- {- "id": 16,- "header": "Security Measures and Data Protection Policies",- "type": "Narrative",- "status": "In Process",- "target": "6",- "limit": "36",- "reviewer": "Assign reviewer"- },- {- "id": 17,- "header": "Scalability and Future Proofing",- "type": "Narrative",- "status": "Done",- "target": "4",- "limit": "37",- "reviewer": "Assign reviewer"- },- {- "id": 18,- "header": "Cost-Benefit Analysis",- "type": "Plain language",- "status": "Done",- "target": "14",- "limit": "38",- "reviewer": "Assign reviewer"- },- {- "id": 19,- "header": "User Training and Onboarding Experience",- "type": "Narrative",- "status": "Done",- "target": "17",- "limit": "39",- "reviewer": "Assign reviewer"- },- {- "id": 20,- "header": "Future Development Roadmap",- "type": "Narrative",- "status": "Done",- "target": "11",- "limit": "40",- "reviewer": "Assign reviewer"- },- {- "id": 21,- "header": "System Architecture Overview",- "type": "Technical content",- "status": "In Process",- "target": "24",- "limit": "18",- "reviewer": "Maya Johnson"- },- {- "id": 22,- "header": "Risk Management Plan",- "type": "Narrative",- "status": "Done",- "target": "15",- "limit": "22",- "reviewer": "Carlos Rodriguez"- },- {- "id": 23,- "header": "Compliance Documentation",- "type": "Legal",- "status": "In Process",- "target": "31",- "limit": "27",- "reviewer": "Sarah Chen"- },- {- "id": 24,- "header": "API Documentation",- "type": "Technical content",- "status": "Done",- "target": "8",- "limit": "12",- "reviewer": "Raj Patel"- },- {- "id": 25,- "header": "User Interface Mockups",- "type": "Visual",- "status": "In Process",- "target": "19",- "limit": "25",- "reviewer": "Leila Ahmadi"- },- {- "id": 26,- "header": "Database Schema",- "type": "Technical content",- "status": "Done",- "target": "22",- "limit": "20",- "reviewer": "Thomas Wilson"- },- {- "id": 27,- "header": "Testing Methodology",- "type": "Technical content",- "status": "In Process",- "target": "17",- "limit": "14",- "reviewer": "Assign reviewer"- },- {- "id": 28,- "header": "Deployment Strategy",- "type": "Narrative",- "status": "Done",- "target": "26",- "limit": "30",- "reviewer": "Eddie Lake"- },- {- "id": 29,- "header": "Budget Breakdown",- "type": "Financial",- "status": "In Process",- "target": "13",- "limit": "16",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 30,- "header": "Market Analysis",- "type": "Research",- "status": "Done",- "target": "29",- "limit": "32",- "reviewer": "Sophia Martinez"- },- {- "id": 31,- "header": "Competitor Comparison",- "type": "Research",- "status": "In Process",- "target": "21",- "limit": "19",- "reviewer": "Assign reviewer"- },- {- "id": 32,- "header": "Maintenance Plan",- "type": "Technical content",- "status": "Done",- "target": "16",- "limit": "23",- "reviewer": "Alex Thompson"- },- {- "id": 33,- "header": "User Personas",- "type": "Research",- "status": "In Process",- "target": "27",- "limit": "24",- "reviewer": "Nina Patel"- },- {- "id": 34,- "header": "Accessibility Compliance",- "type": "Legal",- "status": "Done",- "target": "18",- "limit": "21",- "reviewer": "Assign reviewer"- },- {- "id": 35,- "header": "Performance Metrics",- "type": "Technical content",- "status": "In Process",- "target": "23",- "limit": "26",- "reviewer": "David Kim"- },- {- "id": 36,- "header": "Disaster Recovery Plan",- "type": "Technical content",- "status": "Done",- "target": "14",- "limit": "17",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 37,- "header": "Third-party Integrations",- "type": "Technical content",- "status": "In Process",- "target": "25",- "limit": "28",- "reviewer": "Eddie Lake"- },- {- "id": 38,- "header": "User Feedback Summary",- "type": "Research",- "status": "Done",- "target": "20",- "limit": "15",- "reviewer": "Assign reviewer"- },- {- "id": 39,- "header": "Localization Strategy",- "type": "Narrative",- "status": "In Process",- "target": "12",- "limit": "19",- "reviewer": "Maria Garcia"- },- {- "id": 40,- "header": "Mobile Compatibility",- "type": "Technical content",- "status": "Done",- "target": "28",- "limit": "31",- "reviewer": "James Wilson"- },- {- "id": 41,- "header": "Data Migration Plan",- "type": "Technical content",- "status": "In Process",- "target": "19",- "limit": "22",- "reviewer": "Assign reviewer"- },- {- "id": 42,- "header": "Quality Assurance Protocols",- "type": "Technical content",- "status": "Done",- "target": "30",- "limit": "33",- "reviewer": "Priya Singh"- },- {- "id": 43,- "header": "Stakeholder Analysis",- "type": "Research",- "status": "In Process",- "target": "11",- "limit": "14",- "reviewer": "Eddie Lake"- },- {- "id": 44,- "header": "Environmental Impact Assessment",- "type": "Research",- "status": "Done",- "target": "24",- "limit": "27",- "reviewer": "Assign reviewer"- },- {- "id": 45,- "header": "Intellectual Property Rights",- "type": "Legal",- "status": "In Process",- "target": "17",- "limit": "20",- "reviewer": "Sarah Johnson"- },- {- "id": 46,- "header": "Customer Support Framework",- "type": "Narrative",- "status": "Done",- "target": "22",- "limit": "25",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 47,- "header": "Version Control Strategy",- "type": "Technical content",- "status": "In Process",- "target": "15",- "limit": "18",- "reviewer": "Assign reviewer"- },- {- "id": 48,- "header": "Continuous Integration Pipeline",- "type": "Technical content",- "status": "Done",- "target": "26",- "limit": "29",- "reviewer": "Michael Chen"- },- {- "id": 49,- "header": "Regulatory Compliance",- "type": "Legal",- "status": "In Process",- "target": "13",- "limit": "16",- "reviewer": "Assign reviewer"- },- {- "id": 50,- "header": "User Authentication System",- "type": "Technical content",- "status": "Done",- "target": "28",- "limit": "31",- "reviewer": "Eddie Lake"- },- {- "id": 51,- "header": "Data Analytics Framework",- "type": "Technical content",- "status": "In Process",- "target": "21",- "limit": "24",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 52,- "header": "Cloud Infrastructure",- "type": "Technical content",- "status": "Done",- "target": "16",- "limit": "19",- "reviewer": "Assign reviewer"- },- {- "id": 53,- "header": "Network Security Measures",- "type": "Technical content",- "status": "In Process",- "target": "29",- "limit": "32",- "reviewer": "Lisa Wong"- },- {- "id": 54,- "header": "Project Timeline",- "type": "Planning",- "status": "Done",- "target": "14",- "limit": "17",- "reviewer": "Eddie Lake"- },- {- "id": 55,- "header": "Resource Allocation",- "type": "Planning",- "status": "In Process",- "target": "27",- "limit": "30",- "reviewer": "Assign reviewer"- },- {- "id": 56,- "header": "Team Structure and Roles",- "type": "Planning",- "status": "Done",- "target": "20",- "limit": "23",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 57,- "header": "Communication Protocols",- "type": "Planning",- "status": "In Process",- "target": "15",- "limit": "18",- "reviewer": "Assign reviewer"- },- {- "id": 58,- "header": "Success Metrics",- "type": "Planning",- "status": "Done",- "target": "30",- "limit": "33",- "reviewer": "Eddie Lake"- },- {- "id": 59,- "header": "Internationalization Support",- "type": "Technical content",- "status": "In Process",- "target": "23",- "limit": "26",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 60,- "header": "Backup and Recovery Procedures",- "type": "Technical content",- "status": "Done",- "target": "18",- "limit": "21",- "reviewer": "Assign reviewer"- },- {- "id": 61,- "header": "Monitoring and Alerting System",- "type": "Technical content",- "status": "In Process",- "target": "25",- "limit": "28",- "reviewer": "Daniel Park"- },- {- "id": 62,- "header": "Code Review Guidelines",- "type": "Technical content",- "status": "Done",- "target": "12",- "limit": "15",- "reviewer": "Eddie Lake"- },- {- "id": 63,- "header": "Documentation Standards",- "type": "Technical content",- "status": "In Process",- "target": "27",- "limit": "30",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 64,- "header": "Release Management Process",- "type": "Planning",- "status": "Done",- "target": "22",- "limit": "25",- "reviewer": "Assign reviewer"- },- {- "id": 65,- "header": "Feature Prioritization Matrix",- "type": "Planning",- "status": "In Process",- "target": "19",- "limit": "22",- "reviewer": "Emma Davis"- },- {- "id": 66,- "header": "Technical Debt Assessment",- "type": "Technical content",- "status": "Done",- "target": "24",- "limit": "27",- "reviewer": "Eddie Lake"- },- {- "id": 67,- "header": "Capacity Planning",- "type": "Planning",- "status": "In Process",- "target": "21",- "limit": "24",- "reviewer": "Jamik Tashpulatov"- },- {- "id": 68,- "header": "Service Level Agreements",- "type": "Legal",- "status": "Done",- "target": "26",- "limit": "29",- "reviewer": "Assign reviewer"- }-]\ No newline at end of filediff --git a/flowsint-web/src/app/dashboard/entities/page.tsx b/flowsint-web/src/app/dashboard/entities/page.tsxdeleted file mode 100644index da43e053..00000000--- a/flowsint-web/src/app/dashboard/entities/page.tsx+++ /dev/null@@ -1,18 +0,0 @@-import React from 'react'-import data from "./data.json"-import { DataTable } from './data-table'-import { SubNav } from '@/components/dashboard/sub-nav'-const page = () => {- return (- <>- <div className="sticky z-40 bg-background w-full hidden md:flex top-[48px] border-b">- <SubNav />- </div>- <div className="w-full space-y-8 container mx-auto py-12 px-8">- <DataTable data={data} />- </div>- </>- )-}--export default page\ No newline at end of filediff --git a/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/client.tsx b/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/client.tsxindex 5cdf1bca..e8e1bf10 100644--- a/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/client.tsx+++ b/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/client.tsx@@ -26,9 +26,6 @@ export default function DashboardClient({ projectId, investigationId }: Dashboar})return (<>- <div className="sticky z-40 bg-background top-[48px] border-b">- <InvestigationtNavigation project_id={projectId} investigation_id={investigationId} />- </div>{view === "flow-graph" ?<InvestigationGraph graphQuery={graphQuery} />:diff --git a/flowsint-web/src/app/dashboard/entities/data-table.tsx b/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/individuals/data-table.tsxsimilarity index 88%rename from flowsint-web/src/app/dashboard/entities/data-table.tsxrename to flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/individuals/data-table.tsxindex cd96cb89..1f9ab470 100644--- a/flowsint-web/src/app/dashboard/entities/data-table.tsx+++ b/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/individuals/data-table.tsx@@ -48,6 +48,7 @@ import {LoaderIcon,MoreVerticalIcon,PlusIcon,+ RotateCwIcon,TrendingUpIcon,} from "lucide-react"import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"@@ -106,6 +107,9 @@ import {TabsList,TabsTrigger,} from "@/components/ui/tabs"+import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"+import { formatDistanceToNow } from "date-fns"+import { cn } from "@/lib/utils"export const schema = z.object({id: z.number(),@@ -170,124 +174,86 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [enableHiding: false,},{- accessorKey: "header",- header: "Header",+ accessorKey: "full_name",+ header: "Full Name",cell: ({ row }: any) => {- return <TableCellViewer item={row.original} />+ return (+ <TableCellViewer item={row.original}>+ <div className="flex items-center gap-2">+ <Avatar className="h-7 w-7">+ <AvatarImage src={row.original.image_url} alt={row.original.full_name} />+ <AvatarFallback>{row.original.full_name[0]}</AvatarFallback>+ </Avatar>{row.original.full_name}+ </div>+ </TableCellViewer>)+ },+ enableHiding: false,+ },+ {+ accessorKey: "email",+ header: "Email(s)",+ cell: ({ row }: any) => {+ return <Badge variant="outline" className="px-1.5 text-muted-foreground flex items-center gap-2 max-w-[290px]">+ <span className="truncate text-ellipsis">{row.original?.emails?.map(({ email }: any) => email).join(", ") || <span className="italic opacity-60">No email yet.</span>}</span>+ </Badge>+ },+ enableHiding: false,+ },+ {+ accessorKey: "phone_numbers",+ header: "Phone(s)",+ cell: ({ row }: any) => {+ return <Badge variant="outline" className="px-1.5 text-muted-foreground flex items-center gap-2 max-w-[290px]">+ <span className="truncate text-ellipsis">{row.original?.phone_numbers?.map(({ phone_number }: any) => phone_number).join(", ") || <span className="italic opacity-60">No phone number yet.</span>}</span>+ </Badge>},enableHiding: false,},{- accessorKey: "type",- header: "Section Type",+ accessorKey: "created_at",+ header: "Discovered",cell: ({ row }: any) => (- <div className="w-32">+ <div><Badge variant="outline" className="px-1.5 text-muted-foreground">- {row.original.type}+ {formatDistanceToNow(row.original.created_at, { addSuffix: true }) || "N/A"}</Badge></div>),},{- accessorKey: "status",- header: "Status",+ accessorKey: "nationality",+ header: "Nationality",cell: ({ row }: any) => (- <Badge- variant="outline"- className="flex gap-1 px-1.5 text-muted-foreground [&_svg]:size-3"- >- {row.original.status === "Done" ? (- <CheckCircle2Icon className="text-green-500 dark:text-green-400" />- ) : (- <LoaderIcon className="animate-spin"/>- )}- {row.original.status}- </Badge>+ <div>+ <Badge variant="outline" className="px-1.5 text-muted-foreground">+ {row.original.nationality || "N/A"}+ </Badge>+ </div>),},{- accessorKey: "target",- header: () => <div className="w-full text-right">Target</div>,+ accessorKey: "birth_date",+ header: "Born on",cell: ({ row }: any) => (- <form- onSubmit={(e) => {- e.preventDefault()- toast.promise(new Promise((resolve) => setTimeout(resolve, 1000)), {- loading: `Saving ${row.original.header}`,- success: "Done",- error: "Error",- })- }}+ <Badge+ variant="outline"+ className="flex gap-1 px-1.5 text-muted-foreground [&_svg]:size-3">- <Label htmlFor={`${row.original.id}-target`} className="sr-only">- Target- </Label>- <Input- className="h-8 w-16 border-transparent bg-transparent text-right shadow-none hover:bg-input/30 focus-visible:border focus-visible:bg-background"- defaultValue={row.original.target}- id={`${row.original.id}-target`}- />- </form>+ <span>{row.originalbirth_date || "N/A"}</span>+ </Badge>),},{- accessorKey: "limit",- header: () => <div className="w-full text-right">Limit</div>,+ accessorKey: "gender",+ header: "Gender",cell: ({ row }: any) => (- <form- onSubmit={(e) => {- e.preventDefault()- toast.promise(new Promise((resolve) => setTimeout(resolve, 1000)), {- loading: `Saving ${row.original.header}`,- success: "Done",- error: "Error",- })- }}- >- <Label htmlFor={`${row.original.id}-limit`} className="sr-only">- Limit- </Label>- <Input- className="h-8 w-16 border-transparent bg-transparent text-right shadow-none hover:bg-input/30 focus-visible:border focus-visible:bg-background"- defaultValue={row.original.limit}- id={`${row.original.id}-limit`}- />- </form>+ <div>+ <Badge variant="outline" className="px-1.5 text-muted-foreground">+ {row.original.gender || "N/A"}+ </Badge>+ </div>),},- {- accessorKey: "reviewer",- header: "Reviewer",- cell: ({ row }: any) => {- const isAssigned = row.original.reviewer !== "Assign reviewer"-- if (isAssigned) {- return row.original.reviewer- }-- return (- <>- <Label htmlFor={`${row.original.id}-reviewer`} className="sr-only">- Reviewer- </Label>- <Select>- <SelectTrigger- className="h-8 w-40"- id={`${row.original.id}-reviewer`}- >- <SelectValue placeholder="Assign reviewer" />- </SelectTrigger>- <SelectContent align="end">- <SelectItem value="Eddie Lake">Eddie Lake</SelectItem>- <SelectItem value="Jamik Tashpulatov">- Jamik Tashpulatov- </SelectItem>- </SelectContent>- </Select>- </>- )- },- },{id: "actions",cell: () => (@@ -302,7 +268,7 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [<span className="sr-only">Open menu</span></Button></DropdownMenuTrigger>- <DropdownMenuContent align="end" className="w-32">+ <DropdownMenuContent align="end"><DropdownMenuItem>Edit</DropdownMenuItem><DropdownMenuItem>Make a copy</DropdownMenuItem><DropdownMenuItem>Favorite</DropdownMenuItem>@@ -341,8 +307,18 @@ function DraggableRow({ row }: { row: Row<z.infer<typeof schema>> }) {export function DataTable({data: initialData,+ pageCount,+ pagination,+ setPagination,+ refetch,+ isRefetching}: {- data: z.infer<typeof schema>[]+ data: z.infer<typeof schema>[],+ pageCount: number+ pagination: any+ setPagination: any+ refetch: () => void+ isRefetching: boolean}) {const [data, setData] = React.useState(() => initialData)const [rowSelection, setRowSelection] = React.useState({})@@ -352,10 +328,6 @@ export function DataTable({[])const [sorting, setSorting] = React.useState<SortingState>([])- const [pagination, setPagination] = React.useState({- pageIndex: 0,- pageSize: 10,- })const sortableId = React.useId()const sensors = useSensors(useSensor(MouseSensor, {}),@@ -450,6 +422,9 @@ export function DataTable({<TabsTrigger value="focus-documents">Focus Documents</TabsTrigger></TabsList><div className="flex items-center gap-2">+ <Button disabled={isRefetching} onClick={refetch} variant="outline" size="sm">+ <RotateCwIcon className={cn(isRefetching && "animate-spin")} /> Reload+ </Button><DropdownMenu><DropdownMenuTrigger asChild><Button variant="outline" size="sm">@@ -485,7 +460,7 @@ export function DataTable({</DropdownMenu><Button variant="outline" size="sm"><PlusIcon />- <span className="hidden lg:inline">Add Section</span>+ <span className="hidden lg:inline">Add individual</span></Button></div></div>@@ -536,7 +511,7 @@ export function DataTable({colSpan={columns.length}className="h-24 text-center">- No results.+ No individual.</TableCell></TableRow>)}@@ -661,14 +636,14 @@ const chartConfig = {},} satisfies ChartConfig-function TableCellViewer({ item }: { item: z.infer<typeof schema> }) {+function TableCellViewer({ item, children }: { item: z.infer<typeof schema>, children: React.ReactNode }) {const isMobile = useIsMobile()return (<Sheet><SheetTrigger asChild><Button variant="link" className="w-fit px-0 text-left text-foreground">- {item.header}+ {children}</Button></SheetTrigger><SheetContent side="right" className="flex flex-">diff --git a/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/individuals/page.tsx b/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/individuals/page.tsxnew file mode 100644index 00000000..53040d02--- /dev/null+++ b/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/individuals/page.tsx@@ -0,0 +1,39 @@+"use client"+import React, { useState } from 'react'+import { DataTable } from './data-table'+import { useQuery } from '@tanstack/react-query'+import { useParams } from 'next/navigation'+import { TableSkeleton } from '@/components/ui/table-skeleton'++const IndividualsPage = () => {++ const { investigation_id, project_id } = useParams()+ const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 })++ const fetchIndividuals = async () => {+ const response = await fetch(`/api/projects/${project_id}/investigations/${investigation_id}/individuals?page=${pagination.pageIndex + 1}&size=${pagination.pageSize}&includeEmails=true&includePhones=true`)+ return response.json()+ }++ const { data, isLoading, isError, refetch, isRefetching } = useQuery({+ queryKey: ['individuals', 'table', investigation_id, pagination.pageIndex, pagination.pageSize],+ queryFn: fetchIndividuals,+ })++ if (isError) return <div>Error fetching deliveries</div>+ return (+ <div className="w-full space-y-8 mx-auto py-12 px-8">+ {isLoading ? <TableSkeleton /> :+ <DataTable data={data.individuals}+ pageCount={data?.individuals?.length}+ pagination={pagination}+ refetch={refetch}+ setPagination={setPagination}+ isRefetching={isRefetching}+ />+ }+ </div>+ )+}++export default IndividualsPage\ No newline at end of filediff --git a/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/layout.tsx b/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/layout.tsxindex ae8c3948..13ce9cca 100644--- a/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/layout.tsx+++ b/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/layout.tsx@@ -1,10 +1,10 @@import { InvestigationProvider } from '@/components/contexts/investigation-provider';-import InvestigationLayout from '@/components/investigations/layout';-import Left from './left';import { SearchProvider } from '@/components/contexts/search-context';import { createClient } from "@/lib/supabase/server";import { redirect } from "next/navigation";import { ChatProvider } from '@/components/contexts/chatbot-context';+import { InvestigationtNavigation } from '@/components/investigations/investigation-navigation';+import { ScanDrawer } from '@/components/investigations/scan-drawer';const DashboardLayout = async ({children,params,@@ -13,6 +13,7 @@ const DashboardLayout = async ({params: Promise<{ project_id: string, investigation_id: string }>}) => {const supabase = await createClient()+ const { investigation_id, project_id } = await paramsconst { data, error: userError } = await supabase.auth.getUser()if (userError || !data?.user) {redirect('/login')@@ -21,9 +22,11 @@ const DashboardLayout = async ({<InvestigationProvider><SearchProvider><ChatProvider>- <InvestigationLayout>- {children}- </InvestigationLayout>+ <div className="sticky z-40 bg-background w-full hidden md:flex top-[48px] border-b">+ <InvestigationtNavigation project_id={project_id} investigation_id={investigation_id} />+ </div>+ {children}+ <ScanDrawer /></ChatProvider></SearchProvider></InvestigationProvider>diff --git a/flowsint-web/src/app/layout.tsx b/flowsint-web/src/app/layout.tsxindex 980658db..3c676f7f 100644--- a/flowsint-web/src/app/layout.tsx+++ b/flowsint-web/src/app/layout.tsx@@ -35,7 +35,10 @@ export default function RootLayout({}) {return (<html suppressHydrationWarning lang="en">- <head />+ <head><script+ crossOrigin="anonymous"+ src="//unpkg.com/react-scan/dist/auto.global.js"+ /></head><bodyclassName={clsx("min-h-screen bg-background font-sans antialiased",@@ -50,7 +53,7 @@ export default function RootLayout({<ConfirmContextProvider>{children}</ConfirmContextProvider>- <Toaster richColors/>+ <Toaster richColors /></TooltipProvider></main></Providers>diff --git a/flowsint-web/src/components/investigations/investigation-navigation.tsx b/flowsint-web/src/components/investigations/investigation-navigation.tsxindex d3d9df48..03add9a8 100644--- a/flowsint-web/src/components/investigations/investigation-navigation.tsx+++ b/flowsint-web/src/components/investigations/investigation-navigation.tsx@@ -1,16 +1,18 @@"use client"import { cn } from "@/lib/utils"-import { Users, TimerIcon, MapIcon, WaypointsIcon } from "lucide-react"+import { Users, TimerIcon, MapIcon, WaypointsIcon } from 'lucide-react'import Link from "next/link"import { usePathname } from "next/navigation"+import { memo, useMemo } from "react"import MoreMenu from "./more-menu"import { ScanButton } from "./scans-drawer/scan-button"--export function InvestigationtNavigation({ project_id, investigation_id }: { project_id: string, investigation_id: string }) {+function InvestigationNavigation({ project_id, investigation_id }: { project_id: string, investigation_id: string }) {const pathname = usePathname()- const sections = [++ // Memoize the sections array so it doesn't get recreated on every render+ const sections = useMemo(() => [{id: "sketch",name: "Sketch",@@ -35,10 +37,10 @@ export function InvestigationtNavigation({ project_id, investigation_id }: { prohref: `/dashboard/projects/${project_id}/investigations/${investigation_id}/map`,icon: MapIcon,},- ]+ ], [project_id, investigation_id]);return (- <div className="flex items-center justify-between">+ <div className="flex items-center justify-between w-full"><div className="flex overflow-auto">{sections.map((section) => (<Link@@ -53,9 +55,6 @@ export function InvestigationtNavigation({ project_id, investigation_id }: { pro><section.icon className="h-4 w-4" /><span>{section.name}</span>- {/* {section?.count && (- <span className="ml-1 rounded-full bg-primary/10 px-2 py-0.5 text-xs">{section.count}</span>- )} */}</Link>))}</div>@@ -67,3 +66,8 @@ export function InvestigationtNavigation({ project_id, investigation_id }: { pro)}+// Memoize the entire component+export const MemoizedInvestigationNavigation = memo(InvestigationNavigation);++// For backward compatibility, you can also export the original name+export { MemoizedInvestigationNavigation as InvestigationtNavigation };\ No newline at end of filediff --git a/flowsint-web/src/components/investigations/layout.tsx b/flowsint-web/src/components/investigations/layout.tsxdeleted file mode 100644index ef1f9c9d..00000000--- a/flowsint-web/src/components/investigations/layout.tsx+++ /dev/null@@ -1,15 +0,0 @@-"use client"-import { ScanDrawer } from './scan-drawer';-const InvestigationLayout = ({- children,-}: {- children: React.ReactNode;-}) => {- return (<>- {children}- < ScanDrawer />- </>- )-}--export default InvestigationLayout\ No newline at end of filediff --git a/flowsint-web/src/components/investigations/sketch/graph.tsx b/flowsint-web/src/components/investigations/sketch/graph.tsxindex 9232937f..6154746b 100644--- a/flowsint-web/src/components/investigations/sketch/graph.tsx+++ b/flowsint-web/src/components/investigations/sketch/graph.tsx@@ -1,5 +1,5 @@"use client"-import { useCallback, useEffect, useState } from "react"+import { useCallback, useEffect, useState, useMemo } from "react"import type React from "react"import {ReactFlow,@@ -32,19 +32,18 @@ import {} from "lucide-react"import { useTheme } from "next-themes"import NewActions from "../new-actions"-import FloatingConnectionLine from "./floating-connection"import { useParams } from "next/navigation"import { Tooltip, TooltipContent } from "@/components/ui/tooltip"import { Button } from "@/components/ui/button"import { TooltipTrigger } from "@radix-ui/react-tooltip"import { cn } from "@/lib/utils"import { useInvestigationStore } from "@/store/investigation-store"-import { useFlowStore } from "../../../store/flow-store"-import Loader from "../../loader"+import { useFlowStore } from "@/store/flow-store"+import Loader from "@/components/loader"import { useQueryState } from "nuqs"-import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "../../ui/context-menu"+import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "@/components/ui/context-menu"import AddNodeModal from "../add-node-modal"-import { Dialog, DialogTrigger } from "../../ui/dialog"+import { Dialog, DialogTrigger } from "@/components/ui/dialog"import { memo } from "react"import { shallow } from "zustand/shallow"import { TooltipProvider } from "@/components/ui/tooltip"@@ -52,6 +51,15 @@ import NodeContextMenu from "./nodes/node-context-menu"import GroupNode from "./nodes/group"import CustomEdge from "./nodes/custom-edge"import { BaseNode } from "@/components/ui/base-node"+import {+ ResizableHandle,+ ResizablePanel,+ ResizablePanelGroup,+} from "@/components/ui/resizable"+import NodesPanel from "./nodes-panel"++// Définir les types de nodes et edges à l'extérieur du composant+// pour éviter leur recréation à chaque renduconst edgeTypes = {custom: CustomEdge,}@@ -67,7 +75,7 @@ const nodeTypes = {default: BaseNode}-// Split selectors to minimize re-renders+// Séparation claire des sélecteurs pour un contrôle fin des re-rendusconst nodeEdgeSelector = (store: { nodes: any; edges: any }) => ({nodes: store.nodes,edges: store.edges,@@ -89,14 +97,23 @@ const actionsSelector = (store: {onLayout: store.onLayout,})-const stateSelector = (store: { currentNode: any; setCurrentNode: any, resetNodeStyles: any; reloading: any }) => ({+const stateSelector = (store: {+ currentNode: any;+ setCurrentNode: any,+ resetNodeStyles: any;+ reloading: any;+ updateNode: any;+ highlightPath: any;+}) => ({currentNode: store.currentNode,resetNodeStyles: store.resetNodeStyles,reloading: store.reloading,setCurrentNode: store.setCurrentNode,+ updateNode: store.updateNode,+ highlightPath: store.highlightPath})-+// Définition de l'interface pour FlowControlsinterface FlowControlsProps {onLayout: (direction: string, fitView: () => void) => voidfitView: () => void@@ -105,10 +122,11 @@ interface FlowControlsProps {setView: (view: string) => voidzoomIn: () => voidzoomOut: () => void- addNodes: (payload: Node | Node[]) => void+ addNodes: (payload: any) => voidcurrentNode: any | null | undefined}+// Mémorisation du composant FlowControlsconst FlowControls = memo(({ onLayout, fitView, handleRefetch, reloading, setView, zoomIn, zoomOut, addNodes, currentNode }: FlowControlsProps) => {return (@@ -170,6 +188,13 @@ const FlowControls = memo(</>)},+ // Comparateur personnalisé pour le composant mémorisé+ (prevProps, nextProps) => {+ return (+ prevProps.reloading === nextProps.reloading &&+ prevProps.currentNode?.id === nextProps.currentNode?.id+ )+ })interface LayoutFlowProps {@@ -183,7 +208,7 @@ const LayoutFlow = ({ refetch, theme }: LayoutFlowProps) => {const { settings } = useInvestigationStore()const [_, setView] = useQueryState("view", { defaultValue: "flow-graph" })- // Node context menu state+ // État pour le menu contextuel des nœudsconst [nodeContextMenu, setNodeContextMenu] = useState<{x: numbery: number@@ -192,16 +217,23 @@ const LayoutFlow = ({ refetch, theme }: LayoutFlowProps) => {data: any} | null>(null)- // Split store access to minimize re-renders+ // Séparation des selectors pour optimiser les re-rendusconst { nodes, edges } = useFlowStore(nodeEdgeSelector, shallow)const { onNodesChange, onEdgesChange, onConnect, onNodeClick, onPaneClick, onLayout } = useFlowStore(actionsSelector,shallow,)- const { currentNode, setCurrentNode, resetNodeStyles, reloading } = useFlowStore(stateSelector, shallow)-- // Initial layout- useEffect(() => {+ const {+ currentNode,+ setCurrentNode,+ resetNodeStyles,+ reloading,+ updateNode,+ highlightPath+ } = useFlowStore(stateSelector, shallow)++ // Initial layout avec useCallback pour éviter les recréations+ const initialLayout = useCallback(() => {const timer = setTimeout(() => {onLayout("TB", fitView)fitView()@@ -209,21 +241,27 @@ const LayoutFlow = ({ refetch, theme }: LayoutFlowProps) => {return () => clearTimeout(timer)}, [onLayout, fitView])+ // Utiliser l'effet initial avec la fonction mémorisée+ useEffect(() => {+ return initialLayout()+ }, [initialLayout])++ // Mémorisation du callback de refetchconst handleRefetch = useCallback(() => {refetch()onLayout("TB", fitView)fitView()}, [refetch, onLayout, fitView])- // // Node highlighting effect+ // Effet pour gérer la mise en évidence du nœud courantuseEffect(() => {- resetNodeStyles()if (!currentNode) returnconst internalNode = getNode(currentNode.id)if (!internalNode) return- useFlowStore.getState().updateNode(internalNode.id, {+ // Utiliser les fonctions du store récupérées via le sélecteur+ updateNode(internalNode.id, {...internalNode,zIndex: 5000,data: { ...internalNode.data, forceToolbarVisible: true },@@ -238,120 +276,154 @@ const LayoutFlow = ({ refetch, theme }: LayoutFlowProps) => {zoom: 1.5,})- useFlowStore.getState().highlightPath(internalNode)- }, [currentNode, getNode, setCenter, resetNodeStyles])-- // Memoize connection handler to prevent recreation- const handleConnect = useCallback((params: any) => onConnect(params, investigation_id), [onConnect, investigation_id])-- // Handle node context menu- const handleNodeContextMenu: NodeMouseHandler = useCallback((event, node) => {- event.stopPropagation()- setCurrentNode(node)- // Prevent default context menu- event.preventDefault()- setNodeContextMenu({- x: event.screenX - 200,- y: event.screenY - 150,- nodeId: node.id,- data: node.data,- nodeType: node.type || "default",- })- }, [])+ // Utiliser highlightPath depuis le sélecteur+ // highlightPath(internalNode)+ }, [currentNode, getNode, setCenter, updateNode, highlightPath])++ // Mémorisation du gestionnaire de connexion+ const handleConnect = useCallback(+ (params: any) => onConnect(params, investigation_id),+ [onConnect, investigation_id]+ )++ // Gestionnaire optimisé pour le menu contextuel des nœuds+ const handleNodeContextMenu = useCallback<NodeMouseHandler>(+ (event, node) => {+ event.preventDefault()+ event.stopPropagation()+ setCurrentNode(node)+ setNodeContextMenu({+ x: event.screenX - 200,+ y: event.screenY - 150,+ nodeId: node.id,+ data: node.data,+ nodeType: node.type || "default",+ })+ },+ [setCurrentNode]+ )- // Close node context menu+ // Fermeture du menu contextuelconst closeNodeContextMenu = useCallback(() => {setNodeContextMenu(null)}, [])- // Handle pane click to close context menu+ // Gestion des clics sur le panneauconst handlePaneClick = useCallback((event: React.MouseEvent) => {closeNodeContextMenu()onPaneClick(event)},- [onPaneClick, closeNodeContextMenu],+ [onPaneClick, closeNodeContextMenu])+ // Mémorisation de ReactFlow props pour éviter les recréations+ const reactFlowProps = useMemo(() => ({+ colorMode: theme as ColorMode,+ nodes,+ edges,+ onNodesChange,+ onEdgesChange,+ onConnect: handleConnect,+ onNodeClick,+ onPaneClick: handlePaneClick,+ onNodeContextMenu: handleNodeContextMenu,+ minZoom: 0.1,+ fitView: true,+ proOptions: { hideAttribution: true },+ edgeTypes,+ nodeTypes,+ className: "!bg-background"+ }), [+ theme,+ nodes,+ edges,+ onNodesChange,+ onEdgesChange,+ handleConnect,+ onNodeClick,+ handlePaneClick,+ handleNodeContextMenu+ ])+return (- <div className="w-full grow relative">- <TooltipProvider>- <Dialog>- <ContextMenu>- <ContextMenuTrigger className="h-full w-full">- <ReactFlow- colorMode={theme as ColorMode}- nodes={nodes}- edges={edges}- onNodesChange={onNodesChange}- onEdgesChange={onEdgesChange}- onConnect={handleConnect}- onNodeClick={onNodeClick}- onPaneClick={handlePaneClick}- onNodeContextMenu={handleNodeContextMenu}- minZoom={0.1}- // @ts-ignore- connectionLineComponent={FloatingConnectionLine}- fitView- proOptions={{ hideAttribution: true }}- nodeTypes={nodeTypes}- // @ts-ignore- edgeTypes={edgeTypes}- className="!bg-background"- >- <FlowControls- onLayout={onLayout}- fitView={fitView}- handleRefetch={handleRefetch}- reloading={reloading}- setView={setView}- zoomIn={zoomIn}- zoomOut={zoomOut}- // @ts-ignore- addNodes={addNodes}- currentNode={currentNode}- />- <Background />- {settings.showMiniMap && <MiniMap className="!z-40" pannable />}- </ReactFlow>- </ContextMenuTrigger>- <ContextMenuContent className="w-32">- <DialogTrigger asChild>- <ContextMenuItem>- <PlusIcon className="h-4 w-4 opacity-60" />- <span>New node</span>+ <ResizablePanelGroup direction="horizontal" className="w-screen grow relative overflow-hidden">+ <ResizablePanel defaultSize={80}>+ <TooltipProvider>+ <Dialog>+ <ContextMenu>+ <ContextMenuTrigger className="h-full w-full">+ <ReactFlow {...reactFlowProps}>+ <FlowControls+ onLayout={onLayout}+ fitView={fitView}+ handleRefetch={handleRefetch}+ reloading={reloading}+ setView={setView}+ zoomIn={zoomIn}+ zoomOut={zoomOut}+ addNodes={addNodes}+ currentNode={currentNode}+ />+ <Background />+ {settings.showMiniMap && <MiniMap className="!z-40" pannable />}+ </ReactFlow>+ </ContextMenuTrigger>+ <ContextMenuContent className="w-32">+ <DialogTrigger asChild>+ <ContextMenuItem>+ <PlusIcon className="h-4 w-4 opacity-60" />+ <span>New node</span>+ </ContextMenuItem>+ </DialogTrigger>+ <ContextMenuItem disabled>+ <GroupIcon className="h-4 w-4 opacity-60" />+ <span>New group</span></ContextMenuItem>- </DialogTrigger>- <ContextMenuItem disabled>- <GroupIcon className="h-4 w-4 opacity-60" />- <span>New group</span>- </ContextMenuItem>- </ContextMenuContent>- </ContextMenu>- <AddNodeModal addNodes={addNodes} />- </Dialog>- <NodeContextMenu- x={nodeContextMenu?.x}- y={nodeContextMenu?.y}- onClose={closeNodeContextMenu}- />- </TooltipProvider>- </div>+ </ContextMenuContent>+ </ContextMenu>+ <AddNodeModal addNodes={addNodes} />+ </Dialog>+ <NodeContextMenu+ x={nodeContextMenu?.x}+ y={nodeContextMenu?.y}+ onClose={closeNodeContextMenu}+ />+ </TooltipProvider>+ </ResizablePanel>+ <ResizableHandle />+ <ResizablePanel defaultSize={20} className="h-full">+ <ResizablePanelGroup direction="vertical">+ <ResizablePanel defaultSize={80}>+ <NodesPanel nodes={nodes} />+ </ResizablePanel>+ <ResizableHandle />+ <ResizablePanel defaultSize={20}>+ two+ </ResizablePanel>+ </ResizablePanelGroup>+ </ResizablePanel>+ </ResizablePanelGroup>)}-// Memoize LayoutFlow to prevent unnecessary re-renders-const MemoizedLayoutFlow = memo(LayoutFlow)+// Mémorisation de LayoutFlow avec un comparateur personnalisé+const MemoizedLayoutFlow = memo(LayoutFlow, (prevProps, nextProps) => {+ return prevProps.theme === nextProps.theme && prevProps.refetch === nextProps.refetch+})+// Composant Graph principalfunction Graph({ graphQuery }: { graphQuery: any }) {const [mounted, setMounted] = useState(false)const { refetch, isLoading, data } = graphQueryconst { resolvedTheme } = useTheme()+ // Effet pour initialiser l'état montéuseEffect(() => {setMounted(true)}, [])+ // Effet pour mettre à jour le store avec de nouvelles donnéesuseEffect(() => {if (data) {useFlowStore.setState({ nodes: data?.nodes, edges: data?.edges })@@ -359,6 +431,7 @@ function Graph({ graphQuery }: { graphQuery: any }) {}}, [data])+ // Rendu conditionnel basé sur l'état de chargementif (!mounted || isLoading) {return (<div className="grow w-full flex items-center justify-center">@@ -369,12 +442,10 @@ function Graph({ graphQuery }: { graphQuery: any }) {return (<ReactFlowProvider>- {/* @ts-ignore */}- <MemoizedLayoutFlow refetch={refetch} isLoading={isLoading as boolean} theme={resolvedTheme as string} />+ <MemoizedLayoutFlow refetch={refetch} theme={resolvedTheme || "light"} /></ReactFlowProvider>)}-// Export the memoized Graph component-export default memo(Graph)-+// Export du composant Graph mémorisé+export default memo(Graph)\ No newline at end of filediff --git a/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx b/flowsint-web/src/components/investigations/sketch/nodes-panel.tsxnew file mode 100644index 00000000..0061c479--- /dev/null+++ b/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx@@ -0,0 +1,25 @@+import React, { memo } from 'react'+import { type Node } from '@xyflow/react'+import { useFlowStore } from '@/store/flow-store'+import { Button } from '@/components/ui/button'+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'+import { Badge } from '@/components/ui/badge'+const NodesPanel = ({ nodes }: { nodes: Node[] }) => {+ const { setCurrentNode } = useFlowStore()+ return (+ <div className="!overflow-auto h-full flex flex-col w-full !p-0 !m-0">+ {nodes?.map((node: any) => (+ <Button variant={"ghost"} className='flex items-center justify-start p-4 !py-5 rounded-none text-left border-b' onClick={() => setCurrentNode(node)} key={node.id}>+ <Avatar className="h-7 w-7">+ <AvatarImage src={node?.data?.image_url} alt={node?.data?.full_name} />+ <AvatarFallback>{node?.data?.full_name?.[0]}</AvatarFallback>+ </Avatar>+ <div className='grow truncate text-ellipsis'>{node?.data?.full_name || node?.data?.label}</div>+ <Badge variant={"outline"}>{node?.type}</Badge>+ </Button>+ ))}+ </div>+ )+}++export default memo(NodesPanel)\ No newline at end of filediff --git a/flowsint-web/src/components/investigations/sketch/nodes/button-edge.tsx b/flowsint-web/src/components/investigations/sketch/nodes/button-edge.tsxindex 088bc14a..e728b37e 100644--- a/flowsint-web/src/components/investigations/sketch/nodes/button-edge.tsx+++ b/flowsint-web/src/components/investigations/sketch/nodes/button-edge.tsx@@ -1,14 +1,15 @@-import { ReactNode } from "react";+// ButtonEdge.tsx+import { ReactNode, memo } from "react";import {BaseEdge,EdgeLabelRenderer,EdgeProps,- getBezierPath,getStraightPath,} from "@xyflow/react";-export const ButtonEdge = ({+// Mémorisation du composant ButtonEdge+export const ButtonEdge = memo(({sourceX,sourceY,targetX,@@ -40,4 +41,6 @@ export const ButtonEdge = ({</EdgeLabelRenderer></>);-};\ No newline at end of file+});++ButtonEdge.displayName = "ButtonEdge";\ No newline at end of filediff --git a/flowsint-web/src/components/investigations/sketch/nodes/custom-edge.tsx b/flowsint-web/src/components/investigations/sketch/nodes/custom-edge.tsxindex d263708b..884fe768 100644--- a/flowsint-web/src/components/investigations/sketch/nodes/custom-edge.tsx+++ b/flowsint-web/src/components/investigations/sketch/nodes/custom-edge.tsx@@ -1,9 +1,9 @@+// EditableEdge.tsx"use client"import type React from "react"-import type { EdgeProps } from "@xyflow/react"-import { memo, useCallback, useState, useRef } from "react"+import { memo, useCallback, useState, useRef, useMemo } from "react"import { supabase } from "@/lib/supabase/client"import { Check, Loader2 } from "lucide-react"import { Button } from "@/components/ui/button"@@ -19,6 +19,7 @@ const EditableEdge = memo((props: EdgeProps) => {const [editValue, setEditValue] = useState((label as string) || "")const submitButtonRef = useRef<HTMLButtonElement>(null)+ // Utilisation de useCallback pour toutes les fonctions gestionnairesconst handleEditClick = useCallback(() => {setIsEditing(true)}, [])@@ -62,45 +63,60 @@ const EditableEdge = memo((props: EdgeProps) => {setEditValue(e.target.value)}, [])- return (- <ButtonEdge {...props}>- <form onSubmit={handleSave} className="flex items-center justify-center h-full">- {isEditing ? (- <div className="flex items-center gap-1 bg-background border rounded-md p-1 shadow-sm">- <Input- autoFocus- value={editValue}- onChange={handleInputChange}- onBlur={handleInputBlur}- className="h-5 text-xs max-w-28 rounded-sm"- />- <Button- ref={submitButtonRef}- size="icon"- variant="ghost"- className="h-5 w-5"- type="submit"- disabled={isLoading}- >- {isLoading ? <Loader2 className="h-3.5 w-3.5 animate-spin" /> : <Check className="h-3.5 w-3.5" />}- </Button>- </div>- ) : (+ // Mémorisation des props pour ButtonEdge pour éviter les re-rendus inutiles+ const buttonEdgeProps = useMemo(() => {+ // Filtrer les props que nous voulons passer à ButtonEdge+ const { label: _, ...restProps } = props;+ return restProps;+ }, [props.sourceX, props.sourceY, props.targetX, props.targetY, props.style, props.markerEnd]);++ // Mémorisation du contenu de formulaire pour éviter les re-rendus inutiles+ const formContent = useMemo(() => {+ if (isEditing) {+ return (+ <div className="flex items-center gap-1 bg-background border rounded-md p-1 shadow-sm">+ <Input+ autoFocus+ value={editValue}+ onChange={handleInputChange}+ onBlur={handleInputBlur}+ className="h-5 text-xs max-w-28 rounded-sm"+ /><Button- onClick={handleEditClick}- size="sm"- variant="secondary"- className={cn("text-xs px-1 py-.5 h-auto", !label && "opacity-70")}+ ref={submitButtonRef}+ size="icon"+ variant="ghost"+ className="h-5 w-5"+ type="submit"+ disabled={isLoading}>- {editValue || ""}+ {isLoading ? <Loader2 className="h-3.5 w-3.5 animate-spin" /> : <Check className="h-3.5 w-3.5" />}</Button>- )}+ </div>+ );+ }++ return (+ <Button+ onClick={handleEditClick}+ size="sm"+ variant="secondary"+ className={cn("text-xs px-1 py-.5 h-auto", !editValue && "opacity-70")}+ >+ {editValue || ""}+ </Button>+ );+ }, [isEditing, editValue, isLoading, handleInputChange, handleInputBlur, handleEditClick]);++ return (+ <ButtonEdge {...buttonEdgeProps}>+ <form onSubmit={handleSave} className="flex items-center justify-center h-full">+ {formContent}</form></ButtonEdge>)-})+});EditableEdge.displayName = "EditableEdge"-export default EditableEdge-+export default EditableEdge\ No newline at end of filediff --git a/flowsint-web/src/components/ui/avatar.tsx b/flowsint-web/src/components/ui/avatar.tsxindex 3c678119..b85e1e3c 100644--- a/flowsint-web/src/components/ui/avatar.tsx+++ b/flowsint-web/src/components/ui/avatar.tsx@@ -13,7 +13,7 @@ function Avatar({<AvatarPrimitive.Rootdata-slot="avatar"className={cn(- "relative flex size-8 shrink-0 overflow-hidden rounded-full",+ "relative flex size-8 shrink-0 overflow-hidden rounded-full border",className)}{...props}diff --git a/flowsint-web/src/components/ui/skeleton.tsx b/flowsint-web/src/components/ui/skeleton.tsxindex 6915144a..b4b6e990 100644--- a/flowsint-web/src/components/ui/skeleton.tsx+++ b/flowsint-web/src/components/ui/skeleton.tsx@@ -4,7 +4,7 @@ function Skeleton({ className, ...props }: React.ComponentProps<"div">) {return (<divdata-slot="skeleton"- className={cn("bg-primary/10 animate-pulse rounded-md", className)}+ className={cn("bg-foreground/5 animate-pulse rounded-md", className)}{...props}/>)diff --git a/flowsint-web/src/components/ui/table-skeleton.tsx b/flowsint-web/src/components/ui/table-skeleton.tsxnew file mode 100644index 00000000..ffc8b5ee--- /dev/null+++ b/flowsint-web/src/components/ui/table-skeleton.tsx@@ -0,0 +1,44 @@+import { Skeleton } from "@/components/ui/skeleton"++interface TableSkeletonProps {+ rows?: number+ columns?: number+}++export function TableSkeleton({ rows = 5, columns = 4 }: TableSkeletonProps) {+ return (+ <div className="w-full">+ <div className="border rounded-lg">+ <div className="border-b">+ <div className="flex">+ {Array.from({ length: columns }).map((_, i) => (+ <div+ key={`header-${i}`}+ className="flex-1 p-4"+ >+ <Skeleton className="h-6 w-full" />+ </div>+ ))}+ </div>+ </div>+ <div>+ {Array.from({ length: rows }).map((_, rowIndex) => (+ <div+ key={`row-${rowIndex}`}+ className="flex border-b last:border-b-0"+ >+ {Array.from({ length: columns }).map((_, colIndex) => (+ <div+ key={`cell-${rowIndex}-${colIndex}`}+ className="flex-1 p-4"+ >+ <Skeleton className="h-4 w-full" />+ </div>+ ))}+ </div>+ ))}+ </div>+ </div>+ </div>+ )+}\ No newline at end of filediff --git a/flowsint-web/src/store/flow-store.ts b/flowsint-web/src/store/flow-store.tsindex ea7c824f..35eb45ef 100644--- a/flowsint-web/src/store/flow-store.ts+++ b/flowsint-web/src/store/flow-store.ts@@ -1,6 +1,7 @@import { create } from 'zustand';import { addEdge, applyNodeChanges, applyEdgeChanges, getIncomers, getOutgoers } from '@xyflow/react';import { supabase } from '@/lib/supabase/client';+import { shallow } from 'zustand/shallow';import {type Edge,type Node,@@ -11,6 +12,19 @@ import { getLayoutedElements } from '@/lib/utils';export type AppNode = Node;+// Create selectors to minimize re-renders+export const selectNodes = (state: { nodes: any; }) => state.nodes;+export const selectEdges = (state: { edges: any; }) => state.edges;+export const selectCurrentNode = (state: { currentNode: any; }) => state.currentNode;+export const selectNodeHandlers = (state: { onNodesChange: any; onEdgesChange: any; onNodeClick: any; onPaneClick: any; }) => ({+ onNodesChange: state.onNodesChange,+ onEdgesChange: state.onEdgesChange,+ onNodeClick: state.onNodeClick,+ onPaneClick: state.onPaneClick,+});+export const selectEdgeHandlers = (state: { onConnect: any; }) => ({+ onConnect: state.onConnect,+});export type AppState = {nodes: AppNode[];@@ -30,6 +44,8 @@ export type AppState = {updateNode: (nodeId: string, nodeData: Partial<Node>) => void;resetNodeStyles: () => void;};++// Create store with proper memoizationconst createStore = (initialNodes: AppNode[] = [], initialEdges: Edge[] = []) => {return create<AppState>((set, get) => ({nodes: initialNodes,@@ -50,11 +66,10 @@ const createStore = (initialNodes: AppNode[] = [], initialEdges: Edge[] = []) =>set({ currentNode: node });},onConnect: async (params: any, investigation_id?: string) => {- console.log(investigation_id)if (!investigation_id) return;try {- // Insertion dans Supabase- await supabase+ // Batch database operations with the UI update+ const { error } = await supabase.from("relationships").upsert({individual_a: params.source,@@ -62,24 +77,27 @@ const createStore = (initialNodes: AppNode[] = [], initialEdges: Edge[] = []) =>investigation_id: investigation_id,relation_type: "relation"});- set({- edges: addEdge(- { ...params, label: "relation", type: "custom" },- get().edges- )- });++ if (!error) {+ set({+ edges: addEdge(+ { ...params, label: "relation", type: "custom" },+ get().edges+ )+ });+ }} catch (error) {console.error('Error creating relationship:', error);}},updateNode: (nodeId: string, nodeData: Partial<Node>) => {- set({- nodes: get().nodes.map(node =>+ set((state) => ({+ nodes: state.nodes.map(node =>node.id === nodeId? { ...node, ...nodeData }: node)- });+ }));},setNodes: (nodes) => {set({ nodes });@@ -88,8 +106,8 @@ const createStore = (initialNodes: AppNode[] = [], initialEdges: Edge[] = []) =>set({ edges });},resetNodeStyles: () => {- set({- nodes: get().nodes.map(node => ({+ set((state) => ({+ nodes: state.nodes.map(node => ({...node,disabled: false,draggable: true,@@ -102,9 +120,7 @@ const createStore = (initialNodes: AppNode[] = [], initialEdges: Edge[] = []) =>opacity: 1,},})),- });- set({- edges: get().edges.map(edge => ({+ edges: state.edges.map(edge => ({...edge,animated: false,style: {@@ -113,55 +129,67 @@ const createStore = (initialNodes: AppNode[] = [], initialEdges: Edge[] = []) =>opacity: 0.7,},})),- });+ }));},onNodeClick: (_event: any, node: Partial<Node>) => {set({ currentNode: node });- get().resetNodeStyles();+ // get().resetNodeStyles();},onPaneClick: (_envent: any) => {set({ currentNode: null });- get().resetNodeStyles();-+ // get().resetNodeStyles();},onLayout: (direction = 'TB', fitView: () => void) => {const { nodes, edges } = getLayoutedElements(get().nodes, get().edges, { direction });- set({ nodes });- //@ts-ignore- set({ edges });- fitView();+ // @ts-ignore+ set({ nodes, edges }); // Fixed the edges type issue+ window.requestAnimationFrame(() => {+ fitView();+ });},highlightPath: (selectedNode: Node | null) => {if (!selectedNode) {- set({- nodes: get().nodes.map((node) => ({+ set((state) => ({+ nodes: state.nodes.map((node) => ({...node,style: { ...node.style, opacity: 1 },})),- edges: get().edges.map((edge) => ({+ edges: state.edges.map((edge) => ({...edge,animated: false,style: { ...edge.style, stroke: "#b1b1b750", opacity: 0.7 },}))- });+ }));return;}++ // Calculate highlighted nodes and edges in one passconst nodes = get().nodes;const edges = get().edges;const allIncomers = getIncomers(selectedNode, nodes, edges);const allOutgoers = getOutgoers(selectedNode, nodes, edges);const incomerIds = new Set(allIncomers.map((node) => node.id));const outgoerIds = new Set(allOutgoers.map((node) => node.id));++ // Batch updatesset({nodes: nodes.map((node) => {const highlight = node.id === selectedNode.id || incomerIds.has(node.id) || outgoerIds.has(node.id);- return {+ return highlight ? {...node,- disabled: !highlight,- draggable: highlight,+ disabled: false,+ draggable: true,style: {...node.style,- opacity: highlight ? 1 : 0.25,+ opacity: 1,+ },+ } : {+ ...node,+ disabled: true,+ draggable: false,+ style: {+ ...node.style,+ opacity: 0.25,},};}),@@ -171,18 +199,20 @@ const createStore = (initialNodes: AppNode[] = [], initialEdges: Edge[] = []) =>const animatedOut =outgoerIds.has(edge.target) && (outgoerIds.has(edge.source) || selectedNode.id === edge.source);const animated = animatedIn || animatedOut;+return {...edge,animated,style: {...edge.style,- // stroke: animated ? "var(--primary)" : "#b1b1b750",opacity: animated ? 1 : 0.25,},};})});},- }))-}-export const useFlowStore = createStore();+ }));+};++// Initialize store once+export const useFlowStore = createStore();\ No newline at end of filediff --git a/flowsint-web/tsconfig.json b/flowsint-web/tsconfig.jsonindex 64f91c3f..c55af01b 100644--- a/flowsint-web/tsconfig.json+++ b/flowsint-web/tsconfig.json@@ -23,6 +23,6 @@"@/*": ["./src/*"]}},- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "../../ReconOps/src/lib/utils.ts", "src/components/investigations/collide.js", "src/lib/utils/flow.js", "src/app/dashboard/entities/page.tss"],+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "../../ReconOps/src/lib/utils.ts", "src/components/investigations/collide.js", "src/lib/utils/flow.js", "src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/individuals/page.tss"],"exclude": ["node_modules"]}diff --git a/flowsint-web/yarn.lock b/flowsint-web/yarn.lockindex 9bdabda4..4d9b8b42 100644--- a/flowsint-web/yarn.lock+++ b/flowsint-web/yarn.lock@@ -59,6 +59,16 @@resolved "https://registry.yarnpkg.com/@alloc/quick-lru/-/quick-lru-5.2.0.tgz#7bf68b20c0a350f936915fcae06f58e32007ce30"integrity sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==+"@babel/helper-string-parser@^7.25.9":+ version "7.25.9"+ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c"+ integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==++"@babel/helper-validator-identifier@^7.25.9":+ version "7.25.9"+ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7"+ integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==+"@babel/runtime-corejs3@^7.16.5":version "7.26.7"resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.26.7.tgz#586756721b532572b8592d825ebbb5bc08f08ad4"@@ -74,6 +84,14 @@dependencies:regenerator-runtime "^0.14.0"+"@babel/types@^7.26.0":+ version "7.27.0"+ resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.0.tgz#ef9acb6b06c3173f6632d993ecb6d4ae470b4559"+ integrity sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==+ dependencies:+ "@babel/helper-string-parser" "^7.25.9"+ "@babel/helper-validator-identifier" "^7.25.9"+"@dagrejs/dagre@^1.1.4":version "1.1.4"resolved "https://registry.yarnpkg.com/@dagrejs/dagre/-/dagre-1.1.4.tgz#66f9c0e2b558308f2c268f60e2c28f22ee17e339"@@ -2409,6 +2427,13 @@ axobject-query@^4.1.0:resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-4.1.0.tgz#28768c76d0e3cff21bc62a9e2d0b6ac30042a1ee"integrity sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==+babel-plugin-react-compiler@^19.0.0-beta-e993439-20250328:+ version "19.0.0-beta-e993439-20250328"+ resolved "https://registry.yarnpkg.com/babel-plugin-react-compiler/-/babel-plugin-react-compiler-19.0.0-beta-e993439-20250328.tgz#524fb091728b5aa8a05b842c185fad05922c118c"+ integrity sha512-eq0lxXDicCNfhtIhm2L2nW2FyDcPMfuJTQG641ZWMWxEVqwmtUlAkWXC4o5C3vykhWMTsXmiJe7/hxXVUbV8ZA==+ dependencies:+ "@babel/types" "^7.26.0"+bail@^2.0.0:version "2.0.2"resolved "https://registry.yarnpkg.com/bail/-/bail-2.0.2.tgz#d26f5cd8fe5d6f832a31517b9f7c356040ba6d5d"