Skip to content

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

feat: fullscreen

dextmorgn3b37071cba29
diff --git a/flowsint-web/src/components/full-screen-button.tsx b/flowsint-web/src/components/full-screen-button.tsx
new file mode 100644
index 00000000..a0a50fb9
--- /dev/null
+++ b/flowsint-web/src/components/full-screen-button.tsx
@@ -0,0 +1,42 @@
+'use client';
+import { ExpandIcon, ShrinkIcon } from 'lucide-react';
+import { useState, useEffect } from 'react';
+import { Button } from './ui/button';
+export default function FullscreenButton() {
+ const [isFullscreen, setIsFullscreen] = useState(false);
+ useEffect(() => {
+ const onFullscreenChange = () => {
+ setIsFullscreen(!!document.fullscreenElement);
+ };
+ document.addEventListener('fullscreenchange', onFullscreenChange);
+ return () => {
+ document.removeEventListener('fullscreenchange', onFullscreenChange);
+ };
+ }, []);
+ const enterFullscreen = () => {
+ const elem = document.documentElement;
+ if (elem.requestFullscreen) {
+ elem.requestFullscreen();
+ } else if ((elem as any).webkitRequestFullscreen) {
+ (elem as any).webkitRequestFullscreen();
+ } else if ((elem as any).msRequestFullscreen) {
+ (elem as any).msRequestFullscreen();
+ }
+ };
+ const exitFullscreen = () => {
+ if (document.exitFullscreen) {
+ document.exitFullscreen();
+ } else if ((document as any).webkitExitFullscreen) {
+ (document as any).webkitExitFullscreen();
+ } else if ((document as any).msExitFullscreen) {
+ (document as any).msExitFullscreen();
+ }
+ };
+ return (
+ <Button onClick={isFullscreen ? exitFullscreen : enterFullscreen}
+ variant={"outline"} size="icon">
+ {isFullscreen ? <ShrinkIcon /> : <ExpandIcon />}
+ </Button>
+
+ );
+}
diff --git a/flowsint-web/src/components/investigations/add-node-modal.tsx b/flowsint-web/src/components/investigations/panel-context-menu.tsx
similarity index 85%
rename from flowsint-web/src/components/investigations/add-node-modal.tsx
rename to flowsint-web/src/components/investigations/panel-context-menu.tsx
index 8ffd7b9e..0152373a 100644
--- a/flowsint-web/src/components/investigations/add-node-modal.tsx
+++ b/flowsint-web/src/components/investigations/panel-context-menu.tsx
@@ -5,7 +5,7 @@ import { useParams } from "next/navigation"
import { supabase } from "@/lib/supabase/client"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
-import { AlertCircle, ArrowLeft, PlusIcon } from "lucide-react"
+import { AlertCircle, ArrowLeft, ArrowRight, PlusIcon } from "lucide-react"
import { toast } from "sonner"
import { cn, nodesTypes } from "@/lib/utils"
import { Alert, AlertTitle, AlertDescription } from "../ui/alert"
@@ -13,10 +13,10 @@ import { Badge } from "../ui/badge"
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle } from "../ui/dialog"
import { actionItems, type ActionItem } from "@/lib/action-items"
import { useInvestigationStore } from "@/store/investigation-store"
-import { Card, CardContent } from "@/components/ui/card"
+import { CardContent } from "@/components/ui/card"
import { AnimatePresence, motion } from "framer-motion"
-export default function NewActions({ addNodes }: { addNodes: any }) {
+export default function PanelContextMenu({ addNodes }: { addNodes: any }) {
const { investigation_id } = useParams()
const [openAddNodeModal, setOpenNodeModal] = useState(false)
const [openActionDialog, setOpenActionDialog] = useState(false)
@@ -189,29 +189,21 @@ function ActionCard({ item, onSelect }: ActionCardProps) {
const Icon = item.icon
return (
- <Card
- className={cn(
- "cursor-pointer transition-all hover:scale-105 hover:shadow-md",
- item.disabled && "opacity-50 cursor-not-allowed",
- "h-full",
+ <CardContent className="p-4 relative flex flex-col items-center text-center h-full">
+ <div
+ className="w-8 h-8 rounded-full flex items-center justify-center mb-3 mt-2"
+ style={{ backgroundColor: `${item.color}20` }} // Light background based on item color
+ >
+ <Icon style={{ color: item.color }} className="h-6 w-6 opacity-60 text-primary" />
+ </div>
+ <div className="font-medium text-sm">{item.label}</div>
+ {item.comingSoon && (
+ <Badge variant="outline" className="mt-2 absolute top-2 left-2">
+ soon
+ </Badge>
)}
- onClick={item.disabled ? undefined : onSelect}
- >
- <CardContent className="p-4 flex flex-col items-center text-center h-full">
- <div
- className="w-8 h-8 rounded-full flex items-center justify-center mb-3 mt-2"
- style={{ backgroundColor: `${item.color}20` }} // Light background based on item color
- >
- <Icon style={{ color: item.color }} className="h-6 w-6 opacity-60" />
- </div>
- <div className="font-medium">{item.label}</div>
- {item.comingSoon && (
- <Badge variant="outline" className="mt-2">
- soon
- </Badge>
- )}
- {item.children && <div className="text-xs text-muted-foreground mt-1">{item.children.length} options</div>}
- </CardContent>
- </Card>
+ {item.children && <div className="absolute top-3 right-4 text-xs text-muted-foreground mt-1"><ArrowRight className="h-4 w-4" /></div>}
+ {item.children && <div className="text-xs text-muted-foreground mt-1">{item.children.length} options</div>}
+ </CardContent>
)
}
diff --git a/flowsint-web/src/components/investigations/sketch/graph.tsx b/flowsint-web/src/components/investigations/sketch/graph.tsx
index 987114ea..2d6eaa7a 100644
--- a/flowsint-web/src/components/investigations/sketch/graph.tsx
+++ b/flowsint-web/src/components/investigations/sketch/graph.tsx
@@ -8,10 +8,8 @@ import {
useReactFlow,
// @ts-ignore
Background,
- type ColorMode,
// @ts-ignore
MiniMap,
- type NodeMouseHandler,
} from "@xyflow/react"
import "@xyflow/react/dist/style.css"
import {
@@ -24,6 +22,7 @@ import {
WorkflowIcon,
NetworkIcon,
WaypointsIcon,
+ ExpandIcon,
} from "lucide-react"
import { useTheme } from "next-themes"
import NewActions from "../new-actions"
@@ -37,7 +36,7 @@ import { useFlowStore } from "@/store/flow-store"
import Loader from "@/components/loader"
import { useQueryState } from "nuqs"
import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "@/components/ui/context-menu"
-import AddNodeModal from "../add-node-modal"
+import PanelContextMenu from "../panel-context-menu"
import { memo } from "react"
import { shallow } from "zustand/shallow"
import { TooltipProvider } from "@/components/ui/tooltip"
@@ -52,6 +51,7 @@ import NodesPanel from "./nodes-panel"
import ProfilePanel from "./profile-panel"
import CustomNode from "./nodes/custom-node"
import { Dialog, DialogTrigger } from "@/components/ui/dialog"
+import FullscreenButton from "@/components/full-screen-button"
// Move these outside of component scope
const edgeTypes = {
@@ -99,6 +99,9 @@ const FlowControls = memo(({
}: any) => {
return (
<>
+ <Panel position="top-right" className="flex flex-col items-center gap-1">
+ <FullscreenButton />
+ </Panel>
<Panel position="top-left" className="flex flex-col items-center gap-1">
<NewActions addNodes={addNodes}>
<Button className="bg-gradient-to-r from-purple-600 to-indigo-400 hover:from-purple-700 hover:to-indigo-500 transition-all duration-300" size="icon">
@@ -351,7 +354,7 @@ const LayoutFlow = memo(({ refetch, theme }: any) => {
</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
- <AddNodeModal addNodes={addNodes} />
+ <PanelContextMenu addNodes={addNodes} />
</Dialog>
<NodeContextMenu
x={nodeContextMenu?.x}
diff --git a/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx b/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx
index 55628dc2..97cc801c 100644
--- a/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx
+++ b/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx
@@ -112,7 +112,7 @@ const NodesPanel = memo(({ nodes }: { nodes: Node[] }) => {
return (
<div className="overflow-auto h-full flex flex-col w-full !p-0 !m-0">
- <div className="sticky top-0 p-2 bg-background z-10">
+ <div className="sticky border-b top-0 p-2 bg-background z-10">
<div className="flex items-center gap-2">
<h3 className="text-sm font-medium">Nodes</h3>
<Badge variant={"outline"}>{nodes?.length || 0}</Badge>