From 47b602eda82de4eaffe8136f8d4147f70b774578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20S=C3=A1nchez?= Date: Thu, 9 Jul 2026 09:08:14 -0600 Subject: [PATCH 1/2] fix[frontend](home): refactored components on home page --- .../features/home/components/CardHeader.tsx | 28 + .../src/features/home/components/ChatHero.tsx | 81 +++ .../home/components/ComplianceCard.tsx | 59 ++ .../home/components/DatasourcesCard.tsx | 53 ++ .../features/home/components/EmptyState.tsx | 3 + .../features/home/components/EventsChart.tsx | 81 +++ .../src/features/home/components/IconBtn.tsx | 11 + .../src/features/home/components/KpiTile.tsx | 51 ++ .../home/components/MitreTechniquesCard.tsx | 45 ++ .../features/home/components/SkeletonRows.tsx | 9 + .../features/home/components/Sparkline.tsx | 19 + .../home/components/SystemHealthCard.tsx | 48 ++ .../home/components/TopAssetsCard.tsx | 51 ++ .../src/features/home/components/helpers.ts | 26 + frontend/src/features/home/pages/HomePage.tsx | 581 +----------------- 15 files changed, 575 insertions(+), 571 deletions(-) create mode 100644 frontend/src/features/home/components/CardHeader.tsx create mode 100644 frontend/src/features/home/components/ChatHero.tsx create mode 100644 frontend/src/features/home/components/ComplianceCard.tsx create mode 100644 frontend/src/features/home/components/DatasourcesCard.tsx create mode 100644 frontend/src/features/home/components/EmptyState.tsx create mode 100644 frontend/src/features/home/components/EventsChart.tsx create mode 100644 frontend/src/features/home/components/IconBtn.tsx create mode 100644 frontend/src/features/home/components/KpiTile.tsx create mode 100644 frontend/src/features/home/components/MitreTechniquesCard.tsx create mode 100644 frontend/src/features/home/components/SkeletonRows.tsx create mode 100644 frontend/src/features/home/components/Sparkline.tsx create mode 100644 frontend/src/features/home/components/SystemHealthCard.tsx create mode 100644 frontend/src/features/home/components/TopAssetsCard.tsx create mode 100644 frontend/src/features/home/components/helpers.ts diff --git a/frontend/src/features/home/components/CardHeader.tsx b/frontend/src/features/home/components/CardHeader.tsx new file mode 100644 index 000000000..73618f791 --- /dev/null +++ b/frontend/src/features/home/components/CardHeader.tsx @@ -0,0 +1,28 @@ +import { Link } from 'react-router-dom' +import { type LucideIcon } from 'lucide-react' + +export function CardHeader({ + title, + icon: Icon, + iconClass, + action, +}: { + title: string + icon?: LucideIcon + iconClass?: string + action?: { label: string; href: string } +}) { + return ( +
+

+ {Icon && } + {title} +

+ {action && ( + + {action.label} + + )} +
+ ) +} diff --git a/frontend/src/features/home/components/ChatHero.tsx b/frontend/src/features/home/components/ChatHero.tsx new file mode 100644 index 000000000..559e38f62 --- /dev/null +++ b/frontend/src/features/home/components/ChatHero.tsx @@ -0,0 +1,81 @@ +import { useState } from 'react' +import { useTranslation } from 'react-i18next' +import { AtSign, Paperclip, Sparkles } from 'lucide-react' +import { useSocAi } from '@/features/soc-ai/SocAiProvider' +import { useSocAiConfigured } from '@/features/soc-ai/lib/useSocAiConfig' +import { IconBtn } from './IconBtn' + +const SUGGESTION_KEYS = ['threatHunt', 'observableTriage', 'writeRule', 'systemStatus'] as const + +export function ChatHero() { + const { t } = useTranslation() + const configured = useSocAiConfigured() + const { submit } = useSocAi() + const [value, setValue] = useState('') + + // Hidden entirely until SOC-AI has a provider configured — same gate the + // floating composer/panel use, so we never show a dead chat box. + if (!configured) return null + + const send = () => { + const text = value.trim() + if (!text) return + submit(text) + setValue('') + } + + return ( +
+

{t('home.hero.title')}

+
+
+
+