From 39e5d42305f058021f37e4ad855a34efb2556dfc Mon Sep 17 00:00:00 2001 From: rcourtman Date: Thu, 25 Dec 2025 11:50:06 +0000 Subject: [PATCH] feat: Hide AI buttons when AI is not configured. Closes #905 - InvestigateProblemsButton now checks aiChatStore.enabled - InvestigateAlertButton returns null when AI is not enabled - This provides cleaner UX for users who don't use AI features --- .../src/components/Alerts/InvestigateAlertButton.tsx | 6 ++++++ .../src/components/Dashboard/InvestigateProblemsButton.tsx | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx b/frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx index 00ad59efb..96de30267 100644 --- a/frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx +++ b/frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx @@ -17,11 +17,17 @@ interface InvestigateAlertButtonProps { /** * "Ask AI" button for one-click alert investigation. * When clicked, opens the AI chat panel with the alert context pre-populated. + * Hidden entirely when AI is not configured. */ export function InvestigateAlertButton(props: InvestigateAlertButtonProps) { const [isHovered, setIsHovered] = createSignal(false); const isLocked = () => props.licenseLocked === true; + // Don't render if AI is not enabled + if (aiChatStore.enabled !== true) { + return null; + } + const handleClick = (e: MouseEvent) => { e.stopPropagation(); e.preventDefault(); diff --git a/frontend-modern/src/components/Dashboard/InvestigateProblemsButton.tsx b/frontend-modern/src/components/Dashboard/InvestigateProblemsButton.tsx index c57088c2c..eff09756c 100644 --- a/frontend-modern/src/components/Dashboard/InvestigateProblemsButton.tsx +++ b/frontend-modern/src/components/Dashboard/InvestigateProblemsButton.tsx @@ -118,9 +118,9 @@ Start with the most critical problems first.`; }); }; - // Only show if problems mode is active AND there are results + // Only show if problems mode is active AND there are results AND AI is enabled const shouldShow = createMemo(() => - props.isProblemsMode && props.problemGuests.length > 0 + props.isProblemsMode && props.problemGuests.length > 0 && aiChatStore.enabled === true ); return (