import * as React from "react"; import { HelpCircle, X } from "lucide-react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; /** * SupportAgentFAB — WealthX DS * * Floating action button that opens/closes the Support Agent panel. * Positioned fixed at bottom-right (or bottom-left) of the viewport. * * Features: * - Nudge badge: red dot shown when the agent has a proactive suggestion * - Nudge message: small dismissible tooltip bubble above the button * - Toggles between HelpCircle (closed) and X (open) icon */ // --------------------------------------------------------------------------- // Types // --------------------------------------------------------------------------- export interface SupportAgentFABProps { /** Whether the support panel is currently open. */ isOpen?: boolean; /** Called when the FAB is clicked. */ onClick: () => void; /** Show a red nudge dot on the button. */ hasNudge?: boolean; /** Short message shown in a bubble above the FAB when hasNudge is true. */ nudgeMessage?: string; /** Called when the user dismisses the nudge bubble. */ onDismissNudge?: () => void; /** Position of the FAB on the screen. */ position?: "bottom-right" | "bottom-left"; className?: string; } // --------------------------------------------------------------------------- // SupportAgentFAB // --------------------------------------------------------------------------- export function SupportAgentFAB({ isOpen = false, onClick, hasNudge = false, nudgeMessage, onDismissNudge, position = "bottom-right", className, }: SupportAgentFABProps) { const showBubble = hasNudge && !!nudgeMessage && !isOpen; return (
{nudgeMessage}
{onDismissNudge && ( )} {/* Bubble tail pointing down */}