Skip to content

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

feat: updates

dextmorgnd00088eb4ca1
diff --git a/flowsint-app/resources/favicon.ico b/flowsint-app/resources/favicon.ico
new file mode 100644
index 00000000..02d348a5
Binary files /dev/null and b/flowsint-app/resources/favicon.ico differ
diff --git a/flowsint-app/resources/icon.png b/flowsint-app/resources/icon.png
index cf9e8b2c..02d348a5 100644
Binary files a/flowsint-app/resources/icon.png and b/flowsint-app/resources/icon.png differ
diff --git a/flowsint-app/src/renderer/index.html b/flowsint-app/src/renderer/index.html
index ba65b0ba..9ed61218 100644
--- a/flowsint-app/src/renderer/index.html
+++ b/flowsint-app/src/renderer/index.html
@@ -8,15 +8,17 @@
</script> -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <link rel="icon" href="/favicon.ico" />
+
+ <!-- Favicon -->
+ <link rel="icon" href="/icon.ico" />
+ <link rel="apple-touch-icon" href="/icon.png" />
+ <link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#000000" />
<meta
name="description"
- content="Web site created using create-tsrouter-app"
+ content="Graph based investigation manager."
/>
- <link rel="apple-touch-icon" href="/logo192.png" />
- <link rel="manifest" href="/manifest.json" />
- <title>Create TanStack App - flowsint-app</title>
+ <title>Flowsint</title>
</head>
<body>
<div id="root"></div>
diff --git a/flowsint-app/src/renderer/public/icon.ico b/flowsint-app/src/renderer/public/icon.ico
new file mode 100644
index 00000000..02d348a5
Binary files /dev/null and b/flowsint-app/src/renderer/public/icon.ico differ
diff --git a/flowsint-app/src/renderer/public/icon.png b/flowsint-app/src/renderer/public/icon.png
new file mode 100644
index 00000000..02d348a5
Binary files /dev/null and b/flowsint-app/src/renderer/public/icon.png differ
diff --git a/flowsint-app/src/renderer/public/manifest.json b/flowsint-app/src/renderer/public/manifest.json
new file mode 100644
index 00000000..4b480c0f
--- /dev/null
+++ b/flowsint-app/src/renderer/public/manifest.json
@@ -0,0 +1,14 @@
+{
+ "name": "Flowsint",
+ "short_name": "Flowsint",
+ "icons": [
+ {
+ "src": "/icon.png",
+ "sizes": "512x512",
+ "type": "image/png"
+ }
+ ],
+ "theme_color": "#000000",
+ "background_color": "#000000",
+ "display": "standalone"
+}
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/api/sketch-service.ts b/flowsint-app/src/renderer/src/api/sketch-service.ts
index aaf5ad06..2b877c88 100644
--- a/flowsint-app/src/renderer/src/api/sketch-service.ts
+++ b/flowsint-app/src/renderer/src/api/sketch-service.ts
@@ -35,7 +35,7 @@ export const sketchService = {
});
},
addEdge: async (sketchId: string, body: BodyInit): Promise<any> => {
- return fetchWithAuth(`/api/sketches/${sketchId}/edges/add`, {
+ return fetchWithAuth(`/api/sketches/${sketchId}/relations/add`, {
method: 'POST',
body: body
});
diff --git a/flowsint-app/src/renderer/src/components/dashboard/investigation-skeleton.tsx b/flowsint-app/src/renderer/src/components/dashboard/investigation-skeleton.tsx
new file mode 100644
index 00000000..241df65e
--- /dev/null
+++ b/flowsint-app/src/renderer/src/components/dashboard/investigation-skeleton.tsx
@@ -0,0 +1,93 @@
+import { Skeleton } from '@/components/ui/skeleton'
+import { Card, CardContent, CardHeader } from '@/components/ui/card'
+
+export function InvestigationSkeleton() {
+ return (
+ <div className="h-full w-full px-4 py-12 bg-background overflow-auto">
+ <div className='max-w-4xl mx-auto flex flex-col gap-12 items-center justify-start'>
+ {/* Recent Investigations Skeleton */}
+ <div className="w-full space-y-4">
+ <div className="flex items-center justify-between">
+ <Skeleton className="h-7 w-48" />
+ <Skeleton className="h-9 w-28" />
+ </div>
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
+ {[...Array(2)].map((_, i) => (
+ <Card key={i} className="p-4">
+ <div className="space-y-3">
+ <div className="flex items-center justify-between">
+ <Skeleton className="h-5 w-32" />
+ <Skeleton className="h-4 w-20" />
+ </div>
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-3/4" />
+ <div className="flex items-center gap-2">
+ <Skeleton className="h-4 w-4" />
+ <Skeleton className="h-4 w-24" />
+ </div>
+ </div>
+ </Card>
+ ))}
+ </div>
+ </div>
+
+ {/* Get Started Section Skeleton */}
+ <div className="w-full space-y-4">
+ <Skeleton className="h-7 w-48" />
+ <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
+ {[...Array(3)].map((_, i) => (
+ <Card key={i}>
+ <CardHeader className="flex flex-row items-center gap-3 pb-2">
+ <Skeleton className="h-9 w-9 rounded-lg" />
+ <Skeleton className="h-6 w-32" />
+ </CardHeader>
+ <CardContent>
+ <Skeleton className="h-4 w-full mb-2" />
+ <Skeleton className="h-4 w-3/4" />
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+ </div>
+
+ {/* Discover Section Skeleton */}
+ <div className="w-full space-y-4">
+ <Skeleton className="h-7 w-48" />
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
+ {[...Array(2)].map((_, i) => (
+ <Card key={i}>
+ <CardHeader className="flex flex-row items-center gap-3 pb-2">
+ <Skeleton className="h-9 w-9 rounded-lg" />
+ <Skeleton className="h-6 w-40" />
+ </CardHeader>
+ <CardContent>
+ <Skeleton className="h-4 w-full mb-2" />
+ <Skeleton className="h-4 w-3/4" />
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+ </div>
+
+ {/* Useful Resources Skeleton */}
+ <div className="w-full space-y-4">
+ <Skeleton className="h-7 w-48" />
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
+ {[...Array(2)].map((_, i) => (
+ <Card key={i}>
+ <CardHeader className="flex flex-row items-center gap-3 pb-2">
+ <Skeleton className="h-9 w-9 rounded-lg" />
+ <Skeleton className="h-6 w-40" />
+ </CardHeader>
+ <CardContent>
+ <Skeleton className="h-4 w-full mb-2" />
+ <Skeleton className="h-4 w-3/4" />
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/dashboard/recent-investigations.tsx b/flowsint-app/src/renderer/src/components/dashboard/recent-investigations.tsx
index c703bf49..338702a0 100644
--- a/flowsint-app/src/renderer/src/components/dashboard/recent-investigations.tsx
+++ b/flowsint-app/src/renderer/src/components/dashboard/recent-investigations.tsx
@@ -55,7 +55,7 @@ export function RecentInvestigations() {
return (
<div className="w-full mt-2">
- <h2 className="text-xl font-bold mb-2 text-foreground">Recent investigations</h2>
+ <h2 className="text-xl font-bold mb-2 text-foreground">Recent investigations ({investigations.length})</h2>
<div className="border-b border-border mb-2" />
<div className="flex flex-col gap-2">
{investigations.slice(0, 5).map((investigation) => (
diff --git a/flowsint-app/src/renderer/src/components/graphs/create-relation.tsx b/flowsint-app/src/renderer/src/components/graphs/create-relation.tsx
index ac8af4c2..4795987c 100644
--- a/flowsint-app/src/renderer/src/components/graphs/create-relation.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/create-relation.tsx
@@ -22,24 +22,27 @@ export function CreateRelationDialog() {
const handleSubmit = async (e: { preventDefault: () => void }) => {
e.preventDefault()
- try {
- const newEdge = {
- source: selectedNodes[0],
- target: selectedNodes[1],
- type: direction,
- label: relationType,
- sketch_id: sketchId
- }
- const newEdgeObject = { type: newEdge.type, label: relationType, from: newEdge.source.id, to: newEdge.target.id } as any
- if (addEdge) addEdge(newEdgeObject)
- toast.success("Relation successfully added.")
- setOpenAddRelationDialog(false)
- await sketchService.addEdge(sketchId as string, newEdgeObject)
- } catch (error) {
- toast.error("Unexpected error during node creation.")
- } finally {
- setOpenAddRelationDialog(false)
+ const newEdge = {
+ source: selectedNodes[0],
+ target: selectedNodes[1],
+ type: direction,
+ label: relationType,
+ sketch_id: sketchId
}
+ const newEdgeObject = { type: newEdge.type, label: relationType, from: newEdge.source.id, to: newEdge.target.id } as any
+
+ toast.promise(
+ (async () => {
+ if (addEdge) addEdge(newEdgeObject)
+ setOpenAddRelationDialog(false)
+ return sketchService.addEdge(sketchId as string, JSON.stringify(newEdge))
+ })(),
+ {
+ loading: 'Creating relation...',
+ success: 'Relation successfully added.',
+ error: 'Unexpected error during relation creation.'
+ }
+ )
}
const getNodeDisplayName = (node: any) => {
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 31141a6e..92ca2efa 100644
--- a/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
@@ -1,20 +1,35 @@
import { useLoaderData } from '@tanstack/react-router'
-import { useEffect, useRef, useState } from 'react'
+import { useEffect, useRef, memo, useState } from 'react'
import Graph from '../sketches/graph'
import { useSketchStore } from '@/stores/sketch-store'
import { Toolbar } from '../sketches/toolbar'
import { cn } from '@/lib/utils'
import { ArrowDownToLineIcon } from 'lucide-react'
+import { CreateRelationDialog } from './create-relation'
+
+// Separate component for the drag overlay
+const DragOverlay = memo(({ isDragging }: { isDragging: boolean }) => (
+ <div
+ className={cn(
+ 'absolute flex items-center justify-center inset-0 bg-primary/20 backdrop-blur-xs gap-1',
+ 'opacity-0 pointer-events-none transition-opacity duration-200',
+ isDragging && 'opacity-100 pointer-events-auto'
+ )}
+ >
+ <p className="font-medium">Drop here to add node</p>
+ <ArrowDownToLineIcon className="opacity-60" />
+ </div>
+))
+DragOverlay.displayName = 'DragOverlay'
const GraphPanel = () => {
const graphPanelRef = useRef<HTMLDivElement>(null)
- const [isDraggingOver, setIsDraggingOver] = useState(false)
const handleOpenFormModal = useSketchStore(s => s.handleOpenFormModal)
-
const updateGraphData = useSketchStore(s => s.updateGraphData)
const { sketch, graphData } = useLoaderData({
from: '/_auth/dashboard/investigations/$investigationId/$type/$id',
})
+ const [isDraggingOver, setIsDraggingOver] = useState(false)
useEffect(() => {
if (graphData?.nds && graphData?.rls) {
@@ -22,7 +37,6 @@ const GraphPanel = () => {
}
}, [graphData])
- // Handle drag events
const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {
e.preventDefault()
setIsDraggingOver(true)
@@ -67,22 +81,22 @@ const GraphPanel = () => {
}
return (
-
- <div ref={graphPanelRef}
- className={cn('h-full w-full flex relative outline-2 outline-transparent bg-background')} onDragOver={handleDragOver}
+ <div
+ ref={graphPanelRef}
+ className="h-full w-full flex relative outline-2 outline-transparent bg-background"
+ onDragOver={handleDragOver}
onDragEnter={handleDragEnter}
onDragLeave={handleDragLeave}
onDrop={handleDrop}
>
<Graph isLoading={false} />
- {isDraggingOver &&
- <div className={cn('absolute flex items-center justify-center inset-0 bg-primary/20 backdrop-blur-xs gap-1')}>
- <p className="font-medium">Drop here to add node</p> <ArrowDownToLineIcon className="opacity-60" />
- </div>
- }
- <div className='h-full border-l overflow-y-auto'> <Toolbar /></div>
+ <DragOverlay isDragging={isDraggingOver} />
+ <div className='absolute w-10 right-3 top-3 h-min shadow-sm border rounded-full overflow-y-auto'>
+ <Toolbar />
+ </div>
+ <CreateRelationDialog />
</div>
)
}
-export default GraphPanel
\ No newline at end of file
+export default memo(GraphPanel)
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/graphs/nodes-panel.tsx b/flowsint-app/src/renderer/src/components/graphs/nodes-panel.tsx
index 226e1a46..380b7c20 100644
--- a/flowsint-app/src/renderer/src/components/graphs/nodes-panel.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/nodes-panel.tsx
@@ -229,7 +229,8 @@ const NodesPanel = memo(({ nodes, isLoading }: { nodes: NodeData[]; isLoading?:
<div className="sticky border-b top-0 p-2 bg-card z-10 flex-shrink-0">
<div className="flex items-center gap-2">
<Badge className="h-7" variant={"outline"}>
- <span className="font-semibold">{nodes?.length || 0}</span>{" "}
+ <span className="font-semibold">
+ {(filters?.length || searchQuery) ? `${filteredNodes?.length} / ${nodes?.length || 0}` : nodes?.length || 0}</span>{" "}
<span className="font-normal opacity-60">nodes</span>
</Badge>
<div className="relative grow">
@@ -245,14 +246,16 @@ const NodesPanel = memo(({ nodes, isLoading }: { nodes: NodeData[]; isLoading?:
<DropdownMenu>
<div>
<DropdownMenuTrigger asChild>
- <Button variant={"outline"} className="h-7 w-8 relative border-border border" size={"icon"}>
- <FilterIcon className={cn("opacity-60 h-3 w-3", filters && "opacity-100")} />
- {filters && (
- <Badge className="absolute -top-2 -right-1 text-xs rounded-full h-4 w-4" variant={"default"}>
- {filters.length}
- </Badge>
- )}
- </Button>
+ <div>
+ <Button variant={"outline"} className="h-7 w-8 relative border-border border" size={"icon"}>
+ <FilterIcon className={cn("opacity-60 h-3 w-3", filters && "opacity-100")} />
+ {filters && (
+ <Badge className="absolute -top-2 -right-1 text-xs rounded-full h-4 w-4" variant={"default"}>
+ {filters.length}
+ </Badge>
+ )}
+ </Button>
+ </div>
</DropdownMenuTrigger>
</div>
<DropdownMenuContent className="w-48 max-h-[50vh] space-y-1 overflow-y-auto">
diff --git a/flowsint-app/src/renderer/src/components/investigations/investigation-list.tsx b/flowsint-app/src/renderer/src/components/investigations/investigation-list.tsx
index 4a7a89bb..51bbe35a 100644
--- a/flowsint-app/src/renderer/src/components/investigations/investigation-list.tsx
+++ b/flowsint-app/src/renderer/src/components/investigations/investigation-list.tsx
@@ -138,14 +138,14 @@ const InvestigationList = () => {
>
{data?.map((investigation: Investigation) => (
<AccordionItem key={investigation.id} value={investigation.id}>
- <AccordionTrigger className="px-2 py-1 text-muted-foreground text-sm hover:no-underline hover:bg-muted/50 group">
+ <AccordionTrigger className="px-2 py-1.5 text-muted-foreground text-sm hover:no-underline hover:bg-muted/50 group">
<div className="flex items-center gap-2 w-full">
<Link
to="/dashboard/investigations/$investigationId"
params={{
investigationId: investigation.id,
}}
- className="truncate text-ellipsis"
+ className="truncate text-ellipsis hover:underline"
>{investigation.name}</Link>
<DropdownMenu>
<DropdownMenuTrigger asChild>
diff --git a/flowsint-app/src/renderer/src/components/layout/breadcrumb.tsx b/flowsint-app/src/renderer/src/components/layout/breadcrumb.tsx
new file mode 100644
index 00000000..fbae258a
--- /dev/null
+++ b/flowsint-app/src/renderer/src/components/layout/breadcrumb.tsx
@@ -0,0 +1,120 @@
+import { useLocation, useParams } from "@tanstack/react-router"
+import {
+ Breadcrumb,
+ BreadcrumbItem,
+ BreadcrumbLink,
+ BreadcrumbList,
+ BreadcrumbPage,
+ BreadcrumbSeparator,
+} from "@/components/ui/breadcrumb"
+import { Link } from "@tanstack/react-router"
+import { useQuery } from "@tanstack/react-query"
+import { investigationService } from "@/api/investigation-service"
+import { sketchService } from "@/api/sketch-service"
+import { transformService } from "@/api/transfrom-service"
+import { Skeleton } from "@/components/ui/skeleton"
+import { Home } from "lucide-react"
+
+export function PathBreadcrumb() {
+ const { investigationId, id, type, transformId } = useParams({ strict: false })
+ const location = useLocation()
+
+ const { data: investigation, isLoading: isInvestigationLoading } = useQuery({
+ queryKey: ["investigation", investigationId],
+ queryFn: () => investigationService.getById(investigationId!),
+ enabled: !!investigationId,
+ })
+
+ const { data: sketch, isLoading: isSketchLoading } = useQuery({
+ queryKey: ["sketch", id],
+ queryFn: () => sketchService.getById(id!),
+ enabled: !!id && type === "graph",
+ })
+
+ const { data: transform, isLoading: isTransformLoading } = useQuery({
+ queryKey: ["transform", transformId],
+ queryFn: () => transformService.getById(transformId!),
+ enabled: !!transformId,
+ })
+
+ const isTransformsPage = location.pathname.includes('/transforms')
+
+ return (
+ <div className="w-full overflow-hidden">
+ <Breadcrumb className="w-full">
+ <BreadcrumbList className="flex items-center justify-start gap-1 min-w-0">
+ <BreadcrumbItem className="flex-shrink-0">
+ <BreadcrumbLink asChild>
+ <Link to="/dashboard" className="truncate font-medium">
+ <Home className="h-4 w-4 opacity-60" strokeWidth={1.4} />
+ </Link>
+ </BreadcrumbLink>
+ </BreadcrumbItem>
+ {isTransformsPage ? (
+ <>
+ <BreadcrumbSeparator className="flex-shrink-0" />
+ <BreadcrumbItem className="min-w-0">
+ <BreadcrumbLink asChild>
+ <Link to="/dashboard/transforms" className="truncate block font-medium">
+ Transforms
+ </Link>
+ </BreadcrumbLink>
+ </BreadcrumbItem>
+ {transformId && (
+ <>
+ <BreadcrumbSeparator className="flex-shrink-0" />
+ <BreadcrumbItem className="min-w-0 flex-1">
+ <BreadcrumbPage className="truncate block text-muted-foreground">
+ {isTransformLoading ? (
+ <Skeleton className="h-4 w-24" />
+ ) : (
+ transform?.name || "(Unnamed transform)"
+ )}
+ </BreadcrumbPage>
+ </BreadcrumbItem>
+ </>
+ )}
+ </>
+ ) : investigationId && (
+ <>
+ <BreadcrumbSeparator className="flex-shrink-0" />
+ <BreadcrumbItem className="min-w-0">
+ <BreadcrumbLink asChild>
+ <Link
+ to="/dashboard/investigations/$investigationId"
+ params={{ investigationId: investigationId! }}
+ className="truncate block font-medium"
+ >
+ {isInvestigationLoading ? (
+ <Skeleton className="h-4 w-24" />
+ ) : (
+ investigation?.name
+ )}
+ </Link>
+ </BreadcrumbLink>
+ </BreadcrumbItem>
+ {type && id && (
+ <>
+ <BreadcrumbSeparator className="flex-shrink-0" />
+ <BreadcrumbItem className="min-w-0 flex-1">
+ <BreadcrumbPage className="truncate block text-muted-foreground">
+ {type === "graph" ? (
+ isSketchLoading ? (
+ <Skeleton className="h-4 w-24" />
+ ) : (
+ sketch?.title
+ )
+ ) : (
+ type
+ )}
+ </BreadcrumbPage>
+ </BreadcrumbItem>
+ </>
+ )}
+ </>
+ )}
+ </BreadcrumbList>
+ </Breadcrumb>
+ </div>
+ )
+}
diff --git a/flowsint-app/src/renderer/src/components/layout/root.layout.tsx b/flowsint-app/src/renderer/src/components/layout/root.layout.tsx
index d9e5bab2..0e88de6e 100644
--- a/flowsint-app/src/renderer/src/components/layout/root.layout.tsx
+++ b/flowsint-app/src/renderer/src/components/layout/root.layout.tsx
@@ -7,6 +7,7 @@ import { ConfirmContextProvider } from "@/components/use-confirm-dialog"
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "../ui/resizable"
import { LogPanel } from "./log-panel"
import { useConsoleStore } from "@/stores/console-store"
+import { PathBreadcrumb } from "./breadcrumb"
interface LayoutProps {
children: ReactNode
@@ -41,13 +42,14 @@ export default function RootLayout({ children }: LayoutProps) {
<ResizablePanel
defaultSize={20}
minSize={16}
+ maxSize={30}
collapsible={true}
collapsedSize={0}
>
- {/* <div className="h-10 bg-card flex items-center justify-end px-2 text-sm w-full font-semibold border-b">
- <Button disabled className="h-7 !bg-muted" variant={"outline"}>Import</Button>
- </div> */}
- <div className="h-full flex flex-col overflow-hidden bg-card">
+ <div className="h-10 bg-card flex items-center justify-end px-2 text-sm w-full font-semibold border-b">
+ <PathBreadcrumb />
+ </div>
+ <div className="h-[calc(100%-40px)] flex flex-col overflow-hidden bg-card">
<SecondaryNavigation />
</div>
</ResizablePanel>
diff --git a/flowsint-app/src/renderer/src/components/layout/sketch.layout.tsx b/flowsint-app/src/renderer/src/components/layout/sketch.layout.tsx
deleted file mode 100644
index 6d93ea5d..00000000
--- a/flowsint-app/src/renderer/src/components/layout/sketch.layout.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { type ReactNode } from "react"
-import { Toolbar } from "../sketches/toolbar"
-
-interface LayoutProps {
- children: ReactNode
-}
-
-export default function SketchLayout({ children }: LayoutProps) {
-
- return (
- <div className="flex h-full w-full">
- <div className="h-full w-full">
- {children}
- </div>
- <div className="w-12 h-full border-l !overflow-y-auto p-2">
- <Toolbar />
- </div>
- </div>
- )
-}
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/layout/top-navbar.tsx b/flowsint-app/src/renderer/src/components/layout/top-navbar.tsx
index 0ef92e05..3744fc16 100644
--- a/flowsint-app/src/renderer/src/components/layout/top-navbar.tsx
+++ b/flowsint-app/src/renderer/src/components/layout/top-navbar.tsx
@@ -8,7 +8,10 @@ export function TopNavbar() {
return (
<header className="flex items-center bg-card h-12 px-4 border-b shrink-0">
<div className="flex items-center gap-4">
- <span className="text-lg font-semibold">Flowsint</span>
+ <Link to="/dashboard" className="flex items-center gap-2">
+ <img src="/icon.png" alt="Flowsint" className="h-8 w-8" />
+ <span className="text-lg font-semibold">Flowsint</span>
+ </Link>
<Link to="/dashboard/tools">
<Button variant="ghost" className="px-2">
Tools
diff --git a/flowsint-app/src/renderer/src/components/sketches/graph.tsx b/flowsint-app/src/renderer/src/components/sketches/graph.tsx
index 23d89205..3c8793ee 100644
--- a/flowsint-app/src/renderer/src/components/sketches/graph.tsx
+++ b/flowsint-app/src/renderer/src/components/sketches/graph.tsx
@@ -9,7 +9,7 @@ import { PlusIcon } from "lucide-react"
import { useGraphControls } from "@/stores/graph-controls-store"
// @ts-ignore
import { type CosmosInputNode } from "@cosmograph/cosmos"
-import { ResizablePanel, ResizablePanelGroup } from "../ui/resizable"
+import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "../ui/resizable"
import Legend from "./legend"
// Lazy loading du timeline
@@ -22,64 +22,43 @@ interface GraphProps {
}
// Hook pour tracker l'état de chargement de Cosmograph
const useCosmographLoader = (nodes: any[], edges: any[]) => {
- const [isCosmographReady, setIsCosmographReady] = useState(false)
- const [loadingStage, setLoadingStage] = useState<'importing' | 'simulating' | 'rendering' | 'ready'>('importing')
+ const [isCosmographReady, setIsCosmographReady] = useState(true)
+ const [loadingStage, setLoadingStage] = useState<'importing' | 'simulating' | 'rendering' | 'ready'>('ready')
const cosmograph = useCosmograph()
const dataVersionRef = useRef(0)
- const readyTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
useEffect(() => {
// Reset l'état quand les données changent
dataVersionRef.current += 1
setIsCosmographReady(false)
setLoadingStage('importing')
-
if (!cosmograph?.cosmograph || nodes.length === 0) {
setIsCosmographReady(true)
setLoadingStage('ready')
return
}
+ // Skip simulation if no edges
+ if (edges.length === 0) {
+ setIsCosmographReady(true)
+ setLoadingStage('ready')
+ return
+ }
+ setLoadingStage('simulating')
+ }, [cosmograph?.cosmograph, nodes.length, edges.length])
- const currentVersion = dataVersionRef.current
-
- // Étape 1: Import des données
- setLoadingStage('importing')
-
- // Attendre que la simulation commence
- const checkSimulation = () => {
- if (currentVersion !== dataVersionRef.current) return
-
+ const handleSimulationStart = useCallback(() => {
+ if (edges.length > 0) {
setLoadingStage('simulating')
-
- // Attendre que la simulation se stabilise
- const checkStability = () => {
- if (currentVersion !== dataVersionRef.current) return
-
- setLoadingStage('rendering')
-
- readyTimeoutRef.current = setTimeout(() => {
- if (currentVersion === dataVersionRef.current) {
- setLoadingStage('ready')
- setIsCosmographReady(true)
- }
- }, 300)
- }
-
- // Attendre 500ms pour la simulation (ajustable selon vos besoins)
- setTimeout(checkStability, 500)
+ setIsCosmographReady(false)
}
+ }, [edges.length])
- // Démarrer le processus après un court délai
- setTimeout(checkSimulation, 100)
-
- return () => {
- if (readyTimeoutRef.current) {
- clearTimeout(readyTimeoutRef.current)
- }
- }
- }, [cosmograph?.cosmograph, nodes.length, edges.length])
+ const handleSimulationEnd = useCallback(() => {
+ setLoadingStage('ready')
+ setIsCosmographReady(true)
+ }, [])
- return { isCosmographReady, loadingStage }
+ return { isCosmographReady, loadingStage, handleSimulationStart, handleSimulationEnd }
}
// Composant de loader personnalisé pour Cosmograph
@@ -110,10 +89,11 @@ EmptyState.displayName = "EmptyState"
const GRAPH_CONFIG = {
// simulationCenter: 0.2,
+ useQuadtree: true,
simulationDecay: 100,
simulationGravity: 0.25,
// simulationLinkSpring: 2,
- simulationRepulsion: 1,
+ simulationRepulsion: 2,
// simulationRepulsionTheta: 1.15,
linkStrength: 1,
simulationLinkDistance: .1,
@@ -127,7 +107,7 @@ const GraphContent = memo(() => {
const nodes = useSketchStore(s => s.nodes)
const edges = useSketchStore(s => s.edges)
const currentNode = useSketchStore(s => s.currentNode)
- const { isCosmographReady, loadingStage } = useCosmographLoader(nodes, edges)
+ const { isCosmographReady, loadingStage, handleSimulationStart, handleSimulationEnd } = useCosmographLoader(nodes, edges)
const clearSelectedNodes = useSketchStore(s => s.clearSelectedNodes)
const toggleNodeSelection = useSketchStore(s => s.toggleNodeSelection)
const colors = useNodesDisplaySettings(s => s.colors)
@@ -140,6 +120,7 @@ const GraphContent = memo(() => {
// Callbacks stables - créés une seule fois
const handleLabelClick = useCallback((node: any, event: MouseEvent) => {
+
const multiSelect = event.ctrlKey || event.shiftKey || event.altKey
toggleNodeSelection(node, multiSelect)
cosmograph?.cosmograph?.zoomToNode(node)
@@ -153,8 +134,7 @@ const GraphContent = memo(() => {
if (event) {
const multiSelect = event.ctrlKey || event.shiftKey || event.altKey
toggleNodeSelection(clickedNode, multiSelect)
- cosmograph?.cosmograph?.fitViewByNodeIds([clickedNode.id])
-
+ cosmograph?.cosmograph?.zoomToNode(clickedNode)
} else {
cosmograph?.cosmograph?.zoomToNode(clickedNode)
}
@@ -187,15 +167,15 @@ const GraphContent = memo(() => {
zoomIn: () => {
const current = cosmograph.cosmograph?.getZoomLevel()
const zoomLevel = current ? current * 1.5 : 1.5
- cosmograph.cosmograph?.setZoomLevel(zoomLevel, 500)
+ cosmograph.cosmograph?.setZoomLevel(zoomLevel, 200)
},
zoomToFit: () => {
- cosmograph.cosmograph?.fitView(500)
+ cosmograph.cosmograph?.fitView(200)
},
zoomOut: () => {
const current = cosmograph.cosmograph?.getZoomLevel()
const zoomLevel = current ? current * 0.5 : 0.5
- cosmograph.cosmograph?.setZoomLevel(zoomLevel, 500)
+ cosmograph.cosmograph?.setZoomLevel(zoomLevel, 200)
},
}
@@ -221,6 +201,8 @@ const GraphContent = memo(() => {
<div className="relative h-full w-full">
<Cosmograph
{...GRAPH_CONFIG}
+ onSimulationStart={handleSimulationStart}
+ onSimulationEnd={handleSimulationEnd}
onLabelClick={handleLabelClick}
onClick={handleNodeClick}
nodeSize={nodeSizeFunction}
@@ -246,7 +228,7 @@ const TimelinePanel = memo(() => {
return (
<Suspense fallback={<div className="h-full flex items-center justify-center text-sm text-muted-foreground">Loading timeline...</div>}>
<CosmographTimeline
- className="!bg-background"
+ className="!bg-background !h-full"
// @ts-ignore
accessor={dateAccessor}
animationSpeed={20}
@@ -287,11 +269,9 @@ const Graph = memo(({ isLoading }: GraphProps) => {
if (isLoading) {
return <div className="h-full w-full flex items-center justify-center"><Loader /></div>
}
-
if (!nodes.length) {
return <EmptyState />
}
-
return (
<div className="relative h-full grow w-full flex flex-col bg-background min-h-0">
<GraphProvider nodes={nodes} edges={edges}>
@@ -299,6 +279,10 @@ const Graph = memo(({ isLoading }: GraphProps) => {
<ResizablePanel defaultSize={75} minSize={30} className="flex-grow min-h-0 inset-shadow">
<GraphContent />
</ResizablePanel>
+ <ResizableHandle />
+ {/* <ResizablePanel defaultSize={25} minSize={10} className="flex-grow h-full min-h-0 inset-shadow">
+ <TimelinePanel />
+ </ResizablePanel> */}
</ResizablePanelGroup>
</GraphProvider>
<Legend />
diff --git a/flowsint-app/src/renderer/src/components/sketches/legend.tsx b/flowsint-app/src/renderer/src/components/sketches/legend.tsx
index feeba5aa..091bbf22 100644
--- a/flowsint-app/src/renderer/src/components/sketches/legend.tsx
+++ b/flowsint-app/src/renderer/src/components/sketches/legend.tsx
@@ -3,11 +3,13 @@ import { Card } from '../ui/card'
import { useNodesDisplaySettings } from '@/stores/node-display-settings'
import { AnimatePresence, motion } from 'framer-motion'
import { cn } from '@/lib/utils'
+import { Eye, EyeOff } from 'lucide-react'
const MAX_ENTRIES = 6
const Legend = () => {
const [showAll, setShowAll] = useState(false)
+ const [isVisible, setIsVisible] = useState(false)
const getIcon = useNodesDisplaySettings(s => s.getIcon)
const colors = useNodesDisplaySettings(s => s.colors)
@@ -15,48 +17,67 @@ const Legend = () => {
const visibleEntries = showAll ? entries : entries.slice(0, MAX_ENTRIES)
const left = entries.length - MAX_ENTRIES
-
return (
<div className='absolute text-xs bottom-2 left-2'>
- <Card className='p-2 rounded backdrop-blur-sm bg-background/30 border-none'>
- <div>
- <ul className={cn('grid grid-cols-2 items-center gap-1', showAll && 'grid-cols-3')}>
- <AnimatePresence initial={false}>
- {visibleEntries.map(([key, value]) => (
- <motion.li
- key={key}
- layout
- initial={{ opacity: 0, y: -5 }}
- animate={{ opacity: 1, y: 0 }}
- exit={{ opacity: 0, y: -5 }}
- transition={{ duration: 0.2 }}
- >
- <div className='flex items-center gap-2'>
- {/* @ts-ignore */}
- <span>{getIcon(key)}</span>
- <span className='capitalize'>{key.split("_").join(" ")}</span>
- <span
- className='w-2 h-2 rounded-full'
- style={{ backgroundColor: value }}
- ></span>
- </div>
- </motion.li>
- ))}
- </AnimatePresence>
- </ul>
- {entries.length > MAX_ENTRIES && (
- <motion.button
- onClick={() => setShowAll(prev => !prev)}
- className='mt-2 text-blue-500 hover:underline'
- initial={{ opacity: 0 }}
- animate={{ opacity: 1 }}
- transition={{ delay: 0.2 }}
+ <div className='flex items-center gap-2'>
+ <button
+ onClick={() => setIsVisible(prev => !prev)}
+ className='p-1.5 rounded-full bg-background/30 backdrop-blur-sm hover:bg-background/50 transition-colors'
+ title={isVisible ? 'Hide legend' : 'Show legend'}
+ >
+ {isVisible ? <EyeOff className='opacity-70' size={14} /> : <Eye className='opacity-70' size={14} />}
+ </button>
+ <AnimatePresence>
+ {isVisible && (
+ <motion.div
+ initial={{ opacity: 0, scale: 0.95 }}
+ animate={{ opacity: 1, scale: 1 }}
+ exit={{ opacity: 0, scale: 0.95 }}
+ transition={{ duration: 0.2 }}
>
- {showAll ? 'Show less' : `Show more (${left})`}
- </motion.button>
+ <Card className='p-2 rounded backdrop-blur-sm bg-background/30 border-none'>
+ <div>
+ <ul className={cn('grid grid-cols-2 items-center gap-1', showAll && 'grid-cols-3')}>
+ <AnimatePresence initial={false}>
+ {visibleEntries.map(([key, value]) => (
+ <motion.li
+ key={key}
+ layout
+ initial={{ opacity: 0, y: -5 }}
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0, y: -5 }}
+ transition={{ duration: 0.2 }}
+ >
+ <div className='flex items-center gap-2'>
+ {/* @ts-ignore */}
+ <span>{getIcon(key)}</span>
+ <span className='capitalize'>{key.split("_").join(" ")}</span>
+ <span
+ className='w-2 h-2 rounded-full'
+ style={{ backgroundColor: value }}
+ ></span>
+ </div>
+ </motion.li>
+ ))}
+ </AnimatePresence>
+ </ul>
+ {entries.length > MAX_ENTRIES && (
+ <motion.button
+ onClick={() => setShowAll(prev => !prev)}
+ className='mt-2 text-blue-500 hover:underline'
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ transition={{ delay: 0.2 }}
+ >
+ {showAll ? 'Show less' : `Show more (${left})`}
+ </motion.button>
+ )}
+ </div>
+ </Card>
+ </motion.div>
)}
- </div>
- </Card>
+ </AnimatePresence>
+ </div>
</div>
)
}
diff --git a/flowsint-app/src/renderer/src/components/sketches/new-actions.tsx b/flowsint-app/src/renderer/src/components/sketches/new-actions.tsx
index 6c225e71..ef73066c 100644
--- a/flowsint-app/src/renderer/src/components/sketches/new-actions.tsx
+++ b/flowsint-app/src/renderer/src/components/sketches/new-actions.tsx
@@ -137,7 +137,7 @@ export default function ActionDialog({ children, setCurrentNode }: ActionDialogP
<>Add {currentNodeType.label.toLowerCase()}</>
)}
</DialogTitle>
- <DialogDescription>Feel the required data</DialogDescription>
+ <DialogDescription>Fill the required data.</DialogDescription>
{currentNodeType && (
<DynamicForm
currentNodeType={currentNodeType}
diff --git a/flowsint-app/src/renderer/src/components/sketches/toolbar.tsx b/flowsint-app/src/renderer/src/components/sketches/toolbar.tsx
index 6498af6b..f01e517c 100644
--- a/flowsint-app/src/renderer/src/components/sketches/toolbar.tsx
+++ b/flowsint-app/src/renderer/src/components/sketches/toolbar.tsx
@@ -25,6 +25,7 @@ import { memo, useCallback } from "react"
import { Separator } from "../ui/separator"
import { sketchService } from "@/api/sketch-service"
import { useParams } from "@tanstack/react-router"
+import { toast } from "sonner"
// Tooltip wrapper component to avoid repetition
const ToolbarButton = memo(function ToolbarButton({
@@ -73,8 +74,18 @@ export const Toolbar = memo(function Toolbar() {
const handleDeleteNodes = async () => {
if (!selectedNodes.length) return
if (!await confirm({ title: `You are about to delete ${selectedNodes.length} node(s).`, message: "The action is irreversible." })) return
- removeNodes(selectedNodes.map((n) => n.id))
- await sketchService.deleteNodes(sketchId, JSON.stringify({ nodeIds: selectedNodes.map((n) => n.id) }))
+
+ toast.promise(
+ (async () => {
+ removeNodes(selectedNodes.map((n) => n.id))
+ return sketchService.deleteNodes(sketchId, JSON.stringify({ nodeIds: selectedNodes.map((n) => n.id) }))
+ })(),
+ {
+ loading: `Deleting ${selectedNodes.length} node(s)...`,
+ success: 'Nodes deleted successfully.',
+ error: 'Failed to delete nodes.'
+ }
+ )
}
const isMoreThanZero = selectedNodes.length > 0
const isTwo = selectedNodes.length == 2
diff --git a/flowsint-app/src/renderer/src/components/transforms/editor.tsx b/flowsint-app/src/renderer/src/components/transforms/editor.tsx
index 21957fde..76da4252 100644
--- a/flowsint-app/src/renderer/src/components/transforms/editor.tsx
+++ b/flowsint-app/src/renderer/src/components/transforms/editor.tsx
@@ -281,6 +281,8 @@ const FlowEditor = memo(({ initialEdges, initialNodes, theme, transform }: FlowE
setLoading(true)
await transformService.delete(transformId)
router.navigate({ to: "/dashboard/transforms" })
+ toast.success("Transform deleted successfully.")
+ setLoading(false)
}
}, [transformId, confirm, setLoading])
diff --git a/flowsint-app/src/renderer/src/components/transforms/scanner-item.tsx b/flowsint-app/src/renderer/src/components/transforms/scanner-item.tsx
index 91eaa2f2..79de33af 100644
--- a/flowsint-app/src/renderer/src/components/transforms/scanner-item.tsx
+++ b/flowsint-app/src/renderer/src/components/transforms/scanner-item.tsx
@@ -70,7 +70,6 @@ const ScannerItem = memo(({ scanner, category, color }: ScannerItemProps) => {
<GripVertical className="h-5 w-5 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" />
<div className="space-y-1">
<h3 className="text-sm font-medium">{scanner.class_name}</h3>
- <p className="text-xs text-muted-foreground">{scanner.name}</p>
{scanner.type !== "type" &&
<div className="mt-2 text-xs">
<div className="flex items-center gap-1">
diff --git a/flowsint-app/src/renderer/src/components/transforms/scanner-node.tsx b/flowsint-app/src/renderer/src/components/transforms/scanner-node.tsx
index edffef46..034f6e4c 100644
--- a/flowsint-app/src/renderer/src/components/transforms/scanner-node.tsx
+++ b/flowsint-app/src/renderer/src/components/transforms/scanner-node.tsx
@@ -4,7 +4,6 @@ import { LabeledHandle } from "../ui/labeled-handle"
import { Badge } from "../ui/badge"
import { BaseNodeSchema } from "../ui/base-node"
import { categoryColors } from "./scanner-data"
-import { Progress } from "../ui/progress"
import { NodeStatusIndicator } from "../ui/node-status-indicator"
// Types for the scanner node based on the new structure
diff --git a/flowsint-app/src/renderer/src/components/ui/button.tsx b/flowsint-app/src/renderer/src/components/ui/button.tsx
index 324da497..dda04820 100644
--- a/flowsint-app/src/renderer/src/components/ui/button.tsx
+++ b/flowsint-app/src/renderer/src/components/ui/button.tsx
@@ -10,7 +10,7 @@ const buttonVariants = cva(
variants: {
variant: {
default:
- "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
+ "bg-primary text-white shadow-xs hover:bg-primary/90",
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:
diff --git a/flowsint-app/src/renderer/src/routes/_auth.dashboard.index.tsx b/flowsint-app/src/renderer/src/routes/_auth.dashboard.index.tsx
index 32bd8850..4a230b6c 100644
--- a/flowsint-app/src/renderer/src/routes/_auth.dashboard.index.tsx
+++ b/flowsint-app/src/renderer/src/routes/_auth.dashboard.index.tsx
@@ -3,9 +3,11 @@ import { GetStartedSection } from '@/components/dashboard/get-started-section';
import { RecentInvestigations } from '@/components/dashboard/recent-investigations';
import { DiscoverSection } from '@/components/dashboard/discover-section';
import { UsefulResources } from '@/components/dashboard/useful-resources';
+import { InvestigationSkeleton } from '@/components/dashboard/investigation-skeleton';
export const Route = createFileRoute('/_auth/dashboard/')({
component: DashboardPage,
+ pendingComponent: InvestigationSkeleton,
});
function DashboardPage() {
diff --git a/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx b/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx
index 9124314f..d8e3188b 100644
--- a/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx
+++ b/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx
@@ -1,7 +1,6 @@
import { createFileRoute, useLoaderData } from '@tanstack/react-router'
import GraphPanel from '@/components/graphs/graph-panel'
import { sketchService } from '@/api/sketch-service'
-import Loader from '@/components/shared/loader'
import type { InvestigationGraph } from '@/types'
// Get queryClient from where it's initialized
diff --git a/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx b/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx
index c156a9be..2880c991 100644
--- a/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx
+++ b/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx
@@ -9,6 +9,88 @@ import { cn } from '@/lib/utils'
import type { Sketch } from '@/types/sketch'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { formatDistanceToNow } from 'date-fns'
+import { Skeleton } from '@/components/ui/skeleton'
+
+function InvestigationSkeleton() {
+ return (
+ <div className="w-full h-full bg-background px-6 py-12 overflow-auto">
+ <div className="max-w-4xl mx-auto space-y-8">
+ {/* Header Section Skeleton */}
+ <div className="flex items-start justify-between">
+ <div className="space-y-1">
+ <Skeleton className="h-8 w-48" />
+ <Skeleton className="h-4 w-32" />
+ </div>
+ <div className="flex items-center gap-2">
+ <Skeleton className="h-9 w-24" />
+ <Skeleton className="h-9 w-28" />
+ </div>
+ </div>
+
+ {/* Overview Cards Skeleton */}
+ <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
+ {[...Array(3)].map((_, i) => (
+ <Card key={i}>
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
+ <Skeleton className="h-4 w-24" />
+ <Skeleton className="h-4 w-4" />
+ </CardHeader>
+ <CardContent>
+ <Skeleton className="h-8 w-12 mb-2" />
+ <Skeleton className="h-3 w-32" />
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+
+ {/* Sketches Section Skeleton */}
+ <div className="space-y-4">
+ <div className="flex items-center justify-between">
+ <Skeleton className="h-6 w-24" />
+ <Skeleton className="h-5 w-16" />
+ </div>
+ <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
+ {[...Array(3)].map((_, i) => (
+ <div key={i} className="p-4 rounded-xl border border-border bg-card">
+ <div className="space-y-2">
+ <div className="flex items-center gap-2">
+ <Skeleton className="h-4 w-4" />
+ <Skeleton className="h-4 w-32" />
+ <Skeleton className="h-4 w-12 ml-auto" />
+ </div>
+ <Skeleton className="h-3 w-full" />
+ <Skeleton className="h-3 w-3/4" />
+ <div className="flex items-center gap-2">
+ <Skeleton className="h-3 w-3" />
+ <Skeleton className="h-3 w-32" />
+ </div>
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+
+ {/* Quick Actions Skeleton */}
+ <div className="space-y-4">
+ <Skeleton className="h-6 w-32" />
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
+ {[...Array(2)].map((_, i) => (
+ <Card key={i}>
+ <CardHeader className="flex flex-row items-center gap-3 pb-2">
+ <Skeleton className="h-9 w-9 rounded-lg" />
+ <Skeleton className="h-6 w-40" />
+ </CardHeader>
+ <CardContent>
+ <Skeleton className="h-4 w-full" />
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
export const Route = createFileRoute('/_auth/dashboard/investigations/$investigationId/')({
loader: async ({ params: { investigationId } }) => {
@@ -17,6 +99,7 @@ export const Route = createFileRoute('/_auth/dashboard/investigations/$investiga
}
},
component: InvestigationPage,
+ pendingComponent: InvestigationSkeleton,
})
function InvestigationPage() {
@@ -41,13 +124,13 @@ function InvestigationPage() {
</div>
<div className="flex items-center gap-2">
<Button variant="outline" size="sm">
- <Settings className="w-4 h-4 mr-2" />
+ <Settings className="w-4 h-4" />
Settings
</Button>
<NewSketch noDropDown>
<Button size="sm">
- <PlusIcon className="w-4 h-4 mr-2" />
- New sketch
+ <PlusIcon className="w-4 h-4" />
+ New
</Button>
</NewSketch>
</div>
@@ -177,8 +260,8 @@ function InvestigationPage() {
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<Card className="hover:bg-muted/50 transition-colors cursor-pointer">
<CardHeader className="flex flex-row items-center gap-3 pb-2">
- <div className="bg-blue-600/90 rounded-lg p-2">
- <FileText className="w-5 h-5 text-white" />
+ <div className="bg-blue-600/20 rounded-lg p-2">
+ <FileText className="w-5 h-5 text-blue-600" />
</div>
<CardTitle className="text-lg">Export Investigation</CardTitle>
</CardHeader>
@@ -188,8 +271,8 @@ function InvestigationPage() {
</Card>
<Card className="hover:bg-muted/50 transition-colors cursor-pointer">
<CardHeader className="flex flex-row items-center gap-3 pb-2">
- <div className="bg-green-600/90 rounded-lg p-2">
- <Users className="w-5 h-5 text-white" />
+ <div className="bg-green-600/20 rounded-lg p-2">
+ <Users className="w-5 h-5 text-green-600" />
</div>
<CardTitle className="text-lg">Share Investigation</CardTitle>
</CardHeader>
diff --git a/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.index.tsx b/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.index.tsx
index 22fb649b..16bdf1c2 100644
--- a/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.index.tsx
+++ b/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.index.tsx
@@ -3,13 +3,14 @@ import { DiscoverSection } from '@/components/dashboard/discover-section'
import { GetStartedSection } from '@/components/dashboard/get-started-section'
import { RecentInvestigations } from '@/components/dashboard/recent-investigations'
import { UsefulResources } from '@/components/dashboard/useful-resources'
+import { InvestigationSkeleton } from '@/components/dashboard/investigation-skeleton'
export const Route = createFileRoute('/_auth/dashboard/investigations/')({
component: InvestigationPage,
+ pendingComponent: InvestigationSkeleton,
})
function InvestigationPage() {
-
return (
<div className="h-full w-full px-4 py-12 bg-background overflow-auto">
<div className='max-w-4xl mx-auto flex flex-col gap-12 items-center justify-start'>
diff --git a/flowsint-app/src/renderer/src/routes/_auth.dashboard.tools.tsx b/flowsint-app/src/renderer/src/routes/_auth.dashboard.tools.tsx
index 0b9130e7..803f50c0 100644
--- a/flowsint-app/src/renderer/src/routes/_auth.dashboard.tools.tsx
+++ b/flowsint-app/src/renderer/src/routes/_auth.dashboard.tools.tsx
@@ -98,7 +98,7 @@ const tools: Tool[] = [
function ToolsPage() {
return (
- <div className="h-full w-full px-4 py-12 bg-background overflow-auto">
+ <div className="h-full w-full px-12 py-12 bg-background overflow-auto">
<div className='max-w-7xl mx-auto flex flex-col gap-12 items-center justify-start'>
<div className='w-full'>
<h1 className="font-semibold text-2xl">Tools</h1>
diff --git a/flowsint-app/src/renderer/src/routes/_auth.dashboard.transforms.index.tsx b/flowsint-app/src/renderer/src/routes/_auth.dashboard.transforms.index.tsx
index 52b743ba..aedc3838 100644
--- a/flowsint-app/src/renderer/src/routes/_auth.dashboard.transforms.index.tsx
+++ b/flowsint-app/src/renderer/src/routes/_auth.dashboard.transforms.index.tsx
@@ -1,13 +1,156 @@
import { createFileRoute } from '@tanstack/react-router'
-import Editor from '@/components/transforms/editor'
+import { transformService } from '@/api/transfrom-service'
+import { useQuery } from '@tanstack/react-query'
+import { Button } from '@/components/ui/button'
+import { PlusIcon, FileCode2, Clock } from 'lucide-react'
+import { useNavigate } from '@tanstack/react-router'
+import { SkeletonList } from '@/components/shared/skeleton-list'
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
+import { formatDistanceToNow } from 'date-fns'
+import { toast } from 'sonner'
+import { Badge } from '@/components/ui/badge'
+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
+
+interface Transform {
+ id: string
+ name: string
+ description?: string
+ category?: string[]
+ created_at: string
+ updated_at?: string
+ transform_schema?: any
+}
export const Route = createFileRoute('/_auth/dashboard/transforms/')({
- component: TranformsPage,
+ component: TransformsPage,
})
+function TransformsPage() {
+ const navigate = useNavigate()
+ const { data: transforms, isLoading, refetch } = useQuery<Transform[]>({
+ queryKey: ["transforms"],
+ queryFn: () => transformService.get(),
+ })
+
+ const handleCreateTransform = async () => {
+ toast.promise(
+ (async () => {
+ const response = await transformService.create(JSON.stringify({
+ name: "New Transform",
+ description: "A new transform",
+ category: [],
+ transform_schema: {}
+ }))
+ refetch()
+ navigate({ to: `/dashboard/transforms/${response.id}` })
+ return response
+ })(),
+ {
+ loading: 'Creating transform...',
+ success: 'Transform created successfully.',
+ error: 'Failed to create transform.'
+ }
+ )
+ }
+
+ // Get all unique categories
+ const categories = transforms?.reduce((acc: string[], transform) => {
+ if (transform.category) {
+ transform.category.forEach(cat => {
+ if (!acc.includes(cat)) acc.push(cat)
+ })
+ }
+ return acc
+ }, []) || []
+
+ // Add "All" and "Uncategorized" to categories
+ const allCategories = ['All', ...categories, 'Uncategorized']
-function TranformsPage() {
return (
- <Editor />
+ <div className="h-full w-full overflow-y-auto bg-background">
+ <div className="container max-w-6xl mx-auto px-8 py-12">
+ <div className="flex items-center justify-between mb-8">
+ <div>
+ <h1 className="text-3xl font-bold tracking-tight">Transforms</h1>
+ <p className="text-muted-foreground mt-1">
+ Create and manage your data transformation workflows.
+ </p>
+ </div>
+ <Button size="lg" onClick={handleCreateTransform}>
+ <PlusIcon className="w-4 h-4 mr-2" />
+ New Transform
+ </Button>
+ </div>
+
+ {isLoading ? (
+ <div className="p-2">
+ <SkeletonList rowCount={7} />
+ </div>
+ ) : (
+ <Tabs defaultValue="All" className="space-y-6">
+ <TabsList className="w-full justify-start h-auto p-1 bg-muted/50">
+ {allCategories.map((category) => (
+ <TabsTrigger
+ key={category}
+ value={category}
+ className="data-[state=active]:bg-background"
+ >
+ {category}
+ </TabsTrigger>
+ ))}
+ </TabsList>
+
+ {allCategories.map((category) => (
+ <TabsContent key={category} value={category} className="mt-0">
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
+ {transforms
+ ?.filter(transform =>
+ category === 'All'
+ ? true
+ : category === 'Uncategorized'
+ ? !transform.category?.length
+ : transform.category?.includes(category)
+ )
+ .map((transform) => (
+ <Card
+ key={transform.id}
+ className="group hover:border-primary/50 hover:shadow-md transition-all cursor-pointer"
+ onClick={() => navigate({ to: `/dashboard/transforms/${transform.id}` })}
+ >
+ <CardHeader className="pb-2">
+ <div className="flex items-start justify-between">
+ <CardTitle className="text-lg font-medium group-hover:text-primary transition-colors">
+ {transform.name || "(Unnamed transform)"}
+ </CardTitle>
+ <FileCode2 className="w-4 h-4 text-muted-foreground" />
+ </div>
+ <CardDescription className="line-clamp-2 mt-1">
+ {transform.description || "No description provided"}
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <div className="flex items-center justify-between">
+ <div className="flex items-center text-sm text-muted-foreground">
+ <Clock className="w-4 h-4 mr-1" />
+ {formatDistanceToNow(new Date(transform.updated_at || transform.created_at), { addSuffix: true })}
+ </div>
+ <div className="flex flex-wrap gap-2 justify-end">
+ {transform.category?.map((cat) => (
+ <Badge key={cat} variant="secondary">
+ {cat}
+ </Badge>
+ ))}
+ </div>
+ </div>
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+ </TabsContent>
+ ))}
+ </Tabs>
+ )}
+ </div>
+ </div>
)
}
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/styles.css b/flowsint-app/src/renderer/src/styles.css
index 891690a9..392ae44c 100644
--- a/flowsint-app/src/renderer/src/styles.css
+++ b/flowsint-app/src/renderer/src/styles.css
@@ -128,7 +128,7 @@ body {
--card-foreground: oklch(0.27 0 0);
--popover: oklch(21.00 0 0);
--popover-foreground: oklch(0.27 0 0);
- --primary: oklch(0.77 0.16 70.08);
+ --primary: oklch(0.6397 0.1720 36.4421);
--primary-foreground: oklch(0 0 0);
--secondary: oklch(0.97 0.00 264.54);
--secondary-foreground: oklch(0.45 0.03 256.80);
@@ -175,7 +175,7 @@ body {
--card-foreground: oklch(0.92 0 0);
--popover: oklch(0.27 0 0);
--popover-foreground: oklch(0.92 0 0);
- --primary: oklch(0.77 0.16 70.08);
+ --primary: oklch(0.6397 0.1720 36.4421);
--primary-foreground: oklch(0 0 0);
--secondary: oklch(0.27 0 0);
--secondary-foreground: oklch(0.92 0 0);