A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
feat: check investigation on server
dextmorgn75a0a6e12994
diff --git a/src/app/investigations/[investigation_id]/layout.tsx b/src/app/investigations/[investigation_id]/layout.tsxindex a1745f24..71798168 100644--- a/src/app/investigations/[investigation_id]/layout.tsx+++ b/src/app/investigations/[investigation_id]/layout.tsx@@ -3,8 +3,9 @@ import InvestigationLayout from '@/src/components/investigations/layout';import Individuals from './individuals';import { SearchProvider } from '@/src/components/contexts/search-context';import { createClient } from "@/src/lib/supabase/server";-import { redirect } from "next/navigation";+import { notFound, redirect } from "next/navigation";import { ChatProvider } from '@/src/components/contexts/chatbot-context';+import { getInvestigation } from '@/src/lib/actions/investigations';const DashboardLayout = async ({children,@@ -19,7 +20,8 @@ const DashboardLayout = async ({redirect('/login')}const { investigation_id } = await (params)-+ const { investigation, error } = await getInvestigation(investigation_id)+ if (!investigation || error) return notFound()return (<InvestigationProvider><SearchProvider>diff --git a/src/app/layout.tsx b/src/app/layout.tsxindex 2f0c1d3e..c4ae0a2f 100644--- a/src/app/layout.tsx+++ b/src/app/layout.tsx@@ -38,7 +38,7 @@ export default function RootLayout({<head /><bodyclassName={clsx(- "min-h-screen bg-background font-sans antialiased",+ "min-h-screen dark:bg-[#1C1C1C] font-sans antialiased",fontSans.variable,)}>diff --git a/src/components/contexts/chatbot-context.tsx b/src/components/contexts/chatbot-context.tsxindex 1caa9bc8..ccd94bee 100644--- a/src/components/contexts/chatbot-context.tsx+++ b/src/components/contexts/chatbot-context.tsx@@ -22,11 +22,12 @@ interface ChatProviderProps {export const ChatProvider: React.FC<ChatProviderProps> = ({ children }) => {const [open, setOpen] = useState(false);// content is the object passed to the chat, as a secondary object- const [content, setContent] = useState(false);- const { messages, input, handleInputChange, handleSubmit, error, isLoading } = useChat();+ const [context, setContext] = useState(false);+ const { messages, input, handleInputChange, setInput, handleSubmit, error, isLoading } = useChat();const handleOpenChat = (content: any) => {- setContent(content)+ setContext(content)+ setInput(`What pattern can you extract from this person ?\n ${JSON.stringify(content)}`)setOpen(true)}@@ -91,7 +92,8 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({ children }) => {</Flex><form onSubmit={handleSubmit} className="mt-4"><Box width={"100%"}>- <TextField.Root value={input}+ <TextField.Root+ value={input}onChange={handleInputChange}size="2" placeholder="'What pattern can you extract from those relations ?'" /></Box>diff --git a/src/components/dashboard/seach-palette.tsx b/src/components/dashboard/search-palette.tsxsimilarity index 85%rename from src/components/dashboard/seach-palette.tsxrename to src/components/dashboard/search-palette.tsxindex b95032b7..458d2892 100644--- a/src/components/dashboard/seach-palette.tsx+++ b/src/components/dashboard/search-palette.tsx@@ -7,7 +7,7 @@ import { SearchIcon } from "lucide-react"import Highlighter from "react-highlight-words";import Link from 'next/link';import { useSearchResults } from '../../lib/hooks/investigation/use-search-results';-import { Card, Dialog, IconButton, Spinner, TextField } from '@radix-ui/themes';+import { Card, Dialog, Flex, IconButton, ScrollArea, Spinner, TextField } from '@radix-ui/themes';import { MagnifyingGlassIcon } from '@radix-ui/react-icons';import { useInvestigationContext } from '../contexts/investigation-provider';@@ -98,15 +98,19 @@ const SearchModal = ({ investigation_id }: { investigation_id: string }) => {<MagnifyingGlassIcon height="16" width="16" /></TextField.Slot></TextField.Root>- <div className='min-h-[20vh] max-h-[60vh] w-full relative text-center flex flex-col items-center justify-center gap-2'>+ <div className='w-full relative text-center flex flex-col items-center justify-center gap-2'>{error && "An error occured."}{isLoading && <Spinner />}{results?.length === 0 && `No results found for "${search}".`}- <ul className='w-full h-full flex flex-col gap-1 overflow-auto mt-2'>{!error && !isLoading && Array.isArray(results) && results?.map((item) => (- <SearchItem key={item.id} item={item} />- ))}- </ul>- {search === '' && (+ <Flex direction={"column"}>+ <ScrollArea className='max-h-[60vh] p-2'>+ <ul className='w-full h-full flex flex-col gap-1 mt-2'>{!error && !isLoading && Array.isArray(results) && results?.map((item) => (+ <SearchItem key={item.id} item={item} />+ ))}+ </ul>+ </ScrollArea>+ </Flex>+ {/* {search === '' && (<div className="px-6 py-14 text-center flex items-center justify-center flex-col text-sm sm:px-14"><SearchIconclassName="h-12 w-12 opacity-40"@@ -117,7 +121,7 @@ const SearchModal = ({ investigation_id }: { investigation_id: string }) => {Put you search between quotes for an exact match search.</p></div>- )}+ )} */}</div></Dialog.Content></Dialog.Root>diff --git a/src/components/investigations/layout.tsx b/src/components/investigations/layout.tsxindex 1cbbc2f0..94b33223 100644--- a/src/components/investigations/layout.tsx+++ b/src/components/investigations/layout.tsx@@ -3,7 +3,7 @@ import React from 'react'import MoreMenu from './more-menu';import CaseSelector from './case-selector';import NewCase from '../dashboard/new-case';-import SearchModal from '../dashboard/seach-palette';+import SearchModal from '../dashboard/search-palette';import { Flex, IconButton, ScrollArea } from '@radix-ui/themes';import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels';import { BotMessageSquareIcon, PanelRightIcon, PlusIcon } from 'lucide-react';@@ -27,7 +27,7 @@ const InvestigationLayout = ({const { panelOpen, setPanelOpen, investigation } = useInvestigationContext()return (<PanelGroup autoSaveId="conditional" className='h-screen w-screen flex' direction="horizontal">- {panelOpen && <Panel id="left" className='h-screen' defaultSize={20} minSize={10}>+ {panelOpen && <Panel id="left" order={1} className='h-screen' defaultSize={20} minSize={15}><div className='flex flex-col w-full h-full rounded-none shadow-none border-r border-gray-400/20'><div className='w-full rounded-none shadow-none h-12 border-b border-gray-400/20 flex items-center gap-1 flex-row justify-between p-2'><Logo />@@ -52,7 +52,7 @@ const InvestigationLayout = ({</div></Panel>}<PanelResizeHandle />- <Panel id="center" defaultSize={80} minSize={50} className='grow flex flex-col'>+ <Panel id="right" order={2} defaultSize={80} minSize={50} className='grow flex flex-col'><div><div className='w-full rounded-none shadow-none h-12 justify-between border-b border-gray-400/20 flex flex-row items-center p-2'><Flex gap={"1"}>diff --git a/src/lib/hooks/investigation/investigation.ts b/src/lib/hooks/investigation/investigation.tsindex 688db200..194d73b8 100644--- a/src/lib/hooks/investigation/investigation.ts+++ b/src/lib/hooks/investigation/investigation.ts@@ -1,5 +1,6 @@import { supabase } from "@/src/lib/supabase/client";import { useQuery } from "@supabase-cache-helpers/postgrest-swr";+import { notFound } from "next/navigation";export function useInvestigations() {const { data: investigations, count, mutate, isLoading, error } = useQuery(@@ -28,6 +29,5 @@ export function useInvestigation(investigationId: string | string[] | undefined)revalidateOnReconnect: false,});-return { investigation: investigation ?? null, isLoading, refetch: mutate, error };}\ No newline at end of filediff --git a/styles/globals.css b/styles/globals.cssindex 9d979b1e..1650b59d 100644--- a/styles/globals.css+++ b/styles/globals.css@@ -1,7 +1,7 @@@import "tailwindcss";[data-radius='full'] {- --radius-factor: 3!important;- --radius-full: 999999px!important;- --radius-thumb: 999999px!important;+ --radius-factor: 3 !important;+ --radius-full: 999999px !important;+ --radius-thumb: 999999px !important;}\ No newline at end of file