Skip to content

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

feat: add relation from node context menu

dextmorgn41165a67f5eb
diff --git a/flowsint-api/app/api/routes/sketches.py b/flowsint-api/app/api/routes/sketches.py
index cbd04a64..188028d7 100644
--- a/flowsint-api/app/api/routes/sketches.py
+++ b/flowsint-api/app/api/routes/sketches.py
@@ -150,7 +150,6 @@ def dict_to_cypher_props(props: dict, prefix: str = "") -> str:
def add_node(sketch_id: str, node: NodeInput, current_user: Profile = Depends(get_current_user)):
node_data = node.data.model_dump()
- print(node_data)
node_type = node_data["type"]
properties = {
@@ -166,12 +165,10 @@ def add_node(sketch_id: str, node: NodeInput, current_user: Profile = Depends(ge
cypher_props = dict_to_cypher_props(properties)
- print(properties)
- print(cypher_props)
create_query = f"""
MERGE (d:`{node_type}` {{ {cypher_props} }})
- RETURN d as node
+ RETURN d as node, elementId(d) as id
"""
try:
@@ -185,11 +182,13 @@ def add_node(sketch_id: str, node: NodeInput, current_user: Profile = Depends(ge
try:
new_node = create_result[0]["node"]
+ new_node["id"] = create_result[0]["id"]
except (IndexError, KeyError) as e:
print(f"Error extracting node_id: {e}, result: {create_result}")
raise HTTPException(status_code=500, detail="Failed to extract node data from response")
new_node["data"] = node_data
+ new_node["data"]["id"] = new_node["id"]
return {
"status": "node added",
@@ -223,7 +222,7 @@ def add_edge(sketch_id: str, relation: RelationInput, current_user: Profile = De
except Exception as e:
print(f"Edge creation error: {e}")
raise HTTPException(status_code=500, detail="Failed to create edge")
- print(result)
+
if not result:
raise HTTPException(status_code=400, detail="Edge creation failed")
diff --git a/flowsint-api/app/api/routes/types.py b/flowsint-api/app/api/routes/types.py
index 478fe0b3..41853c32 100644
--- a/flowsint-api/app/api/routes/types.py
+++ b/flowsint-api/app/api/routes/types.py
@@ -54,8 +54,8 @@ async def get_types_list():
extract_input_schema(SocialProfile, label_key="username", icon="username"),
extract_input_schema(Organization, label_key="name"),
extract_input_schema(Username, label_key="username", icon="username"),
- extract_input_schema(Alias, label_key="alias", icon="alias"),
- extract_input_schema(Affiliation, label_key="organization", icon="affiliation"),
+ # extract_input_schema(Alias, label_key="alias", icon="alias"),
+ # extract_input_schema(Affiliation, label_key="organization", icon="affiliation"),
],
},
{
@@ -105,7 +105,7 @@ async def get_types_list():
"id": uuid4(),
"type": "security_category",
"key": "security",
- "icon": "shield",
+ "icon": "credential",
"label": "Security & Access",
"fields": [],
"children": [
@@ -114,9 +114,9 @@ async def get_types_list():
extract_input_schema(Device, label_key="device_id", icon="device"),
extract_input_schema(Malware, label_key="name", icon="malware"),
extract_input_schema(Weapon, label_key="name", icon="weapon"),
- extract_input_schema(Script, label_key="name", icon="script"),
- extract_input_schema(ReputationScore, label_key="entity_id", icon="reputation"),
- extract_input_schema(RiskProfile, label_key="entity_id", icon="risk"),
+ # extract_input_schema(Script, label_key="name", icon="script"),
+ # extract_input_schema(ReputationScore, label_key="entity_id", icon="reputation"),
+ # extract_input_schema(RiskProfile, label_key="entity_id", icon="risk"),
],
},
{
@@ -135,11 +135,11 @@ async def get_types_list():
"id": uuid4(),
"type": "financial_category",
"key": "financial",
- "icon": "bank",
+ "icon": "creditcard",
"label": "Financial Data",
"fields": [],
"children": [
- extract_input_schema(BankAccount, label_key="account_number", icon="bank"),
+ extract_input_schema(BankAccount, label_key="account_number", icon="creditcard"),
extract_input_schema(CreditCard, label_key="card_number", icon="creditcard"),
],
},
diff --git a/flowsint-api/app/scanners/websites/to_crawler.py b/flowsint-api/app/scanners/websites/to_crawler.py
index 83a7becf..97130a6e 100644
--- a/flowsint-api/app/scanners/websites/to_crawler.py
+++ b/flowsint-api/app/scanners/websites/to_crawler.py
@@ -1,9 +1,5 @@
-from datetime import datetime
from typing import List, Dict, Any, TypeAlias, Union, Set
-import requests
-import re
-from bs4 import BeautifulSoup
-from urllib.parse import urljoin, urlparse
+from urllib.parse import urlparse
from app.utils import resolve_type
from app.scanners.base import Scanner
from app.types.website import Website
@@ -11,8 +7,7 @@ from app.types.phone import Phone
from app.types.email import Email
from pydantic import TypeAdapter
from app.core.logger import Logger
-from reconcrawl import Crawler
-
+from app.tools.network.reconcrawl import ReconCrawlTool
InputType: TypeAlias = List[Website]
OutputType: TypeAlias = List[Dict[str, Union[Website, List[Phone], List[Email]]]]
@@ -93,18 +88,8 @@ class WebsiteToCrawler(Scanner):
for website in data:
try:
Logger.info(self.sketch_id, {"message": f"Starting comprehensive crawl of {str(website.url)}"})
- crawler = Crawler(
- url=str(website.url),
- max_pages=50,
- timeout=30,
- delay=1.0,
- verbose=False,
- recursive=True
- )
- crawler.fetch()
- crawler.extract_emails()
- crawler.extract_phones()
- crawl_result = crawler.get_results()
+ crawler = ReconCrawlTool()
+ crawl_result = crawler.launch(website.url, {"recursive": True, "verify_ssl": True, "max_pages": 500, "timeout": 10, "delay": 1.0, "verbose": False})
website_result = {
"website": str(website.url), # Store as string instead of Website object
"emails": [],
diff --git a/flowsint-api/app/tools/base.py b/flowsint-api/app/tools/base.py
index a5580a5f..6ee7f8fb 100644
--- a/flowsint-api/app/tools/base.py
+++ b/flowsint-api/app/tools/base.py
@@ -16,6 +16,11 @@ class Tool(ABC):
@abstractmethod
def description(cls) -> str:
pass
+
+ @classmethod
+ @abstractmethod
+ def version(cls) -> str:
+ pass
@abstractmethod
def launch(self, value: str, *args, **kwargs) -> Any:
diff --git a/flowsint-api/app/tools/network/reconcrawl.py b/flowsint-api/app/tools/network/reconcrawl.py
new file mode 100644
index 00000000..5feb1024
--- /dev/null
+++ b/flowsint-api/app/tools/network/reconcrawl.py
@@ -0,0 +1,51 @@
+from typing import Any, Dict
+
+from app.tools.base import Tool
+
+class ReconCrawlTool(Tool):
+
+ def __init__(self):
+ super().__init__()
+
+ @classmethod
+ def name(cls) -> str:
+ return "reconcrawl"
+
+ @classmethod
+ def description(cls) -> str:
+ return "Emails and phone numbers crawler from websites by analyzing their HTML and embedded scripts."
+
+ @classmethod
+ def category(cls) -> str:
+ return "Crawler"
+
+ def install(self) -> None:
+ pass
+ def version(self) -> str:
+ pass
+
+
+ def is_installed(self) -> bool:
+ try:
+ import reconcrawl
+ return True
+ except ImportError:
+ return False
+
+ def launch(self, url: str, args: Dict[str, Any] = None) -> Any:
+ from reconcrawl import Crawler
+ crawler = Crawler(
+ url=str(url),
+ max_pages=args.get("max_pages", 500),
+ timeout=args.get("timeout", 30),
+ delay=args.get("delay", 1.0),
+ verbose=args.get("verbose", False),
+ recursive=args.get("recursive", True),
+ verify_ssl=args.get("verify_ssl", False) # Default to False for compatibility
+ )
+ crawler.fetch()
+ crawler.extract_emails()
+ crawler.extract_phones()
+ crawl_result = crawler.get_results()
+ return crawl_result
+
diff --git a/flowsint-api/app/types/weapon.py b/flowsint-api/app/types/weapon.py
index b1235983..27adffe2 100644
--- a/flowsint-api/app/types/weapon.py
+++ b/flowsint-api/app/types/weapon.py
@@ -1,28 +1,34 @@
from pydantic import BaseModel, Field
-from typing import Optional, List
+from typing import Literal, Optional, List
class Weapon(BaseModel):
name: str = Field(..., description="Weapon name or identifier", title="Name")
- type: Optional[str] = Field(None, description="Type of weapon (malware, exploit, tool, etc.)", title="Type")
- category: Optional[str] = Field(None, description="Weapon category (ransomware, trojan, exploit, etc.)", title="Category")
+ type: Optional[Literal["firearm", "melee", "explosive", "bladed", "blunt", "chemical", "biological", "radiological", "nuclear", "other"]] = Field(None, description="Weapon category (handgun, rifle, shotgun, knife, etc.)", title="Category")
description: Optional[str] = Field(None, description="Weapon description", title="Description")
- first_seen: Optional[str] = Field(None, description="First time weapon was observed", title="First Seen")
- last_seen: Optional[str] = Field(None, description="Last time weapon was observed", title="Last Seen")
- is_active: Optional[bool] = Field(None, description="Whether weapon is currently active", title="Is Active")
- threat_level: Optional[str] = Field(None, description="Threat level assessment", title="Threat Level")
- targets: Optional[List[str]] = Field(None, description="Target platforms or systems", title="Targets")
- attack_vectors: Optional[List[str]] = Field(None, description="Attack vectors used", title="Attack Vectors")
- payload_type: Optional[str] = Field(None, description="Type of payload delivered", title="Payload Type")
- delivery_method: Optional[str] = Field(None, description="Method of delivery", title="Delivery Method")
- evasion_techniques: Optional[List[str]] = Field(None, description="Evasion techniques used", title="Evasion Techniques")
- persistence_mechanisms: Optional[List[str]] = Field(None, description="Persistence mechanisms", title="Persistence Mechanisms")
- command_control: Optional[List[str]] = Field(None, description="Command and control infrastructure", title="Command & Control")
- encryption_methods: Optional[List[str]] = Field(None, description="Encryption methods used", title="Encryption Methods")
- obfuscation_techniques: Optional[List[str]] = Field(None, description="Obfuscation techniques", title="Obfuscation Techniques")
+ manufacturer: Optional[str] = Field(None, description="Weapon manufacturer", title="Manufacturer")
+ model: Optional[str] = Field(None, description="Weapon model", title="Model")
+ caliber: Optional[str] = Field(None, description="Caliber or ammunition type", title="Caliber")
+ serial_number: Optional[str] = Field(None, description="Weapon serial number", title="Serial Number")
+ year_manufactured: Optional[int] = Field(None, description="Year weapon was manufactured", title="Year Manufactured")
+ country_of_origin: Optional[str] = Field(None, description="Country where weapon was manufactured", title="Country of Origin")
+ legal_status: Optional[str] = Field(None, description="Legal status (legal, illegal, restricted, etc.)", title="Legal Status")
+ registration_status: Optional[str] = Field(None, description="Registration status", title="Registration Status")
+ condition: Optional[str] = Field(None, description="Physical condition of the weapon", title="Condition")
+ modifications: Optional[List[str]] = Field(None, description="Any modifications made to the weapon", title="Modifications")
+ accessories: Optional[List[str]] = Field(None, description="Attached accessories", title="Accessories")
+ capacity: Optional[str] = Field(None, description="Magazine capacity or ammunition capacity", title="Capacity")
+ barrel_length: Optional[str] = Field(None, description="Barrel length", title="Barrel Length")
+ overall_length: Optional[str] = Field(None, description="Overall weapon length", title="Overall Length")
+ weight: Optional[str] = Field(None, description="Weapon weight", title="Weight")
+ action_type: Optional[str] = Field(None, description="Action type (semi-automatic, bolt-action, etc.)", title="Action Type")
+ firing_mode: Optional[str] = Field(None, description="Firing mode (single shot, burst, full auto, etc.)", title="Firing Mode")
+ safety_features: Optional[List[str]] = Field(None, description="Safety features present", title="Safety Features")
source: Optional[str] = Field(None, description="Source of weapon information", title="Source")
- analysis_report: Optional[str] = Field(None, description="Link to analysis report", title="Analysis Report")
- sample_hashes: Optional[List[str]] = Field(None, description="Sample file hashes", title="Sample Hashes")
- ioc_indicators: Optional[List[str]] = Field(None, description="Indicators of compromise", title="IOC Indicators")
- attribution: Optional[str] = Field(None, description="Attributed threat actor or group", title="Attribution")
- cve_references: Optional[List[str]] = Field(None, description="Related CVE references", title="CVE References")
- mitre_techniques: Optional[List[str]] = Field(None, description="MITRE ATT&CK techniques", title="MITRE Techniques")
\ No newline at end of file
+ location_found: Optional[str] = Field(None, description="Location where weapon was found", title="Location Found")
+ date_found: Optional[str] = Field(None, description="Date weapon was found", title="Date Found")
+ evidence_number: Optional[str] = Field(None, description="Evidence number or case reference", title="Evidence Number")
+ owner: Optional[str] = Field(None, description="Registered owner or possessor", title="Owner")
+ purchase_date: Optional[str] = Field(None, description="Date weapon was purchased", title="Purchase Date")
+ purchase_location: Optional[str] = Field(None, description="Location where weapon was purchased", title="Purchase Location")
+ price: Optional[float] = Field(None, description="Purchase price", title="Price")
+ notes: Optional[str] = Field(None, description="Additional notes or observations", title="Notes")
\ No newline at end of file
diff --git a/flowsint-api/tests/tools/network/reconcrawl.py b/flowsint-api/tests/tools/network/reconcrawl.py
new file mode 100644
index 00000000..1abbf1e4
--- /dev/null
+++ b/flowsint-api/tests/tools/network/reconcrawl.py
@@ -0,0 +1,20 @@
+import re
+from typing import Dict
+from app.tools.network.reconcrawl import ReconCrawlTool
+
+tool = ReconCrawlTool()
+
+def test_name():
+ assert tool.name() == "reconcrawl"
+
+def test_description():
+ assert tool.description() == "Emails and phone numbers crawler from websites by analyzing their HTML and embedded scripts."
+
+def test_category():
+ assert tool.category() == "Crawler"
+
+def test_install():
+ tool.install()
+ assert tool.is_installed() == True
+
+
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/public/flowsint.png b/flowsint-app/src/renderer/public/flowsint.png
new file mode 100644
index 00000000..cc89f1da
Binary files /dev/null and b/flowsint-app/src/renderer/public/flowsint.png differ
diff --git a/flowsint-app/src/renderer/public/icon-full-size.png b/flowsint-app/src/renderer/public/icon-full-size.png
deleted file mode 100644
index 1cbc0600..00000000
Binary files a/flowsint-app/src/renderer/public/icon-full-size.png and /dev/null differ
diff --git a/flowsint-app/src/renderer/public/icon-large.png b/flowsint-app/src/renderer/public/icon-large.png
new file mode 100644
index 00000000..a25fb867
Binary files /dev/null and b/flowsint-app/src/renderer/public/icon-large.png differ
diff --git a/flowsint-app/src/renderer/public/icons/credential.svg b/flowsint-app/src/renderer/public/icons/credential.svg
new file mode 100644
index 00000000..3dd4e6dd
--- /dev/null
+++ b/flowsint-app/src/renderer/public/icons/credential.svg
@@ -0,0 +1 @@
+<?xml version="1.0"?><svg fill="#F7D154" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.26 11.74L10 14H8v2H6v2l-2 2H0v-4l8.26-8.26a6 6 0 1 1 4 4zm4.86-4.62A3 3 0 0 0 15 2a3 3 0 0 0-2.12.88l4.24 4.24z"/></svg>
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/public/icons/creditcard.svg b/flowsint-app/src/renderer/public/icons/creditcard.svg
new file mode 100644
index 00000000..c05e42f7
--- /dev/null
+++ b/flowsint-app/src/renderer/public/icons/creditcard.svg
@@ -0,0 +1 @@
+<?xml version="1.0"?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg height="512px" style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="512px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="_x33_63-visa_x2C__Credit_card"><g><path d="M485.999,115.445v281.108c0,21.165-17.17,38.335-38.333,38.335H64.334 c-21.163,0-38.333-17.17-38.333-38.335V115.445c0-21.164,17.17-38.334,38.333-38.334h383.332 C468.829,77.111,485.999,94.282,485.999,115.445z" style="fill:#0353A5;"/><g><path d="M421.791,192.111h-24.837c-7.666,0-13.498,2.237-16.771,10.302l-47.678,113.8h33.702 c0,0,5.511-15.332,6.708-18.606h41.209c0.956,4.392,3.832,18.606,3.832,18.606h29.709L421.791,192.111z M382.179,272.211 c2.637-7.106,12.778-34.738,12.778-34.738c-0.16,0.239,2.636-7.268,4.233-11.9l2.235,10.702c0,0,6.07,29.708,7.428,35.937 H382.179z" style="fill:#FFFFFF;"/><path d="M164.32,192.111l-31.385,84.653l-3.435-17.171l-11.181-57.021 c-1.837-7.906-7.507-10.142-14.535-10.461H52.116l-0.56,2.476c12.618,3.195,23.879,7.827,33.701,13.656l28.591,107.813h33.94 l50.471-123.944H164.32z" style="fill:#FFFFFF;"/><polygon points="211.197,192.111 191.152,316.214 223.178,316.214 243.302,192.111 " style="fill:#FFFFFF;"/><path d="M307.989,241.865c-11.26-5.67-18.128-9.504-18.128-15.333c0.159-5.271,5.829-10.702,18.448-10.702 c10.461-0.24,18.128,2.237,23.877,4.711l2.876,1.358l4.392-26.833c-6.31-2.477-16.371-5.272-28.75-5.272 c-31.704,0-53.985,16.932-54.145,41.049c-0.24,17.809,15.971,27.713,28.11,33.701c12.379,6.068,16.611,10.063,16.611,15.413 c-0.159,8.307-10.063,12.14-19.247,12.14c-12.777,0-19.646-1.998-30.105-6.627l-4.234-1.999l-4.472,27.871 c7.505,3.435,21.402,6.47,35.777,6.631c33.701,0.078,55.663-16.614,55.902-42.328 C335.063,261.511,326.438,250.729,307.989,241.865z" style="fill:#FFFFFF;"/></g></g></g><g id="Layer_1"/></svg>
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/public/icons/device.svg b/flowsint-app/src/renderer/public/icons/device.svg
new file mode 100644
index 00000000..4586746d
--- /dev/null
+++ b/flowsint-app/src/renderer/public/icons/device.svg
@@ -0,0 +1 @@
+<?xml version="1.0"?><svg fill="#EAC597" style="enable-background:new 0 0 24 24;" version="1.1" viewBox="0 0 24 24" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="info"/><g id="icons"><path d="M20,4c0-2.2-1.8-4-4-4H8C5.8,0,4,1.8,4,4v16c0,2.2,1.8,4,4,4h8c2.2,0,4-1.8,4-4V4z M13,22h-2c-0.6,0-1-0.4-1-1 c0-0.6,0.4-1,1-1h2c0.6,0,1,0.4,1,1C14,21.6,13.6,22,13,22z M18,17c0,0.6-0.4,1-1,1H7c-0.6,0-1-0.4-1-1V5c0-0.6,0.4-1,1-1h10 c0.6,0,1,0.4,1,1V17z" id="mobile"/></g></svg>
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/public/icons/document.svg b/flowsint-app/src/renderer/public/icons/document.svg
new file mode 100644
index 00000000..e67fa126
--- /dev/null
+++ b/flowsint-app/src/renderer/public/icons/document.svg
@@ -0,0 +1 @@
+<?xml version="1.0"?><svg id="fill" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><rect height="58" style="fill:#cfcfd9" width="46" x="9" y="3"/><rect height="50" style="fill:#d9dae2" width="38" x="13" y="7"/><path d="M13,7H51a0,0,0,0,1,0,0V19A38,38,0,0,1,13,57h0a0,0,0,0,1,0,0V7A0,0,0,0,1,13,7Z" style="fill:#e5e6eb"/><path d="M32,21a4,4,0,0,1-4-4,3.952,3.952,0,0,1,.492-1.911L26.863,8.575,28.8,8.091l1.731,6.926a1,1,0,0,1-.157.824,2,2,0,1,0,3.244,0,1,1,0,0,1-.157-.824L35.28,7.758l1.94.484-1.712,6.847A3.952,3.952,0,0,1,36,17,4,4,0,0,1,32,21Z" style="fill:#fff"/><rect height="4" style="fill:#027de5" width="10" x="35" y="48"/><rect height="2" style="fill:#027de5" width="7" x="22" y="27"/><rect height="2" style="fill:#027de5" width="2" x="31" y="27"/><rect height="2" style="fill:#027de5" width="9" x="35" y="27"/><rect height="8" style="fill:#027de5" width="8" x="39" y="14"/><rect height="2" style="fill:#027de5" width="25" x="19" y="32"/><rect height="2" style="fill:#027de5" width="25" x="19" y="37"/><rect height="2" style="fill:#027de5" width="13" x="19" y="42"/><rect height="6" style="fill:#444" width="14" x="25" y="3"/><path d="M55,2H9A1,1,0,0,0,8,3V61a1,1,0,0,0,1,1H55a1,1,0,0,0,1-1V3A1,1,0,0,0,55,2ZM25,10h2.219l1.273,5.089A3.952,3.952,0,0,0,28,17a4,4,0,0,0,8,0,3.952,3.952,0,0,0-.492-1.911L36.781,10H39a1,1,0,0,0,1-1V8H50V56H14V8H24V9A1,1,0,0,0,25,10Zm8.622,5.841a2,2,0,1,1-3.244,0,1,1,0,0,0,.157-.824L29.281,10h5.438l-1.254,5.017A1,1,0,0,0,33.622,15.841ZM38,8H26V4H38ZM54,60H10V4H24V6H13a1,1,0,0,0-1,1V57a1,1,0,0,0,1,1H51a1,1,0,0,0,1-1V7a1,1,0,0,0-1-1H40V4H54Z"/></svg>
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/public/icons/file.svg b/flowsint-app/src/renderer/public/icons/file.svg
new file mode 100644
index 00000000..25ca07ad
--- /dev/null
+++ b/flowsint-app/src/renderer/public/icons/file.svg
@@ -0,0 +1 @@
+<?xml version="1.0"?><svg height="24" version="1.1" width="24" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><g transform="translate(0 -1028.4)"><path d="m5 1030.4c-1.1046 0-2 0.9-2 2v8 4 6c0 1.1 0.8954 2 2 2h14c1.105 0 2-0.9 2-2v-6-4-4l-6-6h-10z" fill="#95a5a6"/><path d="m5 1029.4c-1.1046 0-2 0.9-2 2v8 4 6c0 1.1 0.8954 2 2 2h14c1.105 0 2-0.9 2-2v-6-4-4l-6-6h-10z" fill="#bdc3c7"/><rect fill="#95a5a6" height="14" transform="translate(0 1028.4)" width="2" x="7" y="5"/><path d="m7 4c-0.5523 0-1 0.4477-1 1v2 1 2 1 2 1 2 1 2c0 0.552 0.4477 1 1 1h2 1 3 1 3c0.552 0 1-0.448 1-1v-2-1-2-3-3-1-2c0-0.5523-0.448-1-1-1h-3-1-4-2zm0 1h2v2h-2v-2zm3 0h3v2h-3v-2zm4 0h3v2h-3v-2zm-7 3h2v2h-2v-2zm3 0h3v2h-3v-2zm4 0h3v2h-3v-2zm-7 3h2v2h-2v-2zm3 0h3v2h-3v-2zm4 0h3v2h-3v-2zm-7 3h2v2h-2v-2zm3 0h3v2h-3v-2zm4 0h3v2h-3v-2zm-7 3h2v2h-2v-2zm3 0h3v2h-3v-2zm4 0h3v2h-3v-2z" fill="#7f8c8d" transform="translate(0 1028.4)"/><path d="m21 1035.4-6-6v4c0 1.1 0.895 2 2 2h4z" fill="#95a5a6"/></g></svg>
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/public/icons/malware.svg b/flowsint-app/src/renderer/public/icons/malware.svg
new file mode 100644
index 00000000..f162f2a9
--- /dev/null
+++ b/flowsint-app/src/renderer/public/icons/malware.svg
@@ -0,0 +1 @@
+<?xml version="1.0"?><svg data-name="01-Virus" id="_01-Virus" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><title/><circle cx="37" cy="41" r="2" style="fill:#107c82"/><circle cx="25" cy="35" r="4" style="fill:#107c82"/><circle cx="30" cy="23" r="2" style="fill:#107c82"/><path d="M61,30a2,2,0,0,1,0,4H58a26.086,26.086,0,0,0-7.32,1.4,18.748,18.748,0,0,1-2.39,6.34,28.829,28.829,0,0,0,4.86,7.44L54.98,51H55a3,3,0,1,1-3,3v-.02l-1.82-1.83a28.5,28.5,0,0,0-7.14-4.72,18.85,18.85,0,0,1-7.64,3.25A26.086,26.086,0,0,0,34,58v3a2,2,0,0,1-4,0V58a26.086,26.086,0,0,0-1.4-7.32,18.85,18.85,0,0,1-7.64-3.25,28.5,28.5,0,0,0-7.14,4.72L12,53.98V54a3,3,0,1,1-3-3h.02l1.83-1.82a28.829,28.829,0,0,0,4.86-7.44,18.748,18.748,0,0,1-2.39-6.34A26.086,26.086,0,0,0,6,34H3a2,2,0,0,1,0-4H6a26.086,26.086,0,0,0,7.32-1.4,18.748,18.748,0,0,1,2.39-6.34,28.829,28.829,0,0,0-4.86-7.44L9.02,13H9a3,3,0,1,1,3-3v.02l1.82,1.83a28.5,28.5,0,0,0,7.14,4.72,18.85,18.85,0,0,1,7.64-3.25A26.086,26.086,0,0,0,30,6V3a2,2,0,0,1,4,0V6a26.086,26.086,0,0,0,1.4,7.32,18.85,18.85,0,0,1,7.64,3.25,28.5,28.5,0,0,0,7.14-4.72L52,10.02V10a3,3,0,1,1,3,3h-.02l-1.83,1.82a28.829,28.829,0,0,0-4.86,7.44,18.748,18.748,0,0,1,2.39,6.34A26.086,26.086,0,0,0,58,30ZM44,29a3,3,0,1,0-3,3A3,3,0,0,0,44,29ZM39,41a2,2,0,1,0-2,2A2.006,2.006,0,0,0,39,41ZM32,23a2,2,0,1,0-2,2A2.006,2.006,0,0,0,32,23ZM29,35a4,4,0,1,0-4,4A4,4,0,0,0,29,35Z" style="fill:#34c1ad"/><circle cx="41" cy="29" r="3" style="fill:#107c82"/><path d="M32,16A16,16,0,1,0,48,32,16,16,0,0,0,32,16ZM25,39a4,4,0,1,1,4-4A4,4,0,0,1,25,39Zm5-14a2,2,0,1,1,2-2A2.006,2.006,0,0,1,30,25Zm7,18a2,2,0,1,1,2-2A2.006,2.006,0,0,1,37,43Zm4-11a3,3,0,1,1,3-3A3,3,0,0,1,41,32Z" style="fill:#21abab"/><path d="M25,30a5,5,0,1,0,5,5A5,5,0,0,0,25,30Zm0,9a4,4,0,1,1,4-4A4,4,0,0,1,25,39Z" style="fill:#13969d"/><path d="M30,20a3,3,0,1,0,3,3A3,3,0,0,0,30,20Zm0,5a2,2,0,1,1,2-2A2.006,2.006,0,0,1,30,25Z" style="fill:#13969d"/><path d="M37,38a3,3,0,1,0,3,3A3,3,0,0,0,37,38Zm0,5a2,2,0,1,1,2-2A2.006,2.006,0,0,1,37,43Z" style="fill:#13969d"/><path d="M41,25a4,4,0,1,0,4,4A4,4,0,0,0,41,25Zm0,7a3,3,0,1,1,3-3A3,3,0,0,1,41,32Z" style="fill:#13969d"/><circle cx="9" cy="10" r="2" style="fill:#21abab"/><circle cx="55" cy="10" r="2" style="fill:#21abab"/><circle cx="55" cy="54" r="2" style="fill:#21abab"/><circle cx="42" cy="37" r="2" style="fill:#13969d"/><circle cx="22" cy="26" r="2" style="fill:#13969d"/><circle cx="36" cy="22" r="2" style="fill:#13969d"/><circle cx="9" cy="54" r="2" style="fill:#21abab"/><circle cx="61" cy="32" r="1" style="fill:#21abab"/><circle cx="33" cy="31" r="1" style="fill:#13969d"/><circle cx="30" cy="43" r="1" style="fill:#13969d"/><circle cx="3" cy="32" r="1" style="fill:#21abab"/><circle cx="32" cy="3" r="1" style="fill:#21abab"/><circle cx="32" cy="61" r="1" style="fill:#21abab"/></svg>
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/public/icons/script.svg b/flowsint-app/src/renderer/public/icons/script.svg
new file mode 100644
index 00000000..1f4e9d37
--- /dev/null
+++ b/flowsint-app/src/renderer/public/icons/script.svg
@@ -0,0 +1 @@
+<?xml version="1.0"?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><g><path d="M365,167.8H228.2c-5.7,0-10.4-4.7-10.4-10.4v-0.8c0-5.7,4.7-10.4,10.4-10.4H365c5.7,0,10.4,4.7,10.4,10.4 v0.8C375.5,163.1,370.8,167.8,365,167.8z" fill="#303A3F"/><path d="M365,228.8H153.9c-5.7,0-10.4-4.7-10.4-10.4v-0.8c0-5.7,4.7-10.4,10.4-10.4H365c5.7,0,10.4,4.7,10.4,10.4 v0.8C375.5,224.1,370.8,228.8,365,228.8z" fill="#303A3F"/><path d="M365,289.8H153.9c-5.7,0-10.4-4.7-10.4-10.4v-0.8c0-5.7,4.7-10.4,10.4-10.4H365c5.7,0,10.4,4.7,10.4,10.4 v0.8C375.5,285.1,370.8,289.8,365,289.8z" fill="#303A3F"/><path d="M365,350.9H153.9c-5.7,0-10.4-4.7-10.4-10.4v-0.8c0-5.7,4.7-10.4,10.4-10.4H365c5.7,0,10.4,4.7,10.4,10.4 v0.8C375.5,346.2,370.8,350.9,365,350.9z" fill="#303A3F"/><path d="M365,411.9H153.9c-5.7,0-10.4-4.7-10.4-10.4v-0.8c0-5.7,4.7-10.4,10.4-10.4H365c5.7,0,10.4,4.7,10.4,10.4 v0.8C375.5,407.2,370.8,411.9,365,411.9z" fill="#303A3F"/></g><path d="M392,43.5H179.2l38.6,51.4h144.7c27.2,0,49.5,22.3,49.5,49.5v269.3c0,27.2-22.3,49.5-49.5,49.5H154.4 c-27.2,0-49.5-22.3-49.5-49.5V150.9L65.3,98.4c-0.3,2.7-0.8,5.3-0.8,8v342.3c0,34.6,28.3,63,63,63H392c34.6,0,63-28.3,63-63V106.4 C454.9,71.8,426.6,43.5,392,43.5z" fill="#303A3F"/><g><path d="M125.5,149.8l68.3,25c3.6,1.3,6.5-0.7,6.3-4.6l-3.2-72.7c-0.1-1.5-0.5-2.9-1.3-4.3l0.1-0.1 c-0.1-0.2-0.3-0.4-0.4-0.6l-48.8-66.6l-16,11.7l44.1,60.2c1.8,2.4,1.2,5.8-1.2,7.6l-3.8,2.8c-2.4,1.8-5.8,1.2-7.6-1.2L118,46.9 l-15.8,11.6l44.4,60.7c1.6,2.2,1.1,5.2-1.1,6.8l-4.7,3.5c-2.2,1.6-5.2,1.1-6.8-1.1L89.6,67.6L72.6,80l47.2,64.4 C121,146.8,123,148.9,125.5,149.8z M138,141.9l47.6-34.9c2.9-2.1,7.6,1.3,7.8,5.8l1.1,39.7c-0.7,0.2-1.4,0.3-2,0.7l-14.2,10.4 c-0.1,0.1-0.3,0-0.3,0.1l-36.8-12.6C137,149.6,135.1,144,138,141.9z" fill="#303A3F"/><path d="M68.9,75.3l-5.7-7.7c-10.5-14.3-7.3-34.5,7-45l22-16.1c14.3-10.5,34.5-7.3,45,7l5.7,7.7L68.9,75.3z" fill="#303A3F"/></g></g></svg>
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/public/icons/weapon.svg b/flowsint-app/src/renderer/public/icons/weapon.svg
new file mode 100644
index 00000000..f24c947b
--- /dev/null
+++ b/flowsint-app/src/renderer/public/icons/weapon.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="350" height="270"><script xmlns="" src="chrome-extension://mfidniedemcgceagapgdekdbmanojomk/js/elephant.js"/>
+<path fill="#F4B8A8" d="m334.8552,193.27523-26.34011-71.35147c-11.06418-28.701029 26.72116-33.762444 26.72116-33.762444 8.39675-4.651025 0-9.712435 0-9.712435-8.77779,2.099986-15.26923-10.126516-15.26923-10.126516L315.0132,56.916631c-2.67412-6.751012-3.43624-7.597661-.3844-20.678207 3.05184-13.099033-6.67862-12.463121-8.39675-10.562782-1.72146,1.911431-7.06302,4.854369-11.07085,.421475-4.0045-4.432892-14.11937-4.21476-14.11937-4.21476l-3.81731-8.448007-4.20171,0-4.19504,8.44431-74.0498,0 0,2.532553-154.96207,0 0-4.222155-3.061871,0c-.374377-3.3829-2.664095-5.911755-2.664095-5.911755-12.601803,0-15.265899,10.551689-15.265899,10.551689l-9.9310228,0 C 3.173732,36.234727 9.2874455,48.893796 9.2874455,48.893796l11.0641835,0 0,34.195019 23.281581,0 1.90197,5.493978 58.02512,0c 54.19444,0 44.65117,50.229597 44.65117,50.229597 40.84388,20.6893 66.41518,7.60506 66.41518,7.60506 20.23308-4.63994 24.04704,14.35236 24.04704,14.35236l13.73497,60.3746c 1.14653,10.54799-.47466,16.87013-.47466,16.87013l0.0267,.86514-.0267,0 0,8.52195c 0,0-.31755,4.61405 5.45188,3.8968l64.04522-5.95982c 1.55099,2.89858 4.37888,4.85437 7.63463,4.85437 4.92372,0 8.90482-4.41071 8.90482-9.84553 0-1.08696-.19721-1.91883-.48803-2.63238l1.94877-.0148c 4.58278-28.29065-4.57609-44.42505-4.57609-44.42505z M309.84547,26.899401c1.60447,0 2.91144,1.438194 2.91144,3.223922 0,1.778334-1.30697,3.216528-2.91144,3.216528-1.60783,0-2.92483-1.438194-2.92483-3.216528 0-1.785728 1.31366-3.223922 2.92483-3.223922z M229.13043,126.5674c-1.14987,7.60875-8.40009,11.82721-8.40009,11.82721-24.76573,9.20222-40.67007,6.61421-53.23844,2.44382-15.33945-5.10208-14.31325-21.45461-14.31325-21.45461 0-22.367805 20.9952-21.946337 20.9952-21.946337l17.17122,0c9.54661,25.325537-13.73831,36.738667-13.73831,36.738667-3.06187,.83556 0,3.3755 0,3.3755 14.11937-.42147 25.56462-25.7544 25.56462-25.7544 l-.37438-10.55539 5.33487-3.804377c20.99856,0 22.14509,21.535947 20.99856,29.129917z m105.72142,113.77635c0,3.5234-2.59724,6.39238-5.78278,6.39238-3.19224,0-5.77946-2.86528-5.77946-6.39238 0-.89841 .17382-1.75245 .47131-2.52516l10.57951-.085c.31756,.79859 .51142,1.67851 .51142,2.61019"/>
+</svg>
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx b/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
index a7acc0c7..1458eb8d 100644
--- a/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
+++ b/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
@@ -213,10 +213,10 @@ export const AnalysisEditor = ({
}
return (
- <div className={`flex flex-col h-full w-full ${className}`}>
+ <div className={`flex flex-col h-full w-full overflow-y-auto ${className}`}>
{/* Header */}
{showHeader && (
- <div className="border-b bg-card h-11 w-full flex items-center justify-between">
+ <div className="bg-background/70 sticky top-0 z-10 backdrop-blur-sm h-11 w-full flex items-center justify-between">
<div className="flex items-center justify-between p-3 w-full">
{/* Left section with navigation and title */}
<div className="flex items-center gap-3 flex-1 min-w-0">
diff --git a/flowsint-app/src/renderer/src/components/chat/floating-chat.tsx b/flowsint-app/src/renderer/src/components/chat/floating-chat.tsx
index cbd1f054..7f295789 100644
--- a/flowsint-app/src/renderer/src/components/chat/floating-chat.tsx
+++ b/flowsint-app/src/renderer/src/components/chat/floating-chat.tsx
@@ -15,6 +15,7 @@ import { MemoizedMarkdown } from './memoized-markdown'
import { ChatSkeleton } from './chat-skeleton'
import { ResizableChat } from './resizable-chat'
import ChatHistory from './chat-history'
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip'
function FloatingChat() {
const [editorValue, setEditorValue] = useState<any>("")
@@ -57,7 +58,7 @@ function FloatingChat() {
onSuccess: () => { },
})
- useKeyboardShortcut({
+ const { isMac } = useKeyboardShortcut({
key: "e",
ctrlOrCmd: true,
callback: toggleChat,
@@ -84,28 +85,42 @@ function FloatingChat() {
}
}, [messages, editorValue])
+ const keyboardShortcut = isMac ? "⌘+E" : "Ctrl+E"
+
return (
<>
{!isOpenChat &&
<div className="fixed bottom-12 right-4 z-10">
- <Button
- className='h-16 w-16 rounded-full bg-card border border-border bg-opacity-100'
- variant="outline"
- onClick={toggleChat}
- >
- {/* <Sparkles className='!h-5 !w-5' /> */}
- <img src="/icon.png" alt="Flowsint" className="h-12 w-12 object-cover" />
-
- </Button>
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <Button
+ className='h-16 w-16 p-0 rounded-full cursor-pointer bg-background border border-border bg-opacity-100'
+ variant="outline"
+ onClick={toggleChat}
+ >
+ {/* <Sparkles className='!h-5 !w-5' /> */}
+ <img src="/icon.png" alt="Flowsint" className="h-12 w-12 object-contain" />
+ </Button>
+ </div>
+ </TooltipTrigger>
+ <TooltipContent side="left">
+ <div className="text-center">
+ <div>Toggle assistant</div>
+ <div className="text-xs opacity-70">{keyboardShortcut}</div>
+ </div>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
</div>}
{/* Chat Panel */}
{isOpenChat &&
-
<div className="fixed bottom-12 overflow-hidden rounded-2xl right-4 shadow z-21">
<ResizableChat minWidth={400} minHeight={400} maxWidth={800} maxHeight={800}>
- <Card className="overflow-hidden backdrop-blur-sm bg-card/90 rounded-2xl gap-0 py-0 h-full">
+ <Card className="overflow-hidden !backdrop-blur bg-background/90 rounded-2xl gap-0 py-0 h-full">
{view === "history" ? (
<ChatHistory setView={setView} deleteChatMutation={deleteChatMutation} handleCreateNewChat={handlecreateNewChat} />
) : (
diff --git a/flowsint-app/src/renderer/src/components/chat/memoized-markdown.tsx b/flowsint-app/src/renderer/src/components/chat/memoized-markdown.tsx
index ee64032e..c91e6f5a 100644
--- a/flowsint-app/src/renderer/src/components/chat/memoized-markdown.tsx
+++ b/flowsint-app/src/renderer/src/components/chat/memoized-markdown.tsx
@@ -3,7 +3,8 @@ import { memo, useMemo } from 'react';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm'
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
-import { dark } from 'react-syntax-highlighter/dist/esm/styles/prism';
+import { dracula } from 'react-syntax-highlighter/dist/esm/styles/prism';
+import { cn } from '@/lib/utils';
function parseMarkdownIntoBlocks(markdown: string): string[] {
const tokens = marked.lexer(markdown);
@@ -13,26 +14,26 @@ function parseMarkdownIntoBlocks(markdown: string): string[] {
const MemoizedMarkdownBlock = memo(
({ content }: { content: string }) => {
return <ReactMarkdown
- components={{
- code({ node, className, children, ...props }) {
- const match = /language-(\w+)/.exec(className || '')
- return match ? (
- <SyntaxHighlighter
- children={String(children).replace(/\n$/, '')}
- style={dark}
- language={match[1]}
- PreTag="div"
- className="rounded-md p-2 text-sm"
- {...props}
- />
- ) : (
- <code className={className} {...props}>
- {children}
- </code>
- )
- }
- }}
- remarkPlugins={[remarkGfm]}>{content}</ReactMarkdown>;
+ components={{
+ code({ node, className, children, ...props }) {
+ const match = /language-(\w+)/.exec(className || '')
+ return match ? (
+ <SyntaxHighlighter
+ children={String(children).replace(/\n$/, '')}
+ style={dracula}
+ language={match[1]}
+ PreTag="div"
+ className="rounded border border-border bg-muted px-1 py-0.5 text-sm"
+ {...props}
+ />
+ ) : (
+ <code className={cn("rounded border border-border bg-muted px-1 py-0.5 text-sm", className)} {...props}>
+ {children}
+ </code>
+ )
+ }
+ }}
+ remarkPlugins={[remarkGfm]}>{content}</ReactMarkdown>;
},
(prevProps, nextProps) => {
if (prevProps.content !== nextProps.content) return false;
diff --git a/flowsint-app/src/renderer/src/components/graphs/details-panel.tsx b/flowsint-app/src/renderer/src/components/graphs/details-panel.tsx
index e9943624..d66a81db 100644
--- a/flowsint-app/src/renderer/src/components/graphs/details-panel.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/details-panel.tsx
@@ -1,43 +1,53 @@
-import { memo, useCallback } from "react"
+import { memo } from "react"
import { cn } from "@/lib/utils"
import { CopyButton } from "@/components/copy"
-import { Button } from "@/components/ui/button"
-import { Edit2, Check, X } from "lucide-react"
+import { Check, Rocket, X } from "lucide-react"
import LaunchTransform from "./launch-transform"
-import { useGraphStore } from "@/stores/graph-store"
+import NodeActions from "./node-actions"
+import { GraphNode } from "@/stores/graph-store"
+import { Button } from "../ui/button"
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip"
-export default function DetailsPanel({ data }: { data: any }) {
- const setOpenNodeEditorModal = useGraphStore(state => state.setOpenNodeEditorModal)
- const handleEdit = useCallback(() => {
- setOpenNodeEditorModal(true)
- }, [])
+export default function DetailsPanel({ node }: { node: GraphNode }) {
return (
<div className="overflow-y-auto overflow-x-hidden w-full min-w-0 h-full min-h-0">
<div className="flex items-center sticky w-full bg-card top-0 border-b justify-start px-4 py-2 gap-2 z-50">
- <h1 className="text-md font-semibold truncate">{data?.label}</h1>
+ <h1 className="text-md font-semibold truncate">{node.data?.label}</h1>
<div className="grow" />
- <div className="flex items-center gap-1">
- <Button
- variant="ghost"
- size="icon"
- onClick={handleEdit}
- className="h-7 w-7 p-0"
- >
- <Edit2 strokeWidth={1.5} className="!h-4 !w-4 opacity-60" />
- </Button>
- <LaunchTransform values={[data.label]} type={data?.type} />
+ <div className="flex items-center">
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <LaunchTransform values={[node.data.label]} type={node.data?.type}>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="h-6 w-6 p-0 hover:bg-muted opacity-70 hover:opacity-100"
+ >
+ <Rocket className="h-3 w-3" strokeWidth={2} />
+ </Button>
+ </LaunchTransform>
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Launch transform</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <NodeActions node={node} />
</div>
</div>
- {data?.description && (
+ {node.data?.description && (
<div className="px-4 py-3 border-b border-border">
<div
className="text-sm text-muted-foreground prose prose-sm max-w-none"
- dangerouslySetInnerHTML={{ __html: data.description }}
+ dangerouslySetInnerHTML={{ __html: node.data.description }}
/>
</div>
)}
- <KeyValueDisplay data={data} />
+ <KeyValueDisplay data={node.data} />
</div>
)
}
diff --git a/flowsint-app/src/renderer/src/components/graphs/graph-navigation.tsx b/flowsint-app/src/renderer/src/components/graphs/graph-navigation.tsx
index ad4c78bf..5a9c9abf 100644
--- a/flowsint-app/src/renderer/src/components/graphs/graph-navigation.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/graph-navigation.tsx
@@ -42,7 +42,7 @@ const GraphNavigation = () => {
defaultSize={30}
className="flex flex-col w-full overflow-hidden min-h-0 min-w-0"
>
- <DetailsPanel data={currentNode.data} />
+ <DetailsPanel node={currentNode} />
</ResizablePanel>
<ResizableHandle />
</>
diff --git a/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx b/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
index b9bb5c32..bb17a5ba 100644
--- a/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
@@ -15,10 +15,12 @@ import { findActionItemByKey } from '@/lib/action-items'
import { useActionItems } from '@/hooks/use-action-items'
import { toast } from 'sonner'
import MapPanel from '../map/map-panel'
+import NewActions from './new-actions'
const GraphReactForce = lazy(() => import('./graph-react-force'))
const Graph = lazy(() => import('./graph'))
-const NODE_COUNT_THRESHOLD = 1000;
+const NODE_COUNT_THRESHOLD = 500;
+
// Separate component for the drag overlay
@@ -56,6 +58,7 @@ const GraphPanel = ({ graphData, isLoading, isRefetching }: GraphPanelProps) =>
const [isDraggingOver, setIsDraggingOver] = useState(false)
useEffect(() => {
+ updateGraphData([], [])
if (graphData?.nds && graphData?.rls) {
updateGraphData(graphData.nds, graphData.rls)
setLoading(false)
@@ -147,6 +150,7 @@ const GraphPanel = ({ graphData, isLoading, isRefetching }: GraphPanelProps) =>
<div className='absolute z-21 left-3 top-3'>
<Toolbar isLoading={isLoading} />
</div>
+ <NewActions />
<CreateRelationDialog />
<NodeEditorModal />
</div>
diff --git a/flowsint-app/src/renderer/src/components/graphs/graph-react-force-3d.tsx b/flowsint-app/src/renderer/src/components/graphs/graph-react-force-3d.tsx
index e2ff9701..aaef335b 100644
--- a/flowsint-app/src/renderer/src/components/graphs/graph-react-force-3d.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/graph-react-force-3d.tsx
@@ -1,4 +1,4 @@
-import React, { useCallback, useEffect, useState } from 'react';
+import React, { useCallback, useEffect, useState, useMemo, useRef } from 'react';
import ForceGraph3D from 'react-force-graph-3d';
import { GraphEdge, GraphNode, useGraphStore } from '@/stores/graph-store';
import { useNodesDisplaySettings } from '@/stores/node-display-settings';
@@ -12,7 +12,6 @@ interface GraphReactForce3DProps {
style?: React.CSSProperties;
}
-
const GraphReactForce3D: React.FC<GraphReactForce3DProps> = () => {
const nodes = useGraphStore(s => s.nodes) as GraphNode[];
const edges = useGraphStore(s => s.edges) as GraphEdge[];
@@ -21,20 +20,59 @@ const GraphReactForce3D: React.FC<GraphReactForce3DProps> = () => {
const clearSelectedNodes = useGraphStore(s => s.clearSelectedNodes);
const setActions = useGraphControls(s => s.setActions);
const getSize = useNodesDisplaySettings(s => s.getSize);
- const graphRef = React.useRef<any>();
- const containerRef = React.useRef<HTMLDivElement>(null);
+ const graphRef = useRef<any>();
+ const containerRef = useRef<HTMLDivElement>(null);
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
const currentNode = useGraphStore(s => s.currentNode);
+ // Cache pour les sprites de texte des liens
+ const linkSpritesCache = useRef<Map<string, any>>(new Map());
+
+ // Mémoriser les données du graphique pour éviter les re-rendus
+ const graphData = useMemo(() => ({
+ nodes,
+ links: edges
+ }), [nodes, edges]);
+
+ // Mémoriser les fonctions de couleur et de taille pour éviter les recalculs
+ const nodeColorFunction = useCallback((node: GraphNode) => {
+ return colors[node.data.type];
+ }, [colors]);
+
+ const nodeValueFunction = useCallback((node: GraphNode) => {
+ return getSize(node.data.type as ItemType) / 4;
+ }, [getSize]);
+
+ // Optimisation des sprites de texte des liens avec cache
+ const linkThreeObjectFunction = useCallback((link: GraphEdge) => {
+ const cacheKey = `${link.source}-${link.target}-${link.label}`;
+
+ if (linkSpritesCache.current.has(cacheKey)) {
+ return linkSpritesCache.current.get(cacheKey);
+ }
+
+ const sprite = new SpriteText(`${link.label}`);
+ sprite.color = 'lightgrey';
+ sprite.textHeight = 1.5;
+
+ linkSpritesCache.current.set(cacheKey, sprite);
+ return sprite;
+ }, []);
+
+ // Nettoyer le cache quand les liens changent
+ useEffect(() => {
+ linkSpritesCache.current.clear();
+ }, [edges]);
+
const handleNodeClick = useCallback((node: any) => {
toggleNodeSelection(node, false);
const distance = 130;
const distRatio = 1 + distance / Math.hypot(node.x, node.y, node.z);
- graphRef.current.cameraPosition(
- { x: node.x * distRatio, y: node.y * distRatio, z: node.z * distRatio }, // new position
- node, // lookAt ({ x, y, z })
- 500 // ms transition duration
+ graphRef.current?.cameraPosition(
+ { x: node.x * distRatio, y: node.y * distRatio, z: node.z * distRatio },
+ node,
+ 500
);
}, [toggleNodeSelection]);
@@ -71,21 +109,26 @@ const GraphReactForce3D: React.FC<GraphReactForce3DProps> = () => {
});
}, [setActions, handleZoomIn, handleZoomOut, handleFit]);
- // Handle container resize
+ // Handle container resize avec debouncing
useEffect(() => {
if (!containerRef.current) return;
+ let timeoutId: NodeJS.Timeout;
const resizeObserver = new ResizeObserver(entries => {
- const { width, height } = entries[0].contentRect;
- setDimensions({ width, height });
- if (graphRef.current) {
- graphRef.current.d3ReheatSimulation();
- }
+ clearTimeout(timeoutId);
+ timeoutId = setTimeout(() => {
+ const { width, height } = entries[0].contentRect;
+ setDimensions({ width, height });
+ if (graphRef.current) {
+ graphRef.current.d3ReheatSimulation();
+ }
+ }, 100); // Debounce de 100ms
});
resizeObserver.observe(containerRef.current);
return () => {
+ clearTimeout(timeoutId);
resizeObserver.disconnect();
};
}, []);
@@ -101,36 +144,43 @@ const GraphReactForce3D: React.FC<GraphReactForce3DProps> = () => {
ref={graphRef}
width={dimensions.width}
height={dimensions.height}
- graphData={{ nodes, links: edges }}
+ graphData={graphData}
nodeLabel="label"
- nodeColor={node => colors[node.data.type]}
+ nodeColor={nodeColorFunction}
nodeRelSize={6}
- nodeVal={node => getSize(node.data.type) / 4}
+ nodeVal={nodeValueFunction}
linkDirectionalArrowLength={3.5}
linkDirectionalArrowRelPos={1}
- cooldownTicks={100}
+ // Optimisations de performance
+ cooldownTicks={50} // Réduit de 100 à 50
+ d3AlphaDecay={0.05} // Augmenté de 0.02 à 0.05 pour convergence plus rapide
+ d3VelocityDecay={0.4} // Augmenté de 0.3 à 0.4
+ d3AlphaMin={0.01} // Ajouter un seuil minimum
+ // Réduire la fréquence de rendu
+ rendererConfig={{
+ antialias: false, // Désactiver l'antialiasing pour de meilleures performances
+ powerPreference: "high-performance"
+ }}
+ // Optimisations pour les gros graphiques
+ numDimensions={3}
+ enablePointerInteraction={true}
onNodeClick={handleNodeClick}
onBackgroundClick={handleBackgroundClick}
linkCurvature={link => link.curve}
- d3AlphaDecay={0.02}
- d3VelocityDecay={0.3}
- // backgroundColor="transparent"
- linkThreeObjectExtend={true}
- linkThreeObject={(link: GraphEdge) => {
- // extend link with text sprite
- const sprite = new SpriteText(`${link.label}`);
- sprite.color = 'lightgrey';
- sprite.textHeight = 1.5;
- return sprite;
- }}
- showNavInfo={false}
backgroundColor="#00000000"
enableNodeDrag={true}
enableNavigationControls={true}
+ // Optimiser les sprites de texte
+ linkThreeObjectExtend={true}
+ linkThreeObject={linkThreeObjectFunction}
+ showNavInfo={false}
+ // Limiter la distance de rendu pour de meilleures performances
+ nodeOpacity={0.9}
+ linkOpacity={0.6}
/>
</div>
</div>
);
};
-export default GraphReactForce3D;
\ No newline at end of file
+export default GraphReactForce3D;
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/graphs/graph.tsx b/flowsint-app/src/renderer/src/components/graphs/graph.tsx
index c202ec40..880fa837 100644
--- a/flowsint-app/src/renderer/src/components/graphs/graph.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/graph.tsx
@@ -71,7 +71,7 @@ CosmographLoader.displayName = "CosmographLoader"
const GRAPH_CONFIG = {
// simulationCenter: 0.2,
useQuadtree: true,
- simulationDecay: 100,
+ simulationDecay: 150,
simulationGravity: 0.25,
// simulationLinkSpring: 2,
simulationRepulsion: 2,
diff --git a/flowsint-app/src/renderer/src/components/graphs/items-panel.tsx b/flowsint-app/src/renderer/src/components/graphs/items-panel.tsx
index a5c2221a..3b5f7364 100644
--- a/flowsint-app/src/renderer/src/components/graphs/items-panel.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/items-panel.tsx
@@ -6,32 +6,36 @@ import { memo, useCallback, useState } from "react"
import { type ActionItem } from "@/lib/action-items"
import { DraggableItem } from "./draggable-item"
import { Input } from "@/components/ui/input"
-import NewActions from "@/components/graphs/new-actions"
import { useActionItems } from "@/hooks/use-action-items"
import { SkeletonList } from "../shared/skeleton-list"
+import { useGraphStore } from "@/stores/graph-store"
export const ItemsPanel = memo(function LeftPanel() {
const [searchQuery, setSearchQuery] = useState<string>("")
+ const setOpenMainDialog = useGraphStore(state => state.setOpenMainDialog)
const handleSearchChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
setSearchQuery(e.target.value)
}, [])
+ const handleOpenNewActionDialog = useCallback(() => {
+ setOpenMainDialog(true)
+ }, [setOpenMainDialog])
+
const { actionItems, isLoading } = useActionItems()
return (
<div className="bg-card p-4 h-full w-full overflow-y-auto flex flex-col">
<div className="flex items-center gap-2 mb-3">
<div>
- <NewActions>
- <Button
- className="h-7 !w-7"
- size="icon"
- variant={"ghost"}
- >
- <PlusIcon />
- </Button>
- </NewActions>
+ <Button
+ onClick={handleOpenNewActionDialog}
+ className="h-7 !w-7"
+ size="icon"
+ variant={"ghost"}
+ >
+ <PlusIcon />
+ </Button>
</div>
<div className="relative grow">
<Search className="absolute left-2.5 top-1.5 h-4 w-4 text-muted-foreground" />
diff --git a/flowsint-app/src/renderer/src/components/graphs/launch-transform.tsx b/flowsint-app/src/renderer/src/components/graphs/launch-transform.tsx
index 2bd9df09..d7f77428 100644
--- a/flowsint-app/src/renderer/src/components/graphs/launch-transform.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/launch-transform.tsx
@@ -1,8 +1,7 @@
"use client"
-import { useState } from "react"
+import { useCallback, useState } from "react"
import { Button } from "@/components/ui/button"
-import { Sparkles } from "lucide-react"
import {
Sheet,
SheetContent,
@@ -10,6 +9,7 @@ import {
SheetTitle,
SheetDescription,
SheetFooter,
+ SheetTrigger,
} from "@/components/ui/sheet"
import { Card, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
@@ -19,6 +19,7 @@ import { useQuery } from "@tanstack/react-query"
import { transformService } from "@/api/transfrom-service"
import { useParams } from "@tanstack/react-router"
import { capitalizeFirstLetter } from "@/lib/utils"
+import { Skeleton } from "@/components/ui/skeleton"
interface Transform {
id: string
@@ -29,7 +30,7 @@ interface Transform {
last_updated_at: string
}
-const LaunchTransform = ({ values, type }: { values: string[], type: string }) => {
+const LaunchTransform = ({ values, type, children }: { values: string[], type: string, children?: React.ReactNode }) => {
const { launchTransform } = useLaunchTransform()
const { id: sketch_id } = useParams({ strict: false })
const [isOpen, setIsOpen] = useState(false)
@@ -41,40 +42,27 @@ const LaunchTransform = ({ values, type }: { values: string[], type: string }) =
// queryFn: () => transformService.get(),
});
-
- const handleOpenModal = () => {
- setIsOpen(true)
- }
-
- const handleCloseModal = () => {
+ const handleCloseModal = useCallback(() => {
setIsOpen(false)
- }
+ }, [])
- const handleSelectTransform = (transform: Transform) => {
+ const handleSelectTransform = useCallback((transform: Transform) => {
setSelectedTransform(transform)
- }
+ }, [])
- const handleLaunchTransform = () => {
+ const handleLaunchTransform = useCallback(() => {
if (selectedTransform) {
launchTransform(values, selectedTransform.id, sketch_id)
handleCloseModal()
}
- }
+ }, [selectedTransform, launchTransform, values, sketch_id])
return (
<div>
- <Button
- onClick={handleOpenModal}
- disabled={isLoading || !transforms?.length}
- className="relative min-w-[80px] h-8 overflow-hidden truncate bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-4 py-2 text-white border-none font-medium rounded-full"
- >
- <span className="flex items-center gap-2">
- <Sparkles className={"h-4 w-4 transition-transform duration-100"} />
- <span>Search</span>
- </span>
- </Button>
-
<Sheet open={isOpen} onOpenChange={setIsOpen}>
+ <SheetTrigger asChild>
+ <div>{children}</div>
+ </SheetTrigger>
<SheetContent className="sm:max-w-xl">
<SheetHeader>
<SheetTitle>Select a transform</SheetTitle>
@@ -83,36 +71,60 @@ const LaunchTransform = ({ values, type }: { values: string[], type: string }) =
<div className="p-4 grow overflow-auto">
<RadioGroup value={selectedTransform?.id} className="space-y-3">
- {transforms?.map((transform: Transform) => (
- <Card
- key={transform.id}
- className={`cursor-pointer border py-1 transition-all ${selectedTransform?.id === transform.id
- ? "border-primary bg-primary/5"
- : "hover:border-primary/50"
- }`}
- onClick={() => handleSelectTransform(transform)}
- >
- <CardHeader className="p-4">
- <div className="flex flex-col space-y-4">
- <div className="flex items-center gap-3">
- <RadioGroupItem value={transform.id} id={transform.id} />
- <CardTitle className="text-base">{transform.name}</CardTitle>
+ {isLoading ? (
+ // Skeleton loading state
+ Array.from({ length: 3 }).map((_, index) => (
+ <Card key={index} className="border py-1">
+ <CardHeader className="p-4">
+ <div className="flex flex-col space-y-4">
+ <div className="flex items-center gap-3">
+ <Skeleton className="h-4 w-4 rounded-full" />
+ <Skeleton className="h-5 w-32" />
+ </div>
+ <div className="pl-7 space-y-2">
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-3/4" />
+ </div>
+ <div className="flex flex-col space-y-1 pl-7">
+ <Skeleton className="h-3 w-24" />
+ <Skeleton className="h-3 w-20" />
+ </div>
</div>
-
- {transform.description && (
- <CardDescription className="text-sm pl-7">
- {transform.description || "No description available"}
- </CardDescription>
- )}
-
- <div className="flex flex-col space-y-1 text-xs text-muted-foreground pl-7">
- <div>Created {formatDistanceToNow(transform.created_at, { addSuffix: true })}</div>
- <div>Updated {formatDistanceToNow(transform.last_updated_at, { addSuffix: true })}</div>
+ </CardHeader>
+ </Card>
+ ))
+ ) : (
+ transforms?.map((transform: Transform) => (
+ <Card
+ key={transform.id}
+ className={`cursor-pointer border py-1 transition-all ${selectedTransform?.id === transform.id
+ ? "border-primary bg-primary/5"
+ : "hover:border-primary/50"
+ }`}
+ onClick={() => handleSelectTransform(transform)}
+ >
+ <CardHeader className="p-4">
+ <div className="flex flex-col space-y-4">
+ <div className="flex items-center gap-3">
+ <RadioGroupItem value={transform.id} id={transform.id} />
+ <CardTitle className="text-base">{transform.name}</CardTitle>
+ </div>
+
+ {transform.description && (
+ <CardDescription className="text-sm pl-7">
+ {transform.description || "No description available"}
+ </CardDescription>
+ )}
+
+ <div className="flex flex-col space-y-1 text-xs text-muted-foreground pl-7">
+ <div>Created {formatDistanceToNow(transform.created_at, { addSuffix: true })}</div>
+ <div>Updated {formatDistanceToNow(transform.last_updated_at, { addSuffix: true })}</div>
+ </div>
</div>
- </div>
- </CardHeader>
- </Card>
- ))}
+ </CardHeader>
+ </Card>
+ ))
+ )}
</RadioGroup>
</div>
diff --git a/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx b/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx
index 82ae785d..a2f0b572 100644
--- a/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx
@@ -1,7 +1,4 @@
-"use client"
-
-import type React from "react"
-import { useState } from "react"
+import { useState, useCallback } from "react"
import { Button } from "@/components/ui/button"
import { ArrowLeft, ArrowRight } from 'lucide-react'
import { toast } from "sonner"
@@ -12,49 +9,49 @@ import { Card, CardContent } from "@/components/ui/card"
import { AnimatePresence, motion } from "framer-motion"
import { DynamicForm } from "@/components/graphs/dynamic-form"
import { Badge } from "@/components/ui/badge"
-import { useGraphStore } from "@/stores/graph-store"
-import { DialogTrigger } from "@radix-ui/react-dialog"
+import { GraphNode, useGraphStore } from "@/stores/graph-store"
import { sketchService } from "@/api/sketch-service"
import { useParams } from "@tanstack/react-router"
import { useIcon } from "@/hooks/use-icon"
import { useLayoutStore } from "@/stores/layout-store"
import { useActionItems } from "@/hooks/use-action-items"
-interface ActionDialogProps {
- children: React.ReactNode
- setCurrentNode?: (node: any) => void
-}
-
-export default function ActionDialog({ children, setCurrentNode }: ActionDialogProps) {
+export default function ActionDialog() {
const handleOpenFormModal = useGraphStore(state => state.handleOpenFormModal)
const currentNodeType = useGraphStore(state => state.currentNodeType)
+ const setCurrentNode = useGraphStore(state => state.setCurrentNode)
+ const relatedNodeToAdd = useGraphStore(state => state.relatedNodeToAdd)
+ const setRelatedNodeToAdd = useGraphStore(state => state.setRelatedNodeToAdd)
const openMainDialog = useGraphStore(state => state.openMainDialog)
const setOpenMainDialog = useGraphStore(state => state.setOpenMainDialog)
const openFormDialog = useGraphStore(state => state.openFormDialog)
const setOpenFormDialog = useGraphStore(state => state.setOpenFormDialog)
const addNode = useGraphStore(state => state.addNode)
+ const addEdge = useGraphStore(state => state.addEdge)
const setActiveTab = useLayoutStore(state => state.setActiveTab)
- const { id } = useParams({ strict: false })
+ const { id: sketch_id } = useParams({ strict: false })
const { actionItems, isLoading } = useActionItems()
const [currentParent, setCurrentParent] = useState<ActionItem | null>(null)
const [navigationHistory, setNavigationHistory] = useState<ActionItem[]>([])
+ const handleDialogOpenChange = useCallback((open: boolean) => {
+ setOpenMainDialog(open)
+ if (!open) {
+ setRelatedNodeToAdd(null)
+ }
+ }, [setOpenMainDialog, setRelatedNodeToAdd])
+
const handleAddNode = async (data: any) => {
try {
- if (!currentNodeType || !id) {
+ if (!currentNodeType || !sketch_id) {
toast.error("Invalid node type or sketch ID.")
return
}
const label_key = currentNodeType.fields.find((f: FormField) => f.name === currentNodeType.label_key)?.name || currentNodeType.fields[0].name
const type = currentNodeType.type
let label = data[label_key as keyof typeof data]
- if (type === "Individual") {
- data.full_name = `${data.first_name} ${data.last_name}`
- label = data.full_name
- }
- // Quick fix in the case where it's an individual, we want to add the fullname
const newNode = {
type: "custom",
label: label,
@@ -64,18 +61,58 @@ export default function ActionDialog({ children, setCurrentNode }: ActionDialogP
type: type.toLowerCase(),
},
}
- if (addNode) addNode(newNode as any)
+
+ // First, create the node via API to get the real database ID
+ const newNodeResponse = await sketchService.addNode(sketch_id as string, JSON.stringify(newNode))
+
+ // Add the node to local state with the real ID from the API response
+ if (addNode && newNodeResponse.node) {
+ const nodeWithRealId = {
+ ...newNode,
+ id: newNodeResponse.node.id,
+ position: { x: 0, y: 0 }
+ }
+ addNode(nodeWithRealId as any)
+ }
+
+ // If we have a related node to connect to, create the edge
+ if (relatedNodeToAdd && newNodeResponse.node) {
+ const newEdge = {
+ source: relatedNodeToAdd,
+ target: newNodeResponse.node,
+ type: "one-way",
+ label: `HAS_${newNode.data.type.toUpperCase()}`,
+ sketch_id: sketch_id
+ }
+
+ // Add edge to local state
+ if (addEdge) {
+ const newEdgeObject = {
+ type: "straight",
+ label: newEdge.label,
+ source: newEdge.source.id,
+ target: newEdge.target.id
+ }
+ addEdge(newEdgeObject)
+ }
+
+ // Make API call to persist the edge
+ await sketchService.addEdge(sketch_id as string, JSON.stringify(newEdge))
+ }
+
+ // Set current node using the API response (which has the correct ID from the database)
+ if (setCurrentNode) setCurrentNode({ ...newNodeResponse.node, position: { x: 0, y: 0 } } as GraphNode)
setActiveTab("entities")
- setOpenFormDialog(false)
- toast.success("New node added.")
- await sketchService.addNode(id, JSON.stringify(newNode))
- if (setCurrentNode) setCurrentNode(newNode)
+ toast.success(relatedNodeToAdd ? `New relation added to ${relatedNodeToAdd.data.label}.` : "New node added.")
} catch (error) {
+ console.error(error)
toast.error("Unexpected error during node creation.")
} finally {
setOpenMainDialog(false)
+ setOpenFormDialog(false)
}
}
+
const navigateToSubItems = (item: ActionItem) => {
setNavigationHistory([...navigationHistory, item])
setCurrentParent(item)
@@ -125,8 +162,7 @@ export default function ActionDialog({ children, setCurrentNode }: ActionDialogP
return (
<>
- <Dialog open={openMainDialog} onOpenChange={setOpenMainDialog}>
- <DialogTrigger disabled={isLoading} asChild>{children}</DialogTrigger>
+ <Dialog open={openMainDialog} onOpenChange={handleDialogOpenChange}>
<DialogContent className="sm:max-w-[800px] h-[80vh] overflow-hidden flex flex-col">
<DialogTitle className="flex items-center">
{currentParent && (
@@ -134,12 +170,25 @@ export default function ActionDialog({ children, setCurrentNode }: ActionDialogP
<ArrowLeft className="h-4 w-4" />
</Button>
)}
- {currentParent ? currentParent.label : "Select an item to insert"}
+ {relatedNodeToAdd
+ ? `Add a relation to `
+ : currentParent
+ ? currentParent.label
+ : "Select an item to insert"
+ }
+ {relatedNodeToAdd && (
+ <span className="text-primary truncate max-w-[50%] text-ellipsis font-semibold ml-1">
+ {relatedNodeToAdd.data.label}
+ </span>
+ )}
</DialogTitle>
<DialogDescription>
- {currentParent
- ? `Select a type of ${currentParent.label.toLowerCase()} to add`
- : "Choose an item to insert to the graph."}
+ {relatedNodeToAdd
+ ? "Choose what type of relation to add to this node."
+ : currentParent
+ ? `Select a type of ${currentParent.label.toLowerCase()} to add`
+ : "Choose an item to insert to the graph."
+ }
</DialogDescription>
<div className="overflow-y-auto overflow-x-hidden pr-1 -mr-1 flex-grow">
diff --git a/flowsint-app/src/renderer/src/components/graphs/node-actions.tsx b/flowsint-app/src/renderer/src/components/graphs/node-actions.tsx
new file mode 100644
index 00000000..734ddfb4
--- /dev/null
+++ b/flowsint-app/src/renderer/src/components/graphs/node-actions.tsx
@@ -0,0 +1,145 @@
+import React, { memo, useCallback } from 'react';
+import { Button } from '@/components/ui/button';
+import { Pencil, Trash2, Sparkles, Plus } from 'lucide-react';
+import { GraphNode, useGraphStore } from '@/stores/graph-store';
+import { useParams } from '@tanstack/react-router';
+import { useConfirm } from '@/components/use-confirm-dialog';
+import { toast } from 'sonner';
+import { sketchService } from '@/api/sketch-service';
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from '@/components/ui/tooltip';
+import { useLayoutStore } from '@/stores/layout-store';
+
+
+const NodeActions = ({ node, setMenu }: { node: GraphNode, setMenu?: (menu: any | null) => void }) => {
+ const { id: sketchId } = useParams({ strict: false })
+ const { confirm } = useConfirm();
+ const setOpenMainDialog = useGraphStore(state => state.setOpenMainDialog)
+ const setRelatedNodeToAdd = useGraphStore(state => state.setRelatedNodeToAdd)
+ const removeNodes = useGraphStore(s => s.removeNodes);
+ const toggleNodeSelection = useGraphStore(s => s.toggleNodeSelection);
+ const openChat = useLayoutStore(s => s.openChat);
+ const setCurrentNode = useGraphStore(s => s.setCurrentNode);
+ const setOpenNodeEditorModal = useGraphStore(s => s.setOpenNodeEditorModal);
+
+ // Add relation dialog
+ const handleOpenMainDialog = useCallback(() => {
+ setRelatedNodeToAdd(node)
+ setOpenMainDialog(true)
+ setMenu?.(null)
+ }, [setOpenMainDialog, setMenu, node])
+
+ // Ask AI dialog
+ const handleAskAI = useCallback((e: React.MouseEvent) => {
+ e.stopPropagation();
+ toggleNodeSelection(node, false)
+ openChat()
+ setMenu?.(null)
+ }, [node, toggleNodeSelection, openChat, setMenu])
+
+ // Edit node dialog
+ const handleEditNode = useCallback((e: React.MouseEvent) => {
+ e.stopPropagation();
+ const typedNode = node as GraphNode
+ setCurrentNode(typedNode)
+ setOpenNodeEditorModal(true)
+ setMenu?.(null)
+ }, [node, setCurrentNode, setOpenNodeEditorModal])
+
+ // Delete node
+ const handleDeleteNode = async () => {
+ if (!node.id || !sketchId) return
+ if (!await confirm({ title: `You are about to delete this node ?`, message: "The action is irreversible." })) return
+ toast.promise(
+ (async () => {
+ removeNodes([node.id])
+ return sketchService.deleteNodes(sketchId, JSON.stringify({ nodeIds: [node.id] }))
+ })(),
+ {
+ loading: `Deleting ${node.data.label}...`,
+ success: 'Node deleted successfully.',
+ error: 'Failed to delete node.'
+ }
+ )
+ }
+ return (
+ <div className="flex items-center gap-1">
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <Button
+ onClick={handleOpenMainDialog}
+ variant="ghost"
+ size="sm"
+ className="h-6 w-6 p-0 hover:bg-muted opacity-70 hover:opacity-100"
+ >
+ <Plus className="h-3.5 w-3.5" strokeWidth={2} />
+ </Button>
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Add relation</p>
+ </TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <Button
+ onClick={handleAskAI}
+ variant="ghost"
+ size="sm"
+ className="h-6 w-6 p-0 hover:bg-muted opacity-70 hover:opacity-100"
+ >
+ <Sparkles className="h-3 w-3" strokeWidth={1.5} />
+ </Button>
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Ask AI</p>
+ </TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <Button
+ onClick={handleEditNode}
+ variant="ghost"
+ size="sm"
+ className="h-6 w-6 p-0 hover:bg-muted opacity-70 hover:opacity-100"
+ >
+ <Pencil className="h-3 w-3" strokeWidth={1.5} />
+ </Button>
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Edit node</p>
+ </TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="h-6 w-6 p-0 hover:bg-muted opacity-70 hover:opacity-100 text-destructive hover:text-destructive"
+ onClick={handleDeleteNode}
+ >
+ <Trash2 className="h-3 w-3" strokeWidth={1.5} />
+ </Button>
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Delete node</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </div>
+ )
+}
+
+export default memo(NodeActions)
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/graphs/node-editor-modal.tsx b/flowsint-app/src/renderer/src/components/graphs/node-editor-modal.tsx
index 7e7d800b..5a9ca691 100644
--- a/flowsint-app/src/renderer/src/components/graphs/node-editor-modal.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/node-editor-modal.tsx
@@ -148,7 +148,7 @@ export const NodeEditorModal: React.FC = () => {
<div className="space-y-4">
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<div className="space-y-2">
- <Label htmlFor="label" className="text-sm font-medium flex items-center gap-2">
+ <Label htmlFor="label" className="text-sm opacity-60 font-medium flex items-center gap-2">
<FileText className="h-3 w-3" />
Label
</Label>
@@ -167,7 +167,7 @@ export const NodeEditorModal: React.FC = () => {
)}
</div>
<div className="space-y-2">
- <Label htmlFor="type" className="text-sm font-medium flex items-center gap-2">
+ <Label htmlFor="type" className="text-sm opacity-60 font-medium flex items-center gap-2">
<Type className="h-3 w-3" />
Type
</Label>
@@ -187,7 +187,7 @@ export const NodeEditorModal: React.FC = () => {
</div>
</div>
<div className="space-y-2">
- <Label htmlFor="caption" className="text-sm font-medium flex items-center gap-2">
+ <Label htmlFor="caption" className="text-sm opacity-60 font-medium flex items-center gap-2">
<FileText className="h-3 w-3" />
Caption
</Label>
@@ -206,7 +206,7 @@ export const NodeEditorModal: React.FC = () => {
)}
</div>
<div className="space-y-2">
- <Label htmlFor="id" className="text-sm font-medium flex items-center gap-2">
+ <Label htmlFor="id" className="text-sm opacity-60 font-medium flex items-center gap-2">
<Hash className="h-3 w-3" />
ID
</Label>
@@ -229,7 +229,7 @@ export const NodeEditorModal: React.FC = () => {
<div key={key} className="space-y-2">
<Label
htmlFor={key}
- className="text-sm font-medium capitalize"
+ className="text-sm opacity-60 font-medium capitalize"
>
{key.replace(/_/g, ' ')}
</Label>
diff --git a/flowsint-app/src/renderer/src/components/graphs/use-force-graph-controls.ts b/flowsint-app/src/renderer/src/components/graphs/use-force-graph-controls.ts
deleted file mode 100644
index 18beb3e0..00000000
--- a/flowsint-app/src/renderer/src/components/graphs/use-force-graph-controls.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import { useCallback, useRef } from 'react';
-
-export interface ForceGraphControls {
- zoomIn: () => void;
- zoomOut: () => void;
- zoomToFit: () => void;
- resetZoom: () => void;
-}
-
-export const useForceGraphControls = () => {
- const graphRef = useRef<any>();
-
- const setGraphRef = useCallback((ref: any) => {
- graphRef.current = ref;
- }, []);
-
- const zoomIn = useCallback(() => {
- if (graphRef.current) {
- const zoom = graphRef.current.zoom();
- graphRef.current.zoom(zoom * 1.5);
- }
- }, []);
-
- const zoomOut = useCallback(() => {
- if (graphRef.current) {
- const zoom = graphRef.current.zoom();
- graphRef.current.zoom(zoom * 0.75);
- }
- }, []);
-
- const zoomToFit = useCallback(() => {
- if (graphRef.current) {
- graphRef.current.zoomToFit(400);
- }
- }, []);
-
- const resetZoom = useCallback(() => {
- if (graphRef.current) {
- graphRef.current.zoom(1);
- graphRef.current.centerAt(0, 0);
- }
- }, []);
-
- const controls: ForceGraphControls = {
- zoomIn,
- zoomOut,
- zoomToFit,
- resetZoom,
- };
-
- return {
- controls,
- setGraphRef,
- };
-};
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/graphs/wall/custom/context-menu.tsx b/flowsint-app/src/renderer/src/components/graphs/wall/custom/context-menu.tsx
index 7258aea8..8843e9b8 100644
--- a/flowsint-app/src/renderer/src/components/graphs/wall/custom/context-menu.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/wall/custom/context-menu.tsx
@@ -4,22 +4,15 @@ import { useQuery } from '@tanstack/react-query';
import { Skeleton } from '@/components/ui/skeleton';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
-import { Pencil, Trash2, FileCode2, Search, Info, Star, Sparkles } from 'lucide-react';
+import { FileCode2, Search, Info, Star } from 'lucide-react';
import { Transform } from '@/types';
import { GraphNode, useGraphStore } from '@/stores/graph-store';
import { useLaunchTransform } from '@/hooks/use-launch-transform';
import { useParams } from '@tanstack/react-router';
import { capitalizeFirstLetter, cn } from '@/lib/utils';
import { useConfirm } from '@/components/use-confirm-dialog';
-import { toast } from 'sonner';
-import { sketchService } from '@/api/sketch-service';
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from '@/components/ui/tooltip';
import { useLayoutStore } from '@/stores/layout-store';
+import NodeActions from '../../node-actions';
export default function ContextMenu({
node,
@@ -48,17 +41,11 @@ export default function ContextMenu({
}) {
const { id: sketchId } = useParams({ strict: false })
const [searchQuery, setSearchQuery] = useState('');
- const { confirm } = useConfirm();
const { launchTransform } = useLaunchTransform(false);
- const removeNodes = useGraphStore(s => s.removeNodes);
- const toggleNodeSelection = useGraphStore(s => s.toggleNodeSelection);
- const openChat = useLayoutStore(s => s.openChat);
- const setCurrentNode = useGraphStore(s => s.setCurrentNode);
- const setOpenNodeEditorModal = useGraphStore(s => s.setOpenNodeEditorModal);
+
const { data: transforms, isLoading } = useQuery({
queryKey: ["transforms", node.data.type],
queryFn: () => transformService.get(capitalizeFirstLetter(node.data.type)),
- // queryFn: () => transformService.get(),
});
const filteredTransforms = transforms?.filter((transform: Transform) => {
@@ -113,36 +100,6 @@ export default function ContextMenu({
e.stopPropagation();
};
- const handleAskAI = useCallback((e: React.MouseEvent) => {
- e.stopPropagation();
- toggleNodeSelection(node, false)
- openChat()
- }, [node, toggleNodeSelection, openChat])
-
- const handleEditNode = useCallback((e: React.MouseEvent) => {
- e.stopPropagation();
- const typedNode = node as GraphNode
- setCurrentNode(typedNode)
- setOpenNodeEditorModal(true)
- setMenu(null)
- }, [node, setCurrentNode, setOpenNodeEditorModal])
-
- const handleDeleteNode = async () => {
- if (!node.id || !sketchId) return
- if (!await confirm({ title: `You are about to delete this node ?`, message: "The action is irreversible." })) return
- toast.promise(
- (async () => {
- removeNodes([node.id])
- return sketchService.deleteNodes(sketchId, JSON.stringify({ nodeIds: [node.id] }))
- })(),
- {
- loading: `Deleting ${node.data.label}...`,
- success: 'Node deleted successfully.',
- error: 'Failed to delete node.'
- }
- )
- }
-
const handleTransformClick = (e: React.MouseEvent, transformId: string) => {
e.stopPropagation();
launchTransform([node.data.label], transformId, sketchId)
@@ -161,61 +118,7 @@ export default function ContextMenu({
<div className='flex text-xs items-center gap-1 truncate'>
<span className='block truncate'>{node.data.label}</span> - <span className='block'>{node.data.type}</span>
</div>
- <div className="flex items-center gap-1 ml-2">
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <div>
- <Button
- onClick={handleAskAI}
- variant="ghost"
- size="sm"
- className="h-6 w-6 p-0 hover:bg-muted opacity-70 hover:opacity-100"
- >
- <Sparkles className="h-3 w-3" strokeWidth={1.5} />
- </Button>
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>Ask AI</p>
- </TooltipContent>
- </Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <div>
- <Button
- onClick={handleEditNode}
- variant="ghost"
- size="sm"
- className="h-6 w-6 p-0 hover:bg-muted opacity-70 hover:opacity-100"
- >
- <Pencil className="h-3 w-3" strokeWidth={1.5} />
- </Button>
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>Edit node</p>
- </TooltipContent>
- </Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <div>
- <Button
- variant="ghost"
- size="sm"
- className="h-6 w-6 p-0 hover:bg-muted opacity-70 hover:opacity-100 text-destructive hover:text-destructive"
- onClick={handleDeleteNode}
- >
- <Trash2 className="h-3 w-3" strokeWidth={1.5} />
- </Button>
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>Delete node</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
+ <NodeActions node={node} setMenu={setMenu} />
</div>
{/* Search bar */}
@@ -240,7 +143,7 @@ export default function ContextMenu({
<div className="flex-1 overflow-auto min-h-0">
{isLoading ? (
<div className="p-2 space-y-2">
- {[...Array(8)].map((_, i) => (
+ {[...Array(3)].map((_, i) => (
<div key={i} className="flex items-center gap-2 p-2 rounded-md">
<Skeleton className="h-4 w-4" />
<div className="flex-1 space-y-1">
diff --git a/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx b/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx
index 057d0ca2..d971e24c 100644
--- a/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx
@@ -14,7 +14,7 @@ export const CustomNode = memo(({ data, selected, id }: NodeProps) => {
return (
- <div className="xy-node -z-[5000] -w-[160px] relative p-1 flex flex-col justify-center items-center !rounded-full h-20">
+ <div className="xy-node -z-[5000] relative p-1 flex flex-col justify-center items-center !rounded-full h-20">
<Handle type="target" position={Position.Top} id="a" className="opacity-0 group-hover:opacity-100" />
<Handle type="target" position={Position.Right} id="b" className="opacity-0 group-hover:opacity-100" />
<Handle type="source" position={Position.Bottom} id="c" className="opacity-0 group-hover:opacity-100" />
@@ -31,7 +31,7 @@ export const CustomNode = memo(({ data, selected, id }: NodeProps) => {
/>
</div>
<div
- className="text-nowrap text-center text-ellipsis truncate"
+ className="text-nowrap text-center max-w-[160px] text-ellipsis truncate"
style={{
fontSize: 11,
color: (selected || isCurrent(id)) ? "#f97316" : "#94a3b8",
diff --git a/flowsint-app/src/renderer/src/components/graphs/wall/custom/floating-edge.tsx b/flowsint-app/src/renderer/src/components/graphs/wall/custom/floating-edge.tsx
index a1701b07..bb86e305 100644
--- a/flowsint-app/src/renderer/src/components/graphs/wall/custom/floating-edge.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/wall/custom/floating-edge.tsx
@@ -1,4 +1,4 @@
-import { getBezierPath, useInternalNode } from '@xyflow/react';
+import { getSmoothStepPath, useInternalNode } from '@xyflow/react';
import { getEdgeParams } from '@/lib/utils';
@@ -27,7 +27,7 @@ function SimpleFloatingEdge({ id, source, target, markerEnd, style }) {
},
);
- const [edgePath] = getBezierPath({
+ const [edgePath] = getSmoothStepPath({
sourceX: sx,
sourceY: sy,
sourcePosition: sourcePos,
diff --git a/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx b/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx
index 81720ef5..300e9833 100644
--- a/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx
@@ -271,7 +271,7 @@ const Wall = memo(({ theme, edges }: { theme: ColorMode, edges: GraphEdge[] }) =
nodes: visibleNodes,
edges: visibleEdges,
nodeTypes,
- edgeTypes: edgeTypes as EdgeTypes,
+ // edgeTypes: edgeTypes as EdgeTypes,
onInit: setReactFlowInstance,
onNodeContextMenu,
onDrop,
@@ -286,6 +286,8 @@ const Wall = memo(({ theme, edges }: { theme: ColorMode, edges: GraphEdge[] }) =
fitView: true,
proOptions: { hideAttribution: true },
colorMode: theme,
+ minZoom: 0.1,
+ maxZoom: 2.5,
onlyRenderVisibleElements: nodes.length > 500,
connectionMode: ConnectionMode.Loose
}), [
diff --git a/flowsint-app/src/renderer/src/components/table/columns.tsx b/flowsint-app/src/renderer/src/components/table/columns.tsx
index d79a94aa..8a88d312 100644
--- a/flowsint-app/src/renderer/src/components/table/columns.tsx
+++ b/flowsint-app/src/renderer/src/components/table/columns.tsx
@@ -14,7 +14,6 @@ import {
import { Checkbox } from "../ui/checkbox"
import { useCallback, memo } from "react"
import { GraphNode, useGraphStore } from "@/stores/graph-store"
-import { Badge } from "@/components/ui/badge"
// Memoized icon component to prevent unnecessary re-renders
const MemoizedIcon = memo(({ type, size = 16 }: { type: string; size?: number }) => {
@@ -27,29 +26,15 @@ MemoizedIcon.displayName = 'MemoizedIcon'
const getStatusStyle = (status: string) => {
switch (status?.toLowerCase()) {
case 'active':
- return { bg: 'bg-emerald-50 dark:bg-emerald-950/20', text: 'text-emerald-700 dark:text-emerald-300', border: 'border-emerald-200 dark:border-emerald-800', icon: CheckCircle }
+ return { bg: 'bg-emerald-50 dark:bg-emerald-950/20', text: 'text-emerald-700 dark:text-emerald-200', border: 'border-emerald-500 dark:border-emerald-800', icon: CheckCircle }
case 'pending':
- return { bg: 'bg-amber-50 dark:bg-amber-950/20', text: 'text-amber-700 dark:text-amber-300', border: 'border-amber-200 dark:border-amber-800', icon: Clock }
+ return { bg: 'bg-amber-50 dark:bg-amber-950/20', text: 'text-amber-700 dark:text-amber-200', border: 'border-amber-500 dark:border-amber-800', icon: Clock }
case 'error':
- return { bg: 'bg-red-50 dark:bg-red-950/20', text: 'text-red-700 dark:text-red-300', border: 'border-red-200 dark:border-red-800', icon: XCircle }
+ return { bg: 'bg-red-50 dark:bg-red-950/20', text: 'text-red-700 dark:text-red-200', border: 'border-red-500 dark:border-red-800', icon: XCircle }
case 'warning':
- return { bg: 'bg-orange-50 dark:bg-orange-950/20', text: 'text-orange-700 dark:text-orange-300', border: 'border-orange-200 dark:border-orange-800', icon: AlertTriangle }
+ return { bg: 'bg-orange-50 dark:bg-orange-950/20', text: 'text-orange-700 dark:text-orange-200', border: 'border-orange-500 dark:border-orange-800', icon: AlertTriangle }
default:
- return { bg: 'bg-gray-50 dark:bg-gray-900', text: 'text-gray-700 dark:text-gray-300', border: 'border-gray-200 dark:border-gray-700', icon: Clock }
- }
-}
-
-// Helper function to get priority styling
-const getPriorityStyle = (priority: string) => {
- switch (priority?.toLowerCase()) {
- case 'high':
- return { bg: 'bg-red-50 dark:bg-red-950/20', text: 'text-red-700 dark:text-red-300', border: 'border-red-200 dark:border-red-800' }
- case 'medium':
- return { bg: 'bg-amber-50 dark:bg-amber-950/20', text: 'text-amber-700 dark:text-amber-300', border: 'border-amber-200 dark:border-amber-800' }
- case 'low':
- return { bg: 'bg-emerald-50 dark:bg-emerald-950/20', text: 'text-emerald-700 dark:text-emerald-300', border: 'border-emerald-200 dark:border-emerald-800' }
- default:
- return { bg: 'bg-gray-50 dark:bg-gray-900', text: 'text-gray-700 dark:text-gray-300', border: 'border-gray-200 dark:border-gray-700' }
+ return { bg: 'bg-gray-50 dark:bg-gray-900', text: 'text-gray-700 dark:text-gray-200', border: 'border-gray-500 dark:border-gray-700', icon: Clock }
}
}
@@ -57,15 +42,15 @@ const getPriorityStyle = (priority: string) => {
const getRiskStyle = (risk: string) => {
switch (risk?.toLowerCase()) {
case 'critical':
- return { bg: 'bg-red-100 dark:bg-red-900/30', text: 'text-red-800 dark:text-red-200' }
+ return { bg: 'bg-red-200 dark:bg-red-900/30', text: 'text-red-800 dark:text-red-500' }
case 'high':
- return { bg: 'bg-orange-100 dark:bg-orange-900/30', text: 'text-orange-800 dark:text-orange-200' }
+ return { bg: 'bg-orange-200 dark:bg-orange-900/30', text: 'text-orange-800 dark:text-orange-500' }
case 'medium':
- return { bg: 'bg-amber-100 dark:bg-amber-900/30', text: 'text-amber-800 dark:text-amber-200' }
+ return { bg: 'bg-amber-200 dark:bg-amber-900/30', text: 'text-amber-800 dark:text-amber-500' }
case 'low':
- return { bg: 'bg-emerald-100 dark:bg-emerald-900/30', text: 'text-emerald-800 dark:text-emerald-200' }
+ return { bg: 'bg-emerald-200 dark:bg-emerald-900/30', text: 'text-emerald-800 dark:text-emerald-500' }
default:
- return { bg: 'bg-gray-100 dark:bg-gray-800', text: 'text-gray-800 dark:text-gray-200' }
+ return { bg: 'bg-gray-200 dark:bg-gray-800', text: 'text-gray-800 dark:text-gray-500' }
}
}
@@ -80,7 +65,7 @@ const getConfidenceColor = (confidence: number) => {
export const columns: ColumnDef<GraphNode>[] = [
{
size: 50,
- minSize: 50,
+ minSize:50,
maxSize: 50,
enableResizing: false,
accessorKey: "icon",
@@ -114,6 +99,9 @@ export const columns: ColumnDef<GraphNode>[] = [
},
{
enableResizing: true,
+ size: 200,
+ minSize:120,
+ maxSize: 500,
accessorKey: "data.label",
header: ({ column }) => {
return (
@@ -141,12 +129,12 @@ export const columns: ColumnDef<GraphNode>[] = [
return (
<button
onClick={openEdit}
- className="text-left font-medium flex items-center gap-2 h-full truncate text-ellipsis w-full rounded-md p-2 transition-colors duration-200"
+ className="text-left font-medium flex items-center gap-2 h-full truncate text-ellipsis w-full rounded-md p-2 transition-colors duration-500"
>
{/* <div className="flex-shrink-0">
<IconComponent size={16} />
</div> */}
- <span className="hover:text-primary truncate text-[.9rem] block font-medium transition-colors duration-200">
+ <span className="hover:text-primary truncate text-[.9rem] block font-medium transition-colors duration-500">
{row.original.data.label}
</span>
</button>
@@ -167,9 +155,9 @@ export const columns: ColumnDef<GraphNode>[] = [
</Button>
)
},
- size: 100,
- minSize: 110,
- maxSize: 150,
+ size: 120,
+ minSize:80,
+ maxSize: 200,
accessorKey: "data.type",
cell: ({ row }) => {
const type = row.original.data.type
@@ -182,6 +170,9 @@ export const columns: ColumnDef<GraphNode>[] = [
},
{
enableResizing: true,
+ size: 200,
+ minSize:120,
+ maxSize: 500,
header: ({ column }) => {
return (
<Button
@@ -210,59 +201,9 @@ export const columns: ColumnDef<GraphNode>[] = [
},
{
enableResizing: true,
- header: ({ column }) => {
- return (
- <Button
- variant="ghost"
- className="h-7"
- onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
- >
- Priority
- <ArrowUpDown className="h-4 w-4" />
- </Button>
- )
- },
- accessorKey: "data.priority",
- cell: ({ row }) => {
- const priority = row.original.data.priority || 'Medium'
- const style = getPriorityStyle(priority)
-
- return (
- <Badge
- variant="outline"
- className={`${style.bg} ${style.text} ${style.border} font-medium capitalize text-xs`}
- >
- {priority}
- </Badge>
- )
- }
- },
- {
- enableResizing: true,
- header: ({ column }) => {
- return (
- <Button
- variant="ghost"
- className="h-7"
- onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
- >
- Category
- <ArrowUpDown className="h-4 w-4" />
- </Button>
- )
- },
- accessorKey: "data.category",
- cell: ({ row }) => {
- const category = row.original.data.category || 'Network'
- return (
- <div className="text-left font-medium text-gray-700 dark:text-gray-300">
- {category}
- </div>
- )
- }
- },
- {
- enableResizing: true,
+ size: 200,
+ minSize:120,
+ maxSize: 500,
header: ({ column }) => {
return (
<Button
@@ -279,7 +220,7 @@ export const columns: ColumnDef<GraphNode>[] = [
cell: ({ row }) => {
const source = row.original.data.source || 'Scanner'
return (
- <div className="text-left font-medium text-gray-700 dark:text-gray-300">
+ <div className="text-left font-medium text-gray-700 dark:text-gray-200">
{source}
</div>
)
@@ -287,6 +228,9 @@ export const columns: ColumnDef<GraphNode>[] = [
},
{
enableResizing: true,
+ size: 200,
+ minSize:120,
+ maxSize: 500,
header: ({ column }) => {
return (
<Button
@@ -306,9 +250,9 @@ export const columns: ColumnDef<GraphNode>[] = [
return (
<div className="flex items-center gap-2">
- <div className="flex-1 bg-gray-200 dark:bg-gray-700 rounded-full h-1.5">
+ <div className="flex-1 bg-gray-500 dark:bg-gray-700 rounded-full h-1.5">
<div
- className={`h-1.5 rounded-full transition-all duration-300 ${color.replace('text-', 'bg-')}`}
+ className={`h-1.5 rounded-full transition-all duration-200 ${color.replace('text-', 'bg-')}`}
style={{ width: `${confidence}%` }}
/>
</div>
@@ -321,6 +265,9 @@ export const columns: ColumnDef<GraphNode>[] = [
},
{
enableResizing: true,
+ size: 200,
+ minSize:120,
+ maxSize: 500,
header: ({ column }) => {
return (
<Button
@@ -335,7 +282,7 @@ export const columns: ColumnDef<GraphNode>[] = [
},
accessorKey: "data.riskLevel",
cell: ({ row }) => {
- const risk = row.original.data.riskLevel || 'Low'
+ const risk = row.original.data.riskLevel || 'N/A'
const style = getRiskStyle(risk)
return (
@@ -347,30 +294,9 @@ export const columns: ColumnDef<GraphNode>[] = [
},
{
enableResizing: true,
- header: ({ column }) => {
- return (
- <Button
- variant="ghost"
- className="h-7"
- onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
- >
- Tags
- <ArrowUpDown className="h-4 w-4" />
- </Button>
- )
- },
- accessorKey: "data.tags",
- cell: ({ row }) => {
- const tags = row.original.data.tags || 'infrastructure'
- return (
- <div className="text-left font-medium text-gray-600 dark:text-gray-400 text-xs">
- {tags}
- </div>
- )
- }
- },
- {
- enableResizing: true,
+ size: 200,
+ minSize:120,
+ maxSize: 500,
header: ({ column }) => {
return (
<Button
@@ -393,87 +319,10 @@ export const columns: ColumnDef<GraphNode>[] = [
)
}
},
- {
- enableResizing: true,
- header: ({ column }) => {
- return (
- <Button
- variant="ghost"
- className="h-7"
- onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
- >
- Owner
- <ArrowUpDown className="h-4 w-4" />
- </Button>
- )
- },
- accessorKey: "data.owner",
- cell: ({ row }) => {
- const owner = row.original.data.owner || 'Team A'
- return (
- <div className="text-left font-medium text-gray-700 dark:text-gray-300">
- {owner}
- </div>
- )
- }
- },
- {
- enableResizing: true,
- header: ({ column }) => {
- return (
- <Button
- variant="ghost"
- className="h-7"
- onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
- >
- Version
- <ArrowUpDown className="h-4 w-4" />
- </Button>
- )
- },
- accessorKey: "data.version",
- cell: ({ row }) => {
- const version = row.original.data.version || '1.2.3'
- return (
- <div className="text-left font-medium text-gray-500 dark:text-gray-400 font-mono text-xs">
- v{version}
- </div>
- )
- }
- },
- {
- enableResizing: true,
- header: ({ column }) => {
- return (
- <Button
- variant="ghost"
- className="h-7"
- onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
- >
- Environment
- <ArrowUpDown className="h-4 w-4" />
- </Button>
- )
- },
- accessorKey: "data.environment",
- cell: ({ row }) => {
- const env = row.original.data.environment || 'Production'
- const isProduction = env.toLowerCase() === 'production'
-
- return (
- <div className={`text-left font-medium text-xs ${isProduction
- ? 'text-red-600 dark:text-red-400'
- : 'text-emerald-600 dark:text-emerald-400'
- }`}>
- {env}
- </div>
- )
- }
- },
{
id: "actions",
size: 50,
- minSize: 50,
+ minSize:50,
maxSize: 50,
enableResizing: false,
header: () => {
@@ -487,7 +336,7 @@ export const columns: ColumnDef<GraphNode>[] = [
<DropdownMenu>
<DropdownMenuTrigger asChild>
<div>
- <Button variant="ghost" className="h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors duration-200">
+ <Button variant="ghost" className="h-8 w-8 p-0 hover:bg-gray-200 dark:hover:bg-gray-800 transition-colors duration-500">
<span className="sr-only">Open menu</span>
<MoreVertical className="h-4 w-4" />
</Button>
diff --git a/flowsint-app/src/renderer/src/components/ui/button.tsx b/flowsint-app/src/renderer/src/components/ui/button.tsx
index dda04820..49c3c1de 100644
--- a/flowsint-app/src/renderer/src/components/ui/button.tsx
+++ b/flowsint-app/src/renderer/src/components/ui/button.tsx
@@ -14,7 +14,7 @@ const buttonVariants = cva(
destructive:
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
- "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
+ "border shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-background/80 dark:hover:bg-background/90 backfrop-blur-sm",
secondary:
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
ghost:
diff --git a/flowsint-app/src/renderer/src/components/ui/sheet.tsx b/flowsint-app/src/renderer/src/components/ui/sheet.tsx
index d1e4ed10..d8c92903 100644
--- a/flowsint-app/src/renderer/src/components/ui/sheet.tsx
+++ b/flowsint-app/src/renderer/src/components/ui/sheet.tsx
@@ -34,7 +34,7 @@ function SheetOverlay({
<SheetPrimitive.Overlay
data-slot="sheet-overlay"
className={cn(
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/10",
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/30",
className
)}
{...props}
@@ -56,7 +56,7 @@ function SheetContent({
<SheetPrimitive.Content
data-slot="sheet-content"
className={cn(
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-300",
side === "right" &&
"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
side === "left" &&
@@ -70,7 +70,7 @@ function SheetContent({
{...props}
>
{children}
- <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
+ <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-300 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
<XIcon className="size-4" />
<span className="sr-only">Close</span>
</SheetPrimitive.Close>
diff --git a/flowsint-app/src/renderer/src/hooks/use-icon.tsx b/flowsint-app/src/renderer/src/hooks/use-icon.tsx
index 49adc2d4..471ab0a5 100644
--- a/flowsint-app/src/renderer/src/hooks/use-icon.tsx
+++ b/flowsint-app/src/renderer/src/hooks/use-icon.tsx
@@ -52,6 +52,7 @@ export const useIcon = (type: IconType, src?: string | null) => {
src={src || iconPath}
width={size}
height={size}
+ className="object-contain"
alt={`${type} icon`}
onError={(e) => {
const target = e.target as HTMLImageElement;
@@ -65,7 +66,7 @@ export const useIcon = (type: IconType, src?: string | null) => {
return (
<img
src={src || iconPath}
- className={className}
+ className={`object-contain ${className}`}
width={size}
height={size}
style={style}
diff --git a/flowsint-app/src/renderer/src/hooks/use-platform-icons.tsx b/flowsint-app/src/renderer/src/hooks/use-platform-icons.tsx
deleted file mode 100644
index b9b70626..00000000
--- a/flowsint-app/src/renderer/src/hooks/use-platform-icons.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { type JSX, useMemo } from "react";
-import { type ActionItem } from "@/lib/action-items"
-import { useIcon } from "@/hooks/use-icon"
-import { useActionItems } from "./use-action-items"
-
-export const usePlatformIcons = () => {
- const { actionItems } = useActionItems()
-
- return useMemo(() => {
- if (!actionItems) return {}
-
- const socials = actionItems.find((item) => item.type === "Socials")?.children
- if (!socials)
- return {};
- return socials.reduce((acc: Record<string, { icon: JSX.Element, color: string }>, item: ActionItem) => {
- const platform = item.key.split("_")[2];
- const IconComponent = useIcon(item.icon);
- acc[platform] = {
- icon: <IconComponent style={{ color: item.color }} />,
- color: item.color ?? "lightgray",
- };
- return acc;
- }, {} as Record<string, { icon: JSX.Element, color: string }>);
- }, [actionItems]);
-};
-
diff --git a/flowsint-app/src/renderer/src/stores/graph-store.ts b/flowsint-app/src/renderer/src/stores/graph-store.ts
index d97a5a1d..d7b4d6cb 100644
--- a/flowsint-app/src/renderer/src/stores/graph-store.ts
+++ b/flowsint-app/src/renderer/src/stores/graph-store.ts
@@ -46,6 +46,10 @@ interface GraphState {
clearSelectedNodes: () => void
toggleNodeSelection: (node: GraphNode, multiSelect?: boolean) => void
+ // === Relation ===
+ relatedNodeToAdd: GraphNode | null
+ setRelatedNodeToAdd: (node: GraphNode | null) => void
+
// === Dialogs ===
openMainDialog: boolean
openFormDialog: boolean
@@ -184,6 +188,10 @@ export const useGraphStore = create<GraphState>()((set, get) => ({
})
},
+ // === Relation ===
+ relatedNodeToAdd: null,
+ setRelatedNodeToAdd: (node) => set({ relatedNodeToAdd: node }),
+
// === Dialogs ===
openMainDialog: false,
openFormDialog: false,
diff --git a/flowsint-app/src/renderer/src/stores/node-display-settings.ts b/flowsint-app/src/renderer/src/stores/node-display-settings.ts
index a6062de7..2ae34fa0 100644
--- a/flowsint-app/src/renderer/src/stores/node-display-settings.ts
+++ b/flowsint-app/src/renderer/src/stores/node-display-settings.ts
@@ -137,7 +137,7 @@ const DEFAULT_COLORS: Record<ItemType, string> = {
online_activity: "#B5D1A9", // sage
digital_footprint: "#D9B0B0", // brick
username: "#C7BEE4", // periwinkle
- credential: "#BDC4CA", // medium gray
+ credential: "#F7D154", // medium gray
biometric: "#AEB3B9", // slate gray
siret: "#ADB9C6", // blue-gray
siren: "#9FAAB8", // dark slate
@@ -154,14 +154,14 @@ const DEFAULT_COLORS: Record<ItemType, string> = {
dns: "#B8E6B8", // soft mint
ssl: "#E6D4A0", // warm yellow
message: "#C4B9ED", // lavender
- malware: "#E6B8B8", // soft rose
+ malware: "#1DA7A8", // soft rose
weapon: "#F4B8A8", // coral
script: "#D4A5D4", // dusty violet
reputation: "#A9CCF4", // medium blue
risk: "#EAAFAF", // dusty rose
file: "#C1C6CD", // cool gray
bank: "#F7D154", // gold
- creditcard: "#E6D4A0", // warm yellow
+ creditcard: "#0253A4", // warm yellow
alias: "#D4A5D4", // dusty violet
affiliation: "#A6D0BF" // sage
}
diff --git a/flowsint-app/src/renderer/src/styles.css b/flowsint-app/src/renderer/src/styles.css
index aa9c1421..14066e99 100644
--- a/flowsint-app/src/renderer/src/styles.css
+++ b/flowsint-app/src/renderer/src/styles.css
@@ -209,11 +209,11 @@ html {
}
.minimal-tiptap-editor .ProseMirror h1 {
- @apply mb-4 mt-[46px] text-[1.375rem] leading-7 tracking-[-0.004375rem];
+ @apply mb-4 mt-[46px] mb-[23px] text-[1.975rem] leading-12 tracking-[-0.004375rem];
}
.minimal-tiptap-editor .ProseMirror h2 {
- @apply mb-3.5 mt-8 text-[1.1875rem] leading-7 tracking-[0.003125rem];
+ @apply mb-3.5 mt-8 text-[1.3375rem] leading-7 tracking-[0.003125rem];
}
.minimal-tiptap-editor .ProseMirror h3 {
@@ -428,7 +428,7 @@ html {
--font-sans: Inter, sans-serif;
--font-serif: Source Serif 4, serif;
--font-mono: JetBrains Mono, monospace;
- --radius: 0.375rem;
+ --radius: 0.975rem;
--shadow-2xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
--shadow-xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
--shadow-sm: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 1px 2px -2px hsl(0 0% 0% / 0.10);
@@ -693,7 +693,7 @@ html {
--font-sans: Inter, sans-serif;
--font-serif: Source Serif 4, serif;
--font-mono: JetBrains Mono, monospace;
- --radius: 0.375rem;
+ --radius: .875rem;
--shadow-2xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
--shadow-xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
--shadow-sm: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 1px 2px -2px hsl(0 0% 0% / 0.10);
@@ -707,9 +707,9 @@ html {
}
.dark {
- --background: oklch(0.25 0 0);
+ --background: oklch(0.20 0 0);
--foreground: oklch(0.9219 0 0);
- --card: oklch(0.2686 0 0);
+ --card: oklch(0.2186 0 0);
--card-foreground: oklch(0.9219 0 0);
--popover: oklch(0.2686 0 0);
--popover-foreground: oklch(0.9219 0 0);
@@ -723,7 +723,7 @@ html {
--accent-foreground: oklch(0.9243 0.1151 95.7459);
--destructive: oklch(0.6368 0.2078 25.3313);
--destructive-foreground: oklch(1.0000 0 0);
- --border: oklch(0.3715 0 0);
+ --border: oklch(0.3215 0 0);
--input: oklch(0.3715 0 0);
--ring: oklch(0.7686 0.1647 70.0804);
--chart-1: oklch(0.8369 0.1644 84.4286);
@@ -742,7 +742,7 @@ html {
--font-sans: Inter, sans-serif;
--font-serif: Source Serif 4, serif;
--font-mono: JetBrains Mono, monospace;
- --radius: 0.375rem;
+ --radius: .875rem;
--shadow-2xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
--shadow-xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
--shadow-sm: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 1px 2px -2px hsl(0 0% 0% / 0.10);
@@ -898,16 +898,18 @@ th,
@keyframes slideInFromBottomRight {
0% {
opacity: 0;
- transform: translate(100%, 100%) scale(0.8);
+ /* transform: translate(100%, 100%) scale(0.1); */
}
100% {
opacity: 1;
- transform: translate(0, 0) scale(1);
+ /* transform: translate(0, 0) scale(1); */
}
}
.floating-chat-animation {
- animation: slideInFromBottomRight 0.3s ease-out forwards;
+ animation: slideInFromBottomRight 0.1s ease-out forwards;
transform-origin: bottom right;
}
+
+