Skip to content

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

feat: move back to xyflow

dextmorgn734ad305f81e
diff --git a/flowsint-api/app/main.py b/flowsint-api/app/main.py
index fa2ed7fd..5de32b74 100644
--- a/flowsint-api/app/main.py
+++ b/flowsint-api/app/main.py
@@ -1,11 +1,12 @@
import json
from uuid import UUID
from fastapi import FastAPI, HTTPException, Depends
-from pydantic import BaseModel
+from pydantic import BaseModel, Field
+from typing import List, Dict, Optional
from app.core.db import get_db
from app.scanners.registry import ScannerRegistry
from app.core.auth import get_current_user
-from app.utils import extract_input_schema, neo4j_to_cytoscape
+from app.utils import extract_input_schema, neo4j_to_xy
from app.core.celery import celery_app
from app.types.domain import MinimalDomain
from app.types.ip import MinimalIp
@@ -14,13 +15,10 @@ from app.neo4j.connector import Neo4jConnection
from fastapi import Query
import os
from dotenv import load_dotenv
-from faker import Faker
-import random
-from uuid import uuid4
-from typing import List, Dict
-from decimal import Decimal
+from typing import List
from fastapi.middleware.cors import CORSMiddleware
-from app.populate import generate_random_sketch
+from datetime import datetime
+
load_dotenv()
URI = os.getenv("NEO4J_URI_BOLT")
@@ -92,7 +90,7 @@ class LaunchTransformPayload(BaseModel):
@app.post("/transforms/{transform_id}/launch")
async def launch_transform(
- transform_id: UUID,
+ transform_id: str,
payload: LaunchTransformPayload,
user=Depends(get_current_user)
):
@@ -110,32 +108,138 @@ async def launch_transform(
raise HTTPException(status_code=404, detail="Transform not found")
[email protected]("/sketch/nodes")
-async def get_sketch_nodes(limit: int = Query(10, ge=1), offset: int = Query(0, ge=0)):
- query = """
- MATCH (a)-[r]->(b) RETURN a, r, b;
[email protected]("/sketch/{sketch_id}/nodes")
+async def get_sketch_nodes(sketch_id: str):
+ # Récupération des nœuds
+ nodes_query = """
+ MATCH (n)
+ WHERE n.sketch_id = $sketch_id
+ RETURN n, labels(n) as node_types
"""
- result = neo4j_connection.query(query, parameters={"limit": limit, "offset": offset})
+ nodes_result = neo4j_connection.query(nodes_query, parameters={"sketch_id": sketch_id})
- if not result:
- raise HTTPException(status_code=404, detail="No nodes found for this sketch")
+ # Récupération des relations
+ edges_query = """
+ MATCH (a)-[r]->(b)
+ WHERE r.sketch_id = $sketch_id
+ RETURN a.id as source, b.id as target, type(r) as type, r as properties
+ """
+ edges_result = neo4j_connection.query(edges_query, parameters={"sketch_id": sketch_id})
- return neo4j_to_cytoscape(result)
-
-async def health():
- return {"status": "ok"}
+ # Transformation des résultats au format React Flow
+ nodes = []
+ for record in nodes_result:
+ node_data = record["n"]
+ node_type = record["node_types"][0] if record["node_types"] else "default"
+
+ # Format standard pour React Flow
+ node = {
+ "id": node_data["id"],
+ "type": node_type,
+ "data": {
+ "label": node_data.get("label", ""),
+ **{k: v for k, v in node_data.items() if k not in ["position_x","sketch_id", "position_y"]}
+ },
+ "position": {
+ "x": float(node_data.get("position_x", 0)),
+ "y": float(node_data.get("position_y", 0))
+ }
+ }
+ nodes.append(node)
+
+ edges = []
+ for record in edges_result:
+ # Format standard pour React Flow
+ edge = {
+ "id": f"{record['source']}-{record['target']}",
+ "source": record["source"],
+ "target": record["target"],
+ "type": record["type"],
+ "data": {k: v for k, v in record["properties"].items() if k != "sketch_id"}
+ }
+ edges.append(edge)
+
+ return {"nodes": nodes, "edges": edges}
-fake = Faker()
+class Node(BaseModel):
+ id: str
+ type: str
+ label: Optional[str] = None
+ data: Dict[str, str] = Field(default_factory=dict)
-def to_serializable(d):
- """Convertit les valeurs Decimal en float dans les dictionnaires"""
- return {
- k: float(v) if isinstance(v, Decimal) else v
- for k, v in d.items()
- }
+class Edge(BaseModel):
+ source: str
+ target: str
+ type: str
+ data: Dict[str, str] = Field(default_factory=dict)
+
+class SketchPayload(BaseModel):
+ nodes: List[Node]
+ edges: List[Edge]
[email protected]("/investigation/generate")
-async def populate():
- generate_random_sketch()
\ No newline at end of file
[email protected]("/sketch/{sketch_id}/save")
+async def save_sketch(sketch_id: str, payload: SketchPayload):
+ now = datetime.utcnow().isoformat()
+
+ try:
+ for node in payload.nodes:
+ type = node.data.get('type', "individual")
+ if type == "individual":
+ first_name = node.data.get("first_name", "")
+ last_name = node.data.get("last_name", "")
+ node_label = f"{first_name} {last_name}".strip()
+ elif type == "organization":
+ node_label = node.data.get("name", "")
+ else:
+ node_label = node.label or f"{node.type}_{node.id[:8]}"
+
+ position_x = 0
+ position_y = 0
+
+ if "position" in node.data:
+ position = node.data.pop("position", {}) # Retirer position de data
+ position_x = position.get("x", 0)
+ position_y = position.get("y", 0)
+
+ query = f"""
+ MERGE (n:{node.type} {{id: $id}})
+ SET n += $props,
+ n.id = $id,
+ n.label = $label,
+ n.position_x = $position_x,
+ n.position_y = $position_y,
+ n.sketch_id = $sketch_id,
+ n.updated_at = $now
+ """
+ neo4j_connection.query(query, parameters={
+ "id": node.id,
+ "props": node.data,
+ "label": node_label,
+ "position_x": position_x,
+ "position_y": position_y,
+ "sketch_id": sketch_id,
+ "now": now
+ })
+
+ for edge in payload.edges:
+ query = f"""
+ MATCH (a {{id: $source}}), (b {{id: $target}})
+ MERGE (a)-[r:{edge.type}]->(b)
+ SET r += $props,
+ r.sketch_id = $sketch_id,
+ r.updated_at = $now
+ """
+ neo4j_connection.query(query, parameters={
+ "source": edge.source,
+ "target": edge.target,
+ "props": edge.data,
+ "sketch_id": sketch_id,
+ "now": now
+ })
+
+ return {"saved": True, "last_saved_at": now}
+
+ except Exception as e:
+ print(e)
+ raise HTTPException(status_code=500, detail=str(e))
\ No newline at end of file
diff --git a/flowsint-api/app/populate.py b/flowsint-api/app/populate.py
deleted file mode 100644
index 46da3d4c..00000000
--- a/flowsint-api/app/populate.py
+++ /dev/null
@@ -1,194 +0,0 @@
-from uuid import uuid4
-import random
-from faker import Faker
-from app.neo4j.connector import Neo4jConnection
-import os
-from dotenv import load_dotenv
-load_dotenv()
-
-URI = os.getenv("NEO4J_URI_BOLT")
-USERNAME = os.getenv("NEO4J_USERNAME")
-PASSWORD = os.getenv("NEO4J_PASSWORD")
-fake = Faker()
-neo4j_connection = Neo4jConnection(URI, USERNAME, PASSWORD)
-
-def generate_emails(person_id, count=1):
- return [
- {
- "id": str(uuid4()),
- "email": fake.email(),
- "person_id": person_id,
- "type":"email"
-
- }
- for _ in range(count)
- ]
-
-def generate_phones(person_id, count=1):
- return [
- {
- "id": str(uuid4()),
- "number": fake.phone_number(),
- "country": fake.country(),
- "carrier": random.choice(["Orange", "Free", "SFR", "Bouygues"]),
- "person_id": person_id,
- "type":"socials"
-
- }
- for _ in range(count)
- ]
-
-def generate_socials(person_id, count=1):
- return [
- {
- "id": str(uuid4()),
- "username": fake.user_name(),
- "platform": random.choice(["Twitter", "LinkedIn", "Instagram"]),
- "profile_url": f"https://{random.choice(['twitter.com', 'linkedin.com/in', 'instagram.com'])}/{fake.user_name()}",
- "bio": fake.sentence(),
- "followers_count": random.randint(0, 10000),
- "following_count": random.randint(0, 5000),
- "posts_count": random.randint(0, 1000),
- "person_id": person_id,
- "type":"socials"
- }
- for _ in range(count)
- ]
-
-def generate_addresses(person_id, count=1):
- return [
- {
- "id": str(uuid4()),
- "address": fake.street_address(),
- "city": fake.city(),
- "country": fake.country(),
- "zip": fake.postcode(),
- "latitude": float(fake.latitude()),
- "longitude": float(fake.longitude()),
- "person_id": person_id,
- "type":"address"
-
- }
- for _ in range(count)
- ]
-
-def generate_websites(person_id, count=1):
- websites = []
- for _ in range(count):
- domain = fake.domain_name()
- ip = fake.ipv4_public()
- websites.append({
- "id": str(uuid4()),
- "url": f"https://{domain}",
- "domain": domain,
- "ip": ip,
- "person_id": person_id,
- "type": "website"
- })
- return websites
-
-def generate_random_sketch():
- organizations = []
- persons = []
- emails, phones, socials, addresses, websites = [], [], [], [], []
- org_links = []
- person_links = []
-
- # Organizations
- for _ in range(4):
- org_id = str(uuid4())
- organizations.append({
- "id": org_id,
- "name": fake.company(),
- "description": fake.catch_phrase(),
- "country": fake.country(),
- "type": "organization"
- })
-
- # Individuals
- for _ in range(10):
- person_id = str(uuid4())
- name = fake.name()
- first_name, last_name = name.split()[0], name.split()[-1]
-
- persons.append({
- "id": person_id,
- "first_name": first_name,
- "last_name": last_name,
- "full_name": name,
- "type": "person"
- })
-
- emails.extend(generate_emails(person_id, random.randint(1, 2)))
- phones.extend(generate_phones(person_id, random.randint(0, 1)))
- socials.extend(generate_socials(person_id, random.randint(0, 1)))
- addresses.extend(generate_addresses(person_id, random.randint(0, 1)))
- websites.extend(generate_websites(person_id, random.randint(0, 1)))
-
- if random.random() < 0.7:
- org = random.choice(organizations)
- org_links.append({
- "person_id": person_id,
- "org_id": org["id"]
- })
-
- # Person-Person relationships
- relationship_types = ["KNOWS", "WORKS_WITH", "FRIEND_OF", "COLLEAGUE"]
- for _ in range(10):
- src, tgt = random.sample(persons, 2)
- person_links.append({
- "source_id": src["id"],
- "target_id": tgt["id"],
- "type": random.choice(relationship_types)
- })
-
- def create_entities(label: str, props: list[dict], label_fn=None):
- if not props:
- return
-
- if label_fn:
- for entity in props:
- entity["__labels__"] = label_fn(entity).split(":") # <- correction ici
- neo4j_connection.query(f"""
- UNWIND $entities AS entity
- CALL apoc.create.node(entity.__labels__, apoc.map.removeKey(entity, '__labels__')) YIELD node
- RETURN count(node);
- """, {"entities": props})
- else:
- neo4j_connection.query(f"""
- UNWIND $entities AS entity
- CREATE (n:{label})
- SET n = entity;
- """, {"entities": props})
-
-
- def create_relationships(from_label, to_label, rel_name, from_key, to_key, data):
- if data:
- neo4j_connection.query(f"""
- UNWIND $rows AS row
- MATCH (a:{from_label} {{id: row.{from_key}}}), (b:{to_label} {{id: row.{to_key}}})
- CALL apoc.create.relationship(a, '{rel_name}', {{}}, b) YIELD rel
- RETURN count(rel);
- """, {"rows": data})
-
- create_entities("Organization", organizations, lambda o: f"Organization:{o['name']}")
- create_entities("Person", persons, lambda p: f"Person:{p['full_name']}")
- create_entities("Email", emails, lambda e: f"Email:{e['email']}")
- create_entities("Phone", phones, lambda p: f"Phone:{p['number']}")
- create_entities("Social", socials, lambda s: f"Social:{s['platform']}:{s['username']}")
- create_entities("Address", addresses, lambda a: f"Address:{a['city']}")
- create_entities("Website", websites, lambda w: f"Website:{w['domain']}")
-
-
- create_relationships("Person", "Email", "HAS_EMAIL", "person_id", "id", emails)
- create_relationships("Person", "Phone", "HAS_PHONE", "person_id", "id", phones)
- create_relationships("Person", "Social", "HAS_SOCIAL", "person_id", "id", socials)
- create_relationships("Person", "Address", "HAS_ADDRESS", "person_id", "id", addresses)
- create_relationships("Person", "Website", "HAS_WEBSITE", "person_id", "id", websites)
- create_relationships("Person", "Organization", "MEMBER_OF", "person_id", "org_id", org_links)
-
- for rel_type in set(r["type"] for r in person_links):
- rels = [r for r in person_links if r["type"] == rel_type]
- create_relationships("Person", "Person", rel_type, "source_id", "target_id", rels)
-
- return {"status": "success", "message": "Sketch created with entities and relationships."}
diff --git a/flowsint-api/app/utils.py b/flowsint-api/app/utils.py
index f7e3fbc4..daa4b568 100644
--- a/flowsint-api/app/utils.py
+++ b/flowsint-api/app/utils.py
@@ -186,3 +186,43 @@ def neo4j_to_cytoscape(results):
})
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"]
+
+ 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
+ }
diff --git a/flowsint-api/requirements.txt b/flowsint-api/requirements.txt
index 28a8a6d4..9b080037 100644
--- a/flowsint-api/requirements.txt
+++ b/flowsint-api/requirements.txt
@@ -19,4 +19,5 @@ hibpwned
phonenumbers
pydantic[email]
fastapi[all]
-neo4j
\ No newline at end of file
+neo4j
+faker
\ No newline at end of file
diff --git a/flowsint-web/package.json b/flowsint-web/package.json
index 20f1678a..b5ff7418 100644
--- a/flowsint-web/package.json
+++ b/flowsint-web/package.json
@@ -3,7 +3,7 @@
"version": "0.0.1",
"private": true,
"scripts": {
- "dev": "next dev",
+ "dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "eslint . --ext .ts,.tsx -c .eslintrc.json --fix"
diff --git a/flowsint-web/public/address.svg b/flowsint-web/public/address.svg
new file mode 100644
index 00000000..dc6d0556
--- /dev/null
+++ b/flowsint-web/public/address.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-map-pin-icon lucide-map-pin"><path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/></svg>
\ No newline at end of file
diff --git a/flowsint-web/public/company.svg b/flowsint-web/public/company.svg
deleted file mode 100644
index 442831bd..00000000
--- a/flowsint-web/public/company.svg
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- viewBox="0 0 80 80"
- version="1.1"
- id="svg6"
- sodipodi:docname="company.svg"
- width="80px"
- height="80px"
- fill="white"
- opacity="0.8"
- stroke-width="0"
- inkscape:version="0.92.3 (2405546, 2018-03-11)">
- <metadata
- id="metadata12">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs10" />
- <sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="2560"
- inkscape:window-height="1398"
- id="namedview8"
- showgrid="false"
- inkscape:zoom="4.9166667"
- inkscape:cx="38.816032"
- inkscape:cy="9.2262675"
- inkscape:window-x="3840"
- inkscape:window-y="20"
- inkscape:window-maximized="0"
- inkscape:current-layer="svg6" />
- <path
- inkscape:connector-curvature="0"
- d="M 67,16 H 13 a 3,3 0 0 0 -3,3 v 42 a 3,3 0 0 0 3,3 h 54 a 3,3 0 0 0 3,-3 V 19 a 3,3 0 0 0 -3,-3 z m -3,33 a 9,9 0 0 0 -9,9 H 25 A 9,9 0 0 0 16,49 V 31 a 9,9 0 0 0 9,-9 h 30 a 9,9 0 0 0 9,9 z"
- id="path2"
- style="stroke-width:0" />
- <path
- inkscape:connector-curvature="0"
- d="m 40,28 c -6.618,0 -12,5.382 -12,12 0,6.618 5.382,12 12,12 6.618,0 12,-5.382 12,-12 0,-6.618 -5.382,-12 -12,-12 z m 0,18 c -3.309,0 -6,-2.691 -6,-6 0,-3.309 2.691,-6 6,-6 3.309,0 6,2.691 6,6 0,3.309 -2.691,6 -6,6 z"
- id="path4"
- style="stroke-width:0" />
-</svg>
diff --git a/flowsint-web/public/email.svg b/flowsint-web/public/email.svg
new file mode 100644
index 00000000..ac91a648
--- /dev/null
+++ b/flowsint-web/public/email.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-at-sign-icon lucide-at-sign"><circle cx="12" cy="12" r="4"/><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"/></svg>
\ No newline at end of file
diff --git a/flowsint-web/public/ip.svg b/flowsint-web/public/ip.svg
new file mode 100644
index 00000000..fedce4c0
--- /dev/null
+++ b/flowsint-web/public/ip.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-locate-fixed-icon lucide-locate-fixed"><line x1="2" x2="5" y1="12" y2="12"/><line x1="19" x2="22" y1="12" y2="12"/><line x1="12" x2="12" y1="2" y2="5"/><line x1="12" x2="12" y1="19" y2="22"/><circle cx="12" cy="12" r="7"/><circle cx="12" cy="12" r="3"/></svg>
\ No newline at end of file
diff --git a/flowsint-web/public/organization.svg b/flowsint-web/public/organization.svg
new file mode 100644
index 00000000..608ad0f0
--- /dev/null
+++ b/flowsint-web/public/organization.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-building2-icon lucide-building-2"><path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z"/><path d="M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2"/><path d="M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2"/><path d="M10 6h4"/><path d="M10 10h4"/><path d="M10 14h4"/><path d="M10 18h4"/></svg>
\ No newline at end of file
diff --git a/flowsint-web/public/person.svg b/flowsint-web/public/person.svg
index 2e5ccf15..7c26c23d 100644
--- a/flowsint-web/public/person.svg
+++ b/flowsint-web/public/person.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user-icon lucide-user"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user-icon lucide-user"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
\ No newline at end of file
diff --git a/flowsint-web/public/socials.svg b/flowsint-web/public/socials.svg
new file mode 100644
index 00000000..f498d06e
--- /dev/null
+++ b/flowsint-web/public/socials.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-circle-heart-icon lucide-message-circle-heart"><path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/><path d="M15.8 9.2a2.5 2.5 0 0 0-3.5 0l-.3.4-.35-.3a2.42 2.42 0 1 0-3.2 3.6l3.6 3.5 3.6-3.5c1.2-1.2 1.1-2.7.2-3.7"/></svg>
\ No newline at end of file
diff --git a/flowsint-web/public/website.svg b/flowsint-web/public/website.svg
new file mode 100644
index 00000000..09f27af9
--- /dev/null
+++ b/flowsint-web/public/website.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-globe-icon lucide-globe"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>
\ No newline at end of file
diff --git a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/emails/route.ts b/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/emails/route.ts
deleted file mode 100644
index 663df9a7..00000000
--- a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/emails/route.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { createClient } from "@/lib/supabase/server"
-import { NextResponse } from "next/server"
-
-export async function GET(_: Request, { params }: { params: Promise<{ sketch_id: string }> }) {
- const { sketch_id } = await params
- try {
- const supabase = await createClient()
- const {
- data: { user },
- error: userError,
- } = await supabase.auth.getUser();
- if (!user || userError) {
- return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
- }
- const { data: emails, error } = await supabase
- .from('emails')
- .select(`
- *
- `)
- .eq("sketch_id", sketch_id)
-
- if (error) {
- return NextResponse.json({ error: error.message }, { status: 500 })
- }
- return NextResponse.json({ emails })
- } catch (error) {
- return NextResponse.json({ error: "Internal Server Error" }, { status: 500 })
- }
-}
\ No newline at end of file
diff --git a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/individuals/[individual_id]/route.ts b/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/individuals/[individual_id]/route.ts
deleted file mode 100644
index a858391a..00000000
--- a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/individuals/[individual_id]/route.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { createClient } from "@/lib/supabase/server"
-import { NextResponse } from "next/server"
-
-export async function GET(_: Request, { params }: { params: Promise<{ sketch_id: string, individual_id: string }> }) {
- const { sketch_id, individual_id } = await params
- try {
- const supabase = await createClient()
- const {
- data: { user },
- error: userError,
- } = await supabase.auth.getUser();
- if (!user || userError) {
- return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
- }
- const { data: individual, error } = await supabase
- .from('individuals')
- .select(`
- *
- `)
- .eq("sketch_id", sketch_id)
- .eq("id", individual_id)
- .single()
- if (error) {
- return NextResponse.json({ error: error.message }, { status: 500 })
- }
- return NextResponse.json(individual)
- } catch (error) {
- return NextResponse.json({ error: "Internal Server Error" }, { status: 500 })
- }
-}
\ No newline at end of file
diff --git a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/individuals/route.ts b/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/individuals/route.ts
deleted file mode 100644
index 5b91c1be..00000000
--- a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/individuals/route.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { createClient } from "@/lib/supabase/server"
-import { NextRequest, NextResponse } from "next/server"
-
-export async function GET(request: NextRequest, { params }: { params: Promise<{ sketch_id: string }> }) {
- const { sketch_id } = await params
- let size = request.nextUrl.searchParams.get("size") || 10
- let page = request.nextUrl.searchParams.get("page") || 1
- let includeEmails = request.nextUrl.searchParams.get("includeEmails") || false
- let includePhones = request.nextUrl.searchParams.get("includePhones") || false
-
- try {
- const supabase = await createClient()
- const {
- data: { user },
- error: userError,
- } = await supabase.auth.getUser();
- if (!user || userError) {
- return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
- }
- const { data: individuals, error } = await supabase
- .from('individuals')
- .select([`*`,
- includeEmails && "emails(email)",
- includePhones && "phones(number)",
- ].filter(Boolean).join(', '), { count: "exact" })
- .order("created_at", { ascending: false })
- .eq("sketch_id", sketch_id)
- // .range()
-
- if (error) {
- return NextResponse.json({ error: error.message }, { status: 500 })
- }
- return NextResponse.json({ individuals })
- } catch (error) {
- return NextResponse.json({ error: "Internal Server Error" }, { status: 500 })
- }
-}
\ No newline at end of file
diff --git a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/ips/route.ts b/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/ips/route.ts
deleted file mode 100644
index 4ef14232..00000000
--- a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/ips/route.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { createClient } from "@/lib/supabase/server"
-import { NextResponse } from "next/server"
-
-export async function GET(_: Request, { params }: { params: Promise<{ sketch_id: string }> }) {
- const { sketch_id } = await params
- try {
- const supabase = await createClient()
- const {
- data: { user },
- error: userError,
- } = await supabase.auth.getUser();
- if (!user || userError) {
- return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
- }
- const { data: ips, error } = await supabase
- .from('ips')
- .select(`*`)
- .eq("sketch_id", sketch_id)
-
- if (error) {
- return NextResponse.json({ error: error.message }, { status: 500 })
- }
- return NextResponse.json({ ips })
- } catch (error) {
- return NextResponse.json({ error: "Internal Server Error" }, { status: 500 })
- }
-}
\ No newline at end of file
diff --git a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/phones/route.ts b/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/phones/route.ts
deleted file mode 100644
index 139f8ca8..00000000
--- a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/phones/route.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { createClient } from "@/lib/supabase/server"
-import { NextResponse } from "next/server"
-
-export async function GET(_: Request, { params }: { params: Promise<{ sketch_id: string }> }) {
- const { sketch_id } = await params
- try {
- const supabase = await createClient()
- const {
- data: { user },
- error: userError,
- } = await supabase.auth.getUser();
- if (!user || userError) {
- return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
- }
- const { data: phones, error } = await supabase
- .from('phones')
- .select(`*`)
- .eq("sketch_id", sketch_id)
-
- if (error) {
- return NextResponse.json({ error: error.message }, { status: 500 })
- }
- return NextResponse.json({ phones })
- } catch (error) {
- return NextResponse.json({ error: "Internal Server Error" }, { status: 500 })
- }
-}
\ No newline at end of file
diff --git a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/sketch/route.ts b/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/sketch/route.ts
index 07050cbc..60ce4e42 100644
--- a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/sketch/route.ts
+++ b/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/sketch/route.ts
@@ -1,32 +1,26 @@
import { createClient } from "@/lib/supabase/server"
-import type { NodeData, EdgeData } from "@/types"
import { NextResponse } from "next/server"
export async function GET(_: Request, { params }: { params: Promise<{ sketch_id: string }> }) {
const { sketch_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 })
+ 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}/nodes`, {
+ headers: {
+ 'Authorization': `Bearer ${jwt}`,
+ "Content-Type": "application/json",
+ },
+ })
+ const re = await response.json()
+ if (!response.ok) {
+ return NextResponse.json({ error: "An error occured." }, { status: 500 })
}
- const { data: graphData, error: graphError } = await supabase
- .from("sketch_graph")
- .select("*")
- .eq("sketch_id", sketch_id)
- .single();
-
- if (graphError) {
- return NextResponse.json({ error: graphError.message }, { status: 500 })
- }
- if (!graphData) {
- return NextResponse.json({ error: "Not found" }, { status: 404 })
- }
- return NextResponse.json(graphData, { status: 200 })
+ return NextResponse.json(re, { status: 200 })
} catch (error) {
+ console.log(error)
return NextResponse.json({ error: "Internal Server Error" }, { status: 500 })
}
}
diff --git a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/socials/route.ts b/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/socials/route.ts
deleted file mode 100644
index 5798f9ae..00000000
--- a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/socials/route.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { createClient } from "@/lib/supabase/server"
-import { NextResponse } from "next/server"
-
-export async function GET(_: Request, { params }: { params: Promise<{ sketch_id: string }> }) {
- const { sketch_id } = await params
- try {
- const supabase = await createClient()
- const {
- data: { user },
- error: userError,
- } = await supabase.auth.getUser();
- if (!user || userError) {
- return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
- }
- const { data: socials, error } = await supabase
- .from('social_accounts')
- .select(`
- *
- `)
- .eq("sketch_id", sketch_id)
-
- if (error) {
- return NextResponse.json({ error: error.message }, { status: 500 })
- }
- return NextResponse.json({ socials })
- } catch (error) {
- return NextResponse.json({ error: "Internal Server Error" }, { status: 500 })
- }
-}
\ No newline at end of file
diff --git a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/table/route.ts b/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/table/route.ts
deleted file mode 100644
index 7d96bbd1..00000000
--- a/flowsint-web/src/app/api/investigations/[investigation_id]/sketches/[sketch_id]/table/route.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { createClient } from "@/lib/supabase/server"
-import type { NodeData, EdgeData } from "@/types"
-import { NextResponse } from "next/server"
-
-export async function GET(_: Request, { params }: { params: Promise<{ sketch_id: string }> }) {
- const { sketch_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("sketch_table")
- .select("*")
- .eq("sketch_id", sketch_id)
- .single();
-
- if (graphError) {
- return NextResponse.json({ error: graphError.message }, { status: 500 })
- }
- if (!graphData) {
- return NextResponse.json({ error: "Not found" }, { status: 404 })
- }
- return NextResponse.json(graphData.data, { status: 200 })
- } catch (error) {
- return NextResponse.json({ error: "Internal Server Error" }, { status: 500 })
- }
-}
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/actions.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/actions.tsx
similarity index 100%
rename from flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/actions.tsx
rename to flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/actions.tsx
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.tsx
index 5b7981cd..50d01f07 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
@@ -1,15 +1,37 @@
"use client"
import { useQuery } from "@tanstack/react-query"
-import InvestigationGraph from "@/components/sketches/sketch/graph"
-import LargeInvestigationGraph from '@/components/sketches/sketch/large-data-graph'
import { notFound } from "next/navigation"
-import { useQueryState } from "nuqs"
+import { shallow } from 'zustand/shallow'
+import ActionDialog from './actions'
+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 { GraphPanel } from "./graph-panel"
+import { ReactFlowProvider } from "@xyflow/react"
+import { Sketch } from "@/types/sketch"
+
interface DashboardClientProps {
investigationId: string
sketchId: string
+ user_id: string,
+ sketch: Sketch,
}
-export default function DashboardClient({ investigationId, sketchId }: DashboardClientProps) {
- const [view, _] = useQueryState("view", { defaultValue: "flow-graph" })
+export default function DashboardClient({ investigationId, sketchId, sketch, user_id }: DashboardClientProps) {
+ const [open, setOpen] = useState(false)
+ const [isLeftPanelCollapsed, setIsLeftPanelCollapsed] = useState(false)
+ const [isRightPanelCollapsed, setIsRightPanelCollapsed] = useState(false)
+ const stateSelector = (state: { currentNode: any; setCurrentNode: any }) => ({
+ currentNode: state.currentNode,
+ setCurrentNode: state.setCurrentNode,
+ })
+
+ const {
+ currentNode,
+ setCurrentNode
+ } = useFlowStore(stateSelector, shallow)
const graphQuery = useQuery({
queryKey: ["investigations", investigationId, 'sketches', sketchId, "data"],
queryFn: async () => {
@@ -22,13 +44,29 @@ export default function DashboardClient({ investigationId, sketchId }: Dashboard
refetchOnWindowFocus: true,
})
return (
- <>
- {view === "flow-graph" ?
- <InvestigationGraph graphQuery={graphQuery} />
- :
- <LargeInvestigationGraph graphQuery={graphQuery} />
- }
- </>
+ <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 ">
+ {/* Left Panel - Entity Palette */}
+ <LeftPanel
+ isCollapsed={isLeftPanelCollapsed}
+ setIsCollapsed={setIsLeftPanelCollapsed}
+ />
+ <ResizableHandle withHandle />
+ <ResizablePanel defaultSize={65}>
+ <GraphPanel query={graphQuery} />
+ </ResizablePanel>
+ <ResizableHandle withHandle />
+ <RightPanel
+ isCollapsed={isRightPanelCollapsed}
+ setIsCollapsed={setIsRightPanelCollapsed}
+ currentNode={currentNode}
+ />
+ </ResizablePanelGroup>
+ <ActionDialog setCurrentNode={setCurrentNode} setOpenDialog={setOpen} openDialog={open} />
+ </div>
+ </ReactFlowProvider>
)
}
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/console-panel.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/console-panel.tsx
similarity index 58%
rename from flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/console-panel.tsx
rename to flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/console-panel.tsx
index 591e3799..2c8707a8 100644
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/console-panel.tsx
+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/console-panel.tsx
@@ -1,8 +1,9 @@
import { Button } from '@/components/ui/button'
import { ScrollArea } from '@/components/ui/scroll-area'
import { ChevronDown, Database, FileText, Grid, List } from 'lucide-react'
+import { memo } from 'react'
-export function ConsolePanel() {
+export const ConsolePanel = memo(function ConsolePanel() {
// Sample log entries for the console panel
const logEntries = [
{ type: "info", timestamp: "14:32:15", message: 'Loading graph "Investigation 1"' },
@@ -15,8 +16,8 @@ export function ConsolePanel() {
]
return (
- <div className="flex h-full flex-col">
- <div className="flex h-8 items-center justify-between border-b px-4 bg-card">
+ <div className="flex grow flex-col h-full">
+ <div className="flex h-8 items-center bg-card py-2 justify-between border-b px-4">
<h2 className="font-medium text-sm">Console</h2>
<div className="flex items-center gap-1">
<Button variant="ghost" size="icon" className="h-6 w-6">
@@ -33,28 +34,26 @@ export function ConsolePanel() {
</Button>
</div>
</div>
- <ScrollArea className="flex-1">
- <div className="p-2 font-mono text-xs">
- {logEntries.map((entry, index) => (
- <div key={index} className="mb-1 flex">
- <span className="mr-2 text-muted-foreground">[{entry.timestamp}]</span>
- <span
- className={
- entry.type === "error"
- ? "text-destructive"
- : entry.type === "warning"
- ? "text-amber-500"
- : entry.type === "action"
- ? "text-primary"
- : "text-foreground"
- }
- >
- {entry.message}
- </span>
- </div>
- ))}
- </div>
- </ScrollArea>
+ <div className="p-2 font-mono text-xs bg-card grow overflow-auto inset-shadow-sm">
+ {logEntries.map((entry, index) => (
+ <div key={index} className="mb-1 flex">
+ <span className="mr-2 text-muted-foreground">[{entry.timestamp}]</span>
+ <span
+ className={
+ entry.type === "error"
+ ? "text-destructive"
+ : entry.type === "warning"
+ ? "text-amber-500"
+ : entry.type === "action"
+ ? "text-primary"
+ : "text-foreground"
+ }
+ >
+ {entry.message}
+ </span>
+ </div>
+ ))}
+ </div>
</div>
)
-}
\ No newline at end of file
+})
\ No newline at end of file
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.tsx
new file mode 100644
index 00000000..a6e925c7
--- /dev/null
+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph-panel.tsx
@@ -0,0 +1,39 @@
+import { Button } from '@/components/ui/button'
+import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'
+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
+import { Loader, Network, Plus } from 'lucide-react'
+import InvestigationGraph from "@/components/sketches/sketch/graph"
+import { ConsolePanel } from './console-panel'
+import { memo, useState } from 'react'
+
+interface GraphPanelProps {
+ query: any
+}
+export const GraphPanel = memo(function GraphPanel({ query }: 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-">
+ <InvestigationGraph graphQuery={query} />
+ </ResizablePanel>
+
+ <ResizableHandle withHandle />
+
+ {/* Bottom Console Panel */}
+ <ResizablePanel
+ defaultSize={20}
+ minSize={10}
+ maxSize={40}
+ collapsible={true}
+ onCollapse={() => setIsBottomPanelCollapsed(true)}
+ onExpand={() => setIsBottomPanelCollapsed(false)}
+ >
+ <ConsolePanel />
+ </ResizablePanel>
+ </ResizablePanelGroup>
+ </div>
+ </div>
+ )
+})
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/layout.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/layout.tsx
deleted file mode 100644
index 469de731..00000000
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/layout.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import { SketchProvider } from '@/components/contexts/sketch-provider';
-import { createClient } from "@/lib/supabase/server";
-import { notFound, redirect } from "next/navigation";
-import { SketchNavigation } from '@/components/sketches/sketch-navigation';
-import { ScanDrawer } from '@/components/sketches/scan-drawer';
-import { Sketch } from '@/types/sketch';
-const DashboardLayout = async ({
- children,
- params,
-}: {
- children: React.ReactNode;
- params: Promise<{ investigation_id: string, sketch_id: string }>
-}) => {
- const supabase = await createClient()
- const { investigation_id, sketch_id } = await params
- const { data, error: userError } = await supabase.auth.getUser()
- if (userError || !data?.user) {
- redirect('/login')
- }
- const { data: sketch, error } = await supabase.from("sketches").select("*, members:sketches_profiles(profile:profiles(id, first_name, last_name, avatar_url), role)").eq("id", sketch_id).single()
- if (!sketch || error) {
- return notFound()
- }
- return (
- <SketchProvider>
- <div className="sticky z-40 bg-card w-full hidden md:flex top-[48px] border-b">
- <SketchNavigation user_id={data?.user?.id} investigation_id={investigation_id} sketch_id={sketch_id} sketch={sketch as Sketch} />
- </div>
- {children}
- <ScanDrawer />
- </SketchProvider>
- )
-}
-
-export default DashboardLayout
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/left-panel.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/left-panel.tsx
similarity index 97%
rename from flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/left-panel.tsx
rename to flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/left-panel.tsx
index 3803d125..18ae2be7 100644
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/left-panel.tsx
+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/left-panel.tsx
@@ -3,13 +3,14 @@ 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'
interface LeftPanelProps {
isCollapsed: boolean
setIsCollapsed: (collapsed: boolean) => void
}
-export function LeftPanel({ isCollapsed, setIsCollapsed }: LeftPanelProps) {
+export const LeftPanel = memo(function LeftPanel({ isCollapsed, setIsCollapsed }: LeftPanelProps) {
// Sample entity categories for the left panel
const entityCategories = [
{
@@ -89,4 +90,4 @@ export function LeftPanel({ isCollapsed, setIsCollapsed }: LeftPanelProps) {
)}
</ResizablePanel>
)
-}
\ No newline at end of file
+})
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/map/page.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/map/page.tsx
deleted file mode 100644
index 84ebd67d..00000000
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/map/page.tsx
+++ /dev/null
@@ -1,76 +0,0 @@
-"use client"
-
-import { useState } from "react"
-// @ts-ignore
-import { ComposableMap, Geographies, Geography, Marker, ZoomableGroup } from "react-simple-maps"
-
-export default function MapPage() {
- const [position, setPosition] = useState({ coordinates: [0, 0], zoom: 1 })
- const [dimensions, setDimensions] = useState({ width: 800, height: 450 })
-
- const handleMoveEnd = (position: any) => {
- setPosition(position)
- }
-
- // Bordeaux coordinates
- const markerCoordinates = { markerOffset: 15, name: "123 Route du Grand Puits, PARIS 17, France", coordinates: [-0.165159, 45.141177] }
-
- // Responsive scale based on screen width
- const getScale = () => {
- const width = window.innerWidth
- if (width < 640) return 40 // Small screens
- if (width < 1024) return 60 // Medium screens
- return 80 // Large screens
- }
- return (
- <div className="flex flex-col grow w-full">
- <div id="map-container" className="grow w-full relative overflow-hidden">
- <ComposableMap
- projectionConfig={{
- scale: getScale(),
- }}
- width={dimensions.width}
- height={dimensions.height}
- style={{
- width: "100%",
- height: "100%",
- position: "absolute",
- top: 0,
- left: 0,
- }}
- >
- <ZoomableGroup zoom={position.zoom} center={position.coordinates} onMoveEnd={handleMoveEnd}>
- <Geographies geography={"/features.json"}>
- {({ geographies }: { geographies: any[] }) =>
- geographies.map((geo) => (
- <Geography
- key={geo.rsmKey}
- geography={geo}
- fill="#EAEAEC"
- stroke="#D6D6DA"
- style={{
- default: { outline: "none" },
- hover: { fill: "#F5F5F5", outline: "none" },
- pressed: { outline: "none" },
- }}
- />
- ))
- }
- </Geographies>
- <Marker key={name} coordinates={markerCoordinates.coordinates}>
- <circle r={window.innerWidth < 640 ? 2 : 3} fill="#FF5533" stroke="#FFFFFF" strokeWidth={1} />
- <text
- textAnchor="middle"
- y={markerCoordinates.markerOffset}
- style={{ fontFamily: "system-ui", fill: "#5D5A6D", fontSize: window.innerWidth < 640 ? "0.2rem" : ".4rem" }}
- >
- {markerCoordinates.name}
- </text>
- </Marker>
- </ZoomableGroup>
- </ComposableMap>
- </div>
- </div>
- )
-}
-
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.tsx
index 2a774f15..16e740f2 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
@@ -16,7 +16,11 @@ const InvestigationPage = async ({
if (!user || userError) {
return redirect("/login")
}
- return <DashboardClient investigationId={investigation_id} sketchId={sketch_id} />
+ const { data: sketch, error } = await supabase.from("sketches").select("*, members:sketches_profiles(profile:profiles(id, first_name, last_name, avatar_url), role)").eq("id", sketch_id).single()
+ if (!sketch || error) {
+ return notFound()
+ }
+ return <DashboardClient investigationId={investigation_id} sketchId={sketch_id} sketch={sketch} user_id={user?.id} />
}
export default InvestigationPage
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/right-panel.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/right-panel.tsx
similarity index 60%
rename from flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/right-panel.tsx
rename to flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/right-panel.tsx
index 72ff3bcd..59fa1fc5 100644
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/right-panel.tsx
+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/right-panel.tsx
@@ -3,14 +3,32 @@ import { ResizablePanel, ResizablePanelGroup, ResizableHandle } from '@/componen
import { 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 { shallow } from 'zustand/shallow'
+import { MiniMap } from '@xyflow/react'
interface RightPanelProps {
isCollapsed: boolean
setIsCollapsed: (collapsed: boolean) => void
- currentNode: any
+ currentNode: any,
}
-export function RightPanel({ isCollapsed, setIsCollapsed, currentNode }: RightPanelProps) {
+export const RightPanel = memo(function RightPanel({ isCollapsed, setIsCollapsed, currentNode }: RightPanelProps) {
+ const stateSelector = (state: { nodes: any }) => ({
+ nodes: state.nodes,
+ })
+
+ const {
+ nodes,
+ } = useFlowStore(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.length]
+ );
+
return (
<ResizablePanel
defaultSize={20}
@@ -24,28 +42,29 @@ export function RightPanel({ isCollapsed, setIsCollapsed, currentNode }: RightPa
>
{!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>
+ <ResizableHandle withHandle /> */}
+
{currentNode && (
<>
- <ResizablePanel order={1} id="top" defaultSize={40}>
- <div className="flex h-8 items-center justify-between border-b px-4 bg-card">
- <h2 className="font-medium text-sm">Properties</h2>
- <Button variant="ghost" size="icon" className="h-6 w-6">
- <ChevronDown className="h-4 w-4" />
- </Button>
- </div>
+ <ResizablePanel order={1} id="infos" defaultSize={30}>
<ProfilePanel data={currentNode.data} />
</ResizablePanel>
<ResizableHandle withHandle />
</>
)}
- <ResizablePanel order={2} id="bottom" defaultSize={60}>
+ <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>
- <NodesPanel nodes={[]} />
+ <NodesPanel nodes={processedNodes} />
</ResizablePanel>
</ResizablePanelGroup>
) : (
@@ -57,4 +76,4 @@ export function RightPanel({ isCollapsed, setIsCollapsed, currentNode }: RightPa
)}
</ResizablePanel>
)
-}
\ No newline at end of file
+})
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/table/data-table.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/table/data-table.tsx
deleted file mode 100644
index 982d212e..00000000
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/table/data-table.tsx
+++ /dev/null
@@ -1,653 +0,0 @@
-"use client"
-
-import * as React from "react"
-import {
- DndContext,
- KeyboardSensor,
- MouseSensor,
- TouchSensor,
- closestCenter,
- useSensor,
- useSensors,
- type DragEndEvent,
- type UniqueIdentifier,
-} from "@dnd-kit/core"
-import { restrictToVerticalAxis } from "@dnd-kit/modifiers"
-import {
- SortableContext,
- arrayMove,
- useSortable,
- verticalListSortingStrategy,
-} from "@dnd-kit/sortable"
-import { CSS } from "@dnd-kit/utilities"
-import {
- ColumnDef,
- ColumnFiltersState,
- Row,
- SortingState,
- VisibilityState,
- flexRender,
- getCoreRowModel,
- getFacetedRowModel,
- getFacetedUniqueValues,
- getFilteredRowModel,
- getPaginationRowModel,
- getSortedRowModel,
- useReactTable,
-} from "@tanstack/react-table"
-import {
- ChevronDownIcon,
- ChevronLeftIcon,
- ChevronRightIcon,
- ChevronsLeftIcon,
- ChevronsRightIcon,
- ColumnsIcon,
- GripVerticalIcon,
- HelpCircle,
- MoreVerticalIcon,
- PlusIcon,
- RotateCwIcon,
- UserIcon,
-} from "lucide-react"
-import { z } from "zod"
-import { Badge } from "@/components/ui/badge"
-import { Button } from "@/components/ui/button"
-import { Checkbox } from "@/components/ui/checkbox"
-import {
- DropdownMenu,
- DropdownMenuCheckboxItem,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
-} from "@/components/ui/dropdown-menu"
-import { Label } from "@/components/ui/label"
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select"
-import {
- Sheet,
- SheetClose,
- SheetContent,
- SheetFooter,
- SheetTrigger,
-} from "@/components/ui/sheet"
-import {
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
-} from "@/components/ui/table"
-import {
- Tabs,
- TabsContent,
- TabsList,
- TabsTrigger,
-} from "@/components/ui/tabs"
-import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
-import { formatDistanceToNow } from "date-fns"
-import { cn } from "@/lib/utils"
-import { TypeBadge } from "@/components/type-badge"
-import { DialogTitle } from "@radix-ui/react-dialog"
-import { MemoizedKeyValueDisplay } from "@/components/sketches/sketch/profile-panel"
-import { Card } from "@/components/ui/card"
-import { actionItems } from "@/lib/action-items"
-import { usePlatformIcons } from "@/lib/hooks/use-platform-icons"
-
-function DragHandle({ id }: { id: number }) {
- const { attributes, listeners } = useSortable({
- id,
- })
-
- return (
- <Button
- {...attributes}
- {...listeners}
- variant="ghost"
- size="icon"
- className="size-7 text-muted-foreground hover:bg-transparent"
- >
- <GripVerticalIcon className="size-3 text-muted-foreground" />
- <span className="sr-only">Drag to reorder</span>
- </Button>
- )
-}
-
-const columns: ColumnDef<any>[] = [
- {
- id: "drag",
- header: () => null,
- cell: ({ row }: any) => <DragHandle id={row.original.data.id} />,
- },
- {
- id: "select",
- header: ({ table }: any) => (
- <div className="flex items-center justify-center">
- <Checkbox
- checked={
- table.getIsAllPageRowsSelected() ||
- (table.getIsSomePageRowsSelected() && "indeterminate")
- }
- onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
- aria-label="Select all"
- />
- </div>
- ),
- cell: ({ row }: any) => (
- <div className="flex items-center justify-center">
- <Checkbox
- checked={row.getIsSelected()}
- onCheckedChange={(value) => row.toggleSelected(!!value)}
- aria-label="Select row"
- />
- </div>
- ),
- enableSorting: false,
- enableHiding: false,
- },
- {
- accessorKey: "full_name",
- header: "Label",
- cell: ({ row }: any) => {
- return (
- <TableCellViewer item={row.original.data}>
- <div className="flex items-center gap-2">
- {row.original.data.label}
- </div>
- </TableCellViewer>)
- },
- enableHiding: false,
- },
- {
- accessorKey: "type",
- header: "Type",
- cell: ({ row }: any) => {
- return <TypeBadge type={row?.original?.data?.type} />
- },
- enableHiding: false,
- },
- {
- accessorKey: "email",
- header: "Email(s)",
- cell: ({ row }: any) => {
- return <Badge variant="outline" className="px-1.5 text-muted-foreground flex items-center gap-2 max-w-[290px]">
- <span className="truncate text-ellipsis">{row.original.data?.emails?.map(({ email }: any) => email).join(", ") || <span className="italic opacity-60">No email yet.</span>}</span>
- </Badge>
- },
- enableHiding: false,
- },
- {
- accessorKey: "phones",
- header: "Phone(s)",
- cell: ({ row }: any) => {
- return <Badge variant="outline" className="px-1.5 text-muted-foreground flex items-center gap-2 max-w-[290px]">
- <span className="truncate text-ellipsis">{row.original.data?.phones?.map(({ number }: any) => number).join(", ") || <span className="italic opacity-60">No phone number yet.</span>}</span>
- </Badge>
- },
- enableHiding: false,
- },
- {
- accessorKey: "created_at",
- header: "Discovered",
- cell: ({ row }: any) => (
- <div>
- <Badge variant="outline" className="px-1.5 text-muted-foreground">
- {formatDistanceToNow(row.original.data.created_at, { addSuffix: true }) || "N/A"}
- </Badge>
- </div>
- ),
- },
- {
- accessorKey: "nationality",
- header: "Nationality",
- cell: ({ row }: any) => (
- <div>
- <Badge variant="outline" className="px-1.5 text-muted-foreground">
- {row.original.data.nationality || "N/A"}
- </Badge>
- </div>
- ),
- },
- {
- accessorKey: "birth_date",
- header: "Born on",
- cell: ({ row }: any) => (
- <Badge
- variant="outline"
- className="flex gap-1 px-1.5 text-muted-foreground [&_svg]:size-3"
- >
- <span>{row.original.databirth_date || "N/A"}</span>
- </Badge>
- ),
- },
- {
- accessorKey: "gender",
- header: "Gender",
- cell: ({ row }: any) => (
- <div>
- <Badge variant="outline" className="px-1.5 text-muted-foreground">
- {row.original.data.gender || "N/A"}
- </Badge>
- </div>
- ),
- },
- {
- id: "actions",
- cell: () => (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- variant="ghost"
- className="flex size-8 text-muted-foreground data-[state=open]:bg-muted"
- size="icon"
- >
- <MoreVerticalIcon />
- <span className="sr-only">Open menu</span>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem>Edit</DropdownMenuItem>
- <DropdownMenuItem>Make a copy</DropdownMenuItem>
- <DropdownMenuItem>Favorite</DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem>Delete</DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- ),
- },
-]
-
-function DraggableRow({ row }: { row: Row<any> }) {
- const { transform, transition, setNodeRef, isDragging } = useSortable({
- id: row.original.data.id,
- })
-
- return (
- <TableRow
- data-state={row.getIsSelected() && "selected"}
- data-dragging={isDragging}
- ref={setNodeRef}
- className="relative z-0 data-[dragging=true]:z-10 data-[dragging=true]:opacity-80"
- style={{
- transform: CSS.Transform.toString(transform),
- transition: transition,
- }}
- >
- {row.getVisibleCells().map((cell: any) => (
- <TableCell key={cell.id}>
- {flexRender(cell.column.columnDef.cell, cell.getContext())}
- </TableCell>
- ))}
- </TableRow>
- )
-}
-
-export function DataTable({
- data: initialData,
- pageCount,
- pagination,
- setPagination,
- refetch,
- isRefetching
-}: {
- data: any,
- pageCount: number
- pagination: any
- setPagination: any
- refetch: () => void
- isRefetching: boolean
-}) {
- const [data, setData] = React.useState(() => initialData)
- const [rowSelection, setRowSelection] = React.useState({})
- const [columnVisibility, setColumnVisibility] =
- React.useState<VisibilityState>({})
- const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
- []
- )
- const [sorting, setSorting] = React.useState<SortingState>([])
- const sortableId = React.useId()
- const sensors = useSensors(
- useSensor(MouseSensor, {}),
- useSensor(TouchSensor, {}),
- useSensor(KeyboardSensor, {})
- )
-
- const dataIds = React.useMemo<UniqueIdentifier[]>(
- () => !data?.error && data?.map(({ id }: any) => id) || [],
- [data]
- )
-
- const table = useReactTable({
- data,
- columns,
- state: {
- sorting,
- columnVisibility,
- rowSelection,
- columnFilters,
- pagination,
- },
- getRowId: (row: any) => row.id.toString(),
- enableRowSelection: true,
- onRowSelectionChange: setRowSelection,
- onSortingChange: setSorting,
- onColumnFiltersChange: setColumnFilters,
- onColumnVisibilityChange: setColumnVisibility,
- onPaginationChange: setPagination,
- getCoreRowModel: getCoreRowModel(),
- getFilteredRowModel: getFilteredRowModel(),
- getPaginationRowModel: getPaginationRowModel(),
- getSortedRowModel: getSortedRowModel(),
- getFacetedRowModel: getFacetedRowModel(),
- getFacetedUniqueValues: getFacetedUniqueValues(),
- })
-
- function handleDragEnd(event: DragEndEvent) {
- const { active, over } = event
- if (active && over && active.id !== over.id) {
- setData((data: any) => {
- const oldIndex = dataIds.indexOf(active.id)
- const newIndex = dataIds.indexOf(over.id)
- return arrayMove(data, oldIndex, newIndex)
- })
- }
- }
-
- return (
- <Tabs
- defaultValue="outline"
- className="flex w-full flex-col justify-start gap-6"
- >
- <div className="flex items-center justify-between px-4 lg:px-6">
- <Label htmlFor="view-selector" className="sr-only">
- View
- </Label>
- <Select defaultValue="outline">
- <SelectTrigger
- className="@4xl/main:hidden bg-card flex w-fit"
- id="view-selector"
- >
- <SelectValue placeholder="Select a view" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="outline">Outline</SelectItem>
- <SelectItem value="past-performance">Past Performance</SelectItem>
- <SelectItem value="key-personnel">Key Personnel</SelectItem>
- <SelectItem value="focus-documents">Focus Documents</SelectItem>
- </SelectContent>
- </Select>
- <TabsList className="@4xl/main:flex hidden">
- <TabsTrigger value="outline">Outline</TabsTrigger>
- <TabsTrigger value="past-performance" className="gap-1">
- Past Performance{" "}
- <Badge
- variant="secondary"
- className="flex h-5 w-5 items-center justify-center rounded-full bg-muted-foreground/30"
- >
- 3
- </Badge>
- </TabsTrigger>
- <TabsTrigger value="key-personnel" className="gap-1">
- Key Personnel{" "}
- <Badge
- variant="secondary"
- className="flex h-5 w-5 items-center justify-center rounded-full bg-muted-foreground/30"
- >
- 2
- </Badge>
- </TabsTrigger>
- <TabsTrigger value="focus-documents">Focus Documents</TabsTrigger>
- </TabsList>
- <div className="flex items-center gap-2">
- <Button disabled={isRefetching} onClick={refetch} variant="outline" size="sm">
- <RotateCwIcon className={cn(isRefetching && "animate-spin")} /> Reload
- </Button>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="outline" size="sm">
- <ColumnsIcon />
- <span className="hidden lg:inline">Customize Columns</span>
- <span className="lg:hidden">Columns</span>
- <ChevronDownIcon />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-56">
- {table
- .getAllColumns()
- .filter(
- (column: any) =>
- typeof column.accessorFn !== "undefined" &&
- column.getCanHide()
- )
- .map((column: any) => {
- return (
- <DropdownMenuCheckboxItem
- key={column.id}
- className="capitalize"
- checked={column.getIsVisible()}
- onCheckedChange={(value) =>
- column.toggleVisibility(!!value)
- }
- >
- {column.id}
- </DropdownMenuCheckboxItem>
- )
- })}
- </DropdownMenuContent>
- </DropdownMenu>
- <Button variant="outline" size="sm">
- <PlusIcon />
- <span className="hidden lg:inline">Add individual</span>
- </Button>
- </div>
- </div>
- <TabsContent
- value="outline"
- className="relative flex flex-col gap-4 overflow-auto px-4 lg:px-6"
- >
- <Card className="overflow-hidden rounded-lg bg-card border shadow-xs">
- <DndContext
- collisionDetection={closestCenter}
- modifiers={[restrictToVerticalAxis]}
- onDragEnd={handleDragEnd}
- sensors={sensors}
- id={sortableId}
- >
- <Table>
- <TableHeader className="sticky top-0 z-10">
- {table.getHeaderGroups().map((headerGroup: { id: React.Key | null | undefined; headers: any[] }) => (
- <TableRow key={headerGroup.id}>
- {headerGroup.headers.map((header) => {
- return (
- <TableHead key={header.id} colSpan={header.colSpan}>
- {header.isPlaceholder
- ? null
- : flexRender(
- header.column.columnDef.header,
- header.getContext()
- )}
- </TableHead>
- )
- })}
- </TableRow>
- ))}
- </TableHeader>
- <TableBody className="**:data-[slot=table-cell]:first:w-8">
- {table.getRowModel().rows?.length ? (
- <SortableContext
- items={dataIds}
- strategy={verticalListSortingStrategy}
- >
- {table.getRowModel().rows.map((row: any) => (
- <DraggableRow key={row.id} row={row} />
- ))}
- </SortableContext>
- ) : (
- <TableRow>
- <TableCell
- colSpan={columns.length}
- className="h-24 text-center"
- >
- No data yet.
- </TableCell>
- </TableRow>
- )}
- </TableBody>
- </Table>
- </DndContext>
- </Card>
- <div className="flex items-center justify-between px-4">
- <div className="hidden flex-1 text-sm text-muted-foreground lg:flex">
- {table.getFilteredSelectedRowModel().rows.length} of{" "}
- {table.getFilteredRowModel().rows.length} row(s) selected.
- </div>
- <div className="flex w-full items-center gap-8 lg:w-fit">
- <div className="hidden items-center gap-2 lg:flex">
- <Label htmlFor="rows-per-page" className="text-sm font-medium">
- Rows per page
- </Label>
- <Select
- value={`${table.getState().pagination.pageSize}`}
- onValueChange={(value) => {
- table.setPageSize(Number(value))
- }}
- >
- <SelectTrigger className="w-20" id="rows-per-page">
- <SelectValue
- placeholder={table.getState().pagination.pageSize}
- />
- </SelectTrigger>
- <SelectContent side="top">
- {[10, 20, 30, 40, 50].map((pageSize) => (
- <SelectItem key={pageSize} value={`${pageSize}`}>
- {pageSize}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </div>
- <div className="flex w-fit items-center justify-center text-sm font-medium">
- Page {table.getState().pagination.pageIndex + 1} of{" "}
- {table.getPageCount()}
- </div>
- <div className="ml-auto flex items-center gap-2 lg:ml-0">
- <Button
- variant="outline"
- className="hidden h-8 w-8 p-0 lg:flex"
- onClick={() => table.setPageIndex(0)}
- disabled={!table.getCanPreviousPage()}
- >
- <span className="sr-only">Go to first page</span>
- <ChevronsLeftIcon />
- </Button>
- <Button
- variant="outline"
- className="size-8"
- size="icon"
- onClick={() => table.previousPage()}
- disabled={!table.getCanPreviousPage()}
- >
- <span className="sr-only">Go to previous page</span>
- <ChevronLeftIcon />
- </Button>
- <Button
- variant="outline"
- className="size-8"
- size="icon"
- onClick={() => table.nextPage()}
- disabled={!table.getCanNextPage()}
- >
- <span className="sr-only">Go to next page</span>
- <ChevronRightIcon />
- </Button>
- <Button
- variant="outline"
- className="hidden size-8 lg:flex"
- size="icon"
- onClick={() => table.setPageIndex(table.getPageCount() - 1)}
- disabled={!table.getCanNextPage()}
- >
- <span className="sr-only">Go to last page</span>
- <ChevronsRightIcon />
- </Button>
- </div>
- </div>
- </div>
- </TabsContent>
- <TabsContent
- value="past-performance"
- className="flex flex-col px-4 lg:px-6"
- >
- <div className="aspect-video w-full flex-1 rounded-lg border border-dashed"></div>
- </TabsContent>
- <TabsContent value="key-personnel" className="flex flex-col px-4 lg:px-6">
- <div className="aspect-video w-full flex-1 rounded-lg border border-dashed"></div>
- </TabsContent>
- <TabsContent
- value="focus-documents"
- className="flex flex-col px-4 lg:px-6"
- >
- <div className="aspect-video w-full flex-1 rounded-lg border border-dashed"></div>
- </TabsContent>
- </Tabs>
- )
-}
-
-function TableCellViewer({ item, children }: { item: any, children: React.ReactNode }) {
-
- const i = React.useMemo(() =>
- (actionItems as any).find((a: any) => a.type === item?.type),
- [item?.original?.data?.type]
- )
- const Icon = i?.icon || HelpCircle
- return (
- <Sheet>
- <SheetTrigger asChild>
- {item.type === "social" ?
- <SocialButton item={item} /> :
- <Button variant="link" className="w-fit px-0 text-left text-foreground">
- <Badge variant="secondary" className="h-7 w-7 p-0 rounded-full">
- <Icon className="h-5 w-5" />
- </Badge>
- {children}
- </Button>}
- </SheetTrigger>
- <SheetContent side="right" className="flex flex-col">
- <DialogTitle className="text-2xl p-4 font-bold">
- {item.label}
- </DialogTitle>
- <MemoizedKeyValueDisplay data={item} />
- <SheetFooter className="mt-auto flex gap-2 sm:flex-col sm:space-x-0">
- <SheetClose asChild>
- <Button variant="outline" className="w-full">
- Done
- </Button>
- </SheetClose>
- </SheetFooter>
- </SheetContent>
- </Sheet>
- )
-}
-
-const SocialButton = ({ item }: { item: any }) => {
- const platformsIcons = usePlatformIcons()
- const platformIcon = React.useMemo(() => {
- // @ts-ignore
- return platformsIcons?.[item.platform]?.icon
- }, [platformsIcons, item.platform])
-
- return (
- <Button variant="link" className="w-fit px-0 text-left text-foreground">
- <Badge variant="secondary" className="h-7 w-7 p-0 rounded-full">
- {platformIcon}
- </Badge>
- {item.label}
- </Button>
- )
-}
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/table/page.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/table/page.tsx
deleted file mode 100644
index 3a7ef92a..00000000
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/table/page.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-"use client"
-import React, { useState } from 'react'
-import { DataTable } from './data-table'
-import { useQuery } from '@tanstack/react-query'
-import { useParams } from 'next/navigation'
-import { TableSkeleton } from '@/components/ui/table-skeleton'
-
-const IndividualsPage = () => {
-
- const { sketch_id, investigation_id } = useParams()
- const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 })
-
- const fetchIndividuals = async () => {
- const response = await fetch(`/api/investigations/${investigation_id}/sketches/${sketch_id}/table?page=${pagination.pageIndex + 1}&size=${pagination.pageSize}&includeEmails=true&includePhones=true`)
- return response.json()
- }
-
- const { data, isLoading, error, refetch, isRefetching } = useQuery({
- queryKey: ['individuals', 'table', sketch_id, pagination.pageIndex, pagination.pageSize],
- queryFn: fetchIndividuals,
- })
-
- if (error) return <div>Error fetching data.</div>
- return (
- <div className="w-full space-y-8 mx-auto py-12 px-8">
- {isLoading ? <TableSkeleton /> :
- <DataTable data={data}
- pageCount={data?.length}
- pagination={pagination}
- refetch={refetch}
- setPagination={setPagination}
- isRefetching={isRefetching}
- />
- }
- </div>
- )
-}
-
-export default IndividualsPage
\ No newline at end of file
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.tsx
new file mode 100644
index 00000000..524ac61e
--- /dev/null
+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/toolbar.tsx
@@ -0,0 +1,225 @@
+"use client"
+
+import { AvatarList } from "@/components/avatar-list"
+import { DownloadButton } from "@/components/download-button"
+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 type { Profile } from "@/types"
+import type { Sketch } from "@/types/sketch"
+import { useEdges, useNodes, useReactFlow } from "@xyflow/react"
+import {
+ ArrowDownUp,
+ Copy,
+ Filter,
+ Layers,
+ LayoutGrid,
+ Maximize,
+ Minus,
+ Redo,
+ Save,
+ Settings,
+ Share2,
+ Trash,
+ Undo,
+ ZoomIn,
+} from "lucide-react"
+import { memo, useCallback, useEffect, useMemo, useState } 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 repetition
+const ToolbarButton = memo(function ToolbarButton({
+ icon,
+ tooltip,
+ onClick,
+ disabled = false
+}: {
+ icon: React.ReactNode;
+ tooltip: string | React.ReactNode;
+ onClick?: () => void;
+ disabled?: boolean
+}) {
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ onClick={onClick}
+ disabled={disabled}
+ variant="ghost"
+ size="icon"
+ className="h-8 w-8"
+ >
+ {icon}
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>{tooltip}</TooltipContent>
+ </Tooltip>
+ )
+})
+
+// Separator component
+const Separator = memo(() => <div className="h-6 w-px bg-border" />)
+
+export const Toolbar = memo(function Toolbar({
+ investigation_id,
+ sketch_id,
+ sketch,
+ user_id,
+}: {
+ investigation_id: string;
+ sketch_id: string;
+ sketch: Sketch;
+ 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(
+ state => ({
+ currentNode: state.currentNode,
+ }),
+ shallow
+ )
+
+ // Memoize sketch members to prevent unnecessary rerenders
+ const sketchMembers = useMemo(() =>
+ sketch?.members?.map(({ profile }: { profile: Profile }) => ({
+ ...profile,
+ owner: profile.id === sketch.owner_id,
+ })) || [],
+ [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" />
+
+ <Separator />
+
+ <ToolbarButton
+ icon={<Copy className="h-4 w-4" />}
+ tooltip="Copy"
+ disabled={!currentNode}
+ />
+ <ToolbarButton
+ icon={<Trash className="h-4 w-4" />}
+ 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" />
+ <Separator />
+ <ToolbarButton
+ icon={<ZoomIn className="h-4 w-4" />}
+ tooltip="Zoom In"
+ onClick={handleZoomIn}
+ />
+ <ToolbarButton
+ icon={<Minus className="h-4 w-4" />}
+ tooltip="Zoom Out"
+ onClick={handleZoomOut}
+ />
+ <ToolbarButton
+ icon={<Maximize className="h-4 w-4" />}
+ tooltip="Fit to View"
+ onClick={handleFitView}
+ />
+
+ <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>
+ </TooltipProvider>
+ </div>
+ <div className="flex items-center">
+ <div className="px-2">
+ <AvatarList
+ size="md"
+ users={sketchMembers}
+ />
+ </div>
+ <DownloadButton
+ endpoint={`/api/investigations/${investigation_id}/sketches/${sketch_id}/table`}
+ name={investigation_id}
+ />
+ <MoreMenu sketch={sketch} user_id={user_id} />
+ <ScanButton />
+ </div>
+ </div>
+ )
+})
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/client.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/client.tsx
deleted file mode 100644
index d11bafff..00000000
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/client.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-"use client"
-
-import React, { useState } from 'react'
-import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'
-import { useFlowStore } from '@/store/flow-store'
-import { shallow } from 'zustand/shallow'
-import ActionDialog from './actions'
-import { Toolbar } from './toolbar'
-import { LeftPanel } from './left-panel'
-import { GraphPanel } from './graph-panel'
-import { RightPanel } from './right-panel'
-import { useQueryState } from 'nuqs'
-import { useQuery } from '@tanstack/react-query'
-
-const Client = () => {
- const [open, setOpen] = useState(false)
- const [isLeftPanelCollapsed, setIsLeftPanelCollapsed] = useState(false)
- const [isRightPanelCollapsed, setIsRightPanelCollapsed] = useState(false)
- const [activeTab, setActiveTab] = useQueryState("graph1")
-
- const stateSelector = (state: { currentNode: any; setCurrentNode: any }) => ({
- currentNode: state.currentNode,
- setCurrentNode: state.setCurrentNode,
- })
-
- const {
- currentNode,
- setCurrentNode
- } = useFlowStore(stateSelector, shallow)
-
-
- const query = useQuery({
- queryKey: ["sketch", "sketch", activeTab],
- queryFn: async () => {
- const res = await fetch(`${process.env.NEXT_PUBLIC_DOCKER_FLOWSINT_API}/sketch/nodes`)
- if (!res.ok || res.status === 404) {
- throw Error()
- }
- return res.json()
- },
- refetchOnWindowFocus: true,
- })
-
- return (
- <>
- <Toolbar />
- {/* Main Content */}
- <div className="grow w-screen relative">
- <ResizablePanelGroup autoSaveId="persistence" direction="horizontal" className="w-full h-full relative overflow-hidden">
- {/* Left Panel - Entity Palette */}
- <LeftPanel
- isCollapsed={isLeftPanelCollapsed}
- setIsCollapsed={setIsLeftPanelCollapsed}
- />
-
- <ResizableHandle withHandle />
-
- {/* Center Panel with Tabs and Graph */}
- <ResizablePanel defaultSize={65}>
- <GraphPanel
- activeTab={activeTab as string}
- setActiveTab={setActiveTab}
- currentNode={currentNode}
- setCurrentNode={setCurrentNode}
- setOpenDialog={setOpen}
- query={query}
- />
- </ResizablePanel>
-
- <ResizableHandle withHandle />
-
- {/* Right Panel */}
- <RightPanel
- isCollapsed={isRightPanelCollapsed}
- setIsCollapsed={setIsRightPanelCollapsed}
- currentNode={currentNode}
- />
- </ResizablePanelGroup>
-
- <ActionDialog setCurrentNode={setCurrentNode} setOpenDialog={setOpen} openDialog={open} />
- </div>
- </>
- )
-}
-
-export default Client
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/graph-panel.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/graph-panel.tsx
deleted file mode 100644
index 93c5d02f..00000000
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/graph-panel.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-import { Button } from '@/components/ui/button'
-import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'
-import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
-import { Loader, Network, Plus } from 'lucide-react'
-import Graph from './graph'
-import { ConsolePanel } from './console-panel'
-import { useState } from 'react'
-
-interface GraphPanelProps {
- activeTab: string
- setActiveTab: (tab: string) => void
- currentNode: any
- setCurrentNode: (node: any) => void
- setOpenDialog: (open: boolean) => void
- query: any
-}
-
-export function GraphPanel({ activeTab, setActiveTab, currentNode, setCurrentNode, setOpenDialog, query }: GraphPanelProps) {
- const [isBottomPanelCollapsed, setIsBottomPanelCollapsed] = useState(false)
- console.log(query.error)
- return (
- <div className="flex flex-col h-full">
- {/* Tabs header */}
- <div className="border-b bg-muted">
- <div className="flex items-center">
- <Tabs value={activeTab} onValueChange={setActiveTab} className="w-full">
- <TabsList className="bg-background h-8 w-full">
- <TabsTrigger value="graph1" className="text-xs">Investigation 1</TabsTrigger>
- <TabsTrigger value="graph2" className="text-xs">OSINT Analysis</TabsTrigger>
- <TabsTrigger value="graph3" className="text-xs">Network Map</TabsTrigger>
- <Button variant="ghost" size="icon" className="h-7 w-7 ml-1">
- <Plus className="h-4 w-4" />
- </Button>
- </TabsList>
- </Tabs>
- </div>
- </div>
-
- {/* Content area with vertical resizable panels */}
- <div className="grow">
- <ResizablePanelGroup direction="vertical" className="h-full">
- <ResizablePanel defaultSize={80} className="h-full">
- {/* Tab content */}
- <Tabs value={activeTab} className="h-full">
- <TabsContent value="graph1" className="h-full w-full m-0 p-0">
- {query.isLoading ? <div className='flex items-center justify-center w-full h-full'><Loader className='animate-spin' /></div> :
- !query.error && <Graph currentNode={currentNode} setOpenDialog={setOpenDialog} data={query.data} setCurrentNode={setCurrentNode} />
- }
- {!query.isLoading && query.error && <div className='flex items-center justify-center w-full h-full'>An error occured fetching graph data.</div>}
- </TabsContent>
- <TabsContent value="graph2" className="h-full m-0 p-0 data-[state=active]:block">
- <div className="flex h-full items-center justify-center text-muted-foreground">
- <Network className="h-16 w-16 opacity-20 mr-2" />
- <span>OSINT Analysis Graph</span>
- </div>
- </TabsContent>
- <TabsContent value="graph3" className="h-full m-0 p-0 data-[state=active]:block">
- <div className="flex h-full items-center justify-center text-muted-foreground">
- <Network className="h-16 w-16 opacity-20 mr-2" />
- <span>Network Map Graph</span>
- </div>
- </TabsContent>
- </Tabs>
- </ResizablePanel>
-
- <ResizableHandle withHandle />
-
- {/* Bottom Console Panel */}
- <ResizablePanel
- defaultSize={20}
- minSize={10}
- maxSize={40}
- collapsible={true}
- onCollapse={() => setIsBottomPanelCollapsed(true)}
- onExpand={() => setIsBottomPanelCollapsed(false)}
- >
- <ConsolePanel />
- </ResizablePanel>
- </ResizablePanelGroup>
- </div>
- </div>
- )
-}
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/graph.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/graph.tsx
deleted file mode 100644
index 61e0fe2c..00000000
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/graph.tsx
+++ /dev/null
@@ -1,212 +0,0 @@
-'use client';
-import { useEffect, useRef } from 'react';
-import cytoscape from 'cytoscape';
-// @ts-ignore
-import fcose from 'cytoscape-fcose';
-// @ts-ignore
-import cxtmenuPlugin from 'cytoscape-cxtmenu';
-cytoscape.use(cxtmenuPlugin);
-cytoscape.use(fcose)
-
-interface GraphProps {
- data: any;
- currentNode: any,
- setCurrentNode: (node: { data: any }) => void;
- setOpenDialog: (state: boolean) => void;
-}
-
-export default function Graph({ data, currentNode, setCurrentNode, setOpenDialog }: GraphProps) {
- const cyRef = useRef<HTMLDivElement>(null);
-
- useEffect(() => {
- if (!cyRef.current) return;
-
- const cy = cytoscape({
- container: cyRef.current,
- elements: data,
- // @ts-ignore
- layout: {
- name: 'cose',
- animate: true,
- idealEdgeLength: () => 200,
- nodeOverlap: 40,
- refresh: 20,
- fit: true,
- padding: 30,
- randomize: false,
- componentSpacing: 1000,
- nodeRepulsion: 400000,
- edgeElasticity: 100,
- nestingFactor: 5,
- gravity: 80,
- numIter: 1000,
- initialTemp: 200,
- coolingFactor: 0.95,
- minTemp: 1.0
- },
- style: [
- {
- selector: 'node[type="person"]',
- style: {
- 'background-color': '#4CAF50',
- "background-height": "2px",
- "background-width": "2px",
- 'shape': 'ellipse',
- 'background-image': '/person.svg', // petit icône SVG de profil
- 'background-fit': 'contain',
- 'label': 'data(label)',
- 'text-valign': 'bottom',
- 'text-halign': 'center',
- 'font-size': 8,
- 'text-margin-y': 25,
- 'padding': "12px",
- 'border-width': 4,
- 'border-color': '#4CAF50',
- 'width': 60,
- 'height': 60,
- 'text-margin-x': 0, // Décalage horizontal
- },
- },
- {
- selector: 'node[type="domain"]',
- style: {
- 'background-color': '#2196F3',
- 'shape': 'ellipse',
- 'background-image': '/icons/domain.svg',
- 'background-fit': 'cover',
- 'label': 'data(label)',
- 'text-valign': 'bottom',
- 'text-halign': 'center',
- 'color': '#333',
- 'font-size': 12,
- 'text-margin-y': 5,
- 'width': 60,
- 'height': 60,
- 'border-width': 3,
- 'border-color': '#2196F3',
- },
- },
- {
- selector: 'node[type="website"]',
- style: {
- 'background-color': '#2196F3',
- 'shape': 'ellipse',
- 'background-image': '/icons/domain.svg',
- 'background-fit': 'cover',
- 'label': 'data(label)',
- 'text-valign': 'bottom',
- 'text-halign': 'center',
- 'color': '#333',
- 'font-size': 12,
- 'text-margin-y': 5,
- 'width': 60,
- 'height': 60,
- 'border-width': 3,
- 'border-color': '#2196F3',
- },
- },
- {
- selector: 'edge',
- style: {
- 'width': 1,
- 'line-color': '#ccc',
- 'target-arrow-color': '#ccc',
- 'target-arrow-shape': 'triangle',
- 'curve-style': 'bezier',
- // 'label': 'data(label)',
- 'font-size': 10,
- 'text-rotation': 'autorotate',
- 'text-margin-y': -10,
- 'opacity': 0.5 // Réduit l'opacité des arêtes à 50%
- },
- },
- {
- selector: 'node',
- style: {
- 'background-color': '#666',
- 'shape': 'ellipse',
- 'label': 'data(label)',
- 'color': '#fff',
- 'font-size': 12,
- 'text-valign': 'center',
- 'text-halign': 'center',
- 'width': 40,
- 'height': 40,
- },
- },
- ],
- });
-
- // Context menu settings
- const defaults = {
- menuRadius: function () { return 60; }, // the outer radius in pixels
- selector: 'node', // elements matching this Cytoscape.js selector will trigger cxtmenus
- commands: [
- {
- content: 'View',
-
- select: function (ele: { data: () => any; }) {
- alert(ele.data());
- }
- },
- {
- id: 'add-node',
- tooltipText: 'add node',
- image: { src: "add.svg", width: 12, height: 12, x: 6, y: 4 },
- selector: 'node',
- coreAsWell: true,
- content: 'Add relation',
- select: function (ele: { data: () => any; }) {
- setOpenDialog(true)
- }
- }, {
- content: 'Delete',
- select: function (ele: { data: () => any; }) {
- alert(ele.data());
- }
- }
-
- ],
- fillColor: 'rgba(0, 0, 0, 0.75)',
- activeFillColor: 'rgba(1, 105, 217, 0.75)',
- activePadding: 20,
- indicatorSize: 24,
- separatorWidth: 3,
- spotlightPadding: 4,
- adaptativeNodeSpotlightRadius: false,
- minSpotlightRadius: 24,
- maxSpotlightRadius: 38,
- openMenuEvents: 'cxttapstart taphold',
- itemColor: 'white',
- itemTextShadowColor: 'transparent',
- zIndex: 9999,
- atMouse: false,
- outsideMenuCancel: false
- };
-
- // @ts-ignore - To bypass TypeScript errors
- const menu = cy.cxtmenu(defaults);
-
-
- cy.on('tap', 'node', (evt) => {
- const node = evt.target;
- console.log(node.data());
- setCurrentNode({ data: node.data() });
- });
-
- return () => {
- cy.destroy();
- // @ts-ignore - To bypass TypeScript errors
- if (menu && typeof menu.destroy === 'function') {
- menu.destroy();
- }
- // The navigator is automatically destroyed when cy is destroyed
- };
- }, [data, setCurrentNode]);
-
- return (
- <div style={{ position: 'relative', width: '100%', height: '100%' }}>
- <div ref={cyRef} style={{ width: '100%', height: '100%' }} />
- </div>
- );
-}
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/page.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/page.tsx
deleted file mode 100644
index 020c9266..00000000
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/page.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import Client from "./client"
-export default async function Home() {
- return (
- <Client />
- )
-}
diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/toolbar.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/toolbar.tsx
deleted file mode 100644
index 024a853b..00000000
--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/test/toolbar.tsx
+++ /dev/null
@@ -1,174 +0,0 @@
-import { Button } from '@/components/ui/button'
-import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
-import { ArrowDownUp, Copy, Filter, Layers, LayoutGrid, Maximize, Minus, Redo, Save, Search, Settings, Share2, Trash, Undo, ZoomIn } from 'lucide-react'
-
-export function Toolbar() {
- return (
- <div className="flex items-center h-10 border-b px-2 bg-card">
- <div className="flex items-center space-x-1">
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <Undo className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Undo</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <Redo className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Redo</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <div className="h-6 w-px bg-border" />
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <Copy className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Copy</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <Trash className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Delete</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <div className="h-6 w-px bg-border" />
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <ArrowDownUp className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Arrange</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <Filter className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Filter</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <div className="h-6 w-px bg-border" />
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <ZoomIn className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Zoom In</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <Minus className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Zoom Out</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <Maximize className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Fit to View</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <div className="h-6 w-px bg-border" />
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <LayoutGrid className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Layout</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <Layers className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Layers</TooltipContent>
- </Tooltip>
- </TooltipProvider>
- <div className="ml-auto flex items-center gap-2">
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <Save className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Save</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <Share2 className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Share</TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon" className="h-8 w-8">
- <Settings className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Settings</TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- </div>
- </div>
- )
-}
\ No newline at end of file
diff --git a/flowsint-web/src/components/avatar-list.tsx b/flowsint-web/src/components/avatar-list.tsx
index f5847c62..b009f585 100644
--- a/flowsint-web/src/components/avatar-list.tsx
+++ b/flowsint-web/src/components/avatar-list.tsx
@@ -54,13 +54,13 @@ export function AvatarList({
key={profile.id}
className={cn(
sizeClasses[size].avatar,
- "border-2 border-card bg-background relative",
+ "border-2 border-card bg-card relative",
"transition-transform",
"ring-0 ring-offset-0",
)}
>
<AvatarImage src={profile.avatar_url} alt={`${name}'s avatar`} />
- <AvatarFallback className={cn("text-xs", "bg-muted")}>{getInitials(name)}</AvatarFallback>
+ <AvatarFallback className={cn("text-xs text-white", avatarColor)}>{getInitials(name)}</AvatarFallback>
</Avatar>
</div>
)
diff --git a/flowsint-web/src/components/sketches/dynamic-form.tsx b/flowsint-web/src/components/sketches/dynamic-form.tsx
index b3c734d4..7b6dbba4 100644
--- a/flowsint-web/src/components/sketches/dynamic-form.tsx
+++ b/flowsint-web/src/components/sketches/dynamic-form.tsx
@@ -25,7 +25,7 @@ import { toast } from "sonner"
interface DynamicFormProps {
type: string
initialData?: Record<string, any>
- onSubmit?: (data: any) => Promise<void>
+ onSubmit?: (data: any) => void
isForm?: boolean
loading?: boolean
}
diff --git a/flowsint-web/src/components/sketches/new-actions.tsx b/flowsint-web/src/components/sketches/new-actions.tsx
index c35256d4..de376e3f 100644
--- a/flowsint-web/src/components/sketches/new-actions.tsx
+++ b/flowsint-web/src/components/sketches/new-actions.tsx
@@ -7,7 +7,7 @@ import { supabase } from "@/lib/supabase/client"
import { Button } from "@/components/ui/button"
import { ArrowLeft, ArrowRight } from 'lucide-react'
import { toast } from "sonner"
-import { cn } from "@/lib/utils"
+import { cn, flattenObj } from "@/lib/utils"
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@/components/ui/dialog"
import { actionItems, type ActionItem } from "@/lib/action-items"
import { Card, CardContent } from "@/components/ui/card"
@@ -26,8 +26,6 @@ export default function ActionDialog({ children, addNodes, setCurrentNode }: Act
const [openDialog, setOpenDialog] = useState(false)
const [openAddNodeModal, setOpenNodeModal] = useState(false)
const [currentNodeType, setCurrentNodeType] = useState<any | null>(null)
- const [error, setError] = useState<string | null>(null)
- const [loading, setLoading] = useState(false)
const [currentParent, setCurrentParent] = useState<ActionItem | null>(null)
const [navigationHistory, setNavigationHistory] = useState<ActionItem[]>([])
@@ -43,67 +41,39 @@ export default function ActionDialog({ children, addNodes, setCurrentNode }: Act
return
}
setCurrentNodeType(selectedItem)
- setError(null)
setOpenDialog(false)
setOpenNodeModal(true)
}
- const handleAddNode = async (data: any) => {
+ const handleAddNode = (data: any) => {
try {
- setLoading(true)
if (!currentNodeType || !sketch_id) {
toast.error("Invalid node type or sketch ID.")
- setLoading(false)
- return
- }
-
- const dataToInsert = { ...data, sketch_id }
-
- const { data: nodeData, error: insertError } = await supabase
- .from(currentNodeType.table)
- .insert(dataToInsert)
- .select("*")
- .single()
-
- if (insertError) {
- toast.error("Could not insert new node." + insertError.message)
- setLoading(false)
- return
- }
-
- if (!nodeData) {
- toast.error("Could not insert new node.")
- setLoading(false)
return
}
+ const id = crypto.randomUUID()
+ const label = data[currentNodeType.fields[0].name]
+ const type = currentNodeType.type
const newNode = {
- id: nodeData.id,
+ id,
type: "custom",
data: {
- ...nodeData,
- label: data[currentNodeType.fields[0].name],
- type: currentNodeType.type,
+ ...flattenObj(data),
+ label,
+ type,
+ id
},
- position: { x: 0, y: 0 },
- }
- if (addNodes) {
- addNodes(newNode)
- }
- if (setCurrentNode) {
- setCurrentNode(newNode)
+ position: { x: 100, y: 100 },
}
+ if (addNodes) addNodes(newNode)
+ if (setCurrentNode) setCurrentNode(newNode)
setOpenNodeModal(false)
- setError(null)
- toast.success(`${currentNodeType.label} successfully created.`)
} catch (error) {
- toast.error("Error submitting form.")
- setOpenDialog(false)
+ toast.error("Unexpected error during node creation.")
} finally {
- setLoading(false)
setOpenDialog(false)
}
}
-
const navigateToSubItems = (item: ActionItem) => {
setNavigationHistory([...navigationHistory, item])
setCurrentParent(item)
@@ -175,7 +145,6 @@ export default function ActionDialog({ children, addNodes, setCurrentNode }: Act
<DynamicForm
type={currentNodeType.type}
isForm={true}
- loading={loading}
onSubmit={handleAddNode}
/>
)}
diff --git a/flowsint-web/src/components/sketches/sketch-navigation.tsx b/flowsint-web/src/components/sketches/sketch-navigation.tsx
index 7719b4b8..e015d64f 100644
--- a/flowsint-web/src/components/sketches/sketch-navigation.tsx
+++ b/flowsint-web/src/components/sketches/sketch-navigation.tsx
@@ -73,7 +73,7 @@ function SketchNavigation({ investigation_id, sketch_id, sketch, user_id }: { in
</Fragment>
))}
</div>
- <div className="flex items-center ">
+ <div className="flex items-center">
<div className="px-2">
<AvatarList size="md" users={sketch?.members?.map(({ profile }: { profile: Profile }) => ({ ...profile, owner: profile.id === sketch.owner_id })) || []} />
</div>
diff --git a/flowsint-web/src/components/sketches/sketch/graph.tsx b/flowsint-web/src/components/sketches/sketch/graph.tsx
index f334ed16..142a650c 100644
--- a/flowsint-web/src/components/sketches/sketch/graph.tsx
+++ b/flowsint-web/src/components/sketches/sketch/graph.tsx
@@ -3,13 +3,11 @@ 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 {
@@ -22,7 +20,6 @@ import {
WorkflowIcon,
NetworkIcon,
WaypointsIcon,
- ExpandIcon,
} from "lucide-react"
import { useTheme } from "next-themes"
import NewActions from "../new-actions"
@@ -40,13 +37,6 @@ import { memo } from "react"
import { shallow } from "zustand/shallow"
import { TooltipProvider } from "@/components/ui/tooltip"
import NodeContextMenu from "./nodes/node-context-menu"
-import {
- ResizableHandle,
- ResizablePanel,
- ResizablePanelGroup,
-} from "@/components/ui/resizable"
-import NodesPanel from "./nodes-panel"
-import ProfilePanel from "./profile-panel"
import CustomNode from "./nodes/custom-node"
import FullscreenButton from "@/components/full-screen-button"
import FloatingEdge from "./simple-floating-edge"
@@ -172,8 +162,6 @@ export const FlowControls = memo(({
const LayoutFlow = memo(({ refetch, theme }: any) => {
const { fitView, zoomIn, zoomOut, addNodes, getNode, setCenter } = useReactFlow();
const { sketch_id } = useParams();
- const showMiniMap = useSketchStore(state => state.settings.showMiniMap);
- const setOpenActionDialog = useSketchStore(state => state.setOpenActionDialog);
const [_, setView] = useQueryState("view", { defaultValue: "flow-graph" });
// Use a ref for context menu state to avoid re-renders on position changes
@@ -200,8 +188,6 @@ const LayoutFlow = memo(({ refetch, theme }: any) => {
currentNode,
setCurrentNode,
reloading,
- updateNode,
- highlightPath
} = useFlowStore(stateSelector, shallow);
// Initialize layout once
@@ -282,7 +268,7 @@ const LayoutFlow = memo(({ refetch, theme }: any) => {
minZoom: 0.5,
fitView: true,
proOptions: { hideAttribution: true },
- edgeTypes,
+ // edgeTypes,
nodeTypes,
}), [
theme,
@@ -304,61 +290,26 @@ const LayoutFlow = memo(({ refetch, theme }: any) => {
);
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 bgColor="var(--background)" />
- {showMiniMap && <MiniMap className="!z-40 !bg-card" pannable />}
- </ReactFlow>
- </ContextMenuTrigger>
- <ContextMenuContent className="w-32">
- <ContextMenuItem onClick={() => setOpenActionDialog(true)}>
- <PlusIcon className="h-4 w-4 opacity-60" />
- <span>New node</span>
- </ContextMenuItem>
- <ContextMenuItem disabled>
- <GroupIcon className="h-4 w-4 opacity-60" />
- <span>New group</span>
- </ContextMenuItem>
- </ContextMenuContent>
- </ContextMenu>
- <NodeContextMenu
- x={nodeContextMenu?.x}
- y={nodeContextMenu?.y}
- onClose={closeNodeContextMenu}
- />
- </TooltipProvider>
- </ResizablePanel>
- <ResizableHandle withHandle />
- <ResizablePanel defaultSize={20} minSize={15} maxSize={40} className="h-full bg-card">
- <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>
+ <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>
);
});
@@ -385,16 +336,14 @@ function Graph({ graphQuery }: any) {
if (!mounted || isLoading) {
return (
- <div className="grow w-full flex items-center justify-center">
+ <div className="grow w-full h-full flex items-center justify-center">
<Loader /> Loading...
</div>
);
}
return (
- <ReactFlowProvider>
- <LayoutFlow refetch={refetch} theme={resolvedTheme || "light"} />
- </ReactFlowProvider>
+ <LayoutFlow refetch={refetch} theme={resolvedTheme || "light"} />
);
}
diff --git a/flowsint-web/src/components/sketches/sketch/launch-transform.tsx b/flowsint-web/src/components/sketches/sketch/launch-transform.tsx
index 8f22e455..d3b2bc0e 100644
--- a/flowsint-web/src/components/sketches/sketch/launch-transform.tsx
+++ b/flowsint-web/src/components/sketches/sketch/launch-transform.tsx
@@ -1,7 +1,6 @@
"use client"
import { useState } from "react"
-import { useLaunchSan } from "@/hooks/use-launch-scan"
import { useTransforms } from "@/hooks/use-transforms"
import { Button } from "@/components/ui/button"
import { Sparkles } from "lucide-react"
diff --git a/flowsint-web/src/components/sketches/sketch/nodes-panel.tsx b/flowsint-web/src/components/sketches/sketch/nodes-panel.tsx
index 3631b8cb..f7314d98 100644
--- a/flowsint-web/src/components/sketches/sketch/nodes-panel.tsx
+++ b/flowsint-web/src/components/sketches/sketch/nodes-panel.tsx
@@ -8,7 +8,7 @@ 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 } from '@/lib/utils'
+import { cn, typeColorMap } from '@/lib/utils'
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
// Mémoiser le composant SocialNode
@@ -80,9 +80,11 @@ const NodeRenderer = memo(({
)}
onClick={handleClick}
>
- <Badge variant="secondary" className="h-7 w-7 p-0 rounded-full">
- <Icon className="h-4 w-4 opacity-60" />
- </Badge>
+ <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>
<div className='grow truncate text-ellipsis'>{node?.data?.label}</div>
<TypeBadge type={node?.data?.type} />
</Button>
diff --git a/flowsint-web/src/components/sketches/sketch/nodes/custom-node.tsx b/flowsint-web/src/components/sketches/sketch/nodes/custom-node.tsx
index 67495312..054852b2 100644
--- a/flowsint-web/src/components/sketches/sketch/nodes/custom-node.tsx
+++ b/flowsint-web/src/components/sketches/sketch/nodes/custom-node.tsx
@@ -10,13 +10,11 @@ import {
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip-node";
-import { useSketchStore } from '@/store/sketch-store';
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 showNodeLabel = useSketchStore(state => state.settings.showNodeLabel);
const currentNodeId = useFlowStore(state => state.currentNode?.id,
(prev, next) => prev === next);
@@ -26,7 +24,7 @@ export default memo(({ data }: any) => {
<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", item?.size || "h-5 w-5")}>
+ <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>
diff --git a/flowsint-web/src/components/sketches/sketch/nodes/node-context-menu.tsx b/flowsint-web/src/components/sketches/sketch/nodes/node-context-menu.tsx
index f458c442..12ffe338 100644
--- a/flowsint-web/src/components/sketches/sketch/nodes/node-context-menu.tsx
+++ b/flowsint-web/src/components/sketches/sketch/nodes/node-context-menu.tsx
@@ -22,7 +22,6 @@ import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@/compone
import { NodeNotesEditor } from "./node-notes-editor"
import { nodesTypes } from "@/lib/utils"
import { actionItems, type ActionItem } from "@/lib/action-items"
-import { useLaunchSan } from "@/hooks/use-launch-scan"
import { DynamicForm } from "../../dynamic-form"
// Node Context Menu component
@@ -43,7 +42,6 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
const [nodeToInsert, setNodeToInsert] = useState<any | null>(null)
const { confirm } = useConfirm()
const [_, setIndividualId] = useQueryState("individual_id")
- const { launchScan } = useLaunchSan()
const _handleDeleteNode = async (type: string) => {
try {
@@ -236,12 +234,6 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
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 }}
>
- {Boolean(currentNode?.data?.email) && (
- <DropdownMenuItem onClick={() => launchScan("email", [currentNode?.data?.email as string], sketch_id as string)}>Search {nodeToInsert}</DropdownMenuItem>
- )}
- {Boolean(currentNode?.data?.username) && (
- <DropdownMenuItem onClick={() => launchScan("username", [currentNode?.data?.username as string], sketch_id as string)}>Search {nodeToInsert}</DropdownMenuItem>
- )}
{["individual", "organization"].includes(currentNode?.data?.type as string) && (
<DropdownMenuSub>
<DropdownMenuSubTrigger>New</DropdownMenuSubTrigger>
diff --git a/flowsint-web/src/components/sketches/sketch/profile-panel.tsx b/flowsint-web/src/components/sketches/sketch/profile-panel.tsx
index 61796360..bc9dd091 100644
--- a/flowsint-web/src/components/sketches/sketch/profile-panel.tsx
+++ b/flowsint-web/src/components/sketches/sketch/profile-panel.tsx
@@ -1,9 +1,9 @@
"use client"
-import { MoreHorizontalIcon, Sparkles } from "lucide-react"
+import { HelpCircle, MoreHorizontalIcon, Sparkles } from "lucide-react"
import { Button } from "@/components/ui/button"
import { useParams } from "next/navigation"
-import { memo } from "react"
-import { cn } from "@/lib/utils"
+import { memo, useMemo } from "react"
+import { cn, typeColorMap } from "@/lib/utils"
import { CopyButton } from "@/components/copy"
import {
DropdownMenu,
@@ -12,14 +12,26 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import Link from "next/link"
-import LaunchTransform from "./launch-transform"
+import { Badge } from "@/components/ui/badge"
+import { actionItems } from "@/lib/action-items"
export default function ProfilePanel({ data }: { data: any }) {
- const { sketch_id, investigation_id } = useParams()
+ const { investigation_id } = useParams()
+ const item = useMemo(() =>
+ (actionItems as any).find((a: any) => a.type === data?.type),
+ [data?.type]
+ )
+ const Icon = item?.icon || HelpCircle
return (
<div className=" overflow-y-auto overflow-x-hidden h-full">
- <div className="flex items-center sticky bg-card top-0 border-b justify-between px-4 py-2 gap-2 z-50">
+ <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>
<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}`}>
@@ -58,7 +70,7 @@ function KeyValueDisplay({ data, className }: KeyValueDisplayProps) {
return (
<div className={cn("w-full border-collapse", className)}>
{data && Object.entries(data)
- .filter(([key]) => !["id", "individual_id", "sketch_id", "group_id", "forceToolbarVisible"].includes(key))
+ .filter(([key]) => !["individual_id", "forceToolbarVisible"].includes(key))
.map(([key, value], index) => {
const val = Array.isArray(value) ? `${value.length} items` : value?.toString() || null
const display = (typeof val === "string" && val.startsWith("https://")) ? <a href={val} className="underline text-primary" target="_blank">{val}</a> : val
diff --git a/flowsint-web/src/components/transforms/scanner-node.tsx b/flowsint-web/src/components/transforms/scanner-node.tsx
index ac4d66f9..7a13e11e 100644
--- a/flowsint-web/src/components/transforms/scanner-node.tsx
+++ b/flowsint-web/src/components/transforms/scanner-node.tsx
@@ -1,8 +1,8 @@
import { memo } from "react"
import { Position } from "@xyflow/react"
-import { DatabaseSchemaNode, DatabaseSchemaNodeBody, DatabaseSchemaNodeHeader, DatabaseSchemaTableCell, DatabaseSchemaTableRow } from "../ui/schema-node"
import { LabeledHandle } from "../ui/labeled-handle"
import { Badge } from "../ui/badge"
+import { BaseNodeSchema } from "../ui/base-node"
// Types for the scanner node
export interface ScannerNodeData extends Record<string, unknown> {
@@ -40,9 +40,9 @@ function areEqual(prevProps: ScannerNodeProps, nextProps: ScannerNodeProps) {
// Memoized scanner node component with custom equality check
const ScannerNode = memo(({ data, selected, isConnectable }: ScannerNodeProps) => {
return (
- <DatabaseSchemaNode className="shadow-md !border-l-2 p-0" style={{ borderLeftWidth: "8px", borderLeftColor: data.color, cursor: "grab" }}
+ <BaseNodeSchema className="shadow-md rounded-md !border-l-2 p-0 bg-background" style={{ borderLeftWidth: "8px", borderLeftColor: data.color, cursor: "grab" }}
selected={selected}>
- <DatabaseSchemaNodeHeader>
+ <div className="p-3 bg-card rounded-t-md">
<div className="flex flex-col items-start gap-1 relative">
<div className="absolute top-0 right-0">
<Badge variant={"outline"} className="">{data.type}</Badge>
@@ -54,7 +54,7 @@ const ScannerNode = memo(({ data, selected, isConnectable }: ScannerNodeProps) =
{data.doc}
</p>
</div>
- </DatabaseSchemaNodeHeader>
+ </div>
<div>
<div className="grid grid-cols-2 py-1">
<div className="pl-0 pr-6">
@@ -85,7 +85,7 @@ const ScannerNode = memo(({ data, selected, isConnectable }: ScannerNodeProps) =
</div>
</div>
</div>
- </DatabaseSchemaNode>
+ </BaseNodeSchema>
)
}, areEqual)
diff --git a/flowsint-web/src/components/ui/base-node.tsx b/flowsint-web/src/components/ui/base-node.tsx
index c6370664..eea7dd56 100644
--- a/flowsint-web/src/components/ui/base-node.tsx
+++ b/flowsint-web/src/components/ui/base-node.tsx
@@ -30,7 +30,7 @@ export const BaseNodeSchema = forwardRef<
className={cn(
"relative rounded-md border bg-card p-5 text-card-foreground",
className,
- selected ? "border-muted-foreground shadow-lg" : "",
+ selected ? "shadow-lg" : "",
"hover:ring-1",
)}
tabIndex={0}
diff --git a/flowsint-web/src/components/ui/schema-node.tsx b/flowsint-web/src/components/ui/schema-node.tsx
deleted file mode 100644
index 073cc365..00000000
--- a/flowsint-web/src/components/ui/schema-node.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-import React, { ReactNode } from "react";
-import { BaseNodeSchema } from "./base-node";
-import { TableBody, TableRow, TableCell } from "@/components/ui/table";
-
-/* DATABASE SCHEMA NODE HEADER ------------------------------------------------ */
-/**
- * A container for the database schema node header.
- */
-export type DatabaseSchemaNodeHeaderProps = {
- children?: ReactNode;
-};
-
-export const DatabaseSchemaNodeHeader = ({
- children,
-}: DatabaseSchemaNodeHeaderProps) => {
- return (
- <h2 className="rounded-tl-md rounded-tr-md bg-secondary p-2 text-center text-sm">
- {children}
- </h2>
- );
-};
-
-/* DATABASE SCHEMA NODE BODY -------------------------------------------------- */
-/**
- * A container for the database schema node body that wraps the table.
- */
-export type DatabaseSchemaNodeBodyProps = {
- children?: ReactNode;
-};
-
-export const DatabaseSchemaNodeBody = ({
- children,
-}: DatabaseSchemaNodeBodyProps) => {
- return (
- <table className="border-spacing-10 overflow-visible w-full">
- <TableBody>{children}</TableBody>
- </table>
- );
-};
-
-/* DATABASE SCHEMA TABLE ROW -------------------------------------------------- */
-/**
- * A wrapper for individual table rows in the database schema node.
- */
-
-export type DatabaseSchemaTableRowProps = {
- children: ReactNode;
- className?: string;
-};
-
-export const DatabaseSchemaTableRow = ({
- children,
- className,
-}: DatabaseSchemaTableRowProps) => {
- return (
- <TableRow className={`relative text-xs ${className || ""}`}>
- {children}
- </TableRow>
- );
-};
-
-/* DATABASE SCHEMA TABLE CELL ------------------------------------------------- */
-/**
- * A simplified table cell for the database schema node.
- * Renders static content without additional dynamic props.
- */
-export type DatabaseSchemaTableCellProps = {
- className?: string;
- children?: ReactNode;
-};
-
-export const DatabaseSchemaTableCell = ({
- className,
- children,
-}: DatabaseSchemaTableCellProps) => {
- return <TableCell className={className}>{children}</TableCell>;
-};
-
-/* DATABASE SCHEMA NODE ------------------------------------------------------- */
-/**
- * The main DatabaseSchemaNode component that wraps the header and body.
- * It maps over the provided schema data to render rows and cells.
- */
-export type DatabaseSchemaNodeProps = {
- className?: string;
- selected?: boolean;
- children?: ReactNode;
- style?: React.CSSProperties;
-};
-
-export const DatabaseSchemaNode = ({
- className,
- selected,
- children,
- style
-}: DatabaseSchemaNodeProps) => {
- return (
- <BaseNodeSchema style={style} className={className} selected={selected}>
- {children}
- </BaseNodeSchema>
- );
-};
\ No newline at end of file
diff --git a/flowsint-web/src/components/ui/tabs.tsx b/flowsint-web/src/components/ui/tabs.tsx
index 0f2c35e9..e57c4f24 100644
--- a/flowsint-web/src/components/ui/tabs.tsx
+++ b/flowsint-web/src/components/ui/tabs.tsx
@@ -47,8 +47,8 @@ function TabsTrigger({
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset",
"disabled:pointer-events-none disabled:opacity-50",
"data-[state=inactive]:bg-muted/30 data-[state=inactive]:text-muted-foreground data-[state=inactive]:hover:bg-muted/50",
- "data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-b-0 data-[state=active]:relative",
- "data-[state=active]:after:absolute data-[state=active]:after:bottom-[-1px] data-[state=active]:after:left-0 data-[state=active]:after:right-0 data-[state=active]:after:h-[1px] data-[state=active]:after:bg-card", // Creates the connection to content
+ "data-[state=active]:bg-muted data-[state=active]:text-foreground data-[state=active]:border-b-0 data-[state=active]:relative",
+ // "data-[state=active]:after:absolute data-[state=active]:after:bottom-[-1px] data-[state=active]:after:left-0 data-[state=active]:after:right-0 data-[state=active]:after:h-[1px] data-[state=active]:after:bg-card", // Creates the connection to content
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
className
)}
diff --git a/flowsint-web/src/components/ui/tooltip.tsx b/flowsint-web/src/components/ui/tooltip.tsx
index 9239cd54..c97284df 100644
--- a/flowsint-web/src/components/ui/tooltip.tsx
+++ b/flowsint-web/src/components/ui/tooltip.tsx
@@ -46,7 +46,7 @@ function TooltipContent({
data-slot="tooltip-content"
sideOffset={sideOffset}
className={cn(
- "bg-card animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-w-sm rounded-md px-3 py-1.5 text-xs",
+ "bg-card animate-in shadow fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-w-sm rounded-md px-3 py-1.5 text-xs",
className
)}
{...props}
diff --git a/flowsint-web/src/hooks/use-debounce.ts b/flowsint-web/src/hooks/use-debounce.ts
new file mode 100644
index 00000000..7db2cc66
--- /dev/null
+++ b/flowsint-web/src/hooks/use-debounce.ts
@@ -0,0 +1,35 @@
+"use client"
+
+import { useEffect, useState } from "react"
+
+// This hook creates a debounced version of a value
+export function useDebounce<T>(value: T, delay: number): T {
+ const [debouncedValue, setDebouncedValue] = useState<T>(value)
+
+ useEffect(() => {
+ const timer = setTimeout(() => {
+ setDebouncedValue(value)
+ }, delay)
+
+ return () => {
+ clearTimeout(timer)
+ }
+ }, [value, delay])
+
+ return debouncedValue
+}
+
+// This function creates a debounced version of a function
+export function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void {
+ let timeout: NodeJS.Timeout | null = null
+
+ return (...args: Parameters<T>) => {
+ const later = () => {
+ timeout = null
+ func(...args)
+ }
+
+ if (timeout) clearTimeout(timeout)
+ timeout = setTimeout(later, wait)
+ }
+}
diff --git a/flowsint-web/src/hooks/use-keyboard-shortcut.ts b/flowsint-web/src/hooks/use-keyboard-shortcut.ts
new file mode 100644
index 00000000..57b711d8
--- /dev/null
+++ b/flowsint-web/src/hooks/use-keyboard-shortcut.ts
@@ -0,0 +1,42 @@
+"use client"
+
+import { useEffect, useState } from "react"
+
+type ShortcutOptions = {
+ key: string
+ ctrlOrCmd?: boolean
+ alt?: boolean
+ shift?: boolean
+ callback: () => void
+}
+export function useKeyboardShortcut(options: ShortcutOptions) {
+ const [isMac, setIsMac] = useState(false)
+ useEffect(() => {
+ // Détecte si l'utilisateur est sur Mac
+ if (typeof window !== "undefined") {
+ setIsMac(navigator.platform.toLowerCase().includes("mac"))
+ }
+ }, [])
+ useEffect(() => {
+ const handleKeyDown = (event: KeyboardEvent) => {
+ const { key, ctrlKey, altKey, shiftKey, metaKey } = event
+ if (key.toLowerCase() !== options.key.toLowerCase()) {
+ return
+ }
+ const cmdKeyPressed = isMac ? metaKey : ctrlKey
+ if (
+ (options.ctrlOrCmd === undefined || options.ctrlOrCmd === cmdKeyPressed) &&
+ (options.alt === undefined || options.alt === altKey) &&
+ (options.shift === undefined || options.shift === shiftKey)
+ ) {
+ event.preventDefault()
+ options.callback()
+ }
+ }
+ window.addEventListener("keydown", handleKeyDown)
+ return () => {
+ window.removeEventListener("keydown", handleKeyDown)
+ }
+ }, [options, isMac])
+ return { isMac }
+}
diff --git a/flowsint-web/src/hooks/use-launch-scan.ts b/flowsint-web/src/hooks/use-launch-scan.ts
deleted file mode 100644
index b6eba74e..00000000
--- a/flowsint-web/src/hooks/use-launch-scan.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-"use client"
-import { toast } from "sonner"
-import { performSearch } from "@/lib/actions/search"
-import { useConfirm } from "@/components/use-confirm-dialog"
-import { scans } from "@/lib/utils"
-export function useLaunchSan() {
- const { confirm } = useConfirm()
- const launchScan = async (scan_name: string, values: string[], sketch_id: string) => {
- const scan = scans.find((s) => s.name === scan_name)
- if (!values.length || !scan) {
- return toast.error("The item you want to search for was not found.")
- }
- const confirmed = await confirm({
- title: `${scan.scan_name} scan`,
- message: scan.description,
- })
- if (!confirmed) return
- toast.promise(performSearch(values, scan.scan_name, sketch_id), {
- loading: "Loading...",
- success: () => `Scan on "${values.join(",")}" has been launched.`,
- error: (error: any) => `An error occurred: ${JSON.stringify(error)}`,
- })
- }
- return {
- launchScan,
- }
-}
diff --git a/flowsint-web/src/lib/actions/search.ts b/flowsint-web/src/lib/actions/search.ts
deleted file mode 100644
index 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 file
diff --git a/flowsint-web/src/lib/actions/sketches.ts b/flowsint-web/src/lib/actions/sketches.ts
index 7ac3d0c0..5b687f0d 100644
--- a/flowsint-web/src/lib/actions/sketches.ts
+++ b/flowsint-web/src/lib/actions/sketches.ts
@@ -2,6 +2,8 @@
import { createClient } from "../supabase/server"
import { redirect } from "next/navigation"
import { revalidatePath } from "next/cache"
+import { Edge, Node } from "@xyflow/react"
+import { flattenObj } from "../utils"
export async function createNewSketch(formData: FormData, investigation_id: string) {
const supabase = await createClient()
@@ -24,3 +26,46 @@ export async function createNewSketch(formData: FormData, investigation_id: stri
return { success: false, error: "Failed to create new sketch." }
}
}
+
+type Schema = {
+ nodes: Node[]
+ edges: Edge[]
+ sketch_id: string
+}
+
+export async function saveSchemaToNeo4j(schema: Schema) {
+ try {
+ const { nodes, edges, sketch_id } = schema
+ if (!sketch_id) {
+ return { success: false, error: "Missing sketch ID" }
+ }
+ const supabase = await createClient()
+ 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`, {
+ method: "POST",
+ body: JSON.stringify({ nodes, edges }),
+ headers: {
+ 'Authorization': `Bearer ${jwt}`,
+ "Content-Type": "application/json",
+ },
+ })
+ if (!response.ok) {
+ const errorData = await response.json().catch(() => ({}))
+ return {
+ success: false,
+ error: errorData.message || "Failed to save schema to Neo4j"
+ }
+ }
+ return {
+ success: true,
+ timestamp: new Date().toISOString()
+ }
+ } catch (error) {
+ return {
+ success: false,
+ error: "Unexpected error during schema save"
+ }
+ }
+}
\ No newline at end of file
diff --git a/flowsint-web/src/lib/utils.ts b/flowsint-web/src/lib/utils.ts
index d2ae7c72..317aaa59 100644
--- a/flowsint-web/src/lib/utils.ts
+++ b/flowsint-web/src/lib/utils.ts
@@ -371,36 +371,20 @@ export function encodedRedirect(
return redirect(`${path}?${type}=${encodeURIComponent(message)}`);
}
-export const scans = [
- {
- name: "email",
- scan_name: "holehe_scanner",
- description: "Check if an email address is associated with existing online accounts using Holehe.",
- key: "email"
- },
- {
- name: "username",
- scan_name: "maigret_scanner",
- description: "Search for social media and online platform accounts associated with a given username using Maigret.",
- key: "username"
- },
- {
- name: "website",
- scan_name: "domain_infos_scanner",
- description: "Gather public information about a domain, including IP addresses, WHOIS data, geolocation, and subdomains.",
- key: "url"
- },
- {
- name: "individual",
- scan_name: "ghunt_people_scanner",
- description: "",
- key: "full_name"
- },
- {
- name: "phone",
- scan_name: "ignorant_scanner",
- description: "",
- key: "number"
- }
-]
+export const flattenObj = (ob: Record<string, any>) => {
+
+ let result: Record<string, any> = {};
+ for (const i in ob) {
+ if (ob[i] && typeof ob[i] === 'object' && !Array.isArray(ob[i])) {
+ const temp = flattenObj(ob[i]);
+ for (const j in temp) {
+ result[i + '.' + j] = temp[j];
+ }
+ }
+ else {
+ result[i] = ob[i];
+ }
+ }
+ return result;
+}
\ No newline at end of file
diff --git a/flowsint-web/styles/globals.css b/flowsint-web/styles/globals.css
index 8927d0d7..d6642687 100644
--- a/flowsint-web/styles/globals.css
+++ b/flowsint-web/styles/globals.css
@@ -4,7 +4,6 @@
@custom-variant dark (&:is(.dark *));
-
@layer base {
:root {
--sidebar-background: hsl(0, 0%, 98%);
@@ -27,6 +26,9 @@
--sidebar-border: hsl(240, 3.7%, 15.9%);
--sidebar-ring: hsl(217.2, 91.2%, 59.8%);
}
+ body {
+ letter-spacing: var(--tracking-normal);
+ }
}
@layer base {
@@ -59,7 +61,7 @@
}
:root {
- --background: oklch(.98 0 0);
+ --background: oklch(0.94 0.00 236.50);
--foreground: oklch(0.32 0 0);
--card: oklch(1.00 0 0);
--card-foreground: oklch(0.32 0 0);
@@ -103,12 +105,21 @@
--shadow-lg: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 4px 6px -1px hsl(0 0% 0% / 0.10);
--shadow-xl: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 8px 10px -1px hsl(0 0% 0% / 0.10);
--shadow-2xl: 0px 1px 3px 0px hsl(0 0% 0% / 0.25);
+ --shadow-color: hsl(0 0% 0%);
+ --shadow-opacity: 0.1;
+ --shadow-blur: 3px;
+ --shadow-spread: 0px;
+ --shadow-offset-x: 0px;
+ --shadow-offset-y: 1px;
+ --letter-spacing: 0em;
+ --spacing: 0.25rem;
+ --tracking-normal: 0em;
}
.dark {
- --background: oklch(0.24 0.02 268.40);
+ --background: oklch(0.26 0.03 262.67);
--foreground: oklch(0.92 0 0);
- --card: oklch(0.26 0.02 268.40);
+ --card: oklch(0.31 0.03 268.64);
--card-foreground: oklch(0.92 0 0);
--popover: oklch(0.29 0.02 268.40);
--popover-foreground: oklch(0.92 0 0);
@@ -150,6 +161,14 @@
--shadow-lg: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 4px 6px -1px hsl(0 0% 0% / 0.10);
--shadow-xl: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 8px 10px -1px hsl(0 0% 0% / 0.10);
--shadow-2xl: 0px 1px 3px 0px hsl(0 0% 0% / 0.25);
+ --shadow-color: hsl(0 0% 0%);
+ --shadow-opacity: 0.1;
+ --shadow-blur: 3px;
+ --shadow-spread: 0px;
+ --shadow-offset-x: 0px;
+ --shadow-offset-y: 1px;
+ --letter-spacing: 0em;
+ --spacing: 0.25rem;
}
@theme inline {
@@ -186,9 +205,9 @@
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-ring: var(--sidebar-ring);
- --font-sans: var(--font-sans);
- --font-mono: var(--font-mono);
- --font-serif: var(--font-serif);
+ --font-sans: Inter, sans-serif;
+ --font-mono: JetBrains Mono, monospace;
+ --font-serif: Source Serif 4, serif;
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
@@ -203,6 +222,21 @@
--shadow-lg: var(--shadow-lg);
--shadow-xl: var(--shadow-xl);
--shadow-2xl: var(--shadow-2xl);
+ --radius: 0.75rem;
+ --tracking-tighter: calc(var(--tracking-normal) - 0.05em);
+ --tracking-tight: calc(var(--tracking-normal) - 0.025em);
+ --tracking-wide: calc(var(--tracking-normal) + 0.025em);
+ --tracking-wider: calc(var(--tracking-normal) + 0.05em);
+ --tracking-widest: calc(var(--tracking-normal) + 0.1em);
+ --tracking-normal: var(--tracking-normal);
+ --spacing: var(--spacing);
+ --letter-spacing: var(--letter-spacing);
+ --shadow-offset-y: var(--shadow-offset-y);
+ --shadow-offset-x: var(--shadow-offset-x);
+ --shadow-spread: var(--shadow-spread);
+ --shadow-blur: var(--shadow-blur);
+ --shadow-opacity: var(--shadow-opacity);
+ --color-shadow-color: var(--shadow-color);
}
:root {
@@ -392,4 +426,301 @@
bottom: 0;
left: 0;
z-index: 103;
-}
\ No newline at end of file
+}
+ body {
+ letter-spacing: var(--tracking-normal);
+ }
+
+ :root {
+ --background: oklch(0.94 0.00 236.50);
+ --foreground: oklch(0.32 0 0);
+ --card: oklch(1.00 0 0);
+ --card-foreground: oklch(0.32 0 0);
+ --popover: oklch(1.00 0 0);
+ --popover-foreground: oklch(0.32 0 0);
+ --primary: oklch(0.64 0.17 36.44);
+ --primary-foreground: oklch(1.00 0 0);
+ --secondary: oklch(0.97 0.00 264.54);
+ --secondary-foreground: oklch(0.45 0.03 256.80);
+ --muted: oklch(0.98 0.00 247.84);
+ --muted-foreground: oklch(0.55 0.02 264.36);
+ --accent: oklch(0.91 0.02 243.82);
+ --accent-foreground: oklch(0.38 0.14 265.52);
+ --destructive: oklch(0.64 0.21 25.33);
+ --destructive-foreground: oklch(1.00 0 0);
+ --border: oklch(0.90 0.01 247.88);
+ --input: oklch(0.97 0.00 264.54);
+ --ring: oklch(0.64 0.17 36.44);
+ --chart-1: oklch(0.72 0.06 248.68);
+ --chart-2: oklch(0.79 0.09 35.96);
+ --chart-3: oklch(0.58 0.08 254.16);
+ --chart-4: oklch(0.50 0.08 259.49);
+ --chart-5: oklch(0.42 0.10 264.03);
+ --sidebar: oklch(0.90 0.00 258.33);
+ --sidebar-foreground: oklch(0.32 0 0);
+ --sidebar-primary: oklch(0.64 0.17 36.44);
+ --sidebar-primary-foreground: oklch(1.00 0 0);
+ --sidebar-accent: oklch(0.91 0.02 243.82);
+ --sidebar-accent-foreground: oklch(0.38 0.14 265.52);
+ --sidebar-border: oklch(0.93 0.01 264.53);
+ --sidebar-ring: oklch(0.64 0.17 36.44);
+ --font-sans: Inter, sans-serif;
+ --font-serif: Source Serif 4, serif;
+ --font-mono: JetBrains Mono, monospace;
+ --radius: 0.75rem;
+ --shadow-2xs: 0px 1px 3px 0px hsl(0 0% 0% / 0.05);
+ --shadow-xs: 0px 1px 3px 0px hsl(0 0% 0% / 0.05);
+ --shadow-sm: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 1px 2px -1px hsl(0 0% 0% / 0.10);
+ --shadow: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 1px 2px -1px hsl(0 0% 0% / 0.10);
+ --shadow-md: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 2px 4px -1px hsl(0 0% 0% / 0.10);
+ --shadow-lg: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 4px 6px -1px hsl(0 0% 0% / 0.10);
+ --shadow-xl: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 8px 10px -1px hsl(0 0% 0% / 0.10);
+ --shadow-2xl: 0px 1px 3px 0px hsl(0 0% 0% / 0.25);
+ }
+
+ .dark {
+ --background: oklch(0.26 0.03 262.67);
+ --foreground: oklch(0.92 0 0);
+ --card: oklch(0.31 0.03 268.64);
+ --card-foreground: oklch(0.92 0 0);
+ --popover: oklch(0.29 0.02 268.40);
+ --popover-foreground: oklch(0.92 0 0);
+ --primary: oklch(0.64 0.17 36.44);
+ --primary-foreground: oklch(1.00 0 0);
+ --secondary: oklch(0.31 0.03 266.71);
+ --secondary-foreground: oklch(0.92 0 0);
+ --muted: oklch(0.31 0.03 266.71);
+ --muted-foreground: oklch(0.72 0 0);
+ --accent: oklch(0.34 0.06 267.59);
+ --accent-foreground: oklch(0.88 0.06 254.13);
+ --destructive: oklch(0.64 0.21 25.33);
+ --destructive-foreground: oklch(1.00 0 0);
+ --border: oklch(0.38 0.03 269.73);
+ --input: oklch(0.38 0.03 269.73);
+ --ring: oklch(0.64 0.17 36.44);
+ --chart-1: oklch(0.72 0.06 248.68);
+ --chart-2: oklch(0.77 0.09 34.19);
+ --chart-3: oklch(0.58 0.08 254.16);
+ --chart-4: oklch(0.50 0.08 259.49);
+ --chart-5: oklch(0.42 0.10 264.03);
+ --sidebar: oklch(0.31 0.03 267.74);
+ --sidebar-foreground: oklch(0.92 0 0);
+ --sidebar-primary: oklch(0.64 0.17 36.44);
+ --sidebar-primary-foreground: oklch(1.00 0 0);
+ --sidebar-accent: oklch(0.34 0.06 267.59);
+ --sidebar-accent-foreground: oklch(0.88 0.06 254.13);
+ --sidebar-border: oklch(0.38 0.03 269.73);
+ --sidebar-ring: oklch(0.64 0.17 36.44);
+ --font-sans: Inter, sans-serif;
+ --font-serif: Source Serif 4, serif;
+ --font-mono: JetBrains Mono, monospace;
+ --radius: 0.75rem;
+ --shadow-2xs: 0px 1px 3px 0px hsl(0 0% 0% / 0.05);
+ --shadow-xs: 0px 1px 3px 0px hsl(0 0% 0% / 0.05);
+ --shadow-sm: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 1px 2px -1px hsl(0 0% 0% / 0.10);
+ --shadow: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 1px 2px -1px hsl(0 0% 0% / 0.10);
+ --shadow-md: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 2px 4px -1px hsl(0 0% 0% / 0.10);
+ --shadow-lg: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 4px 6px -1px hsl(0 0% 0% / 0.10);
+ --shadow-xl: 0px 1px 3px 0px hsl(0 0% 0% / 0.10), 0px 8px 10px -1px hsl(0 0% 0% / 0.10);
+ --shadow-2xl: 0px 1px 3px 0px hsl(0 0% 0% / 0.25);
+ }
+
+ @theme inline {
+ --color-background: var(--background);
+ --color-foreground: var(--foreground);
+ --color-card: var(--card);
+ --color-card-foreground: var(--card-foreground);
+ --color-popover: var(--popover);
+ --color-popover-foreground: var(--popover-foreground);
+ --color-primary: var(--primary);
+ --color-primary-foreground: var(--primary-foreground);
+ --color-secondary: var(--secondary);
+ --color-secondary-foreground: var(--secondary-foreground);
+ --color-muted: var(--muted);
+ --color-muted-foreground: var(--muted-foreground);
+ --color-accent: var(--accent);
+ --color-accent-foreground: var(--accent-foreground);
+ --color-destructive: var(--destructive);
+ --color-destructive-foreground: var(--destructive-foreground);
+ --color-border: var(--border);
+ --color-input: var(--input);
+ --color-ring: var(--ring);
+ --color-chart-1: var(--chart-1);
+ --color-chart-2: var(--chart-2);
+ --color-chart-3: var(--chart-3);
+ --color-chart-4: var(--chart-4);
+ --color-chart-5: var(--chart-5);
+ --color-sidebar: var(--sidebar);
+ --color-sidebar-foreground: var(--sidebar-foreground);
+ --color-sidebar-primary: var(--sidebar-primary);
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
+ --color-sidebar-accent: var(--sidebar-accent);
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
+ --color-sidebar-border: var(--sidebar-border);
+ --color-sidebar-ring: var(--sidebar-ring);
+
+ --font-sans: var(--font-sans);
+ --font-mono: var(--font-mono);
+ --font-serif: var(--font-serif);
+
+ --radius-sm: calc(var(--radius) - 4px);
+ --radius-md: calc(var(--radius) - 2px);
+ --radius-lg: var(--radius);
+ --radius-xl: calc(var(--radius) + 4px);
+
+ --shadow-2xs: var(--shadow-2xs);
+ --shadow-xs: var(--shadow-xs);
+ --shadow-sm: var(--shadow-sm);
+ --shadow: var(--shadow);
+ --shadow-md: var(--shadow-md);
+ --shadow-lg: var(--shadow-lg);
+ --shadow-xl: var(--shadow-xl);
+ --shadow-2xl: var(--shadow-2xl);
+ }
+
+ :root {
+ --background: oklch(0.98 0 0);
+ --foreground: oklch(0.32 0 0);
+ --card: oklch(1.00 0 0);
+ --card-foreground: oklch(0.32 0 0);
+ --popover: oklch(1.00 0 0);
+ --popover-foreground: oklch(0.32 0 0);
+ --primary: oklch(0.57 0.20 283.08);
+ --primary-foreground: oklch(1.00 0 0);
+ --secondary: oklch(0.82 0.07 249.35);
+ --secondary-foreground: oklch(0.32 0 0);
+ --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);
+ --destructive: oklch(0.64 0.21 25.33);
+ --destructive-foreground: oklch(1.00 0 0);
+ --border: oklch(0.87 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);
+ --chart-2: oklch(0.53 0.17 314.65);
+ --chart-3: oklch(0.34 0.18 301.68);
+ --chart-4: oklch(0.67 0.14 261.34);
+ --chart-5: oklch(0.59 0.10 245.74);
+ --sidebar: oklch(0.98 0 0);
+ --sidebar-foreground: oklch(0.32 0 0);
+ --sidebar-primary: oklch(0.57 0.20 283.08);
+ --sidebar-primary-foreground: oklch(1.00 0 0);
+ --sidebar-accent: oklch(0.65 0.06 117.43);
+ --sidebar-accent-foreground: oklch(1.00 0 0);
+ --sidebar-border: oklch(0.87 0 0);
+ --sidebar-ring: oklch(0.57 0.20 283.08);
+ --font-sans: Montserrat, sans-serif;
+ --font-serif: Playfair Display, serif;
+ --font-mono: Source Code Pro, monospace;
+ --radius: 0.5rem;
+ --shadow-2xs: 0px 5px 10px -2px hsl(0 0% 0% / 0.05);
+ --shadow-xs: 0px 5px 10px -2px hsl(0 0% 0% / 0.05);
+ --shadow-sm: 0px 5px 10px -2px hsl(0 0% 0% / 0.10), 0px 1px 2px -3px hsl(0 0% 0% / 0.10);
+ --shadow: 0px 5px 10px -2px hsl(0 0% 0% / 0.10), 0px 1px 2px -3px hsl(0 0% 0% / 0.10);
+ --shadow-md: 0px 5px 10px -2px hsl(0 0% 0% / 0.10), 0px 2px 4px -3px hsl(0 0% 0% / 0.10);
+ --shadow-lg: 0px 5px 10px -2px hsl(0 0% 0% / 0.10), 0px 4px 6px -3px hsl(0 0% 0% / 0.10);
+ --shadow-xl: 0px 5px 10px -2px hsl(0 0% 0% / 0.10), 0px 8px 10px -3px hsl(0 0% 0% / 0.10);
+ --shadow-2xl: 0px 5px 10px -2px hsl(0 0% 0% / 0.25);
+ }
+
+ .dark {
+ --background: oklch(0.23 0.01 264.29);
+ --foreground: oklch(0.92 0 0);
+ --card: oklch(0.21 0.01 264.29);
+ --card-foreground: oklch(0.92 0 0);
+ --popover: oklch(0.21 0.01 264.29);
+ --popover-foreground: oklch(0.92 0 0);
+ --primary: oklch(0.57 0.20 283.08);
+ --primary-foreground: oklch(1.00 0 0);
+ --secondary: oklch(0.34 0.18 301.68);
+ --secondary-foreground: oklch(0.92 0 0);
+ --muted: oklch(0.39 0 0);
+ --muted-foreground: oklch(0.72 0 0);
+ --accent: oklch(0.67 0.14 261.34);
+ --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);
+ --input: oklch(0.39 0 0);
+ --ring: oklch(0.57 0.20 283.08);
+ --chart-1: oklch(0.57 0.20 283.08);
+ --chart-2: oklch(0.53 0.17 314.65);
+ --chart-3: oklch(0.34 0.18 301.68);
+ --chart-4: oklch(0.67 0.14 261.34);
+ --chart-5: oklch(0.59 0.10 245.74);
+ --sidebar: oklch(0.23 0.01 264.29);
+ --sidebar-foreground: oklch(0.92 0 0);
+ --sidebar-primary: oklch(0.57 0.20 283.08);
+ --sidebar-primary-foreground: oklch(1.00 0 0);
+ --sidebar-accent: oklch(0.67 0.14 261.34);
+ --sidebar-accent-foreground: oklch(0.92 0 0);
+ --sidebar-border: oklch(0.39 0 0);
+ --sidebar-ring: oklch(0.57 0.20 283.08);
+ --font-sans: Montserrat, sans-serif;
+ --font-serif: Playfair Display, serif;
+ --font-mono: Source Code Pro, monospace;
+ --radius: 0.5rem;
+ --shadow-2xs: 0px 5px 10px -2px hsl(0 0% 0% / 0.05);
+ --shadow-xs: 0px 5px 10px -2px hsl(0 0% 0% / 0.05);
+ --shadow-sm: 0px 5px 10px -2px hsl(0 0% 0% / 0.10), 0px 1px 2px -3px hsl(0 0% 0% / 0.10);
+ --shadow: 0px 5px 10px -2px hsl(0 0% 0% / 0.10), 0px 1px 2px -3px hsl(0 0% 0% / 0.10);
+ --shadow-md: 0px 5px 10px -2px hsl(0 0% 0% / 0.10), 0px 2px 4px -3px hsl(0 0% 0% / 0.10);
+ --shadow-lg: 0px 5px 10px -2px hsl(0 0% 0% / 0.10), 0px 4px 6px -3px hsl(0 0% 0% / 0.10);
+ --shadow-xl: 0px 5px 10px -2px hsl(0 0% 0% / 0.10), 0px 8px 10px -3px hsl(0 0% 0% / 0.10);
+ --shadow-2xl: 0px 5px 10px -2px hsl(0 0% 0% / 0.25);
+ }
+
+ @theme inline {
+ --color-background: var(--background);
+ --color-foreground: var(--foreground);
+ --color-card: var(--card);
+ --color-card-foreground: var(--card-foreground);
+ --color-popover: var(--popover);
+ --color-popover-foreground: var(--popover-foreground);
+ --color-primary: var(--primary);
+ --color-primary-foreground: var(--primary-foreground);
+ --color-secondary: var(--secondary);
+ --color-secondary-foreground: var(--secondary-foreground);
+ --color-muted: var(--muted);
+ --color-muted-foreground: var(--muted-foreground);
+ --color-accent: var(--accent);
+ --color-accent-foreground: var(--accent-foreground);
+ --color-destructive: var(--destructive);
+ --color-destructive-foreground: var(--destructive-foreground);
+ --color-border: var(--border);
+ --color-input: var(--input);
+ --color-ring: var(--ring);
+ --color-chart-1: var(--chart-1);
+ --color-chart-2: var(--chart-2);
+ --color-chart-3: var(--chart-3);
+ --color-chart-4: var(--chart-4);
+ --color-chart-5: var(--chart-5);
+ --color-sidebar: var(--sidebar);
+ --color-sidebar-foreground: var(--sidebar-foreground);
+ --color-sidebar-primary: var(--sidebar-primary);
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
+ --color-sidebar-accent: var(--sidebar-accent);
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
+ --color-sidebar-border: var(--sidebar-border);
+ --color-sidebar-ring: var(--sidebar-ring);
+
+ --font-sans: var(--font-sans);
+ --font-mono: var(--font-mono);
+ --font-serif: var(--font-serif);
+
+ --radius-sm: calc(var(--radius) - 4px);
+ --radius-md: calc(var(--radius) - 2px);
+ --radius-lg: var(--radius);
+ --radius-xl: calc(var(--radius) + 4px);
+
+ --shadow-2xs: var(--shadow-2xs);
+ --shadow-xs: var(--shadow-xs);
+ --shadow-sm: var(--shadow-sm);
+ --shadow: var(--shadow);
+ --shadow-md: var(--shadow-md);
+ --shadow-lg: var(--shadow-lg);
+ --shadow-xl: var(--shadow-xl);
+ --shadow-2xl: var(--shadow-2xl);
+ }
\ No newline at end of file