Skip to content

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

feat: single node type

dextmorgn014e49578c6a
diff --git a/flowsint-web/src/app/api/latest-investigations/route.ts b/flowsint-web/src/app/api/latest-investigations/route.ts
index 03af9081..55039002 100644
--- a/flowsint-web/src/app/api/latest-investigations/route.ts
+++ b/flowsint-web/src/app/api/latest-investigations/route.ts
@@ -12,7 +12,7 @@ export async function GET() {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
}
const { data: investigations, error } = await supabase.from("investigations")
- .select("id, title, description, status, project_id, last_updated_at, project:projects(id, name)")
+ .select("id, title, description, last_updated_at, project_id, project:projects(id, name), members:investigations_profiles(profile:profiles(id, first_name, last_name), role)")
.order("last_updated_at", { ascending: false })
.limit(4)
if (error) {
diff --git a/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/data/route.ts b/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/data/route.ts
index 33ad0152..ad17a65d 100644
--- a/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/data/route.ts
+++ b/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/data/route.ts
@@ -5,140 +5,28 @@ import { NextResponse } from "next/server"
export async function GET(_: Request, { params }: { params: Promise<{ investigation_id: string }> }) {
const { investigation_id } = await params
const supabase = await createClient()
-
try {
- // Vérification de l'authentification
const {
data: { user },
error: userError,
} = await supabase.auth.getUser();
-
if (!user || userError) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
}
- // Une seule requête à la vue matérialisée
const { data: graphData, error: graphError } = await supabase
.from("investigation_graph")
.select("*")
.eq("investigation_id", investigation_id)
.single();
+
if (graphError) {
return NextResponse.json({ error: graphError.message }, { status: 500 })
}
- if (!graphData || !graphData.individuals || graphData.individuals.length === 0) {
- return NextResponse.json({ nodes: [], edges: [] })
+ if (!graphData) {
+ return NextResponse.json({ error: "Not found" }, { status: 404 })
}
- const nodes: NodeData[] = []
- const edges: EdgeData[] = []
- graphData.individuals.forEach((ind: any) => {
- const individualId = ind.id.toString()
- nodes.push({
- id: individualId,
- type: "individual",
- data: { ...ind, label: ind.full_name },
- position: { x: 0, y: 100 },
- parentId: ind.group_id?.toString(),
- extent: "parent",
- })
- const relatedDataConfig = [
- {
- dataKey: 'emails',
- type: 'email',
- labelField: 'email',
- position: { x: 100, y: 100 },
- edgeLabel: 'email'
- },
- {
- dataKey: 'phone_numbers',
- type: 'phone',
- labelField: 'phone_number',
- position: { x: -100, y: 100 },
- edgeLabel: 'phone'
- },
- {
- dataKey: 'social_accounts',
- type: 'social',
- labelField: (item: any) => `${item.platform}: ${item.username}`,
- position: { x: 100, y: -100 },
- edgeLabel: 'social'
- },
- {
- dataKey: 'ip_addresses',
- type: 'ip',
- labelField: 'ip_address',
- position: { x: -100, y: -100 },
- edgeLabel: 'IP'
- },
- {
- dataKey: 'vehicles',
- type: 'vehicle',
- labelField: (item: any) => `${item.plate}-${item.model || "Unknown"}`,
- position: { x: -100, y: -100 },
- edgeLabel: (item: any) => item.type
- },
- {
- dataKey: 'physical_addresses',
- type: 'address',
- labelField: (item: any) => [item.address, item.city, item.country].join(", "),
- position: { x: 100, y: 100 },
- edgeLabel: 'address'
- }
- ];
-
- // Traiter chaque type de données associées
- relatedDataConfig.forEach(config => {
- const items = ind[config.dataKey];
- if (!items || !items.length) return;
-
- items.forEach((item: any) => {
- // Déterminer le label
- let label;
- if (typeof config.labelField === 'function') {
- label = config.labelField(item);
- } else {
- label = item[config.labelField];
- }
-
- // Ajouter le nœud
- nodes.push({
- id: item.id.toString(),
- type: config.type,
- data: { ...item, label },
- position: config.position,
- });
-
- // Déterminer l'étiquette de l'arête
- let edgeLabel;
- if (typeof config.edgeLabel === 'function') {
- edgeLabel = config.edgeLabel(item);
- } else {
- edgeLabel = config.edgeLabel;
- }
-
- // Ajouter l'arête
- edges.push({
- source: individualId,
- target: item.id.toString(),
- type: "custom",
- id: `${individualId}-${item.id}`.toString(),
- label: edgeLabel,
- });
- });
- });
- });
- graphData.relationships?.forEach(({ id, individual_a, individual_b, relation_type, confidence_level }: any) => {
- edges.push({
- source: individual_a.toString(),
- target: individual_b.toString(),
- type: "custom",
- id: id.toString(),
- label: relation_type,
- confidence_level,
- })
- })
-
- return NextResponse.json({ nodes, edges })
+ return NextResponse.json(graphData, { status: 200 })
} catch (error) {
return NextResponse.json({ error: "Internal Server Error" }, { status: 500 })
}
-}
\ No newline at end of file
+}
diff --git a/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/route.ts b/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/route.ts
index 9b5c4cb2..ddcdec9a 100644
--- a/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/route.ts
+++ b/flowsint-web/src/app/api/projects/[project_id]/investigations/[investigation_id]/route.ts
@@ -14,7 +14,7 @@ export async function GET(_: Request, { params }: { params: Promise<{ investigat
}
const { data: investigation, error } = await supabase
.from("investigations")
- .select("id, title, description, last_updated_at, project_id, project:projects(id, name)")
+ .select("id, title, description, last_updated_at, project_id, project:projects(id, name), members:investigations_profiles(profile:profiles(id, first_name, last_name), role)")
.eq("id", investigation_id)
.eq("project_id", project_id)
.single()
diff --git a/flowsint-web/src/app/api/projects/[project_id]/investigations/route.ts b/flowsint-web/src/app/api/projects/[project_id]/investigations/route.ts
index 03af9081..7e29247f 100644
--- a/flowsint-web/src/app/api/projects/[project_id]/investigations/route.ts
+++ b/flowsint-web/src/app/api/projects/[project_id]/investigations/route.ts
@@ -12,7 +12,7 @@ export async function GET() {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
}
const { data: investigations, error } = await supabase.from("investigations")
- .select("id, title, description, status, project_id, last_updated_at, project:projects(id, name)")
+ .select("id, title, description, status, project_id, last_updated_at, project:projects(id, name), members:investigations_profiles(profile:profiles(id, first_name, last_name), role)")
.order("last_updated_at", { ascending: false })
.limit(4)
if (error) {
diff --git a/flowsint-web/src/app/api/projects/[project_id]/route.ts b/flowsint-web/src/app/api/projects/[project_id]/route.ts
index c64661fd..a6f4fc58 100644
--- a/flowsint-web/src/app/api/projects/[project_id]/route.ts
+++ b/flowsint-web/src/app/api/projects/[project_id]/route.ts
@@ -13,7 +13,7 @@ export async function GET(_: Request, { params }: { params: Promise<{ project_id
return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
}
const { data: project, error } = await supabase.from("projects")
- .select("*, investigations(*, owner:owner_id(first_name, last_name), individuals(id)), owner:owner_id(first_name, last_name)")
+ .select("*, members:projects_profiles(profile:profiles(id, first_name, last_name), role), investigations(*, owner:owner_id(first_name, last_name), individuals(id)), owner:owner_id(first_name, last_name)")
.eq("id", project_id)
.single()
if (error) {
diff --git a/flowsint-web/src/app/api/projects/route.ts b/flowsint-web/src/app/api/projects/route.ts
index 7124c926..35b14825 100644
--- a/flowsint-web/src/app/api/projects/route.ts
+++ b/flowsint-web/src/app/api/projects/route.ts
@@ -12,7 +12,7 @@ export async function GET() {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
}
const { data: projects, error } = await supabase.from("projects")
- .select("*, investigations(*), owner:owner_id(first_name, last_name)")
+ .select("*, investigations(*), owner:owner_id(first_name, last_name), members:projects_profiles(profile:profiles(id, first_name, last_name), role)")
if (error) {
return NextResponse.json({ error: error.message }, { status: 500 })
}
diff --git a/flowsint-web/src/app/dashboard/page.tsx b/flowsint-web/src/app/dashboard/page.tsx
index df1ec7a7..6ce15ff8 100644
--- a/flowsint-web/src/app/dashboard/page.tsx
+++ b/flowsint-web/src/app/dashboard/page.tsx
@@ -109,16 +109,6 @@ const DashboardPage = () => {
<RecentSketches />
</div>
<div className="flex items-center gap-2 justify-between mb-6">
- {/* <div className="relative w-full max-w-md">
- <Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
- <Input
- type="search"
- placeholder="Search projects..."
- className="pl-8 w-full bg-background"
- value={searchQuery}
- onChange={(e) => setSearchQuery(e.target.value)}
- />
- </div> */}
<div className="flex items-center gap-2">
<DropdownMenu>
<DropdownMenuTrigger asChild>
@@ -188,7 +178,7 @@ const DashboardPage = () => {
{formatDistanceToNow(new Date(project.last_updated_at), { addSuffix: true })}
</TableCell>
<TableCell className="hidden sm:table-cell text-muted-foreground">
- <AvatarList users={[{ id: "1", name: "Jean" }, { id: "2", name: "Eliott" }, { id: "4", name: "Marc" }, { id: "2", name: "Frank" }]} size="sm" />
+ <AvatarList users={project?.members?.map(({ profile }: { profile: { first_name: string, last_name: string, id: string } }) => ({ id: profile.id, name: `${profile.first_name} ${profile.last_name}` })) || []} size="sm" />
</TableCell>
<TableCell className="hidden sm:table-cell text-muted-foreground">
{format(new Date(project.created_at), "dd.MM.yyyy")}
diff --git a/flowsint-web/src/components/dashboard/new-sketch.tsx b/flowsint-web/src/components/dashboard/new-sketch.tsx
index d252accb..0257b495 100644
--- a/flowsint-web/src/components/dashboard/new-sketch.tsx
+++ b/flowsint-web/src/components/dashboard/new-sketch.tsx
@@ -17,7 +17,6 @@ import {
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
-import { Badge } from "@/components/ui/badge"
import { useFormStatus } from "react-dom"
import { toast } from "sonner"
import { useProjectStore } from "@/store/project-store"
diff --git a/flowsint-web/src/components/dashboard/recent-sketches.tsx b/flowsint-web/src/components/dashboard/recent-sketches.tsx
index 93414324..859979d8 100644
--- a/flowsint-web/src/components/dashboard/recent-sketches.tsx
+++ b/flowsint-web/src/components/dashboard/recent-sketches.tsx
@@ -40,56 +40,21 @@ const RecentSketches = () => {
return (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
{Array.from({ length: 4 }).map((_, i) => (
- <Card key={i} className="overflow-hidden shadow-none bg-transparent border-none">
- <Skeleton className="h-40 w-full bg-foreground/5" />
- <CardContent className="p-4">
- <Skeleton className="h-4 w-3/4 mb-2 bg-foreground/5" />
- <Skeleton className="h-3 w-1/2 bg-foreground/5" />
- </CardContent>
+ <Card key={i} className="overflow-hidden rounded-md shadow-none border-none p-0">
+ <Skeleton className="h-32 w-full bg-foreground/10 p-4">
+ <div className="flex items-center gap-2">
+ <Skeleton className="h-12 w-12 rounded-full bg-foreground/5" />
+ <div className="p-4 grow">
+ <Skeleton className="h-4 w-3/4 mb-2 bg-foreground/5" />
+ <Skeleton className="h-3 w-1/2 bg-foreground/5" />
+ </div>
+ </div>
+ </Skeleton>
</Card>
))}
</div>
)
}
-
- // return (
- // <div className="space-y-4">
- // <div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
- // <div className="rounded-lg border bg-card text-card-foreground p-6">
- // <div className="flex flex-row items-center justify-between space-y-0 pb-2">
- // <h3 className="tracking-tight text-sm font-medium">Investigations Actives</h3>
- // <FileSearch className="h-4 w-4 text-muted-foreground" />
- // </div>
- // <div className="text-2xl font-bold">24</div>
- // <p className="text-xs text-muted-foreground">+2 depuis le mois dernier</p>
- // </div>
- // <div className="rounded-lg border bg-card text-card-foreground p-6">
- // <div className="flex flex-row items-center justify-between space-y-0 pb-2">
- // <h3 className="tracking-tight text-sm font-medium">Sujets Suivis</h3>
- // <Users className="h-4 w-4 text-muted-foreground" />
- // </div>
- // <div className="text-2xl font-bold">145</div>
- // <p className="text-xs text-muted-foreground">+12 depuis le mois dernier</p>
- // </div>
- // <div className="rounded-lg border bg-card text-card-foreground p-6">
- // <div className="flex flex-row items-center justify-between space-y-0 pb-2">
- // <h3 className="tracking-tight text-sm font-medium">Documents Collectés</h3>
- // <FileText className="h-4 w-4 text-muted-foreground" />
- // </div>
- // <div className="text-2xl font-bold">532</div>
- // <p className="text-xs text-muted-foreground">+86 depuis le mois dernier</p>
- // </div>
- // <div className="rounded-lg border bg-card text-card-foreground p-6">
- // <div className="flex flex-row items-center justify-between space-y-0 pb-2">
- // <h3 className="tracking-tight text-sm font-medium">Alertes</h3>
- // <FileSearch className="h-4 w-4 text-muted-foreground" />
- // </div>
- // <div className="text-2xl font-bold">9</div>
- // <p className="text-xs text-muted-foreground">-2 depuis le mois dernier</p>
- // </div>
- // </div>
- // </div>
- // )
return (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
{investigations?.map((investigation: Investigation) => {
@@ -103,13 +68,13 @@ const RecentSketches = () => {
</div>
<div className="w-full truncate">
<h3 className="font-medium w-full truncate text-ellispsis transition-colors">
- {investigation?.project?.name}/{investigation.title}
+ {investigation?.project?.name}<span className="mx-1 opacity-40 text-sm">/</span>{investigation.title}
</h3>
<span className="text-xs opacity-60">Last updated {formatDistanceToNow(investigation.last_updated_at, { addSuffix: true })}</span>
</div>
</div>
<div className="flex items-center justify-end">
- <AvatarList users={[{ id: "1", name: "Jean" }, { id: "2", name: "Eliott" }, { id: "4", name: "Marc" }, { id: "2", name: "Frank" }]} size="sm" />
+ <AvatarList users={investigation?.members?.map(({ profile }: { profile: { first_name: string, last_name: string, id: string } }) => ({ id: profile.id, name: `${profile.first_name} ${profile.last_name}` })) || []} size="sm" />
</div>
</CardContent>
</Card>
diff --git a/flowsint-web/src/components/investigations/add-node-modal.tsx b/flowsint-web/src/components/investigations/add-node-modal.tsx
index 6310d9dc..8ffd7b9e 100644
--- a/flowsint-web/src/components/investigations/add-node-modal.tsx
+++ b/flowsint-web/src/components/investigations/add-node-modal.tsx
@@ -1,63 +1,217 @@
"use client"
+import { useState } from "react"
import { useParams } from "next/navigation"
import { supabase } from "@/lib/supabase/client"
import { Button } from "@/components/ui/button"
-import { DialogClose, DialogContent } from "@/components/ui/dialog"
-import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Input } from "@/components/ui/input"
-import type React from "react" // Added import for React
-import { DialogDescription, DialogTitle } from "@radix-ui/react-dialog"
+import { AlertCircle, ArrowLeft, PlusIcon } from "lucide-react"
import { toast } from "sonner"
+import { cn, nodesTypes } from "@/lib/utils"
+import { Alert, AlertTitle, AlertDescription } from "../ui/alert"
+import { Badge } from "../ui/badge"
+import { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle } from "../ui/dialog"
+import { actionItems, type ActionItem } from "@/lib/action-items"
+import { useInvestigationStore } from "@/store/investigation-store"
+import { Card, CardContent } from "@/components/ui/card"
+import { AnimatePresence, motion } from "framer-motion"
-export default function AddNodeModal({ addNodes }: { addNodes: any }) {
+export default function NewActions({ addNodes }: { addNodes: any }) {
const { investigation_id } = useParams()
+ const [openAddNodeModal, setOpenNodeModal] = useState(false)
+ const [openActionDialog, setOpenActionDialog] = useState(false)
+ const { setCurrentNode } = useInvestigationStore((state) => state)
+ const [currentNodeType, setCurrentNodeType] = useState<any | null>(null)
+ const [error, setError] = useState<string | null>(null)
+ const [loading, setLoading] = useState(false)
+ const [currentParent, setCurrentParent] = useState<ActionItem | null>(null)
+ const [navigationHistory, setNavigationHistory] = useState<ActionItem[]>([])
- const onSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
+ const handleOpenAddNodeModal = (key: string) => {
+ if (!nodesTypes[key as keyof typeof nodesTypes]) {
+ toast.error("Invalid node type.")
+ return
+ }
+ setCurrentNodeType(nodesTypes[key as keyof typeof nodesTypes])
+ setError(null)
+ setOpenActionDialog(false)
+ setOpenNodeModal(true)
+ }
+
+ const onSubmitNewNodeModal = async (e: {
+ preventDefault: () => void
+ currentTarget: HTMLFormElement | undefined
+ }) => {
e.preventDefault()
- const formData = new FormData(e.currentTarget)
- const data = Object.fromEntries(formData)
+ const data = Object.fromEntries(new FormData(e.currentTarget))
+ await handleAddNode(data)
+ }
+
+ const handleAddNode = async (data: any) => {
try {
- const { data: node, error } = await supabase
- .from("individuals")
- .insert({ ...data, investigation_id: investigation_id?.toString() })
+ setLoading(true)
+ const dataToInsert = { ...data, investigation_id }
+ const { data: nodeData, error: insertError } = await supabase
+ .from(currentNodeType.table)
+ .insert(dataToInsert)
.select("*")
.single()
- if (error) throw error
- addNodes({
- id: node.id,
- type: "individual",
- data: { ...node, label: data.full_name },
- position: { x: -100, y: -100 },
- })
- toast.success("New node created.")
+ if (insertError) {
+ toast.error("Failed to create node.")
+ setLoading(false)
+ return
+ }
+ if (!nodeData) {
+ toast.error("Failed to create node.")
+ setLoading(false)
+ return
+ }
+ const newNode = {
+ id: nodeData.id,
+ type: currentNodeType.type,
+ data: { ...nodeData, label: data[currentNodeType.fields[0]] },
+ position: { x: 0, y: 0 },
+ }
+ addNodes(newNode)
+ setCurrentNode(newNode)
+ setOpenNodeModal(false)
+ setError(null)
} catch (error) {
- toast.error("Could not create new node:" + JSON.stringify(error))
-
+ toast.error("An unexpected error occurred")
+ } finally {
+ setLoading(false)
}
}
+ const navigateToSubItems = (item: ActionItem) => {
+ setNavigationHistory([...navigationHistory, item])
+ setCurrentParent(item)
+ }
+
+ const navigateBack = () => {
+ const newHistory = [...navigationHistory]
+ newHistory.pop()
+ setNavigationHistory(newHistory)
+ setCurrentParent(newHistory.length > 0 ? newHistory[newHistory.length - 1] : null)
+ }
+
+ const renderActionCards = () => {
+ const items = currentParent ? currentParent.children || [] : actionItems
+
+ return (
+ <AnimatePresence mode="wait">
+ <motion.div
+ key={currentParent?.id || "root"}
+ initial={{ opacity: 0, x: 20 }}
+ animate={{ opacity: 1, x: 0 }}
+ exit={{ opacity: 0, x: -20 }}
+ transition={{ duration: 0.2 }}
+ className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-3 p-1 pb-2"
+ >
+ {items.map((item) => (
+ <ActionCard
+ key={item.id}
+ item={item}
+ onSelect={item.children ? () => navigateToSubItems(item) : () => handleOpenAddNodeModal(item.key)}
+ />
+ ))}
+ </motion.div>
+ </AnimatePresence>
+ )
+ }
return (
- <DialogContent className="w-80">
- <DialogTitle className="text-xl font-bold">New node</DialogTitle>
- <DialogDescription className="opacity-60">Insert a new node.</DialogDescription>
- <form onSubmit={onSubmit} className="flex items-start space-x-3">
- <Avatar>
- <AvatarFallback>A</AvatarFallback>
- </Avatar>
- <div className="flex-1 space-y-2">
- <Input required name="full_name" placeholder="Name of the individual" />
- <div className="flex justify-end">
- <DialogClose asChild>
- <Button type="submit" size="sm">
- Add
+ <>
+ <DialogContent className="sm:max-w-[700px] h-[80vh] overflow-hidden flex flex-col">
+ <DialogTitle className="flex items-center">
+ {currentParent && (
+ <Button variant="ghost" size="icon" className="mr-2" onClick={navigateBack}>
+ <ArrowLeft className="h-4 w-4" />
+ </Button>
+ )}
+ {currentParent ? currentParent.label : "Select action"}
+ </DialogTitle>
+ <DialogDescription>
+ {currentParent
+ ? `Select a ${currentParent.label} type to add`
+ : "Choose an action to add to your investigation"}
+ </DialogDescription>
+
+ <div className="overflow-y-auto overflow-x-hidden pr-1 -mr-1 flex-grow">{renderActionCards()}</div>
+ </DialogContent>
+ {/* Node Creation Dialog */}
+ <Dialog open={openAddNodeModal && currentNodeType} onOpenChange={setOpenNodeModal}>
+ <DialogContent>
+ <DialogTitle>New {currentNodeType?.type}</DialogTitle>
+ <DialogDescription>Add a new related {currentNodeType?.type}.</DialogDescription>
+ <form onSubmit={onSubmitNewNodeModal}>
+ <div className="flex flex-col gap-3">
+ {currentNodeType?.fields.map((field: any, i: number) => {
+ const [key, value] = field.split(":")
+ return (
+ <label key={i}>
+ <p className="my-2">{key}</p>
+ <Input defaultValue={value || ""} name={key} placeholder={`Your value here (${key})`} />
+ </label>
+ )
+ })}
+ </div>
+ {error && (
+ <Alert variant="destructive">
+ <AlertCircle className="h-4 w-4" />
+ <AlertTitle>Error</AlertTitle>
+ <AlertDescription>{error}</AlertDescription>
+ </Alert>
+ )}
+ <div className="flex items-center gap-2 justify-end mt-4">
+ <DialogClose asChild>
+ <Button type="button" variant="outline">
+ Cancel
+ </Button>
+ </DialogClose>
+ <Button disabled={loading} type="submit">
+ Save
</Button>
- </DialogClose>
- </div>
- </div>
- </form>
- </DialogContent>
+ </div>
+ </form>
+ </DialogContent>
+ </Dialog>
+ </>
)
}
+interface ActionCardProps {
+ item: ActionItem
+ onSelect: () => void
+}
+
+function ActionCard({ item, onSelect }: ActionCardProps) {
+ const Icon = item.icon
+
+ return (
+ <Card
+ className={cn(
+ "cursor-pointer transition-all hover:scale-105 hover:shadow-md",
+ item.disabled && "opacity-50 cursor-not-allowed",
+ "h-full",
+ )}
+ onClick={item.disabled ? undefined : onSelect}
+ >
+ <CardContent className="p-4 flex flex-col items-center text-center h-full">
+ <div
+ className="w-8 h-8 rounded-full flex items-center justify-center mb-3 mt-2"
+ style={{ backgroundColor: `${item.color}20` }} // Light background based on item color
+ >
+ <Icon style={{ color: item.color }} className="h-6 w-6 opacity-60" />
+ </div>
+ <div className="font-medium">{item.label}</div>
+ {item.comingSoon && (
+ <Badge variant="outline" className="mt-2">
+ soon
+ </Badge>
+ )}
+ {item.children && <div className="text-xs text-muted-foreground mt-1">{item.children.length} options</div>}
+ </CardContent>
+ </Card>
+ )
+}
diff --git a/flowsint-web/src/components/investigations/new-actions.tsx b/flowsint-web/src/components/investigations/new-actions.tsx
index 8296c700..24b1084f 100644
--- a/flowsint-web/src/components/investigations/new-actions.tsx
+++ b/flowsint-web/src/components/investigations/new-actions.tsx
@@ -5,42 +5,36 @@ import { useParams } from "next/navigation"
import { supabase } from "@/lib/supabase/client"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
-import { AlertCircle } from "lucide-react"
+import { AlertCircle, ArrowLeft, PlusIcon } from "lucide-react"
import { toast } from "sonner"
-import {
- DropdownMenu,
- DropdownMenuItem,
- DropdownMenuSubTrigger,
- DropdownMenuTrigger,
- DropdownMenuSub,
- DropdownMenuPortal,
- DropdownMenuContent,
- DropdownMenuSubContent,
-} from "@/components/ui/dropdown-menu"
import { cn, nodesTypes } from "@/lib/utils"
import { Alert, AlertTitle, AlertDescription } from "../ui/alert"
import { Badge } from "../ui/badge"
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle } from "../ui/dialog"
import { actionItems, type ActionItem } from "@/lib/action-items"
-import { PlusIcon } from "lucide-react"
import { useInvestigationStore } from "@/store/investigation-store"
+import { Card, CardContent } from "@/components/ui/card"
+import { AnimatePresence, motion } from "framer-motion"
-export default function NewActions({ addNodes }: { addNodes: any }) {
+export default function NewActions({ addNodes, children }: { addNodes: any, children: React.ReactNode }) {
const { investigation_id } = useParams()
const [openAddNodeModal, setOpenNodeModal] = useState(false)
+ const [openActionDialog, setOpenActionDialog] = useState(false)
const { setCurrentNode } = useInvestigationStore((state) => state)
const [currentNodeType, setCurrentNodeType] = useState<any | null>(null)
const [error, setError] = useState<string | null>(null)
const [loading, setLoading] = useState(false)
+ const [currentParent, setCurrentParent] = useState<ActionItem | null>(null)
+ const [navigationHistory, setNavigationHistory] = useState<ActionItem[]>([])
- const handleOpenAddNodeModal = (e: { stopPropagation: () => void }, key: string) => {
- e.stopPropagation()
+ const handleOpenAddNodeModal = (key: string) => {
if (!nodesTypes[key as keyof typeof nodesTypes]) {
toast.error("Invalid node type.")
return
}
setCurrentNodeType(nodesTypes[key as keyof typeof nodesTypes])
setError(null)
+ setOpenActionDialog(false)
setOpenNodeModal(true)
}
@@ -62,7 +56,7 @@ export default function NewActions({ addNodes }: { addNodes: any }) {
.insert(dataToInsert)
.select("*")
.single()
- console.log(insertError)
+
if (insertError) {
toast.error("Failed to create node.")
setLoading(false)
@@ -75,8 +69,10 @@ export default function NewActions({ addNodes }: { addNodes: any }) {
}
const newNode = {
id: nodeData.id,
- type: currentNodeType.type,
- data: { ...nodeData, label: data[currentNodeType.fields[0]] },
+ type: "custom",
+ data: {
+ ...nodeData, label: data[currentNodeType.fields[0]], type: currentNodeType.type,
+ },
position: { x: 0, y: 0 },
}
addNodes(newNode)
@@ -90,75 +86,71 @@ export default function NewActions({ addNodes }: { addNodes: any }) {
}
}
- // Render a dropdown menu item
- const renderMenuItem = (item: ActionItem) => {
- const Icon = item.icon
-
- if (item.children) {
- return (
- <DropdownMenuSub key={item.id}>
- <DropdownMenuSubTrigger>
- <Icon style={{ color: item.color }} className={cn("mr-3 h-4 w-4 opacity-50", item.color)} />
- {item.label}
- </DropdownMenuSubTrigger>
- <DropdownMenuPortal>
- <DropdownMenuSubContent>
- <div className="grid grid-cols-1 md:grid-cols-2 gap-1">
- {item.children.map((childItem) => renderMenuItem(childItem))}
- </div>
- </DropdownMenuSubContent>
- </DropdownMenuPortal>
- </DropdownMenuSub>
- )
- }
- return (
- <DropdownMenuItem
- key={item.id}
- disabled={item.disabled}
- onClick={(e) => handleOpenAddNodeModal(e, item.key)}
- className="flex items-center"
- >
- <Icon style={{ color: item.color }} className="h-4 w-4 opacity-70" />
- <span className="truncate">{item.label}</span>
- {item.comingSoon && (
- <Badge variant="outline" className="ml-2">
- soon
- </Badge>
- )}
- </DropdownMenuItem>
- )
+ const navigateToSubItems = (item: ActionItem) => {
+ setNavigationHistory([...navigationHistory, item])
+ setCurrentParent(item)
}
- // Divide items into two columns
- const splitIntoColumns = (items: ActionItem[]) => {
- const middleIndex = Math.ceil(items.length / 2);
- const column1 = items.slice(0, middleIndex);
- const column2 = items.slice(middleIndex);
+ const navigateBack = () => {
+ const newHistory = [...navigationHistory]
+ newHistory.pop()
+ setNavigationHistory(newHistory)
+ setCurrentParent(newHistory.length > 0 ? newHistory[newHistory.length - 1] : null)
+ }
+
+ const renderActionCards = () => {
+ const items = currentParent ? currentParent.children || [] : actionItems
return (
- <div className="grid grid-cols-1 md:grid-cols-2 gap-x-4 min-w-[400px]">
- <div className="space-y-1">
- {column1.map((item) => renderMenuItem(item))}
- </div>
- <div className="space-y-1 md:border-l md:pl-4">
- {column2.map((item) => renderMenuItem(item))}
- </div>
- </div>
- );
- };
+ <AnimatePresence mode="wait">
+ <motion.div
+ key={currentParent?.id || "root"}
+ initial={{ opacity: 0, x: 20 }}
+ animate={{ opacity: 1, x: 0 }}
+ exit={{ opacity: 0, x: -20 }}
+ transition={{ duration: 0.2 }}
+ className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-3 p-1 pb-2"
+ >
+ {items.map((item) => (
+ <ActionCard
+ key={item.id}
+ item={item}
+ onSelect={item.children ? () => navigateToSubItems(item) : () => handleOpenAddNodeModal(item.key)}
+ />
+ ))}
+ </motion.div>
+ </AnimatePresence>
+ )
+ }
return (
<>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button size={"icon"}>
- <PlusIcon />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent className="p-2" align="start">
- {splitIntoColumns(actionItems)}
- </DropdownMenuContent>
- </DropdownMenu>
+ <Button asChild onClick={() => setOpenActionDialog(true)}>
+ {children}
+ </Button>
+
+ {/* Action Selection Dialog */}
+ <Dialog open={openActionDialog} onOpenChange={setOpenActionDialog}>
+ <DialogContent className="sm:max-w-[700px] h-[80vh] overflow-hidden flex flex-col">
+ <DialogTitle className="flex items-center">
+ {currentParent && (
+ <Button variant="ghost" size="icon" className="mr-2" onClick={navigateBack}>
+ <ArrowLeft className="h-4 w-4" />
+ </Button>
+ )}
+ {currentParent ? currentParent.label : "Select action"}
+ </DialogTitle>
+ <DialogDescription>
+ {currentParent
+ ? `Select a ${currentParent.label} type to add`
+ : "Choose an action to add to your investigation"}
+ </DialogDescription>
+
+ <div className="overflow-y-auto overflow-x-hidden pr-1 -mr-1 flex-grow">{renderActionCards()}</div>
+ </DialogContent>
+ </Dialog>
+
+ {/* Node Creation Dialog */}
<Dialog open={openAddNodeModal && currentNodeType} onOpenChange={setOpenNodeModal}>
<DialogContent>
<DialogTitle>New {currentNodeType?.type}</DialogTitle>
@@ -197,4 +189,40 @@ export default function NewActions({ addNodes }: { addNodes: any }) {
</Dialog>
</>
)
-}
\ No newline at end of file
+}
+
+interface ActionCardProps {
+ item: ActionItem
+ onSelect: () => void
+}
+
+function ActionCard({ item, onSelect }: ActionCardProps) {
+ const Icon = item.icon
+
+ return (
+ <Card
+ className={cn(
+ "cursor-pointer transition-all hover:scale-105 hover:shadow-md",
+ item.disabled && "opacity-50 cursor-not-allowed",
+ "h-full",
+ )}
+ onClick={item.disabled ? undefined : onSelect}
+ >
+ <CardContent className="p-4 relative flex flex-col items-center text-center h-full">
+ <div
+ className="w-8 h-8 rounded-full flex items-center justify-center mb-3 mt-2"
+ style={{ backgroundColor: `${item.color}20` }} // Light background based on item color
+ >
+ <Icon style={{ color: item.color }} className="h-6 w-6 opacity-60" />
+ </div>
+ <div className="font-medium text-sm">{item.label}</div>
+ {item.comingSoon && (
+ <Badge variant="outline" className="mt-2 absolute top-2 right-2">
+ soon
+ </Badge>
+ )}
+ {item.children && <div className="text-xs text-muted-foreground mt-1">{item.children.length} options</div>}
+ </CardContent>
+ </Card>
+ )
+}
diff --git a/flowsint-web/src/components/investigations/scan-drawer.tsx b/flowsint-web/src/components/investigations/scan-drawer.tsx
index 9429b131..0c00bf70 100644
--- a/flowsint-web/src/components/investigations/scan-drawer.tsx
+++ b/flowsint-web/src/components/investigations/scan-drawer.tsx
@@ -61,7 +61,7 @@ export function ScanDrawer() {
const [viewMode, setViewMode] = useState<"grid" | "table">("table")
const { data: currentScan = null, isLoading } = useQuery({
- queryKey: ["investigations", investigation_id, "scans", scanId],
+ queryKey: ["projects", project_id, "investigations", investigation_id, "scans", scanId],
queryFn: async (): Promise<Scan | null> => {
const res = await fetch(`/api/projects/${project_id}/investigations/${investigation_id}/scans/${scanId}`)
if (!res.ok) {
diff --git a/flowsint-web/src/components/investigations/scans-drawer/scan-button.tsx b/flowsint-web/src/components/investigations/scans-drawer/scan-button.tsx
index d0aac8f2..947fb5b5 100644
--- a/flowsint-web/src/components/investigations/scans-drawer/scan-button.tsx
+++ b/flowsint-web/src/components/investigations/scans-drawer/scan-button.tsx
@@ -105,14 +105,15 @@ export function ScanButton() {
return (
<Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger asChild>
- <Button variant="ghost" size={"icon"} className="rounded-none">
+ <Button variant="ghost" className="rounded-none">
{pendingCount > 0 ? (
- <>
- <ZapIcon fill="var(--primary)" stroke="var(--primary)" className="!h-4 !w-4 animate-pulse" />
- </>
+ <div className="pr-1">
+ <ZapIcon fill="var(--primary)" stroke="var(--primary)" className="!h-5 !w-5 animate-pulse" />
+ <div className="absolute -top-0 z-[50] flex items-center justify-center right-1 text-[10px] bg-background rounded-full h-5 w-5 border">{pendingCount}</div>
+ </div>
) : (
<>
- <ZapIcon className="!h-4 !w-4" />
+ <ZapIcon className="!h-4 !w-4 opacity-60" />
</>
)}
</Button>
diff --git a/flowsint-web/src/components/investigations/sketch/graph.tsx b/flowsint-web/src/components/investigations/sketch/graph.tsx
index 60fbbf40..4ff98cb1 100644
--- a/flowsint-web/src/components/investigations/sketch/graph.tsx
+++ b/flowsint-web/src/components/investigations/sketch/graph.tsx
@@ -14,12 +14,6 @@ import {
type NodeMouseHandler,
} from "@xyflow/react"
import "@xyflow/react/dist/style.css"
-import IndividualNode from "./nodes/person"
-import PhoneNode from "./nodes/phone"
-import IpNode from "./nodes/ip_address"
-import EmailNode from "./nodes/email"
-import SocialNode from "./nodes/social"
-import AddressNode from "./nodes/physical_address"
import {
MaximizeIcon,
ZoomInIcon,
@@ -49,9 +43,7 @@ import { memo } from "react"
import { shallow } from "zustand/shallow"
import { TooltipProvider } from "@/components/ui/tooltip"
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,
@@ -59,21 +51,21 @@ import {
} from "@/components/ui/resizable"
import NodesPanel from "./nodes-panel"
import ProfilePanel from "./profile-panel"
-import Vehicle from "./nodes/vehicle"
+import CustomNode from "./nodes/custom-node"
const edgeTypes = {
custom: CustomEdge,
}
const nodeTypes = {
- individual: IndividualNode,
- phone: PhoneNode,
- ip: IpNode,
- email: EmailNode,
- social: SocialNode,
- address: AddressNode,
- group: GroupNode,
- default: BaseNode,
- vehicle: Vehicle
+ // individual: IndividualNode,
+ // phone: PhoneNode,
+ // ip: IpNode,
+ // email: EmailNode,
+ // social: SocialNode,
+ // address: AddressNode,
+ // group: GroupNode,
+ custom: CustomNode,
+ // vehicle: Vehicle
}
const nodeEdgeSelector = (store: { nodes: any; edges: any }) => ({
nodes: store.nodes,
@@ -125,11 +117,15 @@ const FlowControls = memo(
return (
<>
<Panel position="top-left" className="flex flex-col items-center gap-1">
- <NewActions addNodes={addNodes} />
+ <NewActions addNodes={addNodes}>
+ <Button size="icon">
+ <PlusIcon />
+ </Button>
+ </NewActions>
<Button size="icon" disabled={reloading} variant="outline" onClick={handleRefetch}>
<RotateCwIcon className={cn("h-4 w-4", reloading && "animate-spin")} />
</Button>
- </Panel>
+ </Panel >
<Panel position="bottom-left" className="flex flex-col items-center gap-1">
<Tooltip>
<TooltipTrigger asChild>
@@ -233,7 +229,7 @@ const LayoutFlow = ({ refetch, theme }: LayoutFlowProps) => {
} = useFlowStore(stateSelector, shallow)
const initialLayout = useCallback(() => {
const timer = setTimeout(() => {
- onLayout("force", fitView)
+ onLayout("dagre", fitView)
fitView()
}, 500)
return () => clearTimeout(timer)
@@ -243,7 +239,7 @@ const LayoutFlow = ({ refetch, theme }: LayoutFlowProps) => {
}, [initialLayout])
const handleRefetch = useCallback(() => {
refetch()
- onLayout("force", fitView)
+ onLayout("dagre", fitView)
fitView()
}, [refetch, onLayout, fitView])
useEffect(() => {
@@ -302,12 +298,12 @@ const LayoutFlow = ({ refetch, theme }: LayoutFlowProps) => {
onNodeClick,
onPaneClick: handlePaneClick,
onNodeContextMenu: handleNodeContextMenu,
- minZoom: 0.7,
+ minZoom: 0.5,
fitView: true,
proOptions: { hideAttribution: true },
edgeTypes,
nodeTypes,
- className: "!bg-accent"
+ className: "!bg-accent dark:!bg-background"
}), [
theme,
nodes,
@@ -340,7 +336,7 @@ const LayoutFlow = ({ refetch, theme }: LayoutFlowProps) => {
addNodes={addNodes}
currentNode={currentNode}
/>
- <Background />
+ <Background className="dark:bg-background bg-accent" />
{settings.showMiniMap && <MiniMap className="!z-40" pannable />}
</ReactFlow>
</ContextMenuTrigger>
diff --git a/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx b/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx
index a11e7421..0b2bd91c 100644
--- a/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx
+++ b/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx
@@ -29,23 +29,23 @@ const SocialNode = ({ node, setCurrentNode }: NodeProps) => {
{platformIcon}
</Badge>
<div className='grow truncate text-ellipsis'>{node?.data?.username || <span className='italic opacity-60'>Unknwon</span>}</div>
- <TypeBadge type={node?.type as string}></TypeBadge>
+ <TypeBadge type={node?.data?.type as string}></TypeBadge>
</Button>
)
}
export function NodeRenderer({ node, setCurrentNode }: NodeProps) {
- const item = useMemo(() => (actionItems as any).find((a: any) => a.type === node.type), [node?.type])
+ const item = useMemo(() => (actionItems as any).find((a: any) => a.type === node.data?.type), [node?.type])
const Icon = item?.icon || QuestionMarkIcon
return (
<>
- {node.type === "social" ?
+ {node.data?.type === "social" ?
<SocialNode setCurrentNode={setCurrentNode} node={node} /> :
<Button variant={"ghost"} className='flex items-center justify-start p-4 !py-5 rounded-none text-left border-b' onClick={() => setCurrentNode(node)}>
<Badge variant="secondary" className="h-7 w-7 p-0 rounded-full">
<Icon className="h-4 w-4 opacity-60" />
</Badge>
<div className='grow truncate text-ellipsis'>{node?.data?.label}</div>
- <TypeBadge type={node?.type}></TypeBadge>
+ <TypeBadge type={node?.data?.type}></TypeBadge>
</Button>
}
</>
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/button-edge.tsx b/flowsint-web/src/components/investigations/sketch/nodes/button-edge.tsx
index e3292cb8..0d30f4ec 100644
--- a/flowsint-web/src/components/investigations/sketch/nodes/button-edge.tsx
+++ b/flowsint-web/src/components/investigations/sketch/nodes/button-edge.tsx
@@ -6,7 +6,10 @@ import {
EdgeLabelRenderer,
EdgeProps,
getStraightPath,
+ useStore,
} from "@xyflow/react";
+import { zoomSelector } from "@/lib/utils";
+import { useInvestigationStore } from "@/store/investigation-store";
// Mémorisation du composant ButtonEdge
export const ButtonEdge = memo(({
@@ -25,19 +28,22 @@ export const ButtonEdge = memo(({
targetY,
});
+ const showContent = useStore(zoomSelector);
+ const { settings } = useInvestigationStore(state => state)
return (
<>
<BaseEdge className="opacity-30" path={edgePath} markerEnd={markerEnd} style={style} />
<EdgeLabelRenderer>
- <div
- className="nodrag nopan pointer-events-auto absolute"
- style={{
- ...style,
- transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
- }}
- >
- {children}
- </div>
+ {settings.showEdgeLabel && showContent &&
+ <div
+ className="nodrag nopan pointer-events-auto absolute"
+ style={{
+ ...style,
+ transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
+ }}
+ >
+ {children}
+ </div>}
</EdgeLabelRenderer>
</>
);
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/custom-edge.tsx b/flowsint-web/src/components/investigations/sketch/nodes/custom-edge.tsx
index d16f9baf..35db641d 100644
--- a/flowsint-web/src/components/investigations/sketch/nodes/custom-edge.tsx
+++ b/flowsint-web/src/components/investigations/sketch/nodes/custom-edge.tsx
@@ -13,7 +13,7 @@ import { ButtonEdge } from "./button-edge"
import { toast } from "sonner"
const EditableEdge = memo((props: EdgeProps) => {
- const { id, label } = props
+ const { id, label, data } = props
const [isEditing, setIsEditing] = useState(false)
const [isLoading, setIsLoading] = useState(false)
const [editValue, setEditValue] = useState((label as string) || "")
@@ -44,8 +44,12 @@ const EditableEdge = memo((props: EdgeProps) => {
.from("relationships")
.update({ relation_type: editValue })
.eq("id", id.toString())
- if (error) {
- toast.error("An error occurred: " + error.message)
+ const { error: error2 } = await supabase
+ .from("organizations_individuals")
+ .update({ relation_type: editValue })
+ .eq("id", id.toString())
+ if (error || error2) {
+ toast.error("An error occurred: ")
} else {
toast.success("Relation updated.")
}
@@ -63,14 +67,11 @@ const EditableEdge = memo((props: EdgeProps) => {
setEditValue(e.target.value)
}, [])
- // 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 (
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/custom-node.tsx b/flowsint-web/src/components/investigations/sketch/nodes/custom-node.tsx
new file mode 100644
index 00000000..8c6bcc9b
--- /dev/null
+++ b/flowsint-web/src/components/investigations/sketch/nodes/custom-node.tsx
@@ -0,0 +1,49 @@
+import React, { memo, useMemo } from 'react';
+import { CopyButton } from '@/components/copy';
+import { Badge } from '@/components/ui/badge';
+import { Handle, Position, useStore } from '@xyflow/react';
+import { cn, typeColorMap, zoomSelector } from '@/lib/utils';
+import { actionItems } from '@/lib/action-items';
+import { QuestionMarkIcon } from '@radix-ui/react-icons';
+import {
+ TooltipNode,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip-node";
+import { useInvestigationStore } from '@/store/investigation-store';
+
+export default memo(({ data, selected }: any) => {
+ const item = useMemo(() => (actionItems as any).find((a: any) => a.type === data.type), [data?.type])
+ const Icon = item?.icon || QuestionMarkIcon
+ const { settings } = useInvestigationStore(state => state)
+ return (
+ <TooltipNode className={cn('p-.5 rounded-full', typeColorMap[data.type])} selected={selected}>
+ <TooltipTrigger>
+ <div className="inline-flex items-center gap-2 p-1 w-auto">
+ <Badge variant="secondary" className={cn("p-0 rounded-full", item?.size || "h-5 w-5")}>
+ <Icon className="h-4 w-4" />
+ </Badge>
+ {settings.showNodeLabel && <div className="flex items-center gap-1">
+ <span className="text-sm">{data.label}</span>
+ <CopyButton className="rounded-full h-7 w-7 text-xs" content={data.label} />
+ </div>}
+ </div>
+ </TooltipTrigger>
+ {!settings.showNodeLabel &&
+ <TooltipContent position={Position.Top}>{data.label}</TooltipContent>
+ }
+ <Handle
+ type="target"
+ style={{ visibility: "hidden" }}
+ position={Position.Top}
+ isConnectable={false}
+ />
+ <Handle
+ type="source"
+ style={{ visibility: "hidden" }}
+ position={Position.Bottom}
+ isConnectable={false}
+ />
+ </TooltipNode>
+ );
+});
\ No newline at end of file
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/email.tsx b/flowsint-web/src/components/investigations/sketch/nodes/email.tsx
deleted file mode 100644
index 7b005b18..00000000
--- a/flowsint-web/src/components/investigations/sketch/nodes/email.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import React, { memo } from 'react';
-import { CopyButton } from '@/components/copy';
-import { Badge } from '@/components/ui/badge';
-import { AtSignIcon } from 'lucide-react';
-import { BaseNode } from '@/components/ui/base-node';
-import { Handle, Position } from '@xyflow/react';
-import { cn, typeColorMap } from '@/lib/utils';
-
-export default memo(({ data, selected }: any) => {
- return (
- <BaseNode className={cn('p-.5 rounded-full', "bg-gradient-to-br from-emerald-50 to-emerald-100 border-emerald-200 shadow-sm dark:from-emerald-950 dark:to-emerald-900 dark:border-emerald-800 dark:shadow-emerald-900/30")} selected={selected}>
- <div className="flex items-center gap-2 p-1">
- <Badge variant="secondary" className="h-6 w-6 p-0 rounded-full dark:bg-emerald-900 bg-emerald-200">
- <AtSignIcon className="h-4 w-4" />
- </Badge>
- <div className="flex items-center gap-1">
- <span className="text-sm">{data.label}</span>
- <CopyButton className="rounded-full h-7 w-7 text-xs" content={data.label} />
- </div>
- </div>
- <Handle
- type="target"
- style={{ visibility: "hidden" }}
- position={Position.Top}
- isConnectable={false}
- />
- <Handle
- type="source"
- style={{ visibility: "hidden" }}
- position={Position.Bottom}
- isConnectable={false}
- />
- </BaseNode>
- );
-});
\ No newline at end of file
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/group.tsx b/flowsint-web/src/components/investigations/sketch/nodes/group.tsx
deleted file mode 100644
index 99e1753f..00000000
--- a/flowsint-web/src/components/investigations/sketch/nodes/group.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import { memo } from "react";
-
-import { NodeProps } from "@xyflow/react";
-import { GroupNode } from "@/components/ui/group-node";
-
-const Group = memo(({ selected, data }: NodeProps) => {
- return <GroupNode selected={selected} label={data.label as string} />;
-});
-
-export default Group;
\ No newline at end of file
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/ip_address.tsx b/flowsint-web/src/components/investigations/sketch/nodes/ip_address.tsx
deleted file mode 100644
index b671755b..00000000
--- a/flowsint-web/src/components/investigations/sketch/nodes/ip_address.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import React, { memo } from 'react';
-import { CopyButton } from '@/components/copy';
-import { Badge } from '@/components/ui/badge';
-import { LocateIcon } from 'lucide-react';
-import { BaseNode } from '@/components/ui/base-node';
-import { Handle, Position } from '@xyflow/react';
-import { cn, typeColorMap } from '@/lib/utils';
-
-export default memo(({ data, selected }: any) => {
- return (
- <BaseNode className={cn('p-.5 rounded-full', "bg-gradient-to-br from-pink-50 to-pink-100 border-pink-200 shadow dark:from-pink-800 dark:to-pink-900 dark:border-pink-700 dark:shadow-pink-900/30",
- )} selected={selected}>
- <div className="flex items-center gap-2 p-1">
- <Badge variant="secondary" className="h-6 w-6 p-0 rounded-full">
- <LocateIcon className="h-4 w-4" />
- </Badge>
- <div className="flex items-center gap-1">
- <span className="text-sm">{data.label}</span>
- <CopyButton className="rounded-full h-7 w-7 text-xs" content={data.label} />
- </div>
- </div>
- <Handle
- type="target"
- style={{ visibility: "hidden" }}
- position={Position.Top}
- isConnectable={false}
- />
- <Handle
- type="source"
- style={{ visibility: "hidden" }}
- position={Position.Bottom}
- isConnectable={false}
- />
- </BaseNode>
- );
-});
\ No newline at end of file
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/node-context-menu.tsx b/flowsint-web/src/components/investigations/sketch/nodes/node-context-menu.tsx
index 9eb9d5ed..898cefce 100644
--- a/flowsint-web/src/components/investigations/sketch/nodes/node-context-menu.tsx
+++ b/flowsint-web/src/components/investigations/sketch/nodes/node-context-menu.tsx
@@ -43,13 +43,14 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
const [error, setError] = useState<null | string>(null)
const [openNote, setOpenNote] = useState(false)
const [loading, setLoading] = useState(false)
- const [currentNodeType, setCurrentNodeType] = useState<any | null>(null)
+ const [nodeToInsert, setNodeToInsert] = useState<any | null>(null)
const { confirm } = useConfirm()
const [_, setIndividualId] = useQueryState("individual_id")
- const handleCheckEmail = useCallback(() => {
+ const handleCheckEmail = useCallback(async () => {
// @ts-ignore
- if (!currentNode && currentNode?.data && !currentNode?.data?.email) return
+ if (!currentNode && currentNode?.data && !currentNode?.data?.email) return toast.error("No email found.")
+ if (!await confirm({ title: "Email scan", message: "This scan will look for some socials that the email might be associated with. The list is not exhaustive and might return false positives." })) return
// @ts-ignore
toast.promise(checkEmail(currentNode?.data?.email, investigation_id), {
loading: "Loading...",
@@ -86,7 +87,7 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
if (insertError) toast.error(insertError.details)
addNodes({
id: node.id,
- type: "individual",
+ type: "custom",
data: node,
position: { x: 0, y: -100 },
})
@@ -94,19 +95,23 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
}
const _handleDeleteNode = async (type: string) => {
- if (!currentNode) return
- if (await confirm({ title: "Node deletion", message: "Are you sure you want to delete this node?" })) {
- await supabase
- .from("individuals")
- .delete()
- .eq("id", currentNode.id)
- .then(({ error }) => {
- if (error) toast.error(error.details)
- })
- setNodes((nodes: any[]) => nodes.filter((node: { id: any }) => node.id !== currentNode?.id?.toString()))
- setEdges((edges: any[]) => edges.filter((edge: { source: any }) => edge.source !== currentNode?.id?.toString()))
- onClose()
- toast.success("Node deleted.")
+ try {
+ if (!currentNode) return
+ if (await confirm({ title: "Node deletion", message: "Are you sure you want to delete this node?" })) {
+ await supabase
+ .from(`${currentNode?.data?.type}s`)
+ .delete()
+ .eq("id", currentNode.id)
+ .then(({ error }) => {
+ if (error) toast.error(error.details)
+ })
+ setNodes((nodes: any[]) => nodes.filter((node: { id: any }) => node.id !== currentNode?.id?.toString()))
+ setEdges((edges: any[]) => edges.filter((edge: { source: any }) => edge.source !== currentNode?.id?.toString()))
+ onClose()
+ }
+ }
+ catch (e) {
+ toast.error("An error occured.")
}
}
@@ -119,7 +124,7 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
toast.error("Invalid node type.")
return
}
- setCurrentNodeType(nodesTypes[key as keyof typeof nodesTypes])
+ setNodeToInsert(nodesTypes[key as keyof typeof nodesTypes])
setError(null)
setOpenNodeModal(true)
}
@@ -141,39 +146,61 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
setLoading(false)
return
}
- const dataToInsert = { ...data, investigation_id }
- if (currentNodeType.table !== "individuals") {
- dataToInsert["individual_id"] = currentNode.id
+ const dataToInsert = { ...data, investigation_id: investigation_id }
+ if (!["individual", "organization"].includes(nodeToInsert.type)) {
+ const tp = currentNode?.data?.type === "individual" ? "individual_id" : "organization_id"
+ dataToInsert[tp] = currentNode.id
}
const { data: nodeData, error: insertError } = await supabase
- .from(currentNodeType.table)
+ .from(nodeToInsert.table)
.insert(dataToInsert)
.select("*")
.single()
- if (insertError) {
- toast.error("An error occured during the creation." + insertError.message)
+ if (insertError || !nodeData) {
+ toast.error("An error occured during the creation." + JSON.stringify(insertError))
setLoading(false)
return
}
- if (!nodeData) {
- toast.error("An error occured during the creation.")
- setLoading(false)
- return
- }
- if (currentNodeType.table === "individuals") {
+ // add individual to individual
+ if (nodeToInsert.type === "individual" && currentNode?.data?.type === "individual") {
const { error: relationshipError } = await supabase.from("relationships").upsert({
individual_a: currentNode.id,
individual_b: nodeData.id,
+ investigation_id: investigation_id,
relation_type: "relation",
})
if (relationshipError) {
toast.error("Error creating new relation.")
}
}
+ // add organization to individual
+ else if ((nodeToInsert.type === "individual" && currentNode?.data?.type === "organization")) {
+ const { error: relationshipError } = await supabase.from("organizations_individuals").upsert({
+ individual_id: nodeData.id,
+ organization_id: currentNode.id,
+ investigation_id: investigation_id,
+ relation_type: "employee",
+ })
+ if (relationshipError) {
+ toast.error("Error creating new relation.")
+ }
+ }
+ // add individual to organization
+ else if ((nodeToInsert.type === "organization" && currentNode?.data?.type === "individual")) {
+ const { error: relationshipError } = await supabase.from("organizations_individuals").upsert({
+ individual_id: currentNode.id,
+ organization_id: nodeData.id,
+ investigation_id: investigation_id,
+ relation_type: "employee",
+ })
+ if (relationshipError) {
+ toast.error("Error creating new relation.")
+ }
+ }
const newNode = {
id: nodeData.id,
- type: currentNodeType.type,
- data: { ...nodeData, label: data[currentNodeType.fields[0]] },
+ type: "custom",
+ data: { ...nodeData, label: data[nodeToInsert.fields[0]], type: nodeToInsert.type },
position: { x: 0, y: 0 },
}
addNodes(newNode)
@@ -182,8 +209,8 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
source: currentNode.id as string,
target: nodeData.id,
type: "custom",
- id: `${currentNode.id}-${nodeData.id}`.toString(),
- label: currentNodeType.type === "individual" ? "relation" : currentNodeType.type,
+ id: `${currentNode.id} - ${nodeData.id}`.toString(),
+ label: nodeToInsert.type === "individual" ? "relation" : nodeToInsert.type,
}
addEdges(newEdge)
}
@@ -193,6 +220,7 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
setCurrentNode(nodeData)
setLoading(false)
}, 0)
+ toast.success(`New ${nodeToInsert.type || "node"} created.`)
} catch (error) {
toast.error("An unexpected error occurred.")
setLoading(false)
@@ -256,9 +284,9 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
style={{ top: y, left: x }}
>
{Boolean(currentNode?.data?.email) && (
- <DropdownMenuItem onClick={handleCheckEmail}>Search {currentNodeType}</DropdownMenuItem>
+ <DropdownMenuItem onClick={handleCheckEmail}>Search {nodeToInsert}</DropdownMenuItem>
)}
- {currentNode?.type === "individual" && (
+ {["individual", "organization"].includes(currentNode?.data?.type as string) && (
<DropdownMenuSub>
<DropdownMenuSubTrigger>New</DropdownMenuSubTrigger>
<DropdownMenuSubContent className="grid grid-cols-1 md:grid-cols-2 gap-2">{actionItems.map((item) => renderMenuItem(item))}</DropdownMenuSubContent>
@@ -277,18 +305,18 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
- <Dialog open={openAddNodeModal && currentNodeType} onOpenChange={setOpenNodeModal}>
+ <Dialog open={openAddNodeModal && nodeToInsert} onOpenChange={setOpenNodeModal}>
<DialogContent>
- <DialogTitle>New {currentNodeType?.type}</DialogTitle>
- <DialogDescription>Add a new related {currentNodeType?.type}.</DialogDescription>
+ <DialogTitle>New {nodeToInsert?.type}</DialogTitle>
+ <DialogDescription>Add a new related {nodeToInsert?.type}.</DialogDescription>
<form onSubmit={onSubmitNewNodeModal}>
<div className="flex flex-col gap-3">
- {currentNodeType?.fields.map((field: any, i: number) => {
+ {nodeToInsert?.fields.map((field: any, i: number) => {
const [key, value] = field.split(":")
return (
<label key={i}>
<p className="my-2">{key}</p>
- <Input defaultValue={value || ""} name={key} placeholder={`Your value here (${key})`} />
+ <Input defaultValue={value || ""} name={key} placeholder={`Your value here(${key})`} />
</label>
)
})}
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/person.tsx b/flowsint-web/src/components/investigations/sketch/nodes/person.tsx
deleted file mode 100644
index 983e82cf..00000000
--- a/flowsint-web/src/components/investigations/sketch/nodes/person.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import React, { memo } from 'react';
-import { Handle, Position } from '@xyflow/react';
-import { CopyButton } from '@/components/copy';
-import { Avatar, AvatarImage } from '@/components/ui/avatar';
-import { BaseNode } from "@/components/ui/base-node";
-import { UserIcon } from 'lucide-react';
-import { cn, typeColorMap } from '@/lib/utils';
-
-export default memo(({ data, selected }: any) => {
- return (
- <BaseNode selected={selected} className={cn('p-1 rounded-full', "rounded-full bg-gradient-to-br from-slate-50 to-slate-100 border-slate-200 shadow dark:from-slate-800 dark:to-slate-900 dark:border-slate-700 dark:shadow-slate-900/30")} >
- <div className="flex gap-2 items-center rounded-full">
- <Avatar className="h-9 w-9 flex items-center justify-center dark:bg-slate-900 bg-slate-200">
- <AvatarImage src={data?.image_url} alt={data.full_name} />
- <UserIcon className="h-4 w-4 opacity-60" />
- </Avatar>
- <div className="flex items-center gap-1">
- <span className="text-sm text-nowrap">{data.full_name}</span>
- <CopyButton className="rounded-full" content={data.full_name} />
- </div>
- </div>
- <Handle
- type="target"
- style={{ visibility: "hidden" }}
- position={Position.Top}
- isConnectable={false}
- />
- <Handle
- type="source"
- style={{ visibility: "hidden" }}
- position={Position.Bottom}
- isConnectable={false}
- />
- </BaseNode>
- );
-});
\ No newline at end of file
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/phone.tsx b/flowsint-web/src/components/investigations/sketch/nodes/phone.tsx
deleted file mode 100644
index 0e6b7dc5..00000000
--- a/flowsint-web/src/components/investigations/sketch/nodes/phone.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import React, { memo } from 'react';
-import { CopyButton } from '@/components/copy';
-import { Badge } from '@/components/ui/badge';
-import { PhoneIcon } from 'lucide-react';
-import { BaseNode } from '@/components/ui/base-node';
-import { Handle, Position } from '@xyflow/react';
-import { cn, typeColorMap } from '@/lib/utils';
-
-export default memo(({ data, selected }: any) => {
- return (
- <BaseNode className={cn('p-.5 rounded-full', "rounded-full bg-gradient-to-br from-sky-50 to-sky-100 border-sky-200 shadow dark:from-sky-800 dark:to-sky-900 dark:border-sky-700 dark:shadow-sky-900/30")} selected={selected}>
- <div className="flex items-center gap-2 p-1">
- <Badge variant="secondary" className="h-6 w-6 p-0 rounded-full">
- <PhoneIcon className="h-4 w-4" />
- </Badge>
- <div className="flex items-center gap-1">
- <span className="text-sm">{data.label}</span>
- <CopyButton className="rounded-full h-7 w-7 text-xs" content={data.label} />
- </div>
- </div>
- <Handle
- type="target"
- style={{ visibility: "hidden" }}
- position={Position.Top}
- isConnectable={false}
- />
- <Handle
- type="source"
- style={{ visibility: "hidden" }}
- position={Position.Bottom}
- isConnectable={false}
- />
- </BaseNode>
- );
-});
\ No newline at end of file
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/physical_address.tsx b/flowsint-web/src/components/investigations/sketch/nodes/physical_address.tsx
deleted file mode 100644
index ea7a7478..00000000
--- a/flowsint-web/src/components/investigations/sketch/nodes/physical_address.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import React, { memo } from 'react';
-import { CopyButton } from '@/components/copy';
-import { Badge } from '@/components/ui/badge';
-import { MapPin } from 'lucide-react';
-import { BaseNode } from '@/components/ui/base-node';
-import { Handle, Position } from '@xyflow/react';
-import { cn, typeColorMap } from '@/lib/utils';
-
-export default memo(({ data, selected }: any) => {
- return (
- <BaseNode className={cn('p-.5 rounded-full', typeColorMap["physical_address"])} selected={selected}>
- <div className="flex items-center gap-2 p-1">
- <Badge variant="secondary" className="h-6 w-6 p-0 rounded-full">
- <MapPin className="h-4 w-4" />
- </Badge>
- <div className="flex items-center gap-1">
- <span className="text-sm">{data.label}</span>
- <CopyButton className="rounded-full h-7 w-7 text-xs" content={data.label} />
- </div>
- </div>
- <Handle
- type="target"
- style={{ visibility: "hidden" }}
- position={Position.Top}
- isConnectable={false}
- />
- <Handle
- type="source"
- style={{ visibility: "hidden" }}
- position={Position.Bottom}
- isConnectable={false}
- />
- </BaseNode>
- );
-});
\ No newline at end of file
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/social.tsx b/flowsint-web/src/components/investigations/sketch/nodes/social.tsx
deleted file mode 100644
index 23156b8b..00000000
--- a/flowsint-web/src/components/investigations/sketch/nodes/social.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import React, { memo, useMemo } from 'react';
-import { Handle, Position } from '@xyflow/react';
-import { CopyButton } from '@/components/copy';
-import { Badge } from '@/components/ui/badge';
-import { usePlatformIcons } from '@/lib/hooks/use-platform-icons';
-import { BaseNode } from '@/components/ui/base-node';
-import { cn, typeColorMap } from '@/lib/utils';
-
-export default memo(({ data, selected }: any) => {
- const platformsIcons = usePlatformIcons()
- const { platformIcon, color } = useMemo(() => {
- // @ts-ignore
- return {
- platformIcon: platformsIcons?.[data?.platform]?.icon, color: platformsIcons?.[data?.platform]?.color
- }
- }, [platformsIcons, data?.platform])
- return (
- <BaseNode className={cn('p-.5 rounded-full', "bg-gradient-to-br from-purple-50 to-purple-100 border-purple-200 shadow-sm dark:from-purple-950 dark:to-purple-900 dark:border-purple-800 dark:shadow-purple-900/30")} selected={selected}>
- <div className="flex items-center gap-2 p-1">
- <Badge variant="secondary" className="h-6 w-6 p-0 rounded-full dark:bg-purple-900 bg-purple-200">
- {platformIcon}
- </Badge>
- <div className="flex items-center gap-1">
- <span className="text-sm">{data.username || data.profile_url}</span>
- <CopyButton className="rounded-full h-7 w-7 text-xs" content={data.username || data.profile_url} />
- </div>
- </div>
- <Handle
- type="target"
- style={{ visibility: "hidden" }}
- position={Position.Top}
- isConnectable={false}
- />
- <Handle
- type="source"
- style={{ visibility: "hidden" }}
- position={Position.Bottom}
- isConnectable={false}
- />
- </BaseNode>
- );
-});
\ No newline at end of file
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/vehicle.tsx b/flowsint-web/src/components/investigations/sketch/nodes/vehicle.tsx
deleted file mode 100644
index 36e2b0ac..00000000
--- a/flowsint-web/src/components/investigations/sketch/nodes/vehicle.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import React, { memo } from 'react';
-import { CopyButton } from '@/components/copy';
-import { Badge } from '@/components/ui/badge';
-import { CarIcon, PhoneIcon } from 'lucide-react';
-import { BaseNode } from '@/components/ui/base-node';
-import { Handle, Position } from '@xyflow/react';
-import { cn, typeColorMap } from '@/lib/utils';
-
-export default memo(({ data, selected }: any) => {
- return (
- <BaseNode className={cn('p-.5 rounded-full', "bg-orange-100 text-orange-800 hover:bg-orange-100/80 dark:bg-orange-900/30 dark:text-orange-300 dark:hover:bg-orange-900/40")} selected={selected}>
- <div className="flex items-center gap-2 p-1">
- <Badge variant="secondary" className="h-6 w-6 p-0 rounded-full">
- <CarIcon className="h-4 w-4" />
- </Badge>
- <div className="flex items-center gap-1">
- <span className="text-sm">{data.label}</span>
- <CopyButton className="rounded-full h-7 w-7 text-xs" content={data.label} />
- </div>
- </div>
- <Handle
- type="target"
- style={{ visibility: "hidden" }}
- position={Position.Top}
- isConnectable={false}
- />
- <Handle
- type="source"
- style={{ visibility: "hidden" }}
- position={Position.Bottom}
- isConnectable={false}
- />
- </BaseNode>
- );
-});
\ No newline at end of file
diff --git a/flowsint-web/src/components/investigations/sketch/profile-panel.tsx b/flowsint-web/src/components/investigations/sketch/profile-panel.tsx
index d9ccdc3d..8a0bcaa2 100644
--- a/flowsint-web/src/components/investigations/sketch/profile-panel.tsx
+++ b/flowsint-web/src/components/investigations/sketch/profile-panel.tsx
@@ -15,12 +15,15 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
+import { useConfirm } from "@/components/use-confirm-dialog"
export default function ProfilePanel({ data, type }: { data: any, type: string }) {
const { investigation_id } = useParams()
+ const { confirm } = useConfirm()
- const handleCheckEmail = useCallback(() => {
+ const handleCheckEmail = useCallback(async () => {
// @ts-ignore
- if (!data && data?.email) return
+ if (!data && data?.email) return toast.error("No email found.")
+ if (!await confirm({ title: "Email scan", message: "This scan will look for some socials that the email might be associated with. The list is not exhaustive and might return false positives." })) return
// @ts-ignore
toast.promise(checkEmail(data?.email, investigation_id), {
loading: "Loading...",
diff --git a/flowsint-web/src/components/ui/resizable.tsx b/flowsint-web/src/components/ui/resizable.tsx
index 83b61cc7..39203e95 100644
--- a/flowsint-web/src/components/ui/resizable.tsx
+++ b/flowsint-web/src/components/ui/resizable.tsx
@@ -6,7 +6,7 @@ import * as ResizablePrimitive from "react-resizable-panels"
import { cn } from "@/lib/utils"
-function ResizablePanelGroup({
+const ResizablePanelGroup = React.memo(function ResizablePanelGroup({
className,
...props
}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) {
@@ -20,15 +20,15 @@ function ResizablePanelGroup({
{...props}
/>
)
-}
+})
-function ResizablePanel({
+const ResizablePanel = React.memo(function ResizablePanel({
...props
}: React.ComponentProps<typeof ResizablePrimitive.Panel>) {
return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
-}
+})
-function ResizableHandle({
+const ResizableHandle = React.memo(function ResizableHandle({
withHandle,
className,
...props
@@ -51,6 +51,6 @@ function ResizableHandle({
)}
</ResizablePrimitive.PanelResizeHandle>
)
-}
+})
export { ResizablePanelGroup, ResizablePanel, ResizableHandle }
diff --git a/flowsint-web/src/components/ui/tooltip-node.tsx b/flowsint-web/src/components/ui/tooltip-node.tsx
new file mode 100644
index 00000000..c47198e5
--- /dev/null
+++ b/flowsint-web/src/components/ui/tooltip-node.tsx
@@ -0,0 +1,101 @@
+import React, {
+ createContext,
+ useContext,
+ useState,
+ useCallback,
+ ReactNode,
+ forwardRef,
+ HTMLAttributes,
+} from "react";
+import { NodeToolbar, NodeProps, NodeToolbarProps } from "@xyflow/react";
+import { BaseNode } from "@/components/ui/base-node";
+
+/* TOOLTIP CONTEXT ---------------------------------------------------------- */
+
+const TooltipContext = createContext(false);
+
+/* TOOLTIP NODE ------------------------------------------------------------- */
+
+export type TooltipNodeProps = Partial<NodeProps> & {
+ children?: ReactNode;
+ className: string
+};
+
+/**
+ * A component that wraps a node and provides tooltip visibility context.
+ */
+export const TooltipNode = forwardRef<HTMLDivElement, TooltipNodeProps>(
+ ({ selected, children, className }, ref) => {
+ const [isTooltipVisible, setTooltipVisible] = useState(false);
+
+ const showTooltip = useCallback(() => setTooltipVisible(true), []);
+ const hideTooltip = useCallback(() => setTooltipVisible(false), []);
+
+ return (
+ <TooltipContext.Provider value={isTooltipVisible}>
+ <BaseNode
+ ref={ref}
+ onMouseEnter={showTooltip}
+ onMouseLeave={hideTooltip}
+ onFocus={showTooltip}
+ onBlur={hideTooltip}
+ tabIndex={0}
+ selected={selected}
+ className={className}
+ >
+ {children}
+ </BaseNode>
+ </TooltipContext.Provider>
+ );
+ },
+);
+
+TooltipNode.displayName = "TooltipNode";
+
+/* TOOLTIP CONTENT ---------------------------------------------------------- */
+
+export type TooltipContentProps = NodeToolbarProps;
+
+/**
+ * A component that displays the tooltip content based on visibility context.
+ */
+export const TooltipContent = forwardRef<HTMLDivElement, TooltipContentProps>(
+ ({ position, children }, ref) => {
+ const isTooltipVisible = useContext(TooltipContext);
+
+ return (
+ <div ref={ref}>
+ <NodeToolbar
+ isVisible={isTooltipVisible}
+ className="rounded-sm bg-background p-2 shadow-md"
+ tabIndex={1}
+ position={position}
+ >
+ {children}
+ </NodeToolbar>
+ </div>
+ );
+ },
+);
+
+TooltipContent.displayName = "TooltipContent";
+
+/* TOOLTIP TRIGGER ---------------------------------------------------------- */
+
+export type TooltipTriggerProps = HTMLAttributes<HTMLParagraphElement>;
+
+/**
+ * A component that triggers the tooltip visibility.
+ */
+export const TooltipTrigger = forwardRef<
+ HTMLParagraphElement,
+ TooltipTriggerProps
+>(({ children, ...props }, ref) => {
+ return (
+ <div ref={ref} {...props}>
+ {children}
+ </div>
+ );
+});
+
+TooltipTrigger.displayName = "TooltipTrigger";
\ No newline at end of file
diff --git a/flowsint-web/src/components/ui/tooltip.tsx b/flowsint-web/src/components/ui/tooltip.tsx
index bb995cee..4d82556e 100644
--- a/flowsint-web/src/components/ui/tooltip.tsx
+++ b/flowsint-web/src/components/ui/tooltip.tsx
@@ -46,13 +46,13 @@ function TooltipContent({
data-slot="tooltip-content"
sideOffset={sideOffset}
className={cn(
- "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-w-sm rounded-md px-3 py-1.5 text-xs",
+ "bg-background text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-w-sm rounded-md px-3 py-1.5 text-xs",
className
)}
{...props}
>
{children}
- <TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
+ <TooltipPrimitive.Arrow className="bg-background fill-background z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
</TooltipPrimitive.Content>
</TooltipPrimitive.Portal>
)
diff --git a/flowsint-web/src/components/use-confirm-dialog.tsx b/flowsint-web/src/components/use-confirm-dialog.tsx
index b62b3838..096bc740 100644
--- a/flowsint-web/src/components/use-confirm-dialog.tsx
+++ b/flowsint-web/src/components/use-confirm-dialog.tsx
@@ -1,13 +1,12 @@
"use client";
import {
- AlertDialog,
- AlertDialogAction,
- AlertDialogCancel,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogTitle,
-} from "@/components/ui/alert-dialog"
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogTitle,
+} from "@/components/ui/dialog"
import { Button } from "@/components/ui/button";
import React, {
@@ -118,25 +117,23 @@ const ConfirmDialog = ({
message: string;
}) => {
return (
- <AlertDialog open={open} onOpenChange={onCancel}>
- <AlertDialogContent>
- <AlertDialogTitle>{title}</AlertDialogTitle>
- <AlertDialogDescription>
+ <Dialog open={open} onOpenChange={onCancel}>
+ <DialogContent>
+ <DialogTitle>{title}</DialogTitle>
+ <DialogDescription>
{message}
- </AlertDialogDescription>
+ </DialogDescription>
<div className="flex items-center gap-3 mt-4 justify-end">
- <AlertDialogCancel asChild>
- <Button onClick={onCancel} variant="destructive">
+ <DialogClose asChild>
+ <Button onClick={onCancel} variant="secondary">
Cancel
</Button>
- </AlertDialogCancel>
- <AlertDialogAction asChild>
- <Button onClick={onConfirm} variant={"destructive"}>
- Continue
- </Button>
- </AlertDialogAction>
+ </DialogClose>
+ <Button onClick={onConfirm}>
+ Continue
+ </Button>
</div>
- </AlertDialogContent>
- </AlertDialog>
+ </DialogContent>
+ </Dialog>
);
};
\ No newline at end of file
diff --git a/flowsint-web/src/lib/action-items.ts b/flowsint-web/src/lib/action-items.ts
index d1729bec..55981a39 100644
--- a/flowsint-web/src/lib/action-items.ts
+++ b/flowsint-web/src/lib/action-items.ts
@@ -57,9 +57,20 @@ export type ActionItem = {
disabled?: boolean
comingSoon?: boolean
children?: ActionItem[]
+ size?: string
}
export const actionItems: ActionItem[] = [
+ {
+ id: 24,
+ type: "organization",
+ table: "organizations",
+ key: "organizations",
+ icon: Building2,
+ label: "Organization",
+ fields: ["name", "registration_number", "founding_date"],
+ size: "h-8 w-8"
+ },
{
id: 1,
type: "individual",
@@ -68,6 +79,7 @@ export const actionItems: ActionItem[] = [
icon: User,
label: "New individual",
fields: ["full_name"],
+ size: "h-7 w-7"
},
{
id: 2,
@@ -77,6 +89,7 @@ export const actionItems: ActionItem[] = [
icon: Phone,
label: "Phone number",
fields: ["phone_number"],
+ size: "h-6 w-6"
},
{
id: 3,
@@ -86,6 +99,7 @@ export const actionItems: ActionItem[] = [
icon: MapPin,
label: "Physical address",
fields: ["address", "city", "country", "zip"],
+ size: "h-6 w-6"
},
{
id: 4,
@@ -95,6 +109,7 @@ export const actionItems: ActionItem[] = [
icon: AtSign,
label: "Email address",
fields: ["email"],
+ size: "h-6 w-6"
},
{
id: 5,
@@ -107,7 +122,8 @@ export const actionItems: ActionItem[] = [
},
{
id: 6,
- type: "social_account",
+ type: "social",
+ size: "h-5 w-5",
table: "",
key: "social_account",
icon: Send,
@@ -123,6 +139,7 @@ export const actionItems: ActionItem[] = [
color: "#1d4ed8",
label: "Facebook",
fields: ["profile_url", "username", "platform:facebook"],
+ size: "h-6 w-6"
},
{
id: 8,
@@ -133,6 +150,7 @@ export const actionItems: ActionItem[] = [
color: "#db2777",
label: "Instagram",
fields: ["profile_url", "username", "platform:instagram"],
+ size: "h-6 w-6"
},
{
id: 9,
@@ -143,6 +161,7 @@ export const actionItems: ActionItem[] = [
color: "#0369a1",
label: "Telegram",
fields: ["profile_url", "username", "platform:telegram"],
+ size: "h-6 w-6"
},
{
id: 10,
@@ -153,6 +172,7 @@ export const actionItems: ActionItem[] = [
color: "#3B45FC",
label: "Signal",
fields: ["profile_url", "username", "platform:signal"],
+ size: "h-6 w-6"
},
{
id: 11,
@@ -163,6 +183,7 @@ export const actionItems: ActionItem[] = [
icon: Ghost,
label: "Snapchat",
fields: ["profile_url", "username", "platform:snapchat"],
+ size: "h-6 w-6"
},
{
id: 12,
@@ -172,6 +193,7 @@ export const actionItems: ActionItem[] = [
icon: Github,
label: "Github",
fields: ["profile_url", "username", "platform:github"],
+ size: "h-6 w-6"
},
{
id: 13,
@@ -183,6 +205,7 @@ export const actionItems: ActionItem[] = [
fields: ["profile_url", "username", "platform:coco"],
disabled: true,
comingSoon: true,
+ size: "h-6 w-6"
},
{
id: 18,
@@ -193,6 +216,7 @@ export const actionItems: ActionItem[] = [
icon: Linkedin,
label: "LinkedIn",
fields: ["profile_url", "username", "platform:linkedin"],
+ size: "h-6 w-6"
},
{
id: 19,
@@ -202,6 +226,7 @@ export const actionItems: ActionItem[] = [
icon: Twitter,
label: "Twitter",
fields: ["profile_url", "username", "platform:twitter"],
+ size: "h-6 w-6"
},
{
id: 20,
@@ -211,6 +236,7 @@ export const actionItems: ActionItem[] = [
icon: Video,
label: "TikTok",
fields: ["profile_url", "username", "platform:tiktok"],
+ size: "h-6 w-6"
},
{
id: 21,
@@ -221,6 +247,7 @@ export const actionItems: ActionItem[] = [
color: "#FF4B13",
label: "Reddit",
fields: ["profile_url", "username", "platform:reddit"],
+ size: "h-6 w-6"
},
{
id: 22,
@@ -231,6 +258,7 @@ export const actionItems: ActionItem[] = [
color: "#525FEE",
label: "Discord",
fields: ["profile_url", "username", "platform:discord"],
+ size: "h-6 w-6"
},
{
id: 2343,
@@ -241,6 +269,7 @@ export const actionItems: ActionItem[] = [
color: "#A96FFF",
label: "Twitch",
fields: ["profile_url", "username", "platform:twitch"],
+ size: "h-6 w-6"
},
],
},
@@ -261,6 +290,7 @@ export const actionItems: ActionItem[] = [
icon: Car,
label: "Car",
fields: ["plate", "model", "brand", "year", "type:car"],
+ size: "h-6 w-6"
},
{
id: 16,
@@ -270,6 +300,7 @@ export const actionItems: ActionItem[] = [
icon: Bike,
label: "Motorcycle",
fields: ["plate", "model", "brand", "year", "type:motorcycle"],
+ size: "h-6 w-6"
},
{
id: 17,
@@ -279,6 +310,7 @@ export const actionItems: ActionItem[] = [
icon: Sailboat,
label: "Boat",
fields: ["plate", "model", "brand", "year", "type:boat"],
+ size: "h-6 w-6"
},
{
id: 23,
@@ -288,18 +320,10 @@ export const actionItems: ActionItem[] = [
icon: Plane,
label: "Aircraft",
fields: ["registration", "model", "manufacturer", "year", "type:aircraft"],
+ size: "h-6 w-6"
},
],
},
- {
- id: 24,
- type: "organization",
- table: "organizations",
- key: "organizations",
- icon: Building2,
- label: "Organization",
- fields: ["name", "registration_number", "founding_date"],
- },
{
id: 25,
type: "website",
@@ -308,6 +332,7 @@ export const actionItems: ActionItem[] = [
icon: Globe,
label: "Website",
fields: ["url", "registration_date", "registrar", "ip_address"],
+ size: "h-6 w-6"
},
{
id: 26,
@@ -317,6 +342,7 @@ export const actionItems: ActionItem[] = [
icon: FileIcon,
label: "Document",
fields: ["title", "author", "creation_date", "file_hash", "file_type"],
+ size: "h-6 w-6"
},
{
id: 27,
@@ -335,6 +361,7 @@ export const actionItems: ActionItem[] = [
icon: Bitcoin,
label: "Crypto Wallet",
fields: ["address", "currency", "platform"],
+ size: "h-6 w-6"
},
{
id: 29,
@@ -344,6 +371,7 @@ export const actionItems: ActionItem[] = [
icon: CreditCard,
label: "Bank Account",
fields: ["account_number", "bank_name", "iban", "bic"],
+ size: "h-6 w-6"
},
{
id: 30,
@@ -353,6 +381,7 @@ export const actionItems: ActionItem[] = [
icon: ArrowRightLeft,
label: "Transaction",
fields: ["amount", "date", "sender", "recipient", "currency"],
+ size: "h-6 w-6"
},
],
},
@@ -364,6 +393,8 @@ export const actionItems: ActionItem[] = [
icon: Calendar,
label: "Event",
fields: ["name", "date", "location", "description", "participants"],
+ size: "h-6 w-6"
+
},
{
id: 32,
@@ -382,6 +413,7 @@ export const actionItems: ActionItem[] = [
icon: Smartphone,
label: "Phone",
fields: ["imei", "model", "manufacturer", "serial_number", "type:phone"],
+ size: "h-6 w-6"
},
{
id: 34,
@@ -391,6 +423,7 @@ export const actionItems: ActionItem[] = [
icon: Laptop,
label: "Computer",
fields: ["mac_address", "model", "manufacturer", "serial_number", "type:computer"],
+ size: "h-6 w-6"
},
{
id: 35,
@@ -400,6 +433,7 @@ export const actionItems: ActionItem[] = [
icon: Tablet,
label: "Tablet",
fields: ["imei", "model", "manufacturer", "serial_number", "type:tablet"],
+ size: "h-6 w-6"
},
{
id: 36,
@@ -409,6 +443,7 @@ export const actionItems: ActionItem[] = [
icon: Wifi,
label: "IoT Device",
fields: ["mac_address", "model", "manufacturer", "serial_number", "type:iot"],
+ size: "h-6 w-6"
},
],
},
@@ -420,6 +455,7 @@ export const actionItems: ActionItem[] = [
icon: ImageIcon,
label: "Media",
fields: ["filename", "hash", "creation_date", "location", "exif_data"],
+ size: "h-6 w-6"
},
{
id: 38,
@@ -429,6 +465,7 @@ export const actionItems: ActionItem[] = [
icon: GraduationCap,
label: "Education",
fields: ["institution", "degree", "field", "start_date", "end_date"],
+ size: "h-6 w-6"
},
{
id: 39,
@@ -438,6 +475,7 @@ export const actionItems: ActionItem[] = [
icon: Users,
label: "Relationship",
fields: ["type", "entity_a", "entity_b", "start_date", "end_date", "description"],
+ size: "h-6 w-6"
},
{
id: 40,
@@ -456,6 +494,7 @@ export const actionItems: ActionItem[] = [
icon: MessageSquare,
label: "Forum Post",
fields: ["forum", "username", "post_date", "post_content", "post_url", "type:forum_post"],
+ size: "h-6 w-6"
},
{
id: 42,
@@ -465,6 +504,7 @@ export const actionItems: ActionItem[] = [
icon: MessageCircle,
label: "Comment",
fields: ["platform", "username", "comment_date", "comment_content", "comment_url", "type:comment"],
+ size: "h-6 w-6"
},
{
id: 43,
@@ -474,6 +514,7 @@ export const actionItems: ActionItem[] = [
icon: ShoppingCart,
label: "Online Purchase",
fields: ["platform", "username", "purchase_date", "item", "price", "type:purchase"],
+ size: "h-6 w-6"
},
],
},
@@ -485,6 +526,7 @@ export const actionItems: ActionItem[] = [
icon: Footprints,
label: "Digital Footprint",
fields: ["platform", "username", "date_discovered", "data_type", "source_url"],
+ size: "h-6 w-6"
},
{
id: 45,
@@ -494,6 +536,7 @@ export const actionItems: ActionItem[] = [
icon: Fingerprint,
label: "Biometric Data",
fields: ["type", "identifier", "date_collected", "source"],
+ size: "h-6 w-6"
},
{
id: 46,
@@ -503,5 +546,6 @@ export const actionItems: ActionItem[] = [
icon: Key,
label: "Credential",
fields: ["service", "username", "hash", "breach_date", "breach_source"],
+ size: "h-6 w-6"
},
]
\ No newline at end of file
diff --git a/flowsint-web/src/lib/utils.ts b/flowsint-web/src/lib/utils.ts
index cf3d6a6d..6939d986 100644
--- a/flowsint-web/src/lib/utils.ts
+++ b/flowsint-web/src/lib/utils.ts
@@ -261,7 +261,6 @@ export const formatFileSize = (bytes: number) => {
}
export const nodesTypes = {
- // Types existants
emails: { table: "emails", type: "email", fields: ["email"] },
individuals: { table: "individuals", type: "individual", fields: ["full_name"] },
phone_numbers: { table: "phone_numbers", type: "phone", fields: ["phone_number"] },
@@ -312,8 +311,6 @@ export const nodesTypes = {
type: "vehicle",
fields: ["plate", "model", "year", "brand", "type:boat"],
},
-
- // Nouveaux réseaux sociaux
social_accounts_linkedin: {
table: "social_accounts",
type: "social",
@@ -339,36 +336,31 @@ export const nodesTypes = {
type: "social",
fields: ["profile_url", "username", "platform:discord"],
},
-
- // Nouveaux types de véhicules
+ social_accounts_twitch: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:twitch"],
+ },
vehicles_aircraft: {
table: "vehicles",
type: "vehicle",
fields: ["registration", "model", "year", "manufacturer", "type:aircraft"],
},
-
- // Organisation
organizations: {
table: "organizations",
type: "organization",
fields: ["name", "registration_number", "founding_date"],
},
-
- // Site web
websites: {
table: "websites",
type: "website",
fields: ["url", "registration_date", "registrar", "ip_address"],
},
-
- // Document
documents: {
table: "documents",
type: "document",
fields: ["title", "author", "creation_date", "file_hash", "file_type"],
},
-
- // Finances
crypto_wallets: {
table: "crypto_wallets",
type: "financial",
@@ -384,15 +376,11 @@ export const nodesTypes = {
type: "financial",
fields: ["amount", "date", "sender", "recipient", "currency"],
},
-
- // Événements
events: {
table: "events",
type: "event",
fields: ["name", "date", "location", "description", "participants"],
},
-
- // Appareils
devices_phone: {
table: "devices",
type: "device",
@@ -413,22 +401,16 @@ export const nodesTypes = {
type: "device",
fields: ["mac_address", "model", "manufacturer", "serial_number", "type:iot"],
},
-
- // Médias
media: {
table: "media",
type: "media",
fields: ["filename", "hash", "creation_date", "location", "exif_data"],
},
-
- // Éducation
education: {
table: "education",
type: "education",
fields: ["institution", "degree", "field", "start_date", "end_date"],
},
-
- // Activités en ligne
forum_posts: {
table: "forum_posts",
type: "online_activity",
@@ -444,22 +426,16 @@ export const nodesTypes = {
type: "online_activity",
fields: ["platform", "username", "purchase_date", "item", "price", "type:purchase"],
},
-
- // Empreinte numérique
digital_footprints: {
table: "digital_footprints",
type: "digital_footprint",
fields: ["platform", "username", "date_discovered", "data_type", "source_url"],
},
-
- // Données biométriques
biometric_data: {
table: "biometric_data",
type: "biometric",
fields: ["type", "identifier", "date_collected", "source"],
},
-
- // Identifiants
credentials: {
table: "credentials",
type: "credential",
@@ -468,13 +444,13 @@ export const nodesTypes = {
}
export const typeColorMap: Record<string, string> = {
- individual: "rounded-full bg-gradient-to-br from-slate-50 to-slate-100 border-slate-200 shadow dark:from-slate-800 dark:to-slate-900 dark:border-slate-700 dark:shadow-slate-900/30",
+ individual: "bg-gradient-to-br from-slate-50 to-slate-100 border-slate-200 shadow dark:from-slate-800 dark:to-slate-900 dark:border-slate-700 dark:shadow-slate-900/30",
phone: "bg-gradient-to-br from-sky-50 to-sky-100 border-sky-200 shadow dark:from-sky-800 dark:to-sky-900 dark:border-sky-700 dark:shadow-sky-900/30",
- address: "bg-amber-100 text-amber-800 hover:bg-amber-100/80 dark:bg-amber-900/30 dark:text-amber-300 dark:hover:bg-amber-900/40",
+ address: "bg-gradient-to-br from-amber-50 to-amber-100 border-amber-200 shadow-sm dark:from-amber-950 dark:to-amber-900 dark:border-amber-800 dark:shadow-amber-900/30",
email: "bg-gradient-to-br from-emerald-50 to-emerald-100 border-emerald-200 shadow-sm dark:from-emerald-950 dark:to-emerald-900 dark:border-emerald-800 dark:shadow-emerald-900/30",
ip: "bg-gradient-to-br from-pink-50 to-pink-100 border-pink-200 shadow dark:from-pink-800 dark:to-pink-900 dark:border-pink-700 dark:shadow-pink-900/30",
social: "bg-gradient-to-br from-purple-50 to-purple-100 border-purple-200 shadow-sm dark:from-purple-950 dark:to-purple-900 dark:border-purple-800 dark:shadow-purple-900/30",
- organization: "bg-gradient-to-br from-orange-50 to-orange-100 border-orange-200 shadow-sm dark:from-orange-950 dark:to-orange-900 dark:border-orange-800 dark:shadow-orange-900/30",
+ organization: "bg-gradient-to-br from-blue-50 to-blue-100 border-blue-200 shadow dark:from-blue-800 dark:to-blue-900 dark:border-blue-700 dark:shadow-blue-900/30",
vehicle: "bg-orange-100 text-orange-800 hover:bg-orange-100/80 dark:bg-orange-900/30 dark:text-orange-300 dark:hover:bg-orange-900/40",
website: "bg-purple-100 text-purple-800 hover:bg-purple-100/80 dark:bg-purple-900/30 dark:text-purple-300 dark:hover:bg-purple-900/40",
document: "bg-yellow-100 text-yellow-800 hover:bg-yellow-100/80 dark:bg-yellow-900/30 dark:text-yellow-300 dark:hover:bg-yellow-900/40",
diff --git a/flowsint-web/src/store/flow-store.ts b/flowsint-web/src/store/flow-store.ts
index 0c870952..4ac27162 100644
--- a/flowsint-web/src/store/flow-store.ts
+++ b/flowsint-web/src/store/flow-store.ts
@@ -150,7 +150,7 @@ const createStore = (initialNodes: AppNode[] = [], initialEdges: Edge[] = []) =>
set({ nodes, edges });
}
window.requestAnimationFrame(() => {
- fitView();
+ // fitView();
});
},
highlightPath: (selectedNode: Node | null) => {
diff --git a/flowsint-web/src/types/investigation.ts b/flowsint-web/src/types/investigation.ts
index 4a5174b9..1f404873 100644
--- a/flowsint-web/src/types/investigation.ts
+++ b/flowsint-web/src/types/investigation.ts
@@ -13,6 +13,7 @@ export interface Investigation {
individuals?: any[]
project?: Project
project_id: string
+ members?: any[]
}
export interface Individual {
id: string
diff --git a/flowsint-web/src/types/project.ts b/flowsint-web/src/types/project.ts
index 60d7f488..a58c3eac 100644
--- a/flowsint-web/src/types/project.ts
+++ b/flowsint-web/src/types/project.ts
@@ -8,4 +8,5 @@ export interface Project {
created_at: string
last_updated_at: string
owner: any
+ members?: any[]
}
\ No newline at end of file
diff --git a/flowsint-web/styles/globals.css b/flowsint-web/styles/globals.css
index c8d55fd2..2faf12bf 100644
--- a/flowsint-web/styles/globals.css
+++ b/flowsint-web/styles/globals.css
@@ -59,7 +59,7 @@
--secondary-foreground: hsl(0 0% 98%);
--muted: hsl(0 0% 14.9%);
--muted-foreground: hsl(0 0% 63.9%);
- --accent: hsl(0, 0%, 11%);
+ --accent: hsl(0, 0%, 12.5%);
--accent-foreground: hsl(0 0% 98%);
--destructive: hsl(0 62.8% 30.6%);
--destructive-foreground: hsl(0 0% 98%);
diff --git a/flowsint-web/tailwind.config.js b/flowsint-web/tailwind.config.js
index 55dcda38..d8e1a676 100644
--- a/flowsint-web/tailwind.config.js
+++ b/flowsint-web/tailwind.config.js
@@ -29,5 +29,50 @@ module.exports = {
}
}
},
+ safelist: [
+ 'bg-gradient-to-br',
+ 'from-slate-50', 'to-slate-100',
+ 'from-sky-50', 'to-sky-100',
+ 'from-amber-50', 'to-amber-100',
+ 'from-emerald-50', 'to-emerald-100',
+ 'from-pink-50', 'to-pink-100',
+ 'from-purple-50', 'to-purple-100',
+ 'from-blue-50', 'to-blue-100',
+ 'dark:from-slate-800', 'dark:to-slate-900',
+ 'dark:from-sky-800', 'dark:to-sky-900',
+ 'dark:from-amber-950', 'dark:to-amber-900',
+ 'dark:from-emerald-950', 'dark:to-emerald-900',
+ 'dark:from-pink-800', 'dark:to-pink-900',
+ 'dark:from-purple-950', 'dark:to-purple-900',
+ 'dark:from-blue-800', 'dark:to-blue-900',
+ 'border-slate-200', 'dark:border-slate-700',
+ 'border-sky-200', 'dark:border-sky-700',
+ 'border-amber-200', 'dark:border-amber-800',
+ 'border-emerald-200', 'dark:border-emerald-800',
+ 'border-pink-200', 'dark:border-pink-700',
+ 'border-purple-200', 'dark:border-purple-800',
+ 'border-blue-200', 'dark:border-blue-700',
+ 'shadow', 'shadow-sm',
+ 'dark:shadow-slate-900/30',
+ 'dark:shadow-sky-900/30',
+ 'dark:shadow-amber-900/30',
+ 'dark:shadow-emerald-900/30',
+ 'dark:shadow-pink-900/30',
+ 'dark:shadow-purple-900/30',
+ 'dark:shadow-blue-900/30',
+ 'bg-orange-100', 'text-orange-800', 'dark:bg-orange-900/30', 'dark:text-orange-300', 'dark:hover:bg-orange-900/40',
+ 'bg-purple-100', 'text-purple-800', 'dark:bg-purple-900/30', 'dark:text-purple-300', 'dark:hover:bg-purple-900/40',
+ 'bg-yellow-100', 'text-yellow-800', 'dark:bg-yellow-900/30', 'dark:text-yellow-300', 'dark:hover:bg-yellow-900/40',
+ 'bg-green-100', 'text-green-800', 'dark:bg-green-900/30', 'dark:text-green-300', 'dark:hover:bg-green-900/40',
+ 'bg-red-100', 'text-red-800', 'dark:bg-red-900/30', 'dark:text-red-300', 'dark:hover:bg-red-900/40',
+ 'bg-blue-100', 'text-blue-800', 'dark:bg-blue-900/30', 'dark:text-blue-300', 'dark:hover:bg-blue-900/40',
+ 'bg-fuchsia-100', 'text-fuchsia-800', 'dark:bg-fuchsia-900/30', 'dark:text-fuchsia-300', 'dark:hover:bg-fuchsia-900/40',
+ 'bg-teal-100', 'text-teal-800', 'dark:bg-teal-900/30', 'dark:text-teal-300', 'dark:hover:bg-teal-900/40',
+ 'bg-rose-100', 'text-rose-800', 'dark:bg-rose-900/30', 'dark:text-rose-300', 'dark:hover:bg-rose-900/40',
+ 'bg-indigo-100', 'text-indigo-800', 'dark:bg-indigo-900/30', 'dark:text-indigo-300', 'dark:hover:bg-indigo-900/40',
+ 'bg-lime-100', 'text-lime-800', 'dark:bg-lime-900/30', 'dark:text-lime-300', 'dark:hover:bg-lime-900/40',
+ 'bg-amber-100', 'text-amber-800', 'dark:bg-amber-900/30', 'dark:text-amber-300', 'dark:hover:bg-amber-900/40',
+ 'bg-gray-100', 'text-gray-800', 'dark:bg-gray-800/50', 'dark:text-gray-300', 'dark:hover:bg-gray-800/60',
+ ],
darkMode: ["class"],
}