A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
feat: transform to nodes
dextmorgnf264e52c81c6
diff --git a/flowsint-api/app/main.py b/flowsint-api/app/main.pyindex 4f71d2ed..b2f17c96 100644--- a/flowsint-api/app/main.py+++ b/flowsint-api/app/main.py@@ -3,21 +3,20 @@ import randomfrom uuid import UUIDfrom fastapi import FastAPI, HTTPException, Dependsfrom pydantic import BaseModel, Field-from typing import List, Dict, Optional+from typing import Listfrom app.core.db import get_dbfrom app.scanners.registry import ScannerRegistryfrom app.core.auth import get_current_user-from app.utils import extract_input_schema, neo4j_to_xy+from app.utils import extract_input_schema, flatten, get_label_colorfrom app.core.celery import celery_appfrom app.types.domain import MinimalDomainfrom app.types.ip import MinimalIp-from typing import List+from typing import List, Dict, Anyfrom app.neo4j.connector import Neo4jConnectionimport osfrom dotenv import load_dotenvfrom typing import Listfrom fastapi.middleware.cors import CORSMiddleware-from datetime import datetimeload_dotenv()@@ -113,18 +112,16 @@ async def launch_transform(async def get_sketch_nodes(sketch_id: str):import random- # 1. Requête pour les 50 premiers nœuds du sketchnodes_query = """MATCH (n)WHERE n.sketch_id = $sketch_idRETURN elementId(n) as id, labels(n) as labels, properties(n) as data- LIMIT 50+ LIMIT 500"""nodes_result = neo4j_connection.query(nodes_query, parameters={"sketch_id": sketch_id})node_ids = [record["id"] for record in nodes_result]- # 2. Requête pour les relations uniquement entre ces nœudsrels_query = """UNWIND $node_ids AS nidMATCH (a)-[r]->(b)@@ -133,27 +130,22 @@ async def get_sketch_nodes(sketch_id: str):"""rels_result = neo4j_connection.query(rels_query, parameters={"node_ids": node_ids})- # 3. Formater les nœudsnodes = [{"id": str(record["id"]),"labels": record["labels"],- "data": {- "label": record["data"].get("domain", "Node"),- "type": record["labels"][0].lower(),- },- "label": record["data"].get("domain", "Node"),+ "data": record["data"],+ "label": record["data"].get("label", "Node"),"type": record["labels"][0].lower(),- "caption": record["data"].get("domain", "Node"),+ "caption": record["data"].get("label", "Node"),"size": 40,- "color": get_label_color(record["labels"][0] if record["labels"] else "default"),+ "color": record["data"].get("color", "#FFFFFF"),"x": random.random() * 1000,"y": random.random() * 1000}for record in nodes_result]- # 4. Formater les relationsrels = [{"id": str(record["id"]),@@ -168,92 +160,60 @@ async def get_sketch_nodes(sketch_id: str):for record in rels_result]- return {"nodes": nodes, "rels": rels}+ return {"nds": nodes, "rls": rels}-# Fonction pour attribuer des couleurs en fonction des labels-def get_label_color(label: str) -> str:- color_map = {- 'subdomain': '#A5ABB6',- 'domain': '#68BDF6',- 'default': '#A5ABB6'- }-- return color_map.get(label, color_map["default"])+class NodeInput(BaseModel):+ type: str+ data: Dict[str, Any] = Field(default_factory=dict)++def dict_to_cypher_props(props: dict) -> str:+ return ", ".join(f"{key}: ${key}" for key in props)-from pydantic import BaseModel-from typing import List, Dict, Any[email protected]("/sketch/{sketch_id}/add")+def add_node_to_sketch(sketch_id: str, node: NodeInput):++ print(node)+ node_type = getattr(node, "type", "unknown")+ node_data = getattr(node, "data", {})++ properties = {+ "type": node_type,+ "sketch_id": sketch_id,+ "caption": node_data.get("label", "Node"),+ "label": node_data.get("label", "Node"),+ "color": node_data.get("color", "Node"),+ "size": 40,+ }-class Node(BaseModel):- id: str- data: Dict[str, Any]- type: str # ex: "domain", "email", etc.- position: Dict[str, float] # x, y+ if node_data and isinstance(node_data, dict):+ flattened_data = flatten(node_data)+ properties.update(flattened_data)-class Edge(BaseModel):- id: str- from_: str # "from" est un mot réservé, donc on utilise from_ en Python- to: str- type: str- data: Dict[str, Any]+ cypher_props = dict_to_cypher_props(properties)-class SketchPayload(BaseModel):- nodes: List[Node]- edges: List[Edge]+ create_query = f"""+ MERGE (d:`{node_type}` {{ {cypher_props} }})+ RETURN d as node+ """-[email protected]("/sketch/{sketch_id}/save")-async def save_sketch(sketch_id: str, payload: SketchPayload):try:- # 1. Supprimer tous les nœuds et relations du sketch- delete_query = """- MATCH (n)- WHERE n.sketch_id = $sketch_id- DETACH DELETE n- """- neo4j_connection.query(delete_query, parameters={"sketch_id": sketch_id})-- # 2. Créer les nouveaux nœuds- for node in payload.nodes:- node_query = """- CREATE (n:$label)- SET n += $props- SET n.sketch_id = $sketch_id- SET n.id = $id- """- neo4j_connection.query(- node_query,- parameters={- "label": node.type.capitalize(),- "props": node.data,- "id": node.id,- "sketch_id": sketch_id- }- )-- # 3. Créer les relations- for edge in payload.edges:- edge_query = """- MATCH (a), (b)- WHERE a.id = $from AND b.id = $to AND a.sketch_id = $sketch_id AND b.sketch_id = $sketch_id- CREATE (a)-[r:$rel_type]->(b)- SET r += $props- SET r.sketch_id = $sketch_id- SET r.id = $id- """- neo4j_connection.query(- edge_query,- parameters={- "from": edge.from_,- "to": edge.to,- "rel_type": edge.type.upper(),- "props": edge.data,- "id": edge.id,- "sketch_id": sketch_id- }- )-- return {"status": "success", "message": "Sketch saved."}-+ create_result = neo4j_connection.query(create_query, properties)except Exception as e:- raise HTTPException(status_code=500, detail=f"Neo4j error: {str(e)}")+ print(f"Query execution error: {e}")+ raise HTTPException(status_code=500, detail=f"Database error: {str(e)}")++ if not create_result:+ raise HTTPException(status_code=400, detail="Node creation failed - no result returned")++ try:+ new_node = create_result[0]["node"]+ except (IndexError, KeyError) as e:+ print(f"Error extracting node_id: {e}, result: {create_result}")+ new_node = None+ new_node["data"]=node_data++ return {+ "status": "node added",+ "node": new_node,+ }\ No newline at end of filediff --git a/flowsint-api/app/scanners/domains/resolve.py b/flowsint-api/app/scanners/domains/resolve.pyindex 82557d7c..a7bba39d 100644--- a/flowsint-api/app/scanners/domains/resolve.py+++ b/flowsint-api/app/scanners/domains/resolve.py@@ -67,12 +67,20 @@ class ResolveScanner(Scanner):SET d.sketch_id = $sketch_idMERGE (ip:ip {address: $ip})SET ip.sketch_id = $sketch_id+ SET ip.label = $label+ SET ip.color = $color+ SET ip.caption = $caption+ SET ip.type = $typeMERGE (d)-[:RESOLVES_TO {sketch_id: $sketch_id}]->(ip)"""if self.neo4j_conn:self.neo4j_conn.query(query, {"domain": domain_obj.domain,"ip": ip_obj.address,- "sketch_id": self.sketch_id+ "sketch_id": self.sketch_id,+ "color": '#5533FF',+ "label": ip_obj.address,+ "caption": ip_obj.address,+ "type": "ip"})return results\ No newline at end of filediff --git a/flowsint-api/app/scanners/domains/subdomains.py b/flowsint-api/app/scanners/domains/subdomains.pyindex 1a40a425..3d519f10 100644--- a/flowsint-api/app/scanners/domains/subdomains.py+++ b/flowsint-api/app/scanners/domains/subdomains.py@@ -1,4 +1,5 @@import requests+import subprocessfrom typing import List, Dict, Any, TypeAlias, Unionfrom app.scanners.base import Scannerfrom app.types.domain import MinimalDomain, Domain@@ -26,20 +27,18 @@ class SubdomainScanner(Scanner):@classmethoddef input_schema(cls) -> Dict[str, Any]:adapter = TypeAdapter(InputType)- schema = [+ return [{"name": prop, "type": resolve_type(details)}for prop, details in adapter.json_schema()["$defs"]["MinimalDomain"]["properties"].items()- ]- return schema+ ]@classmethoddef output_schema(cls) -> Dict[str, Any]:adapter = TypeAdapter(OutputType)- schema = [+ return [{"name": prop, "type": resolve_type(details)}for prop, details in adapter.json_schema()["$defs"]["Domain"]["properties"].items()- ]- return schema+ ]def preprocess(self, data: Union[List[str], List[dict], InputType]) -> InputType:cleaned: InputType = []@@ -56,59 +55,81 @@ class SubdomainScanner(Scanner):return cleaneddef scan(self, data: InputType) -> OutputType:- """Find subdomains using crt.sh."""- domains : OutputType = []+ """Find subdomains using crt.sh and subfinder."""+ domains: OutputType = []+for md in data:- found_subdomains: set[str] = set()- try:- d = Domain(domain = md.domain)- response = requests.get(- f"https://crt.sh/?q=%25.{d.domain}&output=json",- timeout=60- )- if response.ok:- entries = response.json()-- for entry in entries:- name_value = entry.get("name_value", "")- for subdomain in name_value.split("\n"):- if is_valid_domain(subdomain) and subdomain.endswith(d.domain):- found_subdomains.add(subdomain.lower())-- except Exception:- continue- d.subdomains = list(sorted(found_subdomains))+ d = Domain(domain=md.domain)+ subdomains = self.__get_subdomains_from_subfinder(d.domain)+ # subdomains.update(self.__get_subdomains_from_crtsh(d.domain))+ d.subdomains = sorted(subdomains)domains.append(d)return domains+ def __get_subdomains_from_crtsh(self, domain: str) -> set[str]:+ subdomains: set[str] = set()+ try:+ response = requests.get(+ f"https://crt.sh/?q=%25.{domain}&output=json",+ timeout=60+ )+ if response.ok:+ entries = response.json()+ for entry in entries:+ name_value = entry.get("name_value", "")+ for sub in name_value.split("\n"):+ sub = sub.strip().lower()+ if "*" not in sub and is_valid_domain(sub) and sub.endswith(domain) and sub != domain:+ subdomains.add(sub)+ elif "*" in sub:+ print(f"[IGNORED] Wildcard subdomain: {repr(sub)}")+ except Exception as e:+ print(f"[ERROR] crt.sh failed for {domain}: {e}")+ return subdomains++ def __get_subdomains_from_subfinder(self, domain: str) -> set[str]:+ subdomains: set[str] = set()+ try:+ result = subprocess.run(+ ["subfinder", "-silent", "-d", domain],+ capture_output=True, text=True, timeout=60+ )+ print(result)+ if result.returncode == 0:+ for sub in result.stdout.strip().splitlines():+ sub = sub.strip().lower()+ if is_valid_domain(sub) and sub.endswith(domain) and sub != domain:+ subdomains.add(sub)+ else:+ print(f"[ERROR] subfinder failed for {domain}: {result.stderr.strip()}")+ except Exception as e:+ print(f"[ERROR] subfinder exception for {domain}: {e}")+ return subdomains+def postprocess(self, results: OutputType, original_input: InputType) -> OutputType:for domain_obj in results:if not self.neo4j_conn:continue- query_main = """- MERGE (d:domain {domain: $domain})- SET d.sketch_id = $sketch_id- """- self.neo4j_conn.query(query_main, {- "domain": domain_obj.domain,- "sketch_id": self.sketch_id- })-- # Subdomains- for sub in domain_obj.subdomains:- query_sub = """- MERGE (sub:subdomain {domain: $subdomain})- SET sub.sketch_id = $sketch_id- MERGE (d:domain {domain: $domain})- MERGE (d)-[:HAS_SUBDOMAIN {sketch_id: $sketch_id}]->(sub)- """- self.neo4j_conn.query(query_sub, {+ for subdomain in domain_obj.subdomains:+ self.neo4j_conn.query("""+ MERGE (sub:subdomain {domain: $subdomain})+ SET sub.sketch_id = $sketch_id+ SET sub.sketch_id = $sketch_id+ SET sub.label = $label+ SET sub.color = $color+ SET sub.caption = $caption+ SET sub.type = $type+ MERGE (d:domain {domain: $domain})+ MERGE (d)-[:HAS_SUBDOMAIN {sketch_id: $sketch_id}]->(sub)+ """, {"domain": domain_obj.domain,- "subdomain": sub,- "sketch_id": self.sketch_id+ "subdomain": subdomain,+ "sketch_id": self.sketch_id,+ "label": subdomain,+ "caption": subdomain,+ "color": "#865FCD",+ "type": "subdomain"})return results--diff --git a/flowsint-api/app/utils.py b/flowsint-api/app/utils.pyindex daa4b568..7781738a 100644--- a/flowsint-api/app/utils.py+++ b/flowsint-api/app/utils.py@@ -145,84 +145,32 @@ def extract_transform(transform: Dict[str, Any]) -> Dict[str, Any]:}+def get_label_color(label: str) -> str:+ color_map = {+ 'subdomain': '#A5ABB6',+ 'domain': '#68BDF6',+ 'default': '#A5ABB6'+ }-def neo4j_to_cytoscape(results):- elements = []- nodes = {}-- for record in results:- a = record["a"]- b = record["b"]- r = record["r"]-- a_id = a.get("id") or a.get("name")- b_id = b.get("id") or b.get("name")-- if a_id and a_id not in nodes:- nodes[a_id] = {- "data": {- "id": a_id,- "label": a.get("name") or a.get("username") or a_id,- "type": a.get("type") # <-- ajoute le type- }- }-- if b_id and b_id not in nodes:- nodes[b_id] = {- "data": {- "id": b_id,- "label": b.get("name") or b.get("username") or b_id,- "type": b.get("type") # <-- ajoute le type- }- }-- if a_id and b_id:- elements.append({- "data": {- "source": a_id,- "target": b_id,- "label": r[1]- }- })-- return list(nodes.values()) + elements---def neo4j_to_xy(records):- nodes_by_id = {}- edges = []-- for record in records:- a = record["a"]- b = record["b"]- r = record["r"]+ return color_map.get(label, color_map["default"])- a_id = str(a.id)- b_id = str(b.id)-- if a_id not in nodes_by_id:- nodes_by_id[a_id] = {- "id": a_id,- "data": { "label": a.get("label", a.get("type", a_id)) },- "position": { "x": 100, "y": 100 }- }-- if b_id not in nodes_by_id:- nodes_by_id[b_id] = {- "id": b_id,- "data": { "label": b.get("label", b.get("type", b_id)) },- "position": { "x": 100, "y": 100 }- }-- edge_id = f"{a_id}-{b_id}"- edges.append({- "id": edge_id,- "source": a_id,- "target": b_id,- "label": r.type- })-- return {- "nodes": list(nodes_by_id.values()),- "edges": edges- }+def flatten(data_dict):+ """+ Flattens a dictionary to contain only Neo4j-compatible property values.+ Neo4j supports primitive types (string, number, boolean) and arrays of those types.+ Args:+ data_dict (dict): Dictionary to flatten+ Returns:+ dict: Flattened dictionary with only Neo4j-compatible values+ """+ flattened = {}+ if not isinstance(data_dict, dict):+ return flattened+ for key, value in data_dict.items():+ if value is None:+ continue+ if isinstance(value, (str, int, float, bool)) or (+ isinstance(value, list) and all(isinstance(item, (str, int, float, bool)) for item in value)+ ):+ flattened[key] = value+ return flattened\ No newline at end of filediff --git a/flowsint-web/src/app/api/investigations/[investigation_id]/organigrams/[organization_id]/sketch/route.ts b/flowsint-web/src/app/api/investigations/[investigation_id]/organigrams/[organization_id]/sketch/route.tsdeleted file mode 100644index 9c5525b6..00000000--- a/flowsint-web/src/app/api/investigations/[investigation_id]/organigrams/[organization_id]/sketch/route.ts+++ /dev/null@@ -1,24 +0,0 @@-import { createClient } from "@/lib/supabase/server"-import { NextResponse } from "next/server"-export async function GET(_: Request, { params }: { params: Promise<{ organization_id: string }> }) {- const { organization_id } = await params- const supabase = await createClient()- try {- const {- data: { user },- error: userError,- } = await supabase.auth.getUser();- if (!user || userError) {- return NextResponse.json({ error: "Unauthorized" }, { status: 401 })- }- const { data: graphData, error: graphError } = await supabase- .from("organization_graph")- .select("*")- .eq("organization_id", organization_id)- .single();- if (graphError) return NextResponse.json({ error: "Internal Server Error", message: graphError }, { status: 500 })- return NextResponse.json(graphData, { status: 200 })- } catch (error) {- return NextResponse.json({ error: "Internal Server Error" }, { status: 500 })- }-}diff --git a/flowsint-web/src/app/api/investigations/[investigation_id]/route.ts b/flowsint-web/src/app/api/investigations/[investigation_id]/route.tsindex 10b3d67f..0dfd25bb 100644--- a/flowsint-web/src/app/api/investigations/[investigation_id]/route.ts+++ b/flowsint-web/src/app/api/investigations/[investigation_id]/route.ts@@ -13,7 +13,7 @@ export async function GET(_: Request, { params }: { params: Promise<{ investigatreturn NextResponse.json({ error: "Unauthorized" }, { status: 401 })}const { data: investigation, error } = await supabase.from("investigations")- .select("*, members:investigations_profiles(profile:profiles(id, first_name, last_name, avatar_url), role), sketches(*, members:sketches_profiles(profile:profiles(id, first_name, last_name, avatar_url), role), individuals(id)), owner_id")+ .select("*, members:investigations_profiles(profile:profiles(id, first_name, last_name, avatar_url), role), sketches(*, members:sketches_profiles(profile:profiles(id, first_name, last_name, avatar_url), role)), owner_id").eq("id", investigation_id).single()if (error) {diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/client.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/client.tsxdeleted file mode 100644index 11df70e7..00000000--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/client.tsx+++ /dev/null@@ -1,25 +0,0 @@-"use client"-import { useQuery } from "@tanstack/react-query"-import OrganizationGraph from "@/components/organigrams/graph"-import { notFound } from "next/navigation"-interface DashboardClientProps {- investigationId: string- organizationId: string-}-export default function OrganigramClient({ investigationId, organizationId }: DashboardClientProps) {- const graphQuery = useQuery({- queryKey: ["investigations", [investigationId], "organigram", organizationId],- queryFn: async () => {- const res = await fetch(`/api/investigations/${investigationId}/organigrams/${organizationId}/sketch`)- if (!res.ok) {- notFound()- }- return res.json()- },- refetchOnWindowFocus: true,- })- return (- <OrganizationGraph graphQuery={graphQuery} />- )-}-diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/layout.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/layout.tsxdeleted file mode 100644index 12a178a7..00000000--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/layout.tsx+++ /dev/null@@ -1,18 +0,0 @@-import { createClient } from "@/lib/supabase/server";-import { redirect } from "next/navigation";-const DashboardLayout = async ({- children,-}: {- children: React.ReactNode;-}) => {- const supabase = await createClient()- const { data, error: userError } = await supabase.auth.getUser()- if (userError || !data?.user) {- redirect('/login')- }- return (- children- )-}--export default DashboardLayout\ No newline at end of filediff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/loading.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/loading.tsxdeleted file mode 100644index 6b7b0d2d..00000000--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/loading.tsx+++ /dev/null@@ -1,10 +0,0 @@-import Loader from '@/components/loader'-import React from 'react'--const loading = () => {- return (- <div className='h-[90vh] w-full flex items-center justify-center gap-2'><Loader />Loading...</div>- )-}--export default loading\ No newline at end of filediff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/page.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/page.tsxdeleted file mode 100644index 4e0e675c..00000000--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/organigrams/[organization_id]/page.tsx+++ /dev/null@@ -1,27 +0,0 @@-import { notFound, redirect, unauthorized } from "next/navigation"-import DashboardClient from "./client"-import { createClient } from "@/lib/supabase/server"--const OrganigramPage = async ({- params,-}: {- params: Promise<{ investigation_id: string, organization_id: string }>-}) => {- const supabase = await createClient()- const { investigation_id, organization_id } = await (params)- const {- data: { user },- error: userError,- } = await supabase.auth.getUser();- if (!user || userError) {- return redirect("/login")- }- const { data: organization, error } = await supabase.from("organizations").select("id").eq("id", organization_id).single()- if (!organization || error) {- return notFound()- }- return <DashboardClient investigationId={investigation_id} organizationId={organization_id} />-}--export default OrganigramPage-diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/page.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/page.tsxindex 589ef2b9..66b055a9 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/page.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/page.tsx@@ -18,7 +18,7 @@ import { cn } from "@/lib/utils"import { InvestigationNavigation } from "@/components/investigations/investigation-navigation"import { Card } from "@/components/ui/card"import { AvatarList } from "@/components/avatar-list"-import { SectionCards } from "@/components/investigations/section-cards"+// import { SectionCards } from "@/components/investigations/section-cards"import { Profile } from "@/types"import { Skeleton } from "@/components/ui/skeleton"@@ -90,7 +90,7 @@ const DashboardPage = () => {/></div></div>- <SectionCards />+ {/* <SectionCards /> */}<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 bg-card text-muted-foreground" />diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/client.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/client.tsxindex 9f7bac57..ed5d1110 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/client.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/client.tsx@@ -7,11 +7,11 @@ import { Toolbar } from './toolbar'import { LeftPanel } from './left-panel'import { RightPanel } from './right-panel'import { ResizablePanelGroup, ResizableHandle, ResizablePanel } from "@/components/ui/resizable"-import { useState } from "react"-import { useFlowStore } from "@/store/flow-store"+import { useRef, useState } from "react"+import { useSketchStore } from "@/store/sketch-store"import { GraphPanel } from "./graph-panel"-import { ReactFlowProvider } from "@xyflow/react"import { Sketch } from "@/types/sketch"+import SettingsModal from "./settings-modal"interface DashboardClientProps {investigationId: string@@ -23,6 +23,8 @@ export default function DashboardClient({ investigationId, sketchId, sketch, useconst [open, setOpen] = useState(false)const [isLeftPanelCollapsed, setIsLeftPanelCollapsed] = useState(false)const [isRightPanelCollapsed, setIsRightPanelCollapsed] = useState(false)+ const minimapRef = useRef<HTMLDivElement>(null)+const stateSelector = (state: { currentNode: any; setCurrentNode: any }) => ({currentNode: state.currentNode,setCurrentNode: state.setCurrentNode,@@ -31,7 +33,8 @@ export default function DashboardClient({ investigationId, sketchId, sketch, useconst {currentNode,setCurrentNode- } = useFlowStore(stateSelector, shallow)+ } = useSketchStore(stateSelector, shallow)+const graphQuery = useQuery({queryKey: ["investigations", investigationId, 'sketches', sketchId, "data"],queryFn: async () => {@@ -44,10 +47,10 @@ export default function DashboardClient({ investigationId, sketchId, sketch, userefetchOnWindowFocus: true,})return (- <ReactFlowProvider>+ <><Toolbar investigation_id={investigationId} sketch_id={sketchId} sketch={sketch} user_id={user_id} /><div className="grow w-screen overflow-hidden relative">- <ResizablePanelGroup autoSaveId="persistence" direction="horizontal" className="w-full h-full relative ">+ <ResizablePanelGroup autoSaveId="persistence" direction="horizontal" className="w-full h-full overflow-hidden relative">{/* Left Panel - Entity Palette */}<LeftPanelisCollapsed={isLeftPanelCollapsed}@@ -55,10 +58,11 @@ export default function DashboardClient({ investigationId, sketchId, sketch, use/><ResizableHandle withHandle /><ResizablePanel defaultSize={65}>- <GraphPanel query={graphQuery} />+ <GraphPanel minimapRef={minimapRef} query={graphQuery} /></ResizablePanel><ResizableHandle withHandle /><RightPanel+ minimapRef={minimapRef}sketchId={sketchId}isLoading={graphQuery.isLoading}isCollapsed={isRightPanelCollapsed}@@ -68,7 +72,8 @@ export default function DashboardClient({ investigationId, sketchId, sketch, use</ResizablePanelGroup><ActionDialog setCurrentNode={setCurrentNode} setOpenDialog={setOpen} openDialog={open} /></div>- </ReactFlowProvider>+ <SettingsModal />+ </>)}diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/color-badge.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/color-badge.tsxnew file mode 100644index 00000000..a0028e9a--- /dev/null+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/color-badge.tsx@@ -0,0 +1,38 @@+import { type ItemType, useColorSettings } from "@/store/color-settings"++interface ColorBadgeProps {+ itemType: ItemType+ label?: string+ className?: string+}++export default function ColorBadge({ itemType, label, className = "" }: ColorBadgeProps) {+ const { colors } = useColorSettings()++ return (+ <span+ className={`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${className}`}+ style={{+ backgroundColor: colors[itemType],+ color: isLightColor(colors[itemType]) ? "#000" : "#fff",+ }}+ >+ {label || itemType.replace(/_/g, " ")}+ </span>+ )+}++// Helper function to determine if a color is light or dark+function isLightColor(color: string): boolean {+ // Convert hex to RGB+ const hex = color.replace("#", "")+ const r = Number.parseInt(hex.substr(0, 2), 16)+ const g = Number.parseInt(hex.substr(2, 2), 16)+ const b = Number.parseInt(hex.substr(4, 2), 16)++ // Calculate brightness (YIQ formula)+ const brightness = (r * 299 + g * 587 + b * 114) / 1000++ // Return true if the color is light+ return brightness > 128+}diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph-panel.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph-panel.tsxindex 99eaabaf..25abc733 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph-panel.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph-panel.tsx@@ -5,15 +5,16 @@ import Neo4jGraph from './graph'interface GraphPanelProps {query: any+ minimapRef: any}-export const GraphPanel = memo(function GraphPanel({ query }: GraphPanelProps) {+export const GraphPanel = memo(function GraphPanel({ query, minimapRef }: GraphPanelProps) {const [isBottomPanelCollapsed, setIsBottomPanelCollapsed] = useState(false)return (<div className="flex flex-col h-full"><div className="grow"><ResizablePanelGroup direction="vertical" className="h-full"><ResizablePanel defaultSize={80} className="h-full w-full bg-">- <Neo4jGraph data={query.data} isLoading={query.isLoading} />+ <Neo4jGraph minimapRef={minimapRef} data={query.data} isLoading={query.isLoading} /></ResizablePanel><ResizableHandle withHandle />diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph.tsxindex 5b67d537..c74b4c42 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph.tsx@@ -2,50 +2,62 @@import Loader from '@/components/loader'import NewActions from '@/components/sketches/new-actions'import { Button } from '@/components/ui/button'-import { useFlowStore } from '@/store/flow-store'+import { useSketchStore } from '@/store/sketch-store'import type { HitTargets, Node, NVL, Relationship } from '@neo4j-nvl/base'-import { InteractiveNvlWrapper } from '@neo4j-nvl/react'+import { ZoomInteraction } from '@neo4j-nvl/interaction-handlers'import type { MouseEventCallbacks } from '@neo4j-nvl/react'import { PlusIcon } from 'lucide-react'import React, { memo, useEffect, useRef, useState } from 'react'import { shallow } from 'zustand/shallow'+import dynamic from 'next/dynamic'-const stateSelector = (state: { setCurrentNode: any }) => ({+const InteractiveNvlWrapper = dynamic(+ () => import('@neo4j-nvl/react').then(mod => mod.InteractiveNvlWrapper),+ { ssr: false }+)++const stateSelector = (state: { setCurrentNode: any, nodes: Node[], edges: Relationship[], setNodes: any, setEdges: any, addNode: any }) => ({setCurrentNode: state.setCurrentNode,+ nodes: state.nodes,+ edges: state.edges,+ setNodes: state.setNodes,+ setEdges: state.setEdges,+ addNode: state.addNode})-interface Neo4jGraphProps {- isLoading: boolean- data: { nodes: Node[], rels: Relationship[] }+ isLoading: boolean,+ minimapRef: any+ data: { nds: Node[], rls: Relationship[] }}-const Neo4jGraph = ({ data, isLoading }: Neo4jGraphProps) => {++const Neo4jGraph = ({ data, isLoading, minimapRef }: Neo4jGraphProps) => {const nvl = useRef<NVL | null>(null)- const [nds, setNodes] = useState<Node[]>([])- const [rls, setRels] = useState<Relationship[]>([])+ const [ready, setReady] = useState<boolean>(false)const {setCurrentNode,- } = useFlowStore(stateSelector, shallow);+ addNode,+ setNodes,+ setEdges,+ nodes,+ edges+ } = useSketchStore(stateSelector, shallow);+ // S'assurer que nous sommes côté clientuseEffect(() => {- if (isLoading) return- if (data?.nodes) setNodes(data.nodes)- if (data?.rels) setRels(data.rels)- }, [data?.nodes, data?.rels, isLoading, setNodes, setRels])+ if (minimapRef && minimapRef.current) {+ setReady(true)+ }+ }, [minimapRef])- const fitNodes = () => {- nvl.current?.fit(nds.map((n) => n.id))- }- const resetZoom = () => {- nvl.current?.resetZoom()- }- const addNode = (newNode: any) => {- const newNodes = [...nds, {...newNode, caption: newNode.label}]- setNodes(newNodes)- }+ useEffect(() => {+ if (isLoading) return+ if (data?.nds) setNodes(data.nds)+ if (data?.rls) setEdges(data.rls)+ }, [data?.nds, data?.rls, isLoading, setNodes, setEdges])const mouseEventCallbacks: MouseEventCallbacks = {onHover: (element: Node | Relationship, hitTargets: HitTargets, evt: MouseEvent) => { },@@ -64,16 +76,38 @@ const Neo4jGraph = ({ data, isLoading }: Neo4jGraphProps) => {onZoom: (zoomLevel: number) => { },}- if (isLoading) return <div className='flex h-full w-full items-center justify-center'>Loading <Loader /></div>- return <div className='relative h-full w-full'>- <div className='top-3 left-3 absolute z-50'>- <NewActions addNodes={addNode}>- <Button className="bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none" size="icon">- <PlusIcon />- </Button>- </NewActions>+ if (isLoading || !ready) return <div className='flex h-full w-full items-center justify-center'>Loading <Loader /></div>++ if (!isLoading && ready && !nodes.length) return <div className='flex relative gap-3 h-full flex-col w-full items-center justify-center'>++ Your nodes will be displayed here.+ <NewActions addNodes={addNode}>+ <Button className="bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none">+ Add your first item <PlusIcon />+ </Button>+ </NewActions></div>++ return (+ <div className='relative h-full w-full'>+ <div className='top-3 left-3 absolute z-50'>+ <NewActions addNodes={addNode}>+ <Button className="bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none" size="icon">+ <PlusIcon />+ </Button>+ </NewActions>+ </div>+ <InteractiveNvlWrapper+ nvlOptions={{+ renderer: "canvas",+ minimapContainer: minimapRef?.current+ }}+ ref={nvl}+ nodes={nodes}+ rels={edges}+ mouseEventCallbacks={mouseEventCallbacks}+ /></div>- <InteractiveNvlWrapper ref={nvl} nodes={nds} rels={rls} mouseEventCallbacks={mouseEventCallbacks} />- </div>+ )}+export default memo(Neo4jGraph)\ No newline at end of filediff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/left-panel.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/left-panel.tsxindex 18ae2be7..31222759 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/left-panel.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/left-panel.tsx@@ -1,9 +1,16 @@-import { Button } from '@/components/ui/button'-import { ResizablePanel } from '@/components/ui/resizable'-import { ScrollArea } from '@/components/ui/scroll-area'-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'-import { ChevronDown, ChevronRight, Globe, Mail, MapPin, Phone, User, Wifi } from 'lucide-react'-import { memo } from 'react'+"use client"++import { Button } from "@/components/ui/button"+import {+ ResizablePanel,+ ResizablePanelGroup+} from "@/components/ui/resizable"+import { ScrollArea } from "@/components/ui/scroll-area"+import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"+import { ChevronDown, ChevronRight } from 'lucide-react'+import { memo } from "react"+import { actionItems } from "@/lib/action-items"+import { IconContainer } from "@/components/icon-container"interface LeftPanelProps {isCollapsed: boolean@@ -11,75 +18,89 @@ interface LeftPanelProps {}export const LeftPanel = memo(function LeftPanel({ isCollapsed, setIsCollapsed }: LeftPanelProps) {- // Sample entity categories for the left panel- const entityCategories = [- {- name: "Infrastructure",- entities: [- { name: "Domain", icon: <Globe className="h-4 w-4" /> },- { name: "IP Address", icon: <Wifi className="h-4 w-4" /> },- { name: "Website", icon: <Globe className="h-4 w-4" /> },- ],- },- {- name: "Personal",- entities: [- { name: "Person", icon: <User className="h-4 w-4" /> },- { name: "Email Address", icon: <Mail className="h-4 w-4" /> },- { name: "Phone Number", icon: <Phone className="h-4 w-4" /> },- { name: "Location", icon: <MapPin className="h-4 w-4" /> },- ],- },- ]-return (<ResizablePaneldefaultSize={15}minSize={10}maxSize={25}- className="h-full bg-card"+ className="h-[calc(100vh_-_92px)] bg-card"collapsible={true}collapsedSize={2}onCollapse={() => setIsCollapsed(true)}onExpand={() => setIsCollapsed(false)}>{!isCollapsed ? (- <div className="flex h-full flex-col">- <div className="flex h-8 items-center justify-between border-b px-4 bg-card">- <h2 className="font-medium text-sm">Palette</h2>- <Button variant="ghost" size="icon" className="h-6 w-6">- <ChevronDown className="h-4 w-4" />- </Button>- </div>- <ScrollArea className="flex-1">+ <div className="overflow-auto bg-card h-full flex flex-col w-full !p-0 !m-0">+ <div><div className="p-2">- <Accordion type="multiple" defaultValue={["Infrastructure", "Personal"]}>- {entityCategories.map((category) => (- <AccordionItem- key={category.name}- value={category.name}- className="border-b border-border"- >- <AccordionTrigger className="py-2 text-sm">{category.name}</AccordionTrigger>- <AccordionContent>- <div className="grid grid-cols-1 gap-1">- {category.entities.map((entity) => (- <div- key={entity.name}- className="flex cursor-grab items-center gap-2 rounded-md p-2 hover:bg-muted"- draggable="true"- >- {entity.icon}- <span className="text-xs">{entity.name}</span>- </div>- ))}- </div>- </AccordionContent>- </AccordionItem>- ))}- </Accordion>+ <div className="grid grid-cols-1 gap-1">+ {actionItems.map((item) => {+ if (item.children && item.children.length > 0) {+ return (+ <Accordion key={item.id} type="single" collapsible className="border-b border-border">+ <AccordionItem value={item.id.toString()}>+ <AccordionTrigger className="py-1 text-sm">+ <div className="flex items-center gap-2">+ <IconContainer+ icon={item.icon}+ type={item.type}+ />+ <span>{item.label}</span>+ {item.comingSoon && <span className="ml-1 text-xs text-muted-foreground">(Soon)</span>}+ </div>+ </AccordionTrigger>+ <AccordionContent>+ <div className="grid grid-cols-1 gap-1 pl-2">+ {item.children.map((childItem) => {+ return (+ <div+ key={childItem.id}+ className={`flex cursor-grab items-center gap-2 rounded-md p-2 hover:bg-background ${childItem.disabled ? "opacity-50 cursor-not-allowed" : ""+ }`}+ draggable={!childItem.disabled}+ >+ <IconContainer+ icon={childItem.icon}+ type={childItem.type}+ />+ <span className="text-xs">+ {childItem.label}+ {childItem.comingSoon && (+ <span className="ml-1 text-xs text-muted-foreground">(Soon)</span>+ )}+ </span>+ </div>+ );+ })}+ </div>+ </AccordionContent>+ </AccordionItem>+ </Accordion>+ );+ }++ // Otherwise, render it as a regular item+ return (+ <div+ key={item.id}+ className={`flex cursor-grab items-center gap-2 rounded-md p-1 hover:bg-background ${item.disabled ? "opacity-50 cursor-not-allowed" : ""+ }`}+ draggable={!item.disabled}+ >+ <IconContainer+ icon={item.icon}+ type={item.type}+ />+ <span className="text-xs">+ {item.label}+ {item.comingSoon && <span className="ml-1 text-xs text-muted-foreground">(Soon)</span>}+ </span>+ </div>+ );+ })}+ </div></div>- </ScrollArea>+ </div></div>) : (<div className="flex h-full items-center justify-center">@@ -89,5 +110,5 @@ export const LeftPanel = memo(function LeftPanel({ isCollapsed, setIsCollapsed }</div>)}</ResizablePanel>- )-})\ No newline at end of file+ );+});diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/page.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/page.tsxindex 16e740f2..9d5df943 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/page.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/page.tsx@@ -20,7 +20,11 @@ const InvestigationPage = async ({if (!sketch || error) {return notFound()}- return <DashboardClient investigationId={investigation_id} sketchId={sketch_id} sketch={sketch} user_id={user?.id} />+ return (+ <>+ <div className="fixed h-[200px] w-[300px] top-[95px] right-3 z-[200]" id="minimapcontainer"></div>+ <DashboardClient investigationId={investigation_id} sketchId={sketch_id} sketch={sketch} user_id={user?.id} />+ </>)}export default InvestigationPagediff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/right-panel.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/right-panel.tsxindex 1f9c1976..37749e0f 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/right-panel.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/right-panel.tsx@@ -3,8 +3,8 @@ import { ResizablePanel, ResizablePanelGroup, ResizableHandle } from '@/componenimport { ChevronDown, ChevronLeft } from 'lucide-react'import NodesPanel from '@/components/sketches/sketch/nodes-panel'import ProfilePanel from '@/components/sketches/sketch/profile-panel'-import { memo, useMemo } from 'react'-import { useFlowStore } from '@/store/flow-store'+import { memo, useMemo, useRef } from 'react'+import { useSketchStore } from '@/store/sketch-store'import { shallow } from 'zustand/shallow'import { MiniMap } from '@xyflow/react'@@ -14,20 +14,21 @@ interface RightPanelProps {currentNode: any,isLoading: booleansketchId: string+ minimapRef: any}-export const RightPanel = memo(function RightPanel({ isCollapsed, isLoading, setIsCollapsed, currentNode, sketchId }: RightPanelProps) {+export const RightPanel = memo(function RightPanel({ isCollapsed, isLoading, setIsCollapsed, currentNode, sketchId, minimapRef }: RightPanelProps) {const stateSelector = (state: { nodes: any }) => ({nodes: state.nodes,})const {nodes,- } = useFlowStore(stateSelector, shallow)+ } = useSketchStore(stateSelector, shallow)const processedNodes = useMemo(() =>- nodes.map(({ id, data, type }: { id: string; data: any; type: string }) => ({ id, data, type }))- .sort((a: { type: any }, b: { type: string }) => b.type?.localeCompare(a.type || "")),+ nodes.map(({ id, data, type }: { id: string; data: any; type?: string }) => ({ id, data, type }))+ .sort((a: { type?: any }, b: { type?: string }) => b?.type?.localeCompare(a?.type || "")),[nodes.length]);@@ -44,28 +45,19 @@ export const RightPanel = memo(function RightPanel({ isCollapsed, isLoading, set>{!isCollapsed ? (<ResizablePanelGroup autoSaveId="conditional" direction="vertical">- {/* <ResizablePanel order={1} id="map" defaultSize={30} className='flex items-center justfify-center'>- <div className='relative grow'>- <MiniMap pannable className='mx-auto' />- </div>+ <ResizablePanel order={1} id="map" defaultSize={30} className='flex items-center justfify-center p-4'>+ <div className='w-full h-full' ref={minimapRef} /></ResizablePanel>- <ResizableHandle withHandle /> */}-+ <ResizableHandle withHandle className="z-[400]" />{currentNode && (<>- <ResizablePanel order={1} id="infos" defaultSize={30}>+ <ResizablePanel order={2} id="infos" defaultSize={30}><ProfilePanel sketch_id={sketchId} data={currentNode.data} /></ResizablePanel><ResizableHandle withHandle /></>)}- <ResizablePanel order={2} id="nodes" defaultSize={40}>- <div className="flex h-8 items-center justify-between border-b px-4 bg-card">- <h2 className="font-medium text-sm">Entities</h2>- <Button variant="ghost" size="icon" className="h-6 w-6">- <ChevronDown className="h-4 w-4" />- </Button>- </div>+ <ResizablePanel order={3} id="nodes" defaultSize={40}><NodesPanel isLoading={isLoading} nodes={processedNodes} /></ResizablePanel></ResizablePanelGroup>diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/settings-modal.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/settings-modal.tsxnew file mode 100644index 00000000..1ebe0da9--- /dev/null+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/settings-modal.tsx@@ -0,0 +1,214 @@+"use client"++import { useState } from "react"+import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog"+import { Button } from "@/components/ui/button"+import { ScrollArea } from "@/components/ui/scroll-area"+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"+import { Input } from "@/components/ui/input"+import { Label } from "@/components/ui/label"+import { ITEM_TYPES, type ItemType, useColorSettings } from "@/store/color-settings"+import { useModalStore } from "@/store/store-settings"++export default function SettingsModal() {+ const { isSettingsOpen, closeSettings } = useModalStore()+ const { colors, setColor, resetColors } = useColorSettings()+ const [localColors, setLocalColors] = useState<Record<ItemType, string>>({ ...colors })++ const handleColorChange = (itemType: ItemType, color: string) => {+ setLocalColors((prev) => ({+ ...prev,+ [itemType]: color,+ }))+ }++ const handleSave = () => {+ // Update all colors in the store+ Object.entries(localColors).forEach(([itemType, color]) => {+ setColor(itemType as ItemType, color)+ })+ closeSettings()+ }++ const handleCancel = () => {+ // Reset local state to match store+ setLocalColors({ ...colors })+ closeSettings()+ }++ const handleReset = () => {+ resetColors()+ setLocalColors({ ...useColorSettings.getState().colors })+ }++ return (+ <Dialog open={isSettingsOpen} onOpenChange={closeSettings}>+ <DialogContent className="sm:max-w-[600px] max-h-[80vh] flex flex-col">+ <DialogHeader>+ <DialogTitle>Paramètres de Couleur</DialogTitle>+ </DialogHeader>+ <Tabs defaultValue="all" className="flex-1 overflow-hidden">+ <TabsList className="grid grid-cols-2">+ <TabsTrigger value="all">Tous les types</TabsTrigger>+ <TabsTrigger value="grouped">Groupés</TabsTrigger>+ </TabsList>+ <TabsContent value="all" className="flex-1 overflow-hidden p-3">+ <ScrollArea className="h-[50vh] pr-4">+ <div className="grid gap-4">+ {ITEM_TYPES.map((itemType) => (+ <div key={itemType} className="flex items-center gap-4">+ <div className="flex-1">+ <Label htmlFor={`color-${itemType}`} className="capitalize">+ {itemType.replace(/_/g, " ")}+ </Label>+ </div>+ <div className="flex items-center gap-2">+ {/* <div className="w-8 h-8 rounded-md border" style={{ backgroundColor: localColors[itemType] }} /> */}+ <Input+ id={`color-${itemType}`}+ type="color"+ value={localColors[itemType]}+ onChange={(e) => handleColorChange(itemType, e.target.value)}+ className="p-0 overflow-hidden w-8 h-8 rounded-md border"+ />+ </div>+ </div>+ ))}+ </div>+ </ScrollArea>+ </TabsContent>+ <TabsContent value="grouped" className="flex-1 overflow-hidden p-3">+ <ScrollArea className="h-[50vh] pr-4">+ <div className="grid gap-6">+ <div className="space-y-3">+ <h3 className="font-medium text-muted-foreground">Identité</h3>+ <div className="grid gap-2">+ {["individual", "organization", "credential", "biometric"].map((itemType) => (+ <div key={itemType} className="flex items-center gap-4">+ <div className="flex-1">+ <Label htmlFor={`group-color-${itemType}`} className="capitalize">+ {itemType.replace(/_/g, " ")}+ </Label>+ </div>+ <div className="flex items-center gap-2">+ {/* <div+ className="w-8 h-8 rounded-md border"+ style={{ backgroundColor: localColors[itemType as ItemType] }}+ /> */}+ <Input+ id={`group-color-${itemType}`}+ type="color"+ value={localColors[itemType as ItemType]}+ onChange={(e) => handleColorChange(itemType as ItemType, e.target.value)}+ className="p-0 overflow-hidden w-8 h-8 rounded-md border"+ />+ </div>+ </div>+ ))}+ </div>+ </div>+ <div className="space-y-3">+ <h3 className="font-medium text-muted-foreground">Contact</h3>+ <div className="grid gap-2">+ {["phone", "address", "email", "social"].map((itemType) => (+ <div key={itemType} className="flex items-center gap-4">+ <div className="flex-1">+ <Label htmlFor={`group-color-${itemType}`} className="capitalize">+ {itemType.replace(/_/g, " ")}+ </Label>+ </div>+ <div className="flex items-center gap-2">+ {/* <div+ className="w-8 h-8 rounded-md border"+ style={{ backgroundColor: localColors[itemType as ItemType] }}+ /> */}+ <Input+ id={`group-color-${itemType}`}+ type="color"+ value={localColors[itemType as ItemType]}+ onChange={(e) => handleColorChange(itemType as ItemType, e.target.value)}+ className="p-0 overflow-hidden w-8 h-8 rounded-md border"+ />+ </div>+ </div>+ ))}+ </div>+ </div>+ <div className="space-y-3">+ <h3 className="font-medium text-muted-foreground">Web</h3>+ <div className="grid gap-2">+ {["website", "domain", "subdomain", "ip", "online_activity", "digital_footprint"].map(+ (itemType) => (+ <div key={itemType} className="flex items-center gap-4">+ <div className="flex-1">+ <Label htmlFor={`group-color-${itemType}`} className="capitalize">+ {itemType.replace(/_/g, " ")}+ </Label>+ </div>+ <div className="flex items-center gap-2">+ {/* <div+ className="w-8 h-8 rounded-md border"+ style={{ backgroundColor: localColors[itemType as ItemType] }}+ /> */}+ <Input+ id={`group-color-${itemType}`}+ type="color"+ value={localColors[itemType as ItemType]}+ onChange={(e) => handleColorChange(itemType as ItemType, e.target.value)}+ className="p-0 overflow-hidden w-8 h-8 rounded-md border"+ />+ </div>+ </div>+ ),+ )}+ </div>+ </div>+ <div className="space-y-3">+ <h3 className="font-medium text-muted-foreground">Others</h3>+ <div className="grid gap-2">+ {["vehicle", "document", "financial", "event", "device", "media", "education", "relationship"].map(+ (itemType) => (+ <div key={itemType} className="flex items-center gap-4">+ <div className="flex-1">+ <Label htmlFor={`group-color-${itemType}`} className="capitalize">+ {itemType.replace(/_/g, " ")}+ </Label>+ </div>+ <div className="flex items-center gap-2">+ {/* <div+ className="w-8 h-8 rounded-md border"+ style={{ backgroundColor: localColors[itemType as ItemType] }}+ /> */}+ <Input+ id={`group-color-${itemType}`}+ type="color"+ value={localColors[itemType as ItemType]}+ onChange={(e) => handleColorChange(itemType as ItemType, e.target.value)}+ className="p-0 overflow-hidden w-8 h-8 rounded-md border"+ />+ </div>+ </div>+ ),+ )}+ </div>+ </div>+ </div>+ </ScrollArea>+ </TabsContent>+ </Tabs>++ <DialogFooter className="flex justify-between">+ <Button variant="outline" onClick={handleReset}>+ Réinitialiser+ </Button>+ <div className="flex gap-2">+ <Button variant="outline" onClick={handleCancel}>+ Annuler+ </Button>+ <Button onClick={handleSave}>Enregistrer</Button>+ </div>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ )+}diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/toolbar.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/toolbar.tsxindex 524ac61e..a357d2db 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/toolbar.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/toolbar.tsx@@ -6,10 +6,13 @@ import MoreMenu from "@/components/sketches/more-menu"import { ScanButton } from "@/components/sketches/scans-drawer/scan-button"import { Button } from "@/components/ui/button"import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"-import { useFlowStore } from "@/store/flow-store"+import { cn } from "@/lib/utils"+import { useSketchStore } from "@/store/sketch-store"+import { useModalStore } from "@/store/store-settings"import type { Profile } from "@/types"import type { Sketch } from "@/types/sketch"-import { useEdges, useNodes, useReactFlow } from "@xyflow/react"+import { GearIcon } from "@radix-ui/react-icons"+import { useQuery } from "@tanstack/react-query"import {ArrowDownUp,Copy,@@ -19,18 +22,15 @@ import {Maximize,Minus,Redo,- Save,- Settings,- Share2,+ RotateCwIcon,Trash,Undo,ZoomIn,} from "lucide-react"-import { memo, useCallback, useEffect, useMemo, useState } from "react"+import { notFound } from "next/navigation"+import { memo, useMemo } from "react"import { shallow } from "zustand/shallow"-import { toast } from "sonner"-import { saveSchemaToNeo4j } from "@/lib/actions/sketches"-import { useKeyboardShortcut } from "@/hooks/use-keyboard-shortcut"+// Tooltip wrapper component to avoid repetitionconst ToolbarButton = memo(function ToolbarButton({@@ -74,27 +74,29 @@ export const Toolbar = memo(function Toolbar({investigation_id: string;sketch_id: string;sketch: Sketch;- user_id: string+ user_id: string;}) {- const reactFlowInstance = useReactFlow()- const [isSaving, setIsSaving] = useState(false)- const [lastSaved, setLastSaved] = useState<string | null>(null)- // Optimize store selector with specific selection-- const { isMac } = useKeyboardShortcut({- key: "s",- ctrlOrCmd: true,- callback: () => {- saveSchema()- },- })- const { currentNode } = useFlowStore(+ const { currentNode } = useSketchStore(state => ({currentNode: state.currentNode,}),shallow)+ const { toggleSettings } = useModalStore()++ const { refetch, isRefetching } = useQuery({+ queryKey: ["investigations", investigation_id, 'sketches', sketch_id, "data"],+ queryFn: async () => {+ const res = await fetch(`/api/investigations/${investigation_id}/sketches/${sketch_id}/sketch`)+ if (!res.ok) {+ notFound()+ }+ return res.json()+ },+ refetchOnWindowFocus: true,+ })+// Memoize sketch members to prevent unnecessary rerendersconst sketchMembers = useMemo(() =>@@ -105,105 +107,49 @@ export const Toolbar = memo(function Toolbar({[sketch?.members, sketch?.owner_id])- const saveSchema = useCallback(async () => {- if (isSaving) return-- const saveOperation = async () => {- setIsSaving(true)- try {- const nodes = reactFlowInstance.getNodes()- const edges = reactFlowInstance.getEdges()- const result = await saveSchemaToNeo4j({ nodes, edges, sketch_id })-- if (!result.success) {- throw new Error(result.error || "Failed to save schema")- }-- setLastSaved(result.timestamp as string)- return result- } finally {- setIsSaving(false)- }- }-- return toast.promise(saveOperation(), {- loading: 'Saving schema...',- success: 'Schema saved successfully',- error: (err) => `${err.message || 'Unexpected error during schema save'}`- })- }, [isSaving, reactFlowInstance, sketch_id])---- // Handle zoom in- const handleZoomIn = useCallback(() => {- reactFlowInstance.zoomIn()- }, [reactFlowInstance])-- // Handle zoom out- const handleZoomOut = useCallback(() => {- reactFlowInstance.zoomOut()- }, [reactFlowInstance])-- // Handle fit view- const handleFitView = useCallback(() => {- reactFlowInstance.fitView({ padding: 0.2 })- }, [reactFlowInstance])-return (<div className="flex items-center justify-between h-10 border-b px-2 bg-card"><div className="flex items-center space-x-1"><TooltipProvider>- <ToolbarButton icon={<Undo className="h-4 w-4" />} tooltip="Undo" />- <ToolbarButton icon={<Redo className="h-4 w-4" />} tooltip="Redo" />-+ <ToolbarButton icon={<Undo className="h-4 w-4 opacity-70" />} tooltip="Undo" />+ <ToolbarButton icon={<Redo className="h-4 w-4 opacity-70" />} tooltip="Redo" /><Separator />-<ToolbarButton- icon={<Copy className="h-4 w-4" />}+ icon={<Copy className="h-4 w-4 opacity-70" />}tooltip="Copy"disabled={!currentNode}/><ToolbarButton- icon={<Trash className="h-4 w-4" />}+ icon={<Trash className="h-4 w-4 opacity-70" />}tooltip="Delete"disabled={!currentNode}/><Separator />- <ToolbarButton icon={<ArrowDownUp className="h-4 w-4" />} tooltip="Arrange" />- <ToolbarButton icon={<Filter className="h-4 w-4" />} tooltip="Filter" />+ <ToolbarButton icon={<ArrowDownUp className="h-4 w-4 opacity-70" />} tooltip="Arrange" />+ <ToolbarButton icon={<Filter className="h-4 w-4 opacity-70" />} tooltip="Filter" /><Separator /><ToolbarButton- icon={<ZoomIn className="h-4 w-4" />}+ icon={<ZoomIn className="h-4 w-4 opacity-70" />}tooltip="Zoom In"- onClick={handleZoomIn}+ onClick={() => { }}/><ToolbarButton- icon={<Minus className="h-4 w-4" />}+ icon={<Minus className="h-4 w-4 opacity-70" />}tooltip="Zoom Out"- onClick={handleZoomOut}+ onClick={() => { }}/><ToolbarButton- icon={<Maximize className="h-4 w-4" />}+ icon={<Maximize className="h-4 w-4 opacity-70" />}tooltip="Fit to View"- onClick={handleFitView}+ onClick={() => { }}/><Separator />- <ToolbarButton icon={<LayoutGrid className="h-4 w-4" />} tooltip="Layout" />- <ToolbarButton icon={<Layers className="h-4 w-4" />} tooltip="Layers" />-- <div className="ml-auto flex items-center gap-2">- <ToolbarButton- icon={<Save className={`h-4 w-4 ${isSaving ? 'animate-pulse' : ''}`} />}- tooltip={isSaving ? "Saving..." : <kbd className="px-2 py-1 rounded border">{isMac ? "⌘" : "Ctrl"}+S</kbd>}- disabled={isSaving}- onClick={saveSchema}- />- <ToolbarButton icon={<Share2 className="h-4 w-4" />} tooltip="Share" />- <ToolbarButton icon={<Settings className="h-4 w-4" />} tooltip="Settings" />- </div>+ <ToolbarButton icon={<LayoutGrid className="h-4 w-4 opacity-70" />} tooltip="Layout" />+ <ToolbarButton icon={<Layers className="h-4 w-4 opacity-70" />} tooltip="Layers" />+ <ToolbarButton onClick={toggleSettings} icon={<GearIcon className="h-4 w-4 opacity-70" />} tooltip="Settings" />+ <ToolbarButton onClick={refetch} disabled={isRefetching} icon={<RotateCwIcon className={cn("h-4 w-4 opacity-70", isRefetching && "animate-spin")} />} tooltip="Reload" /></TooltipProvider></div><div className="flex items-center">diff --git a/flowsint-web/src/app/dashboard/transforms/page.tsx b/flowsint-web/src/app/dashboard/transforms/page.tsxindex 7d472248..304ad801 100644--- a/flowsint-web/src/app/dashboard/transforms/page.tsx+++ b/flowsint-web/src/app/dashboard/transforms/page.tsx@@ -2,8 +2,12 @@ import { Badge } from "@/components/ui/badge"import { Button } from "@/components/ui/button"import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"import { createClient } from "@/lib/supabase/server"+import { hexToRgba } from "@/lib/utils"+import { useColorSettings } from "@/store/color-settings"import { PlusCircle, FileCode2, ArrowRight, Calendar } from "lucide-react"import Link from "next/link"+import { useMemo } from "react"+import { TransformItem } from "./transform-item"const TransformsPage = async () => {const supabase = await createClient()@@ -61,53 +65,6 @@ const EmptyState = () => {)}-const TransformItem = ({ transform }: { transform: any }) => {- // Format date if available (assuming created_at exists, adjust as needed)- const formattedDate = transform.created_at- ? new Date(transform.created_at).toLocaleDateString("en-US", {- month: "short",- day: "numeric",- year: "numeric",- })- : null- const stepsCount = transform?.transform_schema?.edges?.length || 0-- return (- <Link href={`/dashboard/transforms/${transform.id}`} className="block h-full transition-all">- <Card className="h-full border hover:border-primary/50 hover:shadow-md transition-all">- <CardHeader className="pb-2 relative">- <CardTitle className="text-lg w-full flex items-start justify-between font-medium">- <p className=" line-clamp-2">{transform.name}</p>- <Badge>{transform.category}</Badge>- </CardTitle>- <CardDescription className="line-clamp-2">- {transform.description || "No description provided"}- </CardDescription>- </CardHeader>- <CardContent className="pb-2">- <div className="flex items-center text-sm text-muted-foreground">- <FileCode2 className="h-4 w-4 mr-1" />- <span>- {stepsCount} {stepsCount === 1 ? "step" : "steps"}- </span>- </div>- </CardContent>- <CardFooter className="flex justify-between pt-0">- {formattedDate && (- <div className="flex items-center text-xs text-muted-foreground">- <Calendar className="h-3 w-3 mr-1" />- {formattedDate}- </div>- )}- <div className="text-primary text-sm font-medium flex items-center">- View details- <ArrowRight className="ml-1 h-3 w-3" />- </div>- </CardFooter>- </Card>- </Link>- )-}export default TransformsPagediff --git a/flowsint-web/src/app/dashboard/transforms/transform-item.tsx b/flowsint-web/src/app/dashboard/transforms/transform-item.tsxnew file mode 100644index 00000000..89f83bb7--- /dev/null+++ b/flowsint-web/src/app/dashboard/transforms/transform-item.tsx@@ -0,0 +1,58 @@+"use client"+import { Badge } from "@/components/ui/badge"+import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@/components/ui/card"+import { hexToRgba } from "@/lib/utils"+import { useColorSettings } from "@/store/color-settings"+import { FileCode2, Calendar, ArrowRight } from "lucide-react"+import Link from "next/link"+import { memo, useMemo } from "react"++export const TransformItem = memo(({ transform }: { transform: any }) => {+ const formattedDate = transform.created_at+ ? new Date(transform.created_at).toLocaleDateString("en-US", {+ month: "short",+ day: "numeric",+ year: "numeric",+ })+ : null++ const stepsCount = transform?.transform_schema?.edges?.length || 0+ const color = useColorSettings((state) => state.colors[transform.category as keyof typeof state.colors] || "#000000")+ const bgColor = useMemo(() => hexToRgba(color, 0.3), [color])++ return (+ <Link href={`/dashboard/transforms/${transform.id}`} className="block h-full transition-all">+ <Card className="h-full border hover:border-primary/50 hover:shadow-md transition-all">+ <CardHeader className="pb-2 relative">+ <CardTitle className="text-lg w-full flex items-start justify-between font-medium">+ <p className=" line-clamp-2">{transform.name}</p>+ <Badge style={{ backgroundColor: bgColor }}>{transform.category}</Badge>+ </CardTitle>+ <CardDescription className="line-clamp-2">+ {transform.description || "No description provided"}+ </CardDescription>+ </CardHeader>+ <CardContent className="pb-2">+ <div className="flex items-center text-sm text-muted-foreground">+ <FileCode2 className="h-4 w-4 mr-1" />+ <span>+ {stepsCount} {stepsCount === 1 ? "step" : "steps"}+ </span>+ </div>+ </CardContent>+ <CardFooter className="flex justify-between pt-0">+ {formattedDate && (+ <div className="flex items-center text-xs text-muted-foreground">+ <Calendar className="h-3 w-3 mr-1" />+ {formattedDate}+ </div>+ )}+ <div className="text-primary text-sm font-medium flex items-center">+ View details+ <ArrowRight className="ml-1 h-3 w-3" />+ </div>+ </CardFooter>+ </Card>+ </Link>+ )+})\ No newline at end of filediff --git a/flowsint-web/src/components/contexts/sketch-provider.tsx b/flowsint-web/src/components/contexts/sketch-provider.tsxdeleted file mode 100644index da51c3de..00000000--- a/flowsint-web/src/components/contexts/sketch-provider.tsx+++ /dev/null@@ -1,153 +0,0 @@-"use client"-import type React from "react"-import { type ReactNode, useEffect } from "react"-import { useSketchStore } from "@/store/sketch-store"-import { useParams, useRouter, usePathname, useSearchParams } from "next/navigation"-import { useConfirm } from "@/components/use-confirm-dialog"-import { supabase } from "@/lib/supabase/client"-import { Dialog, DialogContent, DialogDescription, DialogClose, DialogTitle } from "@/components/ui/dialog"-import { Button } from "@/components/ui/button"-import { Switch } from "@/components/ui/switch"-import { cn } from "@/lib/utils"-import { toast } from "sonner"--interface SketchProviderProps {- children: ReactNode-}--export const SketchProvider: React.FC<SketchProviderProps> = ({ children }) => {- const { sketch_id, investigation_id } = useParams()- const router = useRouter()- const pathname = usePathname()- const searchParams = useSearchParams()- const { confirm } = useConfirm()- const {- settings,- setSettings,- openSettingsModal,- setOpenSettingsModal,- setHandleOpenIndividualModal,- setHandleDeleteSketch,- } = useSketchStore()-- useEffect(() => {- const handleDeleteSketch = async () => {- const confirmDelete = await confirm({- title: "Delete sketch",- message: "Are you really sure you want to delete this sketch ?",- })- if (!confirmDelete) return- const confirmFinal = await confirm({- title: "Just making sure",- message: "You will definitely delete all nodes, edges and relationships.",- })- if (!confirmFinal) return- try {- const { data, error } = await supabase- .from("sketches")- .delete()- .eq("id", sketch_id)- .select("id")- if (!data || !data.length)- return toast.error("The sketch could not be deleted. Are you sure you are the owner ?")- if (error)- return toast.error("An error occured. Try again later.")- router.push(`/dashboard/investigations/${investigation_id}`)- toast.success("The sketch was successfully deleted.")- } catch (error) {- toast.error("An error occured.")- }- }- // @ts-ignore- setHandleDeleteSketch(handleDeleteSketch)- }, [- sketch_id,- router,- pathname,- searchParams,- confirm,- setHandleOpenIndividualModal,- setHandleDeleteSketch,- ])-- const SettingSwitch = ({- setting,- value,- title,- description,- disabled = false,- }: {- setting: keyof typeof settings- value: boolean- title: string- description: string- disabled?: boolean- }) => (- <div className={cn("flex items-center justify-between gap-4", disabled && "opacity-60")}>- <div className="flex flex-col gap-1">- <p className="font-medium">{title}</p>- <p className="opacity-70 text-sm">{description}</p>- </div>- <Switch- disabled={disabled}- checked={value}- onCheckedChange={(val: boolean) =>- setSettings({ ...settings, [setting]: val })- }- />- </div>- )-- return (- <>- {children}- <Dialog open={openSettingsModal} onOpenChange={setOpenSettingsModal}>- <DialogContent>- <DialogTitle>Settings</DialogTitle>- <DialogDescription>Make changes to your settings.</DialogDescription>- <div className="flex flex-col gap-3">- <SettingSwitch- setting="showNodeLabel"- value={settings.showNodeLabel}- title="Show labels on nodes"- description="Displays the labels on the nodes, like username or avatar."- />- <SettingSwitch- setting="showEdgeLabel"- value={settings.showEdgeLabel}- title="Show labels on edges"- description="Displays the labels on the edges, like relation type."- />- <SettingSwitch- setting="showMiniMap"- value={settings.showMiniMap}- title="Show minimap on the canva"- description="Displays the minimap on canva."- />- <SettingSwitch- setting="showCopyIcon"- value={settings.showCopyIcon}- title="Show copy button on nodes"- description="Displays a copy button on the nodes."- />- <SettingSwitch- setting="showNodeToolbar"- value={settings.showNodeToolbar}- title="Show toolbar on nodes"- description="Displays a toolbar with actions on the nodes."- />- </div>- <div className="flex items-center gap-2 justify-end">- <DialogClose asChild>- <Button type="button" variant="outline">- Cancel- </Button>- </DialogClose>- </div>- </DialogContent>- </Dialog>- </>- )-}--export const useSketchContext = useSketchStore\ No newline at end of filediff --git a/flowsint-web/src/components/dashboard/new-sketch.tsx b/flowsint-web/src/components/dashboard/new-sketch.tsxindex 8307bc2a..407780e5 100644--- a/flowsint-web/src/components/dashboard/new-sketch.tsx+++ b/flowsint-web/src/components/dashboard/new-sketch.tsx@@ -19,7 +19,7 @@ import { Input } from "@/components/ui/input"import { Label } from "@/components/ui/label"import { useFormStatus } from "react-dom"import { toast } from "sonner"-import { useInvestigationStore } from "@/store/project-store"+import { useInvestigationStore } from "@/store/investigation-store"function SubmitButton() {const { pending } = useFormStatus()diff --git a/flowsint-web/src/components/icon-container.tsx b/flowsint-web/src/components/icon-container.tsxnew file mode 100644index 00000000..1e657c98--- /dev/null+++ b/flowsint-web/src/components/icon-container.tsx@@ -0,0 +1,38 @@+import { useColorSettings } from "@/store/color-settings"+import type { LucideIcon } from "lucide-react"+import { useMemo } from "react"++// Helper function to convert hex to rgba+const hexToRgba = (hex: string, alpha: number) => {+ const r = Number.parseInt(hex.slice(1, 3), 16)+ const g = Number.parseInt(hex.slice(3, 5), 16)+ const b = Number.parseInt(hex.slice(5, 7), 16)+ return `rgba(${r}, ${g}, ${b}, ${alpha})`+}++interface IconContainerProps {+ type: string+ icon: LucideIcon+ size?: number+}++export function IconContainer({ type, icon: Icon, size = 12 }: IconContainerProps) {+ const containerSize = size + 16 // Make container slightly larger than icon+ const color = useColorSettings((state) => state.colors[type as keyof typeof state.colors] || "#000000")+ const bgColor = useMemo(() => hexToRgba(color, 0.3), [color])++ return (+ <div>+ <div+ style={{+ border: `${size/4}px solid ${bgColor}`,+ width: `${containerSize}px`,+ height: `${containerSize}px`,+ }}+ className="flex bg-card items-center justify-center rounded-full"+ >+ <Icon size={size} className="text-foreground" />+ </div>+ </div>+ )+}\ No newline at end of filediff --git a/flowsint-web/src/components/investigations/file-upload.tsx b/flowsint-web/src/components/investigations/file-upload.tsxindex 5daafa74..b0166f30 100644--- a/flowsint-web/src/components/investigations/file-upload.tsx+++ b/flowsint-web/src/components/investigations/file-upload.tsx@@ -18,7 +18,7 @@ import {DialogTitle,} from "@/components/ui/dialog"import { Progress } from "@/components/ui/progress"-import { useInvestigationStore } from "@/store/project-store"+import { useInvestigationStore } from "@/store/investigation-store"import { toast } from "sonner"import { useParams, useRouter } from "next/navigation"diff --git a/flowsint-web/src/components/organigrams/graph.tsx b/flowsint-web/src/components/organigrams/graph.tsxdeleted file mode 100644index 8806ca8d..00000000--- a/flowsint-web/src/components/organigrams/graph.tsx+++ /dev/null@@ -1,404 +0,0 @@-"use client"-import { useCallback, useEffect, useState, useMemo } from "react"-import type React from "react"-import {- ReactFlow,- ReactFlowProvider,- Panel,- useReactFlow,- // @ts-ignore- Background,- // @ts-ignore- MiniMap,-} from "@xyflow/react"-import "@xyflow/react/dist/style.css"-import {- MaximizeIcon,- ZoomInIcon,- ZoomOutIcon,- RotateCwIcon,- PlusIcon,- GroupIcon,- WorkflowIcon,- NetworkIcon,- WaypointsIcon,-} from "lucide-react"-import { useTheme } from "next-themes"-import NewActions from "../sketches/new-actions"-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 { useSketchStore } from "@/store/sketch-store"-import { useFlowStore } from "@/store/flow-store"-import Loader from "@/components/loader"-import { useQueryState } from "nuqs"-import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "@/components/ui/context-menu"-import { memo } from "react"-import { shallow } from "zustand/shallow"-import { TooltipProvider } from "@/components/ui/tooltip"-import {- ResizableHandle,- ResizablePanel,- ResizablePanelGroup,-} from "@/components/ui/resizable"-import { Dialog, DialogTrigger } from "@/components/ui/dialog"-import FullscreenButton from "@/components/full-screen-button"-import ProfilePanel from "../sketches/sketch/profile-panel"-import NodesPanel from "../sketches/sketch/nodes-panel"-import OrganigramNode from "./organigram-node"-import OrganigramEdge from './organigram-edge'-const nodeTypes = {- custom: OrganigramNode,-}--const edgeTypes = {- custom: OrganigramEdge,-}-// Better selectors with more specific equality comparisons-const nodeEdgeSelector = (state: { nodes: any; edges: any }) => ({- nodes: state.nodes,- edges: state.edges,-})--const actionsSelector = (state: { onNodesChange: any; onEdgesChange: any; onConnect: any; onNodeClick: any; onPaneClick: any; onLayout: any }) => ({- onNodesChange: state.onNodesChange,- onEdgesChange: state.onEdgesChange,- onConnect: state.onConnect,- onNodeClick: state.onNodeClick,- onPaneClick: state.onPaneClick,- onLayout: state.onLayout,-})--const stateSelector = (state: { currentNode: any; setCurrentNode: any; resetNodeStyles: any; reloading: any; updateNode: any; highlightPath: any }) => ({- currentNode: state.currentNode,- setCurrentNode: state.setCurrentNode,- resetNodeStyles: state.resetNodeStyles,- reloading: state.reloading,- updateNode: state.updateNode,- highlightPath: state.highlightPath-})--// Properly memoized FlowControls component-const FlowControls = memo(({- onLayout,- fitView,- handleRefetch,- reloading,- setView,- zoomIn,- zoomOut,- addNodes-}: any) => {- return (- <>- <Panel position="top-right" className="flex flex-col items-center gap-1">- <FullscreenButton />- </Panel>- <Panel position="top-left" className="flex flex-col items-center gap-1">- <NewActions addNodes={addNodes}>- <Button className="bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none" 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 position="bottom-left" className="flex flex-col items-center gap-1">- <Tooltip>- <TooltipTrigger asChild>- <Button- size="icon"- variant="outline"- onClick={() => onLayout("dagre", fitView)}- >- <NetworkIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Dagre layout</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button- size="icon"- variant="outline"- onClick={() => onLayout("force", fitView)}- >- <WaypointsIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Force layout</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button disabled size="icon" variant="outline" onClick={() => setView("large-graph")}>- <WorkflowIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>View 2D Graph</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button size="icon" variant="outline" onClick={() => fitView()}>- <MaximizeIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Center view</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button size="icon" variant="outline" onClick={() => zoomIn()}>- <ZoomInIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Zoom in</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button size="icon" variant="outline" onClick={() => zoomOut()}>- <ZoomOutIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Zoom out</TooltipContent>- </Tooltip>- </Panel>- </>- )-});--const LayoutFlow = memo(({ refetch, theme }: any) => {- const { fitView, zoomIn, zoomOut, addNodes, getNode, setCenter, getNodes } = useReactFlow();- const { sketch_id } = useParams();- const showMiniMap = useSketchStore(state => state.settings.showMiniMap);- const [_, setView] = useQueryState("view", { defaultValue: "flow-graph" });-- // Use a ref for context menu state to avoid re-renders on position changes- const [nodeContextMenu, setNodeContextMenu] = useState<{- x: number;- y: number;- nodeId: string;- data: any;- nodeType: string;- } | null>(null);-- // Use shallow comparison for complex objects from the store- const { nodes, edges } = useFlowStore(nodeEdgeSelector, shallow);- const {- onNodesChange,- onEdgesChange,- onConnect,- onNodeClick,- onPaneClick,- onLayout- } = useFlowStore(actionsSelector, shallow);-- const {- currentNode,- setCurrentNode,- reloading,- updateNode,- highlightPath- } = useFlowStore(stateSelector, shallow);-- // Initialize layout once- useEffect(() => {- const timer = setTimeout(() => {- onLayout("dagre", fitView);- fitView();- }, 500);- return () => clearTimeout(timer);- }, []); // Empty dependency array - run once only-- const handleRefetch = useCallback(() => {- refetch();- onLayout("dagre", fitView);- fitView();- }, [refetch, onLayout, fitView]);-- // Handle current node changes- useEffect(() => {- if (!currentNode) return;- const internalNode = getNode(currentNode.id);- if (!internalNode) return;- updateNode(internalNode.id, {- ...internalNode,- zIndex: 5000,- data: { ...internalNode.data, forceToolbarVisible: true },- style: { ...internalNode.style, opacity: 1 },- });- const nodeWidth = internalNode.measured?.width ?? 0;- const nodeHeight = internalNode.measured?.height ?? 0;- setCenter(- internalNode.position.x + nodeWidth / 2,- internalNode.position.y + nodeHeight / 2 + 20,- {- duration: 500,- zoom: 1.5,- }- );- }, [currentNode?.id]); // Only depend on currentNode.id, not the whole object-- const handleConnect = useCallback(- (params: any) => onConnect(params, sketch_id),- [onConnect, sketch_id]- );-- const handleNodeContextMenu = useCallback(- (event: { preventDefault: () => void; stopPropagation: () => void; screenX: number; screenY: number }, node: { id: any; data: any; type?: any }) => {- 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]- );-- const closeNodeContextMenu = useCallback(() => {- setNodeContextMenu(null);- }, []);-- const handlePaneClick = useCallback(- (event: any) => {- closeNodeContextMenu();- onPaneClick(event);- },- [onPaneClick, closeNodeContextMenu]- );-- // Memoize ReactFlow props to prevent unnecessary re-renders- const reactFlowProps = useMemo(() => ({- colorMode: theme,- nodes,- edges,- onNodesChange,- onEdgesChange,- onConnect: handleConnect,- onNodeClick,- onPaneClick: handlePaneClick,- onNodeContextMenu: handleNodeContextMenu,- minZoom: 0.5,- fitView: true,- nodeTypes,- edgeTypes,- proOptions: { hideAttribution: true },- className: "!bg-background dark:!bg-background"- }), [- theme,- nodes,- edges,- onNodesChange,- onEdgesChange,- handleConnect,- onNodeClick,- handlePaneClick,- handleNodeContextMenu- ]);-- // Process nodes only when nodes array length changes- const processedNodes = useMemo(() =>- nodes.map(({ id, data, type }: { id: string; data: any; type: string }) => ({ id, data, type }))- .sort((a: { type: any }, b: { type: string }) => b.type?.localeCompare(a.type || "")),- [nodes.length]- );-- return (- <ResizablePanelGroup autoSaveId="persistence" direction="horizontal" className="w-screen grow relative overflow-hidden">- <ResizablePanel defaultSize={80}>- <TooltipProvider>- <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}- />- <Background className="dark:bg-background bg-background" />- {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>- </ContextMenuContent>- </ContextMenu>- </TooltipProvider>- </ResizablePanel>- <ResizableHandle withHandle />- <ResizablePanel defaultSize={20} minSize={15} maxSize={40} className="h-full bg-background">- <ResizablePanelGroup autoSaveId="conditional" direction="vertical">- {currentNode && (- <>- <ResizablePanel order={1} id="top" defaultSize={40}>- <ProfilePanel data={currentNode.data} />- </ResizablePanel>- <ResizableHandle withHandle />- </>- )}- <ResizablePanel order={2} id="bottom" defaultSize={60}>- <NodesPanel nodes={processedNodes} />- </ResizablePanel>- </ResizablePanelGroup>- </ResizablePanel>- </ResizablePanelGroup>- );-});--function Graph({ graphQuery }: any) {- const [mounted, setMounted] = useState(false);- const { refetch, isLoading, data } = graphQuery;- const { resolvedTheme } = useTheme();-- // Only run mounting effect once- useEffect(() => {- setMounted(true);- }, []);-- // Update flow store when data changes- useEffect(() => {- if (data) {- useFlowStore.setState({- nodes: data?.nodes || [],- edges: data?.edges || []- });- setMounted(true);- }- }, [data]);-- if (!mounted || isLoading) {- return (- <div className="grow w-full flex items-center justify-center">- <Loader /> Loading...- </div>- );- }-- return (- <ReactFlowProvider>- <LayoutFlow refetch={refetch} theme={resolvedTheme || "light"} />- </ReactFlowProvider>- );-}--export default memo(Graph);\ No newline at end of filediff --git a/flowsint-web/src/components/organigrams/organigram-edge.tsx b/flowsint-web/src/components/organigrams/organigram-edge.tsxdeleted file mode 100644index ccd046ce..00000000--- a/flowsint-web/src/components/organigrams/organigram-edge.tsx+++ /dev/null@@ -1,123 +0,0 @@-// EditableEdge.tsx-"use client"--import type React from "react"-import type { EdgeProps } from "@xyflow/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"-import { Input } from "@/components/ui/input"-import { cn } from "@/lib/utils"-import { ButtonEdge } from "../ui/button-edge"-import { toast } from "sonner"--const EditableEdge = memo((props: EdgeProps) => {- const { id, label, data } = props- const [isEditing, setIsEditing] = useState(false)- const [isLoading, setIsLoading] = useState(false)- const [editValue, setEditValue] = useState((label as string) || "")- const submitButtonRef = useRef<HTMLButtonElement>(null)-- const handleEditClick = useCallback(() => {- setIsEditing(true)- }, [])-- const handleInputBlur = useCallback((e: React.FocusEvent) => {- if (submitButtonRef.current && submitButtonRef.current.contains(e.relatedTarget as Node)) {- return- }- setIsEditing(false)- }, [])-- const handleSave = useCallback(- async (e: React.FormEvent) => {- e.preventDefault()- e.stopPropagation()- if (!id) return- setIsLoading(true)- try {- const { error } = await supabase- .from("individuals_individuals")- .update({ relation_type: editValue })- .eq("id", id.toString())- const { error: error2 } = await supabase- .from("organizations_individuals")- .update({ relation_type: editValue })- .eq("id", id.toString())- const { error: error3 } = await supabase- .from("organizations_organizations")- .update({ relation_type: editValue })- .eq("id", id.toString())- if (error || error2) {- toast.error("An error occurred: " + JSON.stringify(error3))- } else {- toast.success("Relation updated.")- }- } catch (err) {- toast.error("An error occurred.")- } finally {- setIsLoading(false)- setIsEditing(false)- }- },- [id, editValue],- )-- const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {- setEditValue(e.target.value)- }, [])-- const buttonEdgeProps = useMemo(() => {- const { label: _, ...restProps } = props;- return restProps;- }, [props.sourceX, props.sourceY, props.targetX, props.targetY, props.style, props.markerEnd]);-- 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- 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>- );- }- 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 = "OrganigramEdge"--export default EditableEdge\ No newline at end of filediff --git a/flowsint-web/src/components/organigrams/organigram-node.tsx b/flowsint-web/src/components/organigrams/organigram-node.tsxdeleted file mode 100644index 00a676c4..00000000--- a/flowsint-web/src/components/organigrams/organigram-node.tsx+++ /dev/null@@ -1,42 +0,0 @@-import React, { memo, useMemo } from 'react';-import { CopyButton } from '@/components/copy';-import { Badge } from '@/components/ui/badge';-import { Handle, Position } from '@xyflow/react';-import { cn, typeColorMap } from '@/lib/utils';-import { actionItems } from '@/lib/action-items';-import { QuestionMarkIcon } from '@radix-ui/react-icons';-import { useFlowStore } from '@/store/flow-store';-import { BaseNode } from '../ui/base-node';--export default memo(({ data }: any) => {- const item = useMemo(() => (actionItems as any).find((a: any) => a.type === data.type), [data?.type]);- const Icon = item?.icon || QuestionMarkIcon;- const currentNodeId = useFlowStore(state => state.currentNode?.id,- (prev, next) => prev === next);- const active = currentNodeId === data.id;- return (- <BaseNode className={cn('p-.5 rounded-md', typeColorMap[data.type])} selected={active}>- <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>- <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 filediff --git a/flowsint-web/src/components/sketches/more-menu.tsx b/flowsint-web/src/components/sketches/more-menu.tsxindex 067b2cba..adaaecc3 100644--- a/flowsint-web/src/components/sketches/more-menu.tsx+++ b/flowsint-web/src/components/sketches/more-menu.tsx@@ -1,5 +1,5 @@import { Ellipsis } from "lucide-react";-import { useSketchStore } from '@/store/sketch-store';+import { supabase } from "@/lib/supabase/client";import {DropdownMenu,DropdownMenuTrigger,@@ -10,10 +10,40 @@ import { Button } from "@/components/ui/button";import { AddInvestigationModal } from "./add-contributor";import { useState } from "react";import { Sketch } from "@/types/sketch";+import { toast } from "sonner";+import { useConfirm } from "../use-confirm-dialog";+import { useRouter } from "next/navigation";export default function MoreMenu({ sketch, user_id }: { sketch: Sketch, user_id: string }) {- const { setOpenSettingsModal, handleDeleteSketch } = useSketchStore();const [open, setOpen] = useState(false)const isOwner = sketch.owner_id == user_id+ const { confirm } = useConfirm()+ const router = useRouter()++ const handleDeleteSketch = async () => {+ if (!await confirm({ title: `Deleting sketch "${sketch.title}"`, message: "Are you sure you want to delete this sketch ? All nodes from it will be lost." })) return+ return toast.promise(+ async () => {+ const sketch_id = sketch.id+ if (!sketch_id) {+ throw new Error("No sketch ID provided");+ }+ const { error } = await supabase+ .from('sketches')+ .delete()+ .eq('id', sketch_id);+ if (error) {+ throw error;+ }+ router.push(`/dashboard/investigations/${sketch.investigation_id}`)+ return "Sketch successfully deleted";+ },+ {+ loading: 'Deleting sketch...',+ success: (data) => `${data}`,+ error: (err) => `Failed to delete sketch: ${err.message}`+ }+ );+ };return (<><DropdownMenu>@@ -25,8 +55,6 @@ export default function MoreMenu({ sketch, user_id }: { sketch: Sketch, user_id:<DropdownMenuContent align="end">{isOwner &&<DropdownMenuItem onClick={() => setOpen(true)}>Add contributor</DropdownMenuItem>}- {/* @ts-ignore */}- <DropdownMenuItem onClick={setOpenSettingsModal}>Settings</DropdownMenuItem>{isOwner &&<DropdownMenuItem onClick={handleDeleteSketch} className="text-red-500">Deletediff --git a/flowsint-web/src/components/sketches/new-actions.tsx b/flowsint-web/src/components/sketches/new-actions.tsxindex de376e3f..c73425b7 100644--- a/flowsint-web/src/components/sketches/new-actions.tsx+++ b/flowsint-web/src/components/sketches/new-actions.tsx@@ -14,6 +14,8 @@ import { Card, CardContent } from "@/components/ui/card"import { AnimatePresence, motion } from "framer-motion"import { DynamicForm } from "@/components/sketches/dynamic-form"import { Badge } from "@/components/ui/badge"+import { saveNode } from "@/lib/actions/sketches"+import { useColorSettings } from "@/store/color-settings"interface ActionDialogProps {children: React.ReactNode@@ -23,9 +25,10 @@ interface ActionDialogProps {export default function ActionDialog({ children, addNodes, setCurrentNode }: ActionDialogProps) {const { sketch_id } = useParams()+ const { colors } = useColorSettings()const [openDialog, setOpenDialog] = useState(false)const [openAddNodeModal, setOpenNodeModal] = useState(false)- const [currentNodeType, setCurrentNodeType] = useState<any | null>(null)+ const [currentNodeType, setCurrentNodeType] = useState<ActionItem | null>(null)const [currentParent, setCurrentParent] = useState<ActionItem | null>(null)const [navigationHistory, setNavigationHistory] = useState<ActionItem[]>([])@@ -45,7 +48,7 @@ export default function ActionDialog({ children, addNodes, setCurrentNode }: ActsetOpenNodeModal(true)}- const handleAddNode = (data: any) => {+ const handleAddNode = async (data: any) => {try {if (!currentNodeType || !sketch_id) {toast.error("Invalid node type or sketch ID.")@@ -54,21 +57,26 @@ export default function ActionDialog({ children, addNodes, setCurrentNode }: Actconst id = crypto.randomUUID()const label = data[currentNodeType.fields[0].name]const type = currentNodeType.type+ const color = colors[type as keyof typeof colors]const newNode = {id,- type: "custom",+ type: type,+ caption: label,+ color,data: {...flattenObj(data),+ color,label,type,id},- position: { x: 100, y: 100 },}- if (addNodes) addNodes(newNode)+ const resp = await saveNode({ node: newNode, sketch_id })+ if (addNodes) addNodes(resp.data?.node as any)if (setCurrentNode) setCurrentNode(newNode)setOpenNodeModal(false)} catch (error) {+ toast.error(JSON.stringify(error))toast.error("Unexpected error during node creation.")} finally {setOpenDialog(false)diff --git a/flowsint-web/src/components/sketches/scans-drawer/scan-button.tsx b/flowsint-web/src/components/sketches/scans-drawer/scan-button.tsxindex 9952f4e5..2304ce5b 100644--- a/flowsint-web/src/components/sketches/scans-drawer/scan-button.tsx+++ b/flowsint-web/src/components/sketches/scans-drawer/scan-button.tsx@@ -20,7 +20,8 @@ import {import { ScanTable } from "./scan-table"import { toast } from "sonner"import { supabase } from "@/lib/supabase/client"-import { useParams } from "next/navigation"+import { notFound, useParams } from "next/navigation"+import { useQuery } from "@tanstack/react-query"export type Scan = {id: stringvalue: string@@ -34,7 +35,19 @@ export function ScanButton() {const [pendingCount, setPendingCount] = useState(0)const [scanId, setScanId] = useQueryState("scan_id")const [open, setOpen] = useState(false)- const { sketch_id } = useParams()+ const { investigation_id, sketch_id } = useParams()++ const { refetch } = useQuery({+ queryKey: ["investigations", investigation_id, 'sketches', sketch_id, "data"],+ queryFn: async () => {+ const res = await fetch(`/api/investigations/${investigation_id}/sketches/${sketch_id}/sketch`)+ if (!res.ok) {+ notFound()+ }+ return res.json()+ },+ refetchOnWindowFocus: true,+ })useEffect(() => {// Initial fetch of scans@@ -70,13 +83,8 @@ export function ScanButton() {setScans((current) => {const newScans = current.map((scan) => (scan.id === payload.new.id ? (payload.new as Scan) : scan))updatePendingCount(newScans)- toast(<div>- <p className="text-primary font-medium">{payload.new.value}</p>- <div className="flex items-center gap-1">- <p> Scan complete on this item.</p> <Button variant="outline" onClick={() => setScanId(payload.new.id)}>Click to see results</Button>- </div></div>, {- duration: 6000,- })+ toast.success('Scan complete on this item ! Refreshing now.')+ refetch()return newScans})} else if (payload.eventType === "DELETE") {diff --git a/flowsint-web/src/components/sketches/sketch-selector.tsx b/flowsint-web/src/components/sketches/sketch-selector.tsxindex 9a977e73..2f766b7f 100644--- a/flowsint-web/src/components/sketches/sketch-selector.tsx+++ b/flowsint-web/src/components/sketches/sketch-selector.tsx@@ -1,6 +1,5 @@"use client"-import { useSketches } from "@/lib/hooks/sketches";-import { useSketchStore } from '@/store/sketch-store';+import { useSketch, useSketches } from "@/lib/hooks/sketches";import { useParams, useRouter } from "next/navigation";import {Select,@@ -16,11 +15,8 @@ import { Badge } from "../ui/badge";export default function CaseSelector() {const router = useRouter()const { sketch_id, investigation_id } = useParams()- const useSketchData = useSketchStore(- (state) => state.useSketchData- );const { sketches, isLoading } = useSketches(investigation_id as string)- const { sketch } = useSketchData(investigation_id as string, sketch_id as string);+ const sketch = useSketch(sketch_id as string);const handleSelectionChange = (value: string) => {value === "overview" ? router.push(`/dashboard/investigations/${investigation_id}`) :diff --git a/flowsint-web/src/components/sketches/sketch/graph.tsx b/flowsint-web/src/components/sketches/sketch/graph.tsxdeleted file mode 100644index 142a650c..00000000--- a/flowsint-web/src/components/sketches/sketch/graph.tsx+++ /dev/null@@ -1,350 +0,0 @@-"use client"-import { useCallback, useEffect, useState, useMemo } from "react"-import type React from "react"-import {- ReactFlow,- Panel,- useReactFlow,- // @ts-ignore- Background,- // @ts-ignore-} from "@xyflow/react"-import "@xyflow/react/dist/style.css"-import {- MaximizeIcon,- ZoomInIcon,- ZoomOutIcon,- RotateCwIcon,- PlusIcon,- GroupIcon,- WorkflowIcon,- NetworkIcon,- WaypointsIcon,-} from "lucide-react"-import { useTheme } from "next-themes"-import NewActions from "../new-actions"-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 { useSketchStore } from "@/store/sketch-store"-import { useFlowStore } from "@/store/flow-store"-import Loader from "@/components/loader"-import { useQueryState } from "nuqs"-import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "@/components/ui/context-menu"-import { memo } from "react"-import { shallow } from "zustand/shallow"-import { TooltipProvider } from "@/components/ui/tooltip"-import NodeContextMenu from "./nodes/node-context-menu"-import CustomNode from "./nodes/custom-node"-import FullscreenButton from "@/components/full-screen-button"-import FloatingEdge from "./simple-floating-edge"--const edgeTypes = {- custom: FloatingEdge,-}-const nodeTypes = {- custom: CustomNode,-}--const nodeEdgeSelector = (state: { nodes: any; edges: any }) => ({- nodes: state.nodes,- edges: state.edges,-})--const actionsSelector = (state: { onNodesChange: any; onEdgesChange: any; onConnect: any; onNodeClick: any; onPaneClick: any; onLayout: any }) => ({- onNodesChange: state.onNodesChange,- onEdgesChange: state.onEdgesChange,- onConnect: state.onConnect,- onNodeClick: state.onNodeClick,- onPaneClick: state.onPaneClick,- onLayout: state.onLayout,-})--const stateSelector = (state: { currentNode: any; setCurrentNode: any; resetNodeStyles: any; reloading: any; updateNode: any; highlightPath: any }) => ({- currentNode: state.currentNode,- setCurrentNode: state.setCurrentNode,- resetNodeStyles: state.resetNodeStyles,- reloading: state.reloading,- updateNode: state.updateNode,- highlightPath: state.highlightPath-})--// Properly memoized FlowControls component-export const FlowControls = memo(({- onLayout,- fitView,- handleRefetch,- reloading,- setView,- zoomIn,- zoomOut,- addNodes-}: any) => {- return (- <>- <Panel position="top-right" className="flex flex-col items-center gap-1">- <FullscreenButton />- </Panel>- <Panel position="top-left" className="flex flex-col items-center gap-1">- <NewActions addNodes={addNodes}>- <Button className="bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none" 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 position="bottom-left" className="flex flex-col items-center gap-1">- <Tooltip>- <TooltipTrigger asChild>- <Button- size="icon"- variant="outline"- onClick={() => onLayout("dagre", fitView)}- >- <NetworkIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Dagre layout</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button- size="icon"- variant="outline"- onClick={() => onLayout("force", fitView)}- >- <WaypointsIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Force layout</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button disabled size="icon" variant="outline" onClick={() => setView("large-graph")}>- <WorkflowIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>View 2D Graph</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button size="icon" variant="outline" onClick={() => fitView()}>- <MaximizeIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Center view</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button size="icon" variant="outline" onClick={() => zoomIn()}>- <ZoomInIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Zoom in</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button size="icon" variant="outline" onClick={() => zoomOut()}>- <ZoomOutIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Zoom out</TooltipContent>- </Tooltip>- </Panel>- </>- )-});--const LayoutFlow = memo(({ refetch, theme }: any) => {- const { fitView, zoomIn, zoomOut, addNodes, getNode, setCenter } = useReactFlow();- const { sketch_id } = useParams();- const [_, setView] = useQueryState("view", { defaultValue: "flow-graph" });-- // Use a ref for context menu state to avoid re-renders on position changes- const [nodeContextMenu, setNodeContextMenu] = useState<{- x: number;- y: number;- nodeId: string;- data: any;- nodeType: string;- } | null>(null);-- // Use shallow comparison for complex objects from the store- const { nodes, edges } = useFlowStore(nodeEdgeSelector, shallow);- const {- onNodesChange,- onEdgesChange,- onConnect,- onNodeClick,- onPaneClick,- onLayout- } = useFlowStore(actionsSelector, shallow);-- const {- currentNode,- setCurrentNode,- reloading,- } = useFlowStore(stateSelector, shallow);-- // Initialize layout once- useEffect(() => {- const timer = setTimeout(() => {- onLayout("force", fitView);- fitView();- }, 500);- return () => clearTimeout(timer);- }, []); // Empty dependency array - run once only-- const handleRefetch = useCallback(() => {- refetch();- onLayout("force", fitView);- fitView();- }, [refetch, onLayout, fitView]);-- useEffect(() => {- if (!currentNode) return;- const internalNode = getNode(currentNode.id);- if (!internalNode) return;- const nodeWidth = internalNode.measured?.width ?? 0;- const nodeHeight = internalNode.measured?.height ?? 0;- setCenter(- internalNode.position.x + nodeWidth / 2,- internalNode.position.y + nodeHeight / 2 + 20,- {- duration: 500,- zoom: 1.5,- }- );- }, [currentNode?.id]);-- const handleConnect = useCallback(- (params: any) => onConnect(params, sketch_id),- [onConnect, sketch_id]- );-- const handleNodeContextMenu = useCallback(- (event: { preventDefault: () => void; stopPropagation: () => void; screenX: number; screenY: number }, node: { id: any; data: any; type?: any }) => {- 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]- );-- const closeNodeContextMenu = useCallback(() => {- setNodeContextMenu(null);- }, []);-- const handlePaneClick = useCallback(- (event: any) => {- closeNodeContextMenu();- onPaneClick(event);- },- [onPaneClick, closeNodeContextMenu]- );-- // Memoize ReactFlow props to prevent unnecessary re-renders- const reactFlowProps = useMemo(() => ({- colorMode: theme,- nodes,- edges,- onNodesChange,- onEdgesChange,- onConnect: handleConnect,- onNodeClick,- onPaneClick: handlePaneClick,- onNodeContextMenu: handleNodeContextMenu,- minZoom: 0.5,- fitView: true,- proOptions: { hideAttribution: true },- // edgeTypes,- nodeTypes,- }), [- theme,- nodes,- edges,- onNodesChange,- onEdgesChange,- handleConnect,- onNodeClick,- handlePaneClick,- handleNodeContextMenu- ]);-- // Process nodes only when nodes array length changes- const processedNodes = useMemo(() =>- nodes.map(({ id, data, type }: { id: string; data: any; type: string }) => ({ id, data, type }))- .sort((a: { type: any }, b: { type: string }) => b.type?.localeCompare(a.type || "")),- [nodes.length]- );-- return (- <TooltipProvider>- <ReactFlow {...reactFlowProps}>- <FlowControls- onLayout={onLayout}- fitView={fitView}- handleRefetch={handleRefetch}- reloading={reloading}- setView={setView}- zoomIn={zoomIn}- zoomOut={zoomOut}- addNodes={addNodes}- />- <Background bgColor="var(--background)" />- </ReactFlow>- <NodeContextMenu- x={nodeContextMenu?.x}- y={nodeContextMenu?.y}- onClose={closeNodeContextMenu}- />- </TooltipProvider>- );-});--function Graph({ graphQuery }: any) {- const [mounted, setMounted] = useState(false);- const { refetch, isLoading, data } = graphQuery;- const { resolvedTheme } = useTheme();-- // Only run mounting effect once- useEffect(() => {- setMounted(true);- }, []);-- // Update flow store when data changes- useEffect(() => {- if (data) {- useFlowStore.setState({- nodes: data?.nodes || [],- edges: data?.edges || []- });- setMounted(true);- }- }, [data]);-- if (!mounted || isLoading) {- return (- <div className="grow w-full h-full flex items-center justify-center">- <Loader /> Loading...- </div>- );- }-- return (- <LayoutFlow refetch={refetch} theme={resolvedTheme || "light"} />- );-}--export default memo(Graph);\ No newline at end of filediff --git a/flowsint-web/src/components/sketches/sketch/large-data-graph.tsx b/flowsint-web/src/components/sketches/sketch/large-data-graph.tsxdeleted file mode 100644index 166a7478..00000000--- a/flowsint-web/src/components/sketches/sketch/large-data-graph.tsx+++ /dev/null@@ -1,342 +0,0 @@-"use client"--import { useEffect, useState, useCallback, useMemo, useRef } from "react"-import dynamic from "next/dynamic"-import { Button } from "@/components/ui/button"-import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from "@/components/ui/tooltip"-import { AlignCenterVertical, PencilRulerIcon, RotateCwIcon, ZoomInIcon, ZoomOutIcon } from "lucide-react"-import { useTheme } from "next-themes"-import { useFlowStore } from "../../../store/flow-store"-import Loader from "../../loader"-import { useQueryState } from "nuqs"-// @ts-ignore-import * as d3 from 'd3'--// Import ForceGraph2D with types-const ForceGraph2D = dynamic(() => import("react-force-graph-2d"), { ssr: false })--// Constants-const NODE_R = 8-const GROUPS_COLORS = {- individual: "#ff6b6b",- email: "#4ecdc4",- phone: "#45b7d1",- address: "#96ceb4",- social: "#ffeead",-}--// Types-interface NodeData {- id: string- color?: string- x?: number- y?: number- group?: string- [key: string]: any-}--interface EdgeData {- source: string- target: string- type?: string- [key: string]: any-}--interface GraphData {- nodes: NodeData[]- links: EdgeData[]-}--interface LayoutFlowProps {- refetch: () => void- isLoading: boolean- theme: string-}--interface ForceGraphNode extends NodeData {- id: string- x: number- y: number- color: string-}--interface LargeInvestigationGraphProps {- graphQuery: {- refetch: () => void- isLoading: boolean- data?: {- nodes: NodeData[]- edges: EdgeData[]- }- }-}--function LayoutFlow({ refetch, theme }: LayoutFlowProps) {- const [view, setView] = useQueryState("view", { defaultValue: "flow-graph" })- const [highlightNodes, setHighlightNodes] = useState<Set<string>>(new Set())- const [highlightLinks, setHighlightLinks] = useState<Set<string>>(new Set())- const [hoverNode, setHoverNode] = useState<ForceGraphNode | null>(null)- const graphRef = useRef<any>(null)- const [zoomLevel, setZoomLevel] = useState(1)-- const { nodes, edges, reloading } = useFlowStore()-- // Amélioration du groupement des nœuds- const getNodeGroup = useCallback((node: NodeData) => {- if (node.data?.type?.includes("individual")) return "individual"- if (node.data?.type?.includes("email")) return "email"- if (node.data?.type?.includes("phone")) return "phone"- if (node.data?.type?.includes("address")) return "address"- if (node.data?.type?.includes("social")) return "social"- return "other"- }, [])-- // Convert data for ForceGraph with improved grouping- const graphData: GraphData = useMemo(() => {- return {- nodes: nodes.map((node) => ({- id: node.id,- ...node.data,- group: getNodeGroup(node),- color: GROUPS_COLORS[getNodeGroup(node) as keyof typeof GROUPS_COLORS] || "#666",- })),- links: edges.map((edge) => ({- source: edge.source,- target: edge.target,- ...edge.data,- })),- }- }, [nodes, edges, getNodeGroup])-- // Amélioration du rendu des nœuds- const Node = useCallback(- (node: any, ctx: CanvasRenderingContext2D) => {- if (node.x === undefined || node.y === undefined) return-- const label = node.data.label- const fontSize = 12- ctx.font = `${fontSize}px Inter, system-ui, sans-serif`- const textWidth = ctx.measureText(label).width- const padding = 12- const height = 24- const width = textWidth + padding * 2-- // Dessiner l'ombre- ctx.shadowColor = "rgba(0, 0, 0, 0.1)"- ctx.shadowBlur = 5- ctx.shadowOffsetX = 0- ctx.shadowOffsetY = 2-- // Dessiner le fond- ctx.fillStyle = node.color- const radius = height / 2-- // Créer le chemin pour la forme de pilule- ctx.beginPath()- ctx.moveTo(node.x - width / 2 + radius, node.y - height / 2)- ctx.lineTo(node.x + width / 2 - radius, node.y - height / 2)- ctx.arcTo(node.x + width / 2, node.y - height / 2, node.x + width / 2, node.y, radius)- ctx.lineTo(node.x + width / 2, node.y + height / 2 - radius)- ctx.arcTo(node.x + width / 2, node.y + height / 2, node.x + width / 2 - radius, node.y + height / 2, radius)- ctx.lineTo(node.x - width / 2 + radius, node.y + height / 2)- ctx.arcTo(node.x - width / 2, node.y + height / 2, node.x - width / 2, node.y + height / 2 - radius, radius)- ctx.lineTo(node.x - width / 2, node.y - height / 2 + radius)- ctx.arcTo(node.x - width / 2, node.y - height / 2, node.x - width / 2 + radius, node.y - height / 2, radius)- ctx.fill()-- // Réinitialiser l'ombre pour le texte- ctx.shadowColor = "transparent"-- // Dessiner le texte- ctx.textAlign = "center"- ctx.textBaseline = "middle"- ctx.fillStyle = theme === "dark" ? "#fff" : "#000"- ctx.fillText(label, node.x, node.y)-- if (highlightNodes.has(node.id)) {- ctx.strokeStyle = theme === "dark" ? "#fff" : "#000"- ctx.lineWidth = 2- ctx.stroke()- }- },- [highlightNodes, theme],- )-- const handleNodeHover = useCallback(- (node: ForceGraphNode | null) => {- setHoverNode(node)- setHighlightNodes(new Set(node ? [node.id] : []))-- // Mettre en évidence les liens connectés- const connectedLinks = new Set<string>()- if (node) {- edges.forEach((edge) => {- if (edge.source === node.id || edge.target === node.id) {- connectedLinks.add(`${edge.source}-${edge.target}`)- // @ts-ignore- setHighlightNodes((prev) => new Set([...prev, edge.source, edge.target]))- }- })- }- setHighlightLinks(connectedLinks)- },- [edges],- )-- const handleNodeClick = useCallback((node: ForceGraphNode, event: MouseEvent) => {- if (node && graphRef.current) {- // Zoom plus fluide et naturel- const distance = 13000- graphRef.current.centerAt(node.x, node.y, distance)- graphRef.current.zoom(2.5, distance)- }- }, [])-- useEffect(() => {- if (graphRef.current) {- // Significantly increase repulsion force- graphRef.current- .d3Force("link")- .distance(() => 2100) // Increase from 150 to 200- .strength(0.1) // Decrease from 0.2 to 0.1 for more flexibility-- graphRef.current- .d3Force("charge")- .strength(-400) // Double the repulsion from -200 to -400- .distanceMax(5100) // Increase from 250 to 500-- // Add this to improve initial positioning- graphRef.current.d3Force("x", d3.forceX().strength(0.05))- graphRef.current.d3Force("y", d3.forceY().strength(0.05))- }- }, [])-- const handleZoomIn = useCallback(() => {- if (graphRef.current) {- const currentZoom = graphRef.current.zoom()- graphRef.current.zoom(currentZoom * 1.2, 400)- }- }, [])-- const handleZoomOut = useCallback(() => {- if (graphRef.current) {- const currentZoom = graphRef.current.zoom()- graphRef.current.zoom(currentZoom / 1.2, 400)- }- }, [])-- return (- <div className="w-full grow overflow-hidden relative">- <div className="absolute top-3.5 left-3.5 z-10 flex items-center gap-1">- <TooltipProvider>- <Tooltip>- <TooltipTrigger asChild>- <Button size="icon" variant="outline" onClick={() => graphRef.current?.zoomToFit(400)}>- <AlignCenterVertical className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Fit view</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button size="icon" variant="outline" onClick={handleZoomIn}>- <ZoomInIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Zoom in</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button size="icon" variant="outline" onClick={handleZoomOut}>- <ZoomOutIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Zoom out</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button size="icon" variant="outline" onClick={() => setView("flow-graph")}>- <PencilRulerIcon className="h-4 w-4" />- </Button>- </TooltipTrigger>- <TooltipContent>Switch to editor</TooltipContent>- </Tooltip>- </TooltipProvider>- </div>- <div className="absolute top-4 right-4 z-10 flex items-center gap-1">- <Button size="icon" disabled={reloading} variant="outline" onClick={refetch}>- <RotateCwIcon className={`h-4 w-4 ${reloading ? "animate-spin" : ""}`} />- </Button>- </div>- <ForceGraph2D-- ref={graphRef}- graphData={graphData}- nodeRelSize={NODE_R}- nodeCanvasObject={Node}- nodeCanvasObjectMode={() => "after"}- linkColor={() => (theme === "dark" ? "#ffffff33" : "#00000033")}- linkWidth={(link: any) =>- highlightLinks.has(`${(link.source as ForceGraphNode).id}-${(link.target as ForceGraphNode).id}`) ? 2 : 1- }- linkDirectionalParticles={4}- linkDirectionalParticleWidth={(link: any) =>- highlightLinks.has(`${(link.source as ForceGraphNode).id}-${(link.target as ForceGraphNode).id}`) ? 2 : 0- }- linkDirectionalParticleColor={() => (theme === "dark" ? "#fff" : "#000")}- // @ts-ignore- onNodeHover={handleNodeHover}- // @ts-ignore- onNodeClick={handleNodeClick}- backgroundColor="transparent"- d3AlphaDecay={0.01} // Ralentir la stabilisation pour un meilleur layout- d3VelocityDecay={0.4} // Amortissement du mouvement- cooldownTime={3000} // Temps de stabilisation plus long- onEngineStop={() => {- // Ajuster la position des nœuds après la stabilisation- if (graphRef.current) {- graphRef.current.zoomToFit(400)- }- }}- />- </div>- )-}--export default function LargeInvestigationGraph({ graphQuery }: LargeInvestigationGraphProps) {- const [mounted, setMounted] = useState(false)- const { refetch, isLoading, data } = graphQuery- const { resolvedTheme } = useTheme()-- useEffect(() => {- setMounted(true)- }, [])-- useEffect(() => {- if (data) {- useFlowStore.setState({- nodes: data?.nodes.map((node) => ({- ...node,- position: { x: node.x ?? 0, y: node.y ?? 0 },- data: node,- })),- edges: data?.edges.map((edge) => ({- ...edge,- id: `${edge.source}-${edge.target}`,- })),- })- setMounted(true)- }- }, [data])-- if (!mounted || isLoading) {- return (- <div className="grow w-full flex items-center justify-center">- <Loader /> Loading...- </div>- )- }-- return <LayoutFlow refetch={refetch} isLoading={isLoading} theme={resolvedTheme as string} />-}-diff --git a/flowsint-web/src/components/sketches/sketch/launch-transform.tsx b/flowsint-web/src/components/sketches/sketch/launch-transform.tsxindex d3b2bc0e..77dd70ba 100644--- a/flowsint-web/src/components/sketches/sketch/launch-transform.tsx+++ b/flowsint-web/src/components/sketches/sketch/launch-transform.tsx@@ -92,7 +92,7 @@ const LaunchTransform = ({ values, type, sketch_id }: { values: string[], type:{transform.description || "No description available"}</CardDescription>)}- <div className="mt-2 text-xs text-muted-foreground">+ <div className="mt-2 mb-3 text-xs text-muted-foreground"><div>Created: {formatDistanceToNow(transform.created_at, { addSuffix: true })}</div><div>Last updated: {formatDistanceToNow(transform.last_updated_at, { addSuffix: true })}</div></div>diff --git a/flowsint-web/src/components/sketches/sketch/nodes-panel.tsx b/flowsint-web/src/components/sketches/sketch/nodes-panel.tsxindex b9de184a..e180a615 100644--- a/flowsint-web/src/components/sketches/sketch/nodes-panel.tsx+++ b/flowsint-web/src/components/sketches/sketch/nodes-panel.tsx@@ -1,6 +1,6 @@import React, { memo, useMemo, useState, useCallback } from 'react'import { type Node } from '@xyflow/react'-import { useFlowStore } from '@/store/flow-store'+import { useSketchStore } from '@/store/sketch-store'import { Button } from '@/components/ui/button'import { Badge } from '@/components/ui/badge'import { TypeBadge } from '@/components/type-badge'@@ -8,9 +8,11 @@ import { Search, HelpCircle, FilterIcon, XIcon } from "lucide-react"import { usePlatformIcons } from '@/lib/hooks/use-platform-icons'import { Input } from '@/components/ui/input'import { actionItems } from '@/lib/action-items'-import { cn, typeColorMap } from '@/lib/utils'+import { cn, hexToRgba } from '@/lib/utils'import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'import Loader from '@/components/loader'+import { useColorSettings } from '@/store/color-settings'+import { IconContainer } from '@/components/icon-container'// Mémoiser le composant SocialNodeconst SocialNode = memo(({ node, setCurrentNode, currentNodeId }: {@@ -57,7 +59,7 @@ const NodeRenderer = memo(({currentNodeId: string | null}) => {const item = useMemo(() =>- (actionItems as any).find((a: any) => a.type === node.data?.type),+ (actionItems as any).find((a: any) => a?.type === node.data?.type),[node.data?.type])const Icon = item?.icon || HelpCircle@@ -71,7 +73,6 @@ const NodeRenderer = memo(({currentNodeId={currentNodeId}/>}-return (<Buttonvariant={"ghost"}@@ -81,21 +82,21 @@ const NodeRenderer = memo(({)}onClick={handleClick}>- <div className={cn("p-1 flex items-center justify-center rounded-full bg-card h-7 w-7", typeColorMap[item.type])}>- <Badge variant="secondary" className={cn("rounded-full h-full w-full bg-card")}>- <Icon className="h-4 w-4" />- </Badge>- </div>+ <IconContainer+ type={node?.data?.type}+ icon={Icon}+ size={12}+ /><div className='grow truncate text-ellipsis'>{node?.data?.label}</div><TypeBadge type={node?.data?.type} /></Button>)})-const NodesPanel = memo(({ nodes, isLoading }: { nodes: Node[], isLoading: boolean }) => {+const NodesPanel = memo(({ nodes, isLoading }: { nodes: Node[], isLoading?: boolean }) => {// Utiliser des sélecteurs précis pour éviter les re-renders inutiles- const setCurrentNode = useFlowStore(state => state.setCurrentNode)- const currentNodeId = useFlowStore(state => state.currentNode?.id)+ const setCurrentNode = useSketchStore(state => state.setCurrentNode)+ const currentNodeId = useSketchStore(state => state.currentNode?.id)const [searchQuery, setSearchQuery] = useState("")const [filters, setFilters] = useState<null | string[]>(null) // 'individual', 'email', etc.@@ -144,7 +145,7 @@ const NodesPanel = memo(({ nodes, isLoading }: { nodes: Node[], isLoading: boole<div className="relative grow"><Search className="absolute left-2.5 top-1.5 h-4 w-4 text-muted-foreground" /><Input- type="text"+ type="search"placeholder="Search nodes..."className="pl-8 h-7"value={searchQuery}@@ -165,7 +166,7 @@ const NodesPanel = memo(({ nodes, isLoading }: { nodes: Node[], isLoading: boole<DropdownMenuSeparator /><DropdownMenuItem className={cn(filters == null && "bg-primary")} onClick={() => toggleFilter(null)}>All</DropdownMenuItem>{actionItems.map((item) => (- <DropdownMenuItem className={cn(filters?.includes(item.type) && "bg-primary/30")} key={item.id} onClick={() => toggleFilter(item.type)}>{item.type}</DropdownMenuItem>+ <DropdownMenuItem className={cn(filters?.includes(item?.type) && "bg-primary/30")} key={item.id} onClick={() => toggleFilter(item?.type)}>{item?.type || "unknown"}</DropdownMenuItem>))}</DropdownMenuContent></DropdownMenu>diff --git a/flowsint-web/src/components/sketches/sketch/nodes/custom-node.tsx b/flowsint-web/src/components/sketches/sketch/nodes/custom-node.tsxdeleted file mode 100644index 054852b2..00000000--- a/flowsint-web/src/components/sketches/sketch/nodes/custom-node.tsx+++ /dev/null@@ -1,47 +0,0 @@-import React, { memo, useMemo, useCallback } from 'react';-import { CopyButton } from '@/components/copy';-import { Badge } from '@/components/ui/badge';-import { Handle, Position } from '@xyflow/react';-import { cn, typeColorMap } 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 { useFlowStore } from '@/store/flow-store';--export default memo(({ data }: any) => {- const item = useMemo(() => (actionItems as any).find((a: any) => a.type === data.type), [data?.type]);- const Icon = item?.icon || QuestionMarkIcon;- const currentNodeId = useFlowStore(state => state.currentNode?.id,- (prev, next) => prev === next);-- const active = currentNodeId === data.id;-- return (- <TooltipNode className={cn('p-.5 rounded-full', typeColorMap[data.type])} selected={active}>- <TooltipTrigger>- <div className="inline-flex items-center gap-2 p-1 w-auto">- <Badge variant="secondary" className={cn("p-0 rounded-full bg-card", item?.size || "h-5 w-5")}>- <Icon className="h-4 w-4" />- </Badge>- </div>- </TooltipTrigger>- <TooltipContent selected={active} position={Position.Top}>{data.label}<CopyButton className="h-6 w-6" content={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 filediff --git a/flowsint-web/src/components/sketches/sketch/nodes/node-context-menu.tsx b/flowsint-web/src/components/sketches/sketch/nodes/node-context-menu.tsxdeleted file mode 100644index 12ffe338..00000000--- a/flowsint-web/src/components/sketches/sketch/nodes/node-context-menu.tsx+++ /dev/null@@ -1,275 +0,0 @@-"use client"-import { Badge } from "@/components/ui/badge"-import {- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuSeparator,- DropdownMenuSub,- DropdownMenuSubContent,- DropdownMenuSubTrigger,-} from "@/components/ui/dropdown-menu"-import { SquarePenIcon } from "lucide-react"-import { useQueryState } from "nuqs"-import { memo, useCallback, useState } from "react"-import { useParams } from "next/navigation"-import { supabase } from "@/lib/supabase/client"-import { useReactFlow } from "@xyflow/react"-import { useConfirm } from "@/components/use-confirm-dialog"-import { toast } from "sonner"-import { useFlowStore } from "@/store/flow-store"-import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@/components/ui/dialog"-import { NodeNotesEditor } from "./node-notes-editor"-import { nodesTypes } from "@/lib/utils"-import { actionItems, type ActionItem } from "@/lib/action-items"-import { DynamicForm } from "../../dynamic-form"--// Node Context Menu component-interface NodeContextMenuProps {- x: number | undefined- y: number | undefined- onClose: () => void | null | undefined-}--const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {- const { currentNode, setCurrentNode } = useFlowStore()- const { addNodes, addEdges, setNodes, setEdges } = useReactFlow()- const { sketch_id } = useParams()- const [openAddNodeModal, setOpenNodeModal] = useState(false)- const [error, setError] = useState<null | string>(null)- const [openNote, setOpenNote] = useState(false)- const [loading, setLoading] = useState(false)- const [nodeToInsert, setNodeToInsert] = useState<any | null>(null)- const { confirm } = useConfirm()- const [_, setIndividualId] = useQueryState("individual_id")-- const _handleDeleteNode = async (type: string) => {- 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()- }- toast.success("Node deleted.")- }- catch (e) {- toast.error("An error occured deleting the node.")- }- }-- const handleDeleteNode = useCallback(_handleDeleteNode, [currentNode?.id, setNodes, setEdges, confirm, onClose])-- const handleOpenAddNodeModal = (e: { stopPropagation: () => void }, key: string) => {- e.stopPropagation()- if (!currentNode) return- if (!nodesTypes[key as keyof typeof nodesTypes]) {- toast.error("Invalid node type.")- return- }- setNodeToInsert(nodesTypes[key as keyof typeof nodesTypes])- setError(null)- setOpenNodeModal(true)- }-- const handleAddNode = async (data: any) => {- try {- setLoading(true)- if (!currentNode) {- toast.error("No node detected.")- setLoading(false)- return- }- const dataToInsert = { ...data, sketch_id: sketch_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(nodeToInsert.table)- .insert(dataToInsert)- .select("*")- .single()- if (insertError || !nodeData) {- toast.error("An error occured during the creation." + JSON.stringify(insertError))- setLoading(false)- return- }- // add individual to individual- if (nodeToInsert.type === "individual" && currentNode?.data?.type === "individual") {- const { error: relationshipError } = await supabase.from("individuals_individuals").upsert({- individual_a: currentNode.id,- individual_b: nodeData.id,- sketch_id: sketch_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,- sketch_id: sketch_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,- sketch_id: sketch_id,- relation_type: "employee",- })- if (relationshipError) {- toast.error("Error creating new relation.")- }- }- // add organization to organization- else if ((nodeToInsert.type === "organization" && currentNode?.data?.type === "organization")) {- const { error: relationshipError } = await supabase.from("organizations_organizations").upsert({- organization_a: currentNode.id,- organization_b: nodeData.id,- sketch_id: sketch_id,- })- if (relationshipError) {- toast.error("Error creating new relation.")- }- }- const newNode = {- id: nodeData.id,- type: "custom",- data: { ...nodeData, label: data[nodeToInsert.fields[0]], type: nodeToInsert.type },- position: { x: 0, y: 0 },- }- addNodes(newNode)- if (currentNode.id) {- const newEdge = {- source: currentNode.id as string,- target: nodeData.id,- type: "custom",- id: `${currentNode.id} - ${nodeData.id}`.toString(),- label: nodeToInsert.type === "individual" ? "relation" : nodeToInsert.type,- }- addEdges(newEdge)- }- setOpenNodeModal(false)- setError(null)- setTimeout(() => {- setCurrentNode(nodeData)- setLoading(false)- }, 0)- toast.success(`New ${nodeToInsert.type || "node"} created.`)- } catch (error) {- toast.error("An unexpected error occurred.")- setLoading(false)- }- }-- const handleEditClick = useCallback(- () => setIndividualId(currentNode?.id as string),- [currentNode?.id, setIndividualId],- )- const handleDeleteClick = useCallback(- () => handleDeleteNode(currentNode?.type as string),- [currentNode?.type, handleDeleteNode],- )- const handleNoteClick = useCallback(() => setOpenNote(true), [setOpenNote])-- // Render a dropdown menu item with the current node's ID- const renderMenuItem = (item: ActionItem) => {- const Icon = item.icon-- if (item.children) {- return (- <DropdownMenuSub key={item.id}>- <DropdownMenuSubTrigger>- <Icon className="mr-3 h-4 w-4 opacity-50" />- {item.label}- </DropdownMenuSubTrigger>- <DropdownMenuSubContent>- {item.children.map((childItem) => renderMenuItem(childItem))}- </DropdownMenuSubContent>- </DropdownMenuSub>- )- }-- return (- <DropdownMenuItem- key={item.id}- disabled={item.disabled}- onClick={(e) => handleOpenAddNodeModal(e, item.key)}- className="flex items-center"- >- <Icon className="mr-2 h-4 w-4 opacity-70" />- <span className="truncate">{item.label}</span>- {item.comingSoon && (- <Badge variant="outline" className="ml-2">- soon- </Badge>- )}- </DropdownMenuItem>- )- }-- if (!currentNode) return null-- return (- <>- <DropdownMenu open={Boolean(currentNode) && Boolean(x) && Boolean(y)} onOpenChange={onClose}>- <DropdownMenuContent- className="absolute z-50 min-w-40 max-w-48 bg-popover text-popover-foreground rounded-md border shadow py-1 overflow-hidden"- style={{ top: y, left: x }}- >- {["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>- </DropdownMenuSub>)}- <DropdownMenuItem onClick={handleEditClick}>View and edit</DropdownMenuItem>- <DropdownMenuSeparator />- <DropdownMenuItem onClick={handleNoteClick}>- New note- <SquarePenIcon className="ml-2 h-4 w-4" />- </DropdownMenuItem>- <DropdownMenuSeparator />- <DropdownMenuItem onClick={handleDeleteClick} className="text-red-600">- Delete- <span className="ml-auto text-xs text-muted-foreground">⌘ ⌫</span>- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- <Dialog open={openAddNodeModal && nodeToInsert} onOpenChange={setOpenNodeModal}>- <DialogContent>- <DialogTitle>New {nodeToInsert?.type}</DialogTitle>- <DialogDescription>Add a new related {nodeToInsert?.type}.</DialogDescription>- <DynamicForm- type={nodeToInsert?.type}- isForm={true}- loading={loading}- onSubmit={handleAddNode}- />- </DialogContent>- </Dialog>- {currentNode.id && (- <NodeNotesEditor openNote={openNote} setOpenNote={setOpenNote} individualId={currentNode.id} />- )}- </>- )-})--export default NodeContextMenu-diff --git a/flowsint-web/src/components/sketches/sketch/profile-panel.tsx b/flowsint-web/src/components/sketches/sketch/profile-panel.tsxindex e32bc2eb..2a02b47b 100644--- a/flowsint-web/src/components/sketches/sketch/profile-panel.tsx+++ b/flowsint-web/src/components/sketches/sketch/profile-panel.tsx@@ -3,7 +3,7 @@ import { HelpCircle, MoreHorizontalIcon, Sparkles } from "lucide-react"import { Button } from "@/components/ui/button"import { useParams } from "next/navigation"import { memo, useMemo } from "react"-import { cn, typeColorMap } from "@/lib/utils"+import { cn, hexToRgba } from "@/lib/utils"import { CopyButton } from "@/components/copy"import {DropdownMenu,@@ -11,13 +11,11 @@ import {DropdownMenuItem,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu"-import Link from "next/link"-import { Badge } from "@/components/ui/badge"import { actionItems } from "@/lib/action-items"import LaunchTransform from "./launch-transform"+import { IconContainer } from "@/components/icon-container"-export default function ProfilePanel({ data, sketch_id }: { data: any, sketch_id: string }) {- const { investigation_id } = useParams()+export default function ProfilePanel({ data, sketch_id }: { data: any, sketch_id?: string }) {const item = useMemo(() =>(actionItems as any).find((a: any) => a.type === data?.type),[data?.type]@@ -26,26 +24,14 @@ export default function ProfilePanel({ data, sketch_id }: { data: any, sketch_idreturn (<div className=" overflow-y-auto overflow-x-hidden h-full"><div className="flex items-center sticky bg-card top-0 border-b justify-start px-4 py-2 gap-2 z-50">- <div className={cn("p-1 flex items-center justify-center rounded-full bg-card h-10 w-10", typeColorMap[data?.type])}>- <Badge variant="secondary" className={cn("rounded-full h-full w-full bg-card")}>- <Icon className="h- w-7" />- </Badge>- </div>+ <IconContainer+ type={data?.type}+ icon={Icon}+ size={20}+ /><h1 className="text-md font-semibold truncate">{data?.label}</h1><div className="grow" /><div className="flex items-center gap-2">- {data?.type === "organization" &&- <Link href={`/dashboard/investigations/${investigation_id}/organigrams/${data?.id}`}>- <Button- className="relative min-w-[80px] h-8 overflow-hidden truncate bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none font-medium rounded-full"- >- <span className="flex items-center truncate gap-2">- <Sparkles className={'h-4 w-4 transition-transform duration-300'} />- <span className="block truncate">Organigram</span>- </span>- <span className="absolute inset-0 bg-black opacity-0 hover:opacity-10 transition-opacity duration-300" />- </Button>- </Link>}<LaunchTransform values={[data.label]} sketch_id={sketch_id as string} type={data?.type} /><DropdownMenu><DropdownMenuTrigger asChild><Button variant={"ghost"} size={"icon"}><MoreHorizontalIcon /></Button></DropdownMenuTrigger>diff --git a/flowsint-web/src/components/transforms/editor.tsx b/flowsint-web/src/components/transforms/editor.tsxindex 52bba806..ec1bada3 100644--- a/flowsint-web/src/components/transforms/editor.tsx+++ b/flowsint-web/src/components/transforms/editor.tsx@@ -436,7 +436,6 @@ function TransformEditor({</div>)}-return (<ReactFlowProvider><FlowEditordiff --git a/flowsint-web/src/components/transforms/save-modal.tsx b/flowsint-web/src/components/transforms/save-modal.tsxindex df11898d..18dc81f2 100644--- a/flowsint-web/src/components/transforms/save-modal.tsx+++ b/flowsint-web/src/components/transforms/save-modal.tsx@@ -13,6 +13,7 @@ import {import { Input } from "@/components/ui/input"import { Label } from "@/components/ui/label"import { Textarea } from "@/components/ui/textarea"+import { useKeyboardShortcut } from "@/hooks/use-keyboard-shortcut"interface TransformModalProps {open: boolean@@ -26,6 +27,14 @@ export function TransformModal({ open, onOpenChange, onSave, isLoading }: Transfconst [description, setDescription] = useState("")const [nameError, setNameError] = useState("")+ useKeyboardShortcut({+ key: "s",+ ctrlOrCmd: true,+ callback: () => {+ handleSave()+ },+ })+const handleSave = () => {if (!name.trim()) {setNameError("Transform name is required")diff --git a/flowsint-web/src/components/transforms/scanner-node.tsx b/flowsint-web/src/components/transforms/scanner-node.tsxindex 7a13e11e..c3c8d30a 100644--- a/flowsint-web/src/components/transforms/scanner-node.tsx+++ b/flowsint-web/src/components/transforms/scanner-node.tsx@@ -40,7 +40,7 @@ function areEqual(prevProps: ScannerNodeProps, nextProps: ScannerNodeProps) {// Memoized scanner node component with custom equality checkconst ScannerNode = memo(({ data, selected, isConnectable }: ScannerNodeProps) => {return (- <BaseNodeSchema className="shadow-md rounded-md !border-l-2 p-0 bg-background" style={{ borderLeftWidth: "8px", borderLeftColor: data.color, cursor: "grab" }}+ <BaseNodeSchema className="shadow-md rounded-md !border-l-2 p-0 bg-background !max-w-[340px]" style={{ borderLeftWidth: "8px", borderLeftColor: data.color, cursor: "grab" }}selected={selected}><div className="p-3 bg-card rounded-t-md"><div className="flex flex-col items-start gap-1 relative">@@ -50,7 +50,7 @@ const ScannerNode = memo(({ data, selected, isConnectable }: ScannerNodeProps) =<div className="font-semibold text-sm">{data.class_name}</div>- <p className="text-xs text-muted-foreground">+ <p className="text-xs text-muted-foreground mt-2">{data.doc}</p></div>diff --git a/flowsint-web/src/components/type-badge.tsx b/flowsint-web/src/components/type-badge.tsxindex 21419ea8..da40df56 100644--- a/flowsint-web/src/components/type-badge.tsx+++ b/flowsint-web/src/components/type-badge.tsx@@ -1,5 +1,6 @@import { Badge } from "@/components/ui/badge"-import { cn, typeColorMap } from "@/lib/utils"+import { cn, hexToRgba } from "@/lib/utils"+import { useColorSettings } from "@/store/color-settings"import { memo } from "react"type TypeBadgeProps = {@@ -8,12 +9,14 @@ type TypeBadgeProps = {}function TypeBadgeComponent({ type, className }: TypeBadgeProps) {- const colorClasses = typeColorMap[type] || "bg-gray-100 text-gray-800 hover:bg-gray-100/80 dark:bg-gray-800/50 dark:text-gray-300 dark:hover:bg-gray-800/60"+ const { colors } = useColorSettings()+ const color = colors[type as keyof typeof colors] || "bg-gray-100 text-gray-800 hover:bg-gray-100/80 dark:bg-gray-800/50 dark:text-gray-300 dark:hover:bg-gray-800/60"return (<Badgevariant="outline"- className={cn(colorClasses, "font-medium border-transparent", className)}+ style={{ backgroundColor: hexToRgba(color, 0.3) }}+ className={cn("font-medium border-transparent", className)}>{type}</Badge>diff --git a/flowsint-web/src/lib/action-items.ts b/flowsint-web/src/lib/action-items.tsindex bf41cbd5..bce08c3a 100644--- a/flowsint-web/src/lib/action-items.ts+++ b/flowsint-web/src/lib/action-items.ts@@ -100,7 +100,7 @@ export const actionItems: ActionItem[] = [table: "individuals",key: "individuals",icon: User,- label: "New individual",+ label: "Individual",fields: [{ name: "first_name", label: "Firstname", type: "text", required: true },{ name: "last_name", label: "Lastname", type: "text", required: true },{ name: "birth_date", label: "Birth date", type: "date", required: false },@@ -175,6 +175,16 @@ export const actionItems: ActionItem[] = [fields: [{ name: "domain", label: "Domain", type: "text", required: true }],size: "h-5 w-5",},+ {+ id: 2588,+ type: "subdomain",+ table: "subdomains",+ key: "domain",+ icon: Locate,+ label: "Subdomain",+ fields: [{ name: "subomain", label: "subdomain", type: "text", required: true }, { name: "root", label: "root domain", type: "text", required: true }],+ size: "h-5 w-5",+ },{id: 5,type: "ip",diff --git a/flowsint-web/src/lib/actions/search.ts b/flowsint-web/src/lib/actions/search.tsdeleted file mode 100644index 2915f836..00000000--- a/flowsint-web/src/lib/actions/search.ts+++ /dev/null@@ -1,31 +0,0 @@-'use server'-import { createClient } from "@/lib/supabase/server";-import { scans } from "@/lib/utils";-export async function performSearch(values: string[], scan_name: string, sketch_id: string) {- const supabase = await createClient()- await supabase.auth.refreshSession()- const { data: { session } } = await supabase.auth.getSession();- const jwt = session?.access_token;- const scan = scans.find((s) => s.scan_name === scan_name)- if (!scan) {- throw Error(`Scanner "${scan_name}" was not found.`)- }- const url = `${process.env.NEXT_PUBLIC_DOCKER_FLOWSINT_API}/scan`;- const body = JSON.stringify({- scanner: scan.scan_name,- sketch_id: sketch_id,- values: values- })- const response = await fetch(url, {- method: 'POST',- headers: {- 'Authorization': `Bearer ${jwt}`,- "Content-Type": "application/json",- },- body- },- );- const resp = await response.json()- if (response.status !== 200) throw Error(`Error: received status ${response.status}`)- return { ...resp, status: response.status };-}\ No newline at end of filediff --git a/flowsint-web/src/lib/actions/sketches.ts b/flowsint-web/src/lib/actions/sketches.tsindex 5b687f0d..9eb75792 100644--- a/flowsint-web/src/lib/actions/sketches.ts+++ b/flowsint-web/src/lib/actions/sketches.ts@@ -2,7 +2,7 @@import { createClient } from "../supabase/server"import { redirect } from "next/navigation"import { revalidatePath } from "next/cache"-import { Edge, Node } from "@xyflow/react"+import { Node, Relationship } from "@neo4j-nvl/base"import { flattenObj } from "../utils"export async function createNewSketch(formData: FormData, investigation_id: string) {@@ -28,14 +28,13 @@ export async function createNewSketch(formData: FormData, investigation_id: stri}type Schema = {- nodes: Node[]- edges: Edge[]- sketch_id: string+ node: Node+ sketch_id: string | string[]}-export async function saveSchemaToNeo4j(schema: Schema) {+export async function saveNode(schema: Schema) {try {- const { nodes, edges, sketch_id } = schema+ const { node, sketch_id } = schemaif (!sketch_id) {return { success: false, error: "Missing sketch ID" }}@@ -43,23 +42,24 @@ export async function saveSchemaToNeo4j(schema: Schema) {await supabase.auth.refreshSession()const { data: { session } } = await supabase.auth.getSession();const jwt = session?.access_token;- const response = await fetch(`${process.env.NEXT_PUBLIC_DOCKER_FLOWSINT_API}/sketch/${sketch_id}/save`, {+ const response = await fetch(`${process.env.NEXT_PUBLIC_DOCKER_FLOWSINT_API}/sketch/${sketch_id}/add`, {method: "POST",- body: JSON.stringify({ nodes, edges }),+ body: JSON.stringify(node),headers: {'Authorization': `Bearer ${jwt}`,"Content-Type": "application/json",},})+ const data = await response.json()if (!response.ok) {- const errorData = await response.json().catch(() => ({}))return {success: false,- error: errorData.message || "Failed to save schema to Neo4j"+ error: "Failed to create new node"}}return {success: true,+ data: data,timestamp: new Date().toISOString()}} catch (error) {diff --git a/flowsint-web/src/lib/hooks/sketches.ts b/flowsint-web/src/lib/hooks/sketches.tsindex b0c9410d..bd509499 100644--- a/flowsint-web/src/lib/hooks/sketches.ts+++ b/flowsint-web/src/lib/hooks/sketches.ts@@ -30,5 +30,5 @@ export function useSketch(sketch_id: string | string[] | undefined) {revalidateOnReconnect: false,});- return { sketch: sketch ?? null, isLoading, refetch: mutate, error };+ return { data: sketch ?? null, isLoading, refetch: mutate, error };}\ No newline at end of filediff --git a/flowsint-web/src/lib/utils.ts b/flowsint-web/src/lib/utils.tsindex 26b98cb5..baea3b9a 100644--- a/flowsint-web/src/lib/utils.ts+++ b/flowsint-web/src/lib/utils.ts@@ -16,7 +16,6 @@ export function cn(...inputs: ClassValue[]) {export const zoomSelector = (s: { transform: number[]; }) => s.transform[2] >= 0.6;import { Position, MarkerType } from '@xyflow/react';-import { AppNode } from "@/store/flow-store";// this helper function returns the intersection point// of the line between the center of the intersectionNode and the target node@@ -138,7 +137,7 @@ interface LayoutOptions {}export const getForceLayoutedElements = (- nodes: AppNode[],+ nodes: Node[],edges: Edge[],options: LayoutOptions = {direction: "LR",@@ -210,7 +209,7 @@ export const getForceLayoutedElements = (}}-export const getDagreLayoutedElements = (nodes: AppNode[],+export const getDagreLayoutedElements = (nodes: Node[],edges: Edge[],options: LayoutOptions = {direction: "TB",@@ -301,31 +300,6 @@ export function generateNodeTypes() {export const nodesTypes = generateNodeTypes()--export const typeColorMap: Record<string, string> = {- 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-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-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",- domain: "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",- financial: "bg-green-100 text-green-800 hover:bg-green-100/80 dark:bg-green-900/30 dark:text-green-300 dark:hover:bg-green-900/40",- event: "bg-red-100 text-red-800 hover:bg-red-100/80 dark:bg-red-900/30 dark:text-red-300 dark:hover:bg-red-900/40",- device: "bg-blue-100 text-blue-800 hover:bg-blue-100/80 dark:bg-blue-900/30 dark:text-blue-300 dark:hover:bg-blue-900/40",- media: "bg-fuchsia-100 text-fuchsia-800 hover:bg-fuchsia-100/80 dark:bg-fuchsia-900/30 dark:text-fuchsia-300 dark:hover:bg-fuchsia-900/40",- education: "bg-teal-100 text-teal-800 hover:bg-teal-100/80 dark:bg-teal-900/30 dark:text-teal-300 dark:hover:bg-teal-900/40",- relationship: "bg-rose-100 text-rose-800 hover:bg-rose-100/80 dark:bg-rose-900/30 dark:text-rose-300 dark:hover:bg-rose-900/40",- online_activity: "bg-indigo-100 text-indigo-800 hover:bg-indigo-100/80 dark:bg-indigo-900/30 dark:text-indigo-300 dark:hover:bg-indigo-900/40",- digital_footprint: "bg-lime-100 text-lime-800 hover:bg-lime-100/80 dark:bg-lime-900/30 dark:text-lime-300 dark:hover:bg-lime-900/40",- biometric: "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",- credential: "bg-gray-100 text-gray-800 hover:bg-gray-100/80 dark:bg-gray-800/50 dark:text-gray-300 dark:hover:bg-gray-800/60",-}-export const getInitials = (name: string) => {return name.split(" ")@@ -388,4 +362,11 @@ export const flattenObj = (ob: Record<string, any>) => {}}return result;+}++export function hexToRgba(hex: string, alpha: number) {+ const r = parseInt(hex.slice(1, 3), 16)+ const g = parseInt(hex.slice(3, 5), 16)+ const b = parseInt(hex.slice(5, 7), 16)+ return `rgba(${r}, ${g}, ${b}, ${alpha})`}\ No newline at end of filediff --git a/flowsint-web/src/store/color-settings.ts b/flowsint-web/src/store/color-settings.tsnew file mode 100644index 00000000..15e57e1b--- /dev/null+++ b/flowsint-web/src/store/color-settings.ts@@ -0,0 +1,102 @@+import { create } from "zustand"+import { persist } from "zustand/middleware"++export type ItemType =+ | "individual"+ | "phone"+ | "address"+ | "email"+ | "ip"+ | "social"+ | "organization"+ | "vehicle"+ | "website"+ | "domain"+ | "subdomain"+ | "document"+ | "financial"+ | "event"+ | "device"+ | "media"+ | "education"+ | "relationship"+ | "online_activity"+ | "digital_footprint"+ | "biometric"+ | "credential"++export const ITEM_TYPES: ItemType[] = [+ "individual",+ "phone",+ "address",+ "email",+ "ip",+ "social",+ "organization",+ "vehicle",+ "website",+ "domain",+ "subdomain",+ "document",+ "financial",+ "event",+ "device",+ "media",+ "education",+ "relationship",+ "online_activity",+ "digital_footprint",+ "biometric",+ "credential",+]++// Default colors for each item type+const DEFAULT_COLORS: Record<ItemType, string> = {+ individual: "#ff5733",+ phone: "#33ff57",+ address: "#3357ff",+ email: "#f3ff33",+ ip: "#ff33f3",+ social: "#33fff3",+ organization: "#ff8c33",+ vehicle: "#338cff",+ website: "#8c33ff",+ domain: "#ff338c",+ subdomain: "#8cff33",+ document: "#33ff8c",+ financial: "#c733ff",+ event: "#ffc733",+ device: "#33c7ff",+ media: "#ff33c7",+ education: "#c7ff33",+ relationship: "#33ffc7",+ online_activity: "#ff5733",+ digital_footprint: "#33ff57",+ biometric: "#3357ff",+ credential: "#f3ff33",+}++interface ColorSettingsState {+ colors: Record<ItemType, string>+ setColor: (itemType: ItemType, color: string) => void+ resetColors: () => void+}++export const useColorSettings = create<ColorSettingsState>()(+ persist(+ (set) => ({+ colors: { ...DEFAULT_COLORS },+ setColor: (itemType, color) =>+ set((state) => ({+ colors: {+ ...state.colors,+ [itemType]: color,+ },+ })),+ resetColors: () => set({ colors: { ...DEFAULT_COLORS } }),+ }),+ {+ name: "color-settings",+ },+ ),+)diff --git a/flowsint-web/src/store/flow-store.ts b/flowsint-web/src/store/flow-store.tsdeleted file mode 100644index 75c89c30..00000000--- a/flowsint-web/src/store/flow-store.ts+++ /dev/null@@ -1,223 +0,0 @@-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,- type OnNodesChange,- type OnEdgesChange,-} from '@xyflow/react';-import { getForceLayoutedElements, getDagreLayoutedElements } 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[];- edges: Edge[];- reloading: boolean;- currentNode: Partial<Node> | null;- onNodesChange: OnNodesChange<AppNode>;- onEdgesChange: OnEdgesChange;- setNodes: (nodes: AppNode[]) => void;- setEdges: (edges: Edge[]) => void;- highlightPath: (selectedNode: Node | null) => void;- onLayout: (layout: string, fitView: () => void) => void,- onConnect: (params: any, sketch_id?: string) => Promise<void>;- onNodeClick: (_: React.MouseEvent, node: Node) => void;- onPaneClick: (_: React.MouseEvent) => void,- setCurrentNode: (node: object | null) => void;- updateNode: (nodeId: string, nodeData: Partial<Node>) => void;- resetNodeStyles: () => void;-};--// Create store with proper memoization-const createStore = (initialNodes: AppNode[] = [], initialEdges: Edge[] = []) => {- return create<AppState>((set, get) => ({- nodes: initialNodes,- edges: initialEdges,- currentNode: null,- reloading: false,- onNodesChange: (changes) => {- set({- nodes: applyNodeChanges(changes, get().nodes),- });- },- onEdgesChange: (changes) => {- set({- edges: applyEdgeChanges(changes, get().edges),- });- },- setCurrentNode: (node: Partial<Node> | null) => {- set({ currentNode: node });- },- onConnect: async (params: any, sketch_id?: string) => {- if (!sketch_id) return;- try {- // Batch database operations with the UI update- const { error } = await supabase- .from("individuals_individuals")- .upsert({- individual_a: params.source,- individual_b: params.target,- sketch_id: sketch_id,- relation_type: "relation"- });- 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((state) => ({- nodes: state.nodes.map(node =>- node.id === nodeId- ? { ...node, ...nodeData }- : node- )- }));- },- setNodes: (nodes) => {- set({ nodes });- },- setEdges: (edges) => {- set({ edges });- },- resetNodeStyles: () => {- set((state) => ({- nodes: state.nodes.map(node => ({- ...node,- disabled: false,- draggable: true,- data: {- ...node.data,- forceToolbarVisible: false- },- style: {- ...node.style,- opacity: 1,- },- })),- edges: state.edges.map(edge => ({- ...edge,- animated: false,- style: {- ...edge.style,- stroke: "#b1b1b750",- opacity: 0.7,- },- })),- }));- },- onNodeClick: (_event: any, node: Partial<Node>) => {- set({ currentNode: node });- // get().resetNodeStyles();- },- onPaneClick: (_envent: any) => {- set({ currentNode: null });- // get().resetNodeStyles();- },- onLayout: (layout = "dagre", fitView: () => void) => {- if (layout === "force") {- const { nodes, edges } = getForceLayoutedElements(get().nodes, get().edges);- // @ts-ignore- set({ nodes, edges });- } else {- const { nodes, edges } = getDagreLayoutedElements(get().nodes, get().edges);- // @ts-ignore- set({ nodes, edges });- }- window.requestAnimationFrame(() => {- fitView();- });- },- highlightPath: (selectedNode: Node | null) => {- if (!selectedNode) {- set((state) => ({- nodes: state.nodes.map((node) => ({- ...node,- style: { ...node.style, opacity: 1 },- })),- edges: state.edges.map((edge) => ({- ...edge,- animated: false,- style: { ...edge.style, stroke: "#b1b1b750", opacity: 0.7 },- }))- }));- return;- }-- // Calculate highlighted nodes and edges in one pass- const 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 updates- set({- nodes: nodes.map((node) => {- const highlight = node.id === selectedNode.id || incomerIds.has(node.id) || outgoerIds.has(node.id);- return highlight ? {- ...node,- disabled: false,- draggable: true,- style: {- ...node.style,- opacity: 1,- },- } : {- ...node,- disabled: true,- draggable: false,- style: {- ...node.style,- opacity: 0.25,- },- };- }),- edges: edges.map((edge) => {- const animatedIn =- incomerIds.has(edge.source) && (incomerIds.has(edge.target) || selectedNode.id === edge.target);- const animatedOut =- outgoerIds.has(edge.target) && (outgoerIds.has(edge.source) || selectedNode.id === edge.source);- const animated = animatedIn || animatedOut;-- return {- ...edge,- animated,- style: {- ...edge.style,- opacity: animated ? 1 : 0.25,- },- };- })- });- },- }));-};--// Initialize store once-export const useFlowStore = createStore();\ No newline at end of filediff --git a/flowsint-web/src/store/project-store.ts b/flowsint-web/src/store/investigation-store.tssimilarity index 67%rename from flowsint-web/src/store/project-store.tsrename to flowsint-web/src/store/investigation-store.tsindex 9b53435d..c90a6460 100644--- a/flowsint-web/src/store/project-store.ts+++ b/flowsint-web/src/store/investigation-store.ts@@ -1,11 +1,11 @@import { create } from "zustand";-interface ProjectState {+interface InvestigationState {openUploadModal: boolean;setOpenUploadModal: (isOpen: boolean) => void;}-export const useInvestigationStore = create<ProjectState>((set) => ({+export const useInvestigationStore = create<InvestigationState>((set) => ({openUploadModal: false,setOpenUploadModal: (isOpen) => set({ openUploadModal: isOpen }),}));diff --git a/flowsint-web/src/store/sketch-store.ts b/flowsint-web/src/store/sketch-store.tsindex 9821f547..fe9924a0 100644--- a/flowsint-web/src/store/sketch-store.ts+++ b/flowsint-web/src/store/sketch-store.ts@@ -1,112 +1,52 @@"use client"import { create } from "zustand"-import { persist, createJSONStorage } from "zustand/middleware"-import { useQuery, type QueryObserverResult } from "@tanstack/react-query"import type { Sketch } from "@/types/sketch"+import { Node, Relationship } from "@neo4j-nvl/base"-interface QueryResult<T> {- data: T- isLoading: boolean- refetch: () => Promise<void>-}-interface SketchResults {- sketch: QueryResult<Sketch>-}interface SketchState {- filters: any- settings: {- showNodeLabel: boolean- showEdgeLabel: boolean- showMiniMap: boolean- showCopyIcon: boolean- showNodeToolbar: boolean- }- openSettingsModal: boolean- currentNode: any+ nodes: Node[]+ edges: Relationship[]+ setNodes: (nodes: Node[]) => void+ addNode: (newNode: Partial<Node>) => void+ setEdges: (edges: Relationship[]) => void+ filters: Record<string, unknown>+ currentNode: Node | nullpanelOpen: boolean- openNewNode: boolean,- openActionDialog: boolean,+ openNewNode: boolean+ openActionDialog: booleansketch: Sketch | nullisRefetching: boolean- setFilters: (filters: any) => void- setSettings: (settings: any) => void- setOpenSettingsModal: (open: boolean) => void+ setFilters: (filters: Record<string, unknown>) => voidsetOpenNewNode: (open: boolean) => void- setCurrentNode: (node: any) => void+ setCurrentNode: (node: Node | null) => voidsetPanelOpen: (open: boolean) => voidsetSketch: (sketch: Sketch | null) => void- handleOpenIndividualModal: (id: string) => void- setHandleOpenIndividualModal: (handler: (id: string) => void) => void- handleDeleteSketch: () => Promise<void>- setHandleDeleteSketch: (handler: () => Promise<void>) => voidsetOpenActionDialog: (open: boolean) => void- useSketchData: (investigationId: string, sketchId: string) => SketchResults & {- refetchAll: () => Promise<void>- }}-export const useSketchStore = create(- persist<SketchState>(- (set, get) => ({- // UI State- filters: {},- settings: {- showNodeLabel: true,- showEdgeLabel: true,- showMiniMap: true,- showCopyIcon: true,- showNodeToolbar: true,- },- openSettingsModal: false,- currentNode: null,- openNewNode: false,- panelOpen: false,- sketch: null,- isRefetching: false,- openActionDialog: false,- setFilters: (filters) => set({ filters }),- setSettings: (settings) => set({ settings }),- setOpenSettingsModal: (open) => set({ openSettingsModal: open }),- setOpenNewNode: (open) => set({ openNewNode: open }),- setCurrentNode: (node) => set({ currentNode: node }),- setPanelOpen: (open) => set({ panelOpen: open }),- setSketch: (sketch) => set({ sketch }),- setOpenActionDialog: (open) => set({ openActionDialog: open }),- handleOpenIndividualModal: () => { },- setHandleOpenIndividualModal: (handler) => set({ handleOpenIndividualModal: handler }),- handleDeleteSketch: async () => { },- setHandleDeleteSketch: (handler) => set({ handleDeleteSketch: handler }),- useSketchData: (investigationId: string, sketchId: string) => {- const wrapRefetch = async (refetch: () => Promise<QueryObserverResult>) => {- await refetch()- }- const sketchQuery = useQuery<Sketch>({- queryKey: ["investigations", investigationId, "sketches", sketchId],- queryFn: async () => {- const res = await fetch(`/api/investigations/${investigationId}/sketches/${sketchId}`)- if (!res.ok) throw new Error("Failed to fetch sketch.")- const data = await res.json()- return data.sketch as Sketch- },- })- return {- sketch: {- data: sketchQuery.data as Sketch,- isLoading: sketchQuery.isLoading,- refetch: () => wrapRefetch(sketchQuery.refetch),- },- refetchAll: () => wrapRefetch(sketchQuery.refetch),+export const useSketchStore = create<SketchState>((set, get) => ({+ nodes: [],+ edges: [],+ filters: {},+ currentNode: null,+ panelOpen: false,+ openNewNode: false,+ openActionDialog: false,+ sketch: null,+ isRefetching: false,- }- },- }),- {- name: "sketch-storage",- storage: typeof window !== 'undefined' ? createJSONStorage(() => localStorage) : undefined,- partialize: (state) => ({- ...state,- }),- },- )-)\ No newline at end of file+ setNodes: (nodes) => set({ nodes }),+ addNode: (newNode) => {+ const { nodes, setNodes } = get()+ const newNodes = [...nodes, { ...newNode }] as Node[]+ setNodes(newNodes)+ },+ setEdges: (edges) => set({ edges }),+ setFilters: (filters) => set({ filters }),+ setOpenNewNode: (open) => set({ openNewNode: open }),+ setCurrentNode: (node) => set({ currentNode: node }),+ setPanelOpen: (open) => set({ panelOpen: open }),+ setSketch: (sketch) => set({ sketch }),+ setOpenActionDialog: (open) => set({ openActionDialog: open }),+}))diff --git a/flowsint-web/src/store/store-settings.ts b/flowsint-web/src/store/store-settings.tsnew file mode 100644index 00000000..31d6a728--- /dev/null+++ b/flowsint-web/src/store/store-settings.ts@@ -0,0 +1,15 @@+import { create } from "zustand"++interface ModalState {+ isSettingsOpen: boolean+ openSettings: () => void+ closeSettings: () => void+ toggleSettings: () => void+}++export const useModalStore = create<ModalState>((set) => ({+ isSettingsOpen: false,+ openSettings: () => set({ isSettingsOpen: true }),+ closeSettings: () => set({ isSettingsOpen: false }),+ toggleSettings: () => set((state) => ({ isSettingsOpen: !state.isSettingsOpen })),+}))diff --git a/flowsint-web/styles/globals.css b/flowsint-web/styles/globals.cssindex fad26e71..d9b376dc 100644--- a/flowsint-web/styles/globals.css+++ b/flowsint-web/styles/globals.css@@ -592,10 +592,10 @@--muted: oklch(0.82 0.02 91.62);--muted-foreground: oklch(0.54 0 0);--accent: oklch(0.65 0.06 117.43);- --accent-foreground: oklch(1.00 0 0);+ --accent-foreground: oklch(0.82 0.02 91.62)--destructive: oklch(0.64 0.21 25.33);--destructive-foreground: oklch(1.00 0 0);- --border: oklch(0.87 0 0);+ --border: oklch(0.95 0 0);--input: oklch(0.87 0 0);--ring: oklch(0.57 0.20 283.08);--chart-1: oklch(0.57 0.20 283.08);@@ -641,7 +641,7 @@--accent-foreground: oklch(0.92 0 0);--destructive: oklch(0.64 0.21 25.33);--destructive-foreground: oklch(1.00 0 0);- --border: oklch(0.30 0.01 223.67);+ --border: oklch(0.27 0.01 223.67);--input: oklch(0.39 0 0);--ring: oklch(0.57 0.20 283.08);--chart-1: oklch(0.57 0.20 283.08);