A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
Analysis Components Architecture
This directory contains the refactored analysis components that provide reusable functionality for editing analyses.
Components
AnalysisEditor (Core Component)
The main reusable component that contains all analysis editing logic.
Props:
analysis: Analysis | null- The current analysis to editinvestigationId: string- The investigation IDonAnalysisUpdate?: (analysis: Analysis) => void- Callback when analysis is updatedonAnalysisDelete?: (analysisId: string) => void- Callback when analysis is deletedonAnalysisCreate?: (investigationId: string) => void- Callback when New analysis is createdonAnalysisSelect?: (analysisId: string) => void- Callback when analysis is selected from dropdownshowHeader?: boolean- Whether to show the header (default: true)showActions?: boolean- Whether to show action buttons (default: true)showAnalysisSelector?: boolean- Whether to show analysis dropdown selector (default: false)showNavigation?: boolean- Whether to show navigation button (default: false)className?: string- Additional CSS classesisLoading?: boolean- Loading stateisRefetching?: boolean- Refetching stateanalyses?: Analysis[]- List of analyses for selector dropdowncurrentAnalysisId?: string | null- Current analysis ID for selector
Features:
- Rich text editing with TipTap
- AI prompt integration with context
- Save/delete/create operations
- Keyboard shortcuts (Ctrl+S to save, Ctrl+E for AI prompt)
- Title editing
- Analysis selector dropdown
- Navigation controls
- External link to full page
- Context-aware AI prompts
AnalysisPanel (Panel Component)
A panel component that uses AnalysisEditor with analysis selection functionality.
Features:
- Analysis selector dropdown
- Integration with analysis panel store
- Navigation to full-page view
- All original action buttons (Save, AI Chat, New analysis, Delete, Open in Page)
AnalysisPage (Full Page Component)
A full-page component that uses AnalysisEditor for dedicated analysis editing.
Features:
- Full-page layout
- Navigation controls
- All editing functionality
Usage Examples
Using AnalysisEditor as a disposable component:
import { AnalysisEditor } from "@/components/analyses/analysis-editor"
// Basic usage
<AnalysisEditor
analysis={currentAnalysis}
investigationId={investigationId}
onAnalysisUpdate={handleUpdate}
onAnalysisDelete={handleDelete}
onAnalysisCreate={handleCreate}
/>
// With analysis selector
<AnalysisEditor
analysis={currentAnalysis}
investigationId={investigationId}
onAnalysisUpdate={handleUpdate}
onAnalysisDelete={handleDelete}
onAnalysisCreate={handleCreate}
onAnalysisSelect={handleSelect}
showAnalysisSelector={true}
showNavigation={true}
analyses={analyses}
currentAnalysisId={currentAnalysisId}
/>
// Minimal usage without header
<AnalysisEditor
analysis={analysis}
investigationId={investigationId}
showHeader={false}
showActions={false}
className="border rounded-lg"
/>
Using AnalysisPanel in a layout:
import AnalysisPanel from '@/components/analyses/notes-panel'
// In a layout component
;<AnalysisPanel />
Using AnalysisPage in a route:
import { AnalysisPage } from '@/components/analyses/analysis-page'
// In a route component
;<AnalysisPage />
Action Buttons
The AnalysisEditor includes all the original action buttons:
- Save (πΎ) - Save the current analysis
- AI Chat (β¨) - Open AI prompt panel
- New analysis (β) - Create a New analysis
- Delete (ποΈ) - Delete the current analysis
- Open in Page (π) - Open analysis in full page view
Architecture Benefits
- Reusability: The core
AnalysisEditorcan be used in any context - Separation of Concerns: UI logic is separated from routing logic
- Minimal Code Rewriting: Existing functionality is preserved
- Flexibility: Components can be customized via props
- Consistency: All analysis editing uses the same core component
- Complete Functionality: All original features are maintained
Migration Notes
The existing AnalysisPanel has been refactored to use the new AnalysisEditor component. All original functionality including:
- Analysis selector dropdown
- All action buttons (Save, AI Chat, New analysis, Delete, Open in Page)
- Navigation controls
- AI prompt integration
- Keyboard shortcuts
Everything works exactly as before, but the code is now more modular and reusable.