import { cn } from "~/lib/utils"; import { AlertTriangle, TrendingUp, Info, X, Bell, ChevronRight } from "lucide-react"; import { Button } from "@/routes/ui/button"; export interface ProactiveAlertData { /** Alert ID */ id: string; /** Alert type */ type: "price_pump" | "price_dump" | "whale_activity" | "volume_spike" | "safety_warning"; /** Token symbol */ tokenSymbol: string; /** Alert title */ title: string; /** Current price */ currentPrice?: string; /** User's entry price (if applicable) */ entryPrice?: string; /** User's P&L (if applicable) */ pnl?: string; /** Warning messages */ warnings?: string[]; /** When the alert was triggered */ timestamp: Date; } export interface ProactiveAlertCardProps { /** Alert data */ alert: ProactiveAlertData; /** AI's recommendation text */ recommendation?: string; /** Callback when view details is clicked */ onViewDetails?: () => void; /** Callback when dismiss is clicked */ onDismiss?: () => void; /** Callback when set alert is clicked */ onSetAlert?: () => void; /** Callback when tell me more is clicked */ onTellMore?: () => void; /** Additional class names */ className?: string; } /** * ProactiveAlertCard - AI-initiated alert card embedded in chat * * Displays proactive alerts from the AI about price movements, * whale activity, or safety concerns. Shows user's position if applicable. */ export function ProactiveAlertCard({ alert, recommendation, onViewDetails, onDismiss, onSetAlert, onTellMore, className, }: ProactiveAlertCardProps) { const getAlertIcon = () => { switch (alert.type) { case "price_pump": case "price_dump": return TrendingUp; case "whale_activity": case "volume_spike": return AlertTriangle; case "safety_warning": return AlertTriangle; default: return Info; } }; const getAlertColor = () => { switch (alert.type) { case "price_pump": return "text-green-500 bg-green-500/10"; case "price_dump": case "safety_warning": return "text-red-500 bg-red-500/10"; case "whale_activity": case "volume_spike": return "text-yellow-500 bg-yellow-500/10"; default: return "text-primary bg-primary/10"; } }; const Icon = getAlertIcon(); const colorClass = getAlertColor(); return (
{/* Header */}
🚨 ProactiveAlertCard

{alert.timestamp.toLocaleTimeString()}

{/* Alert content */}

{alert.title}

{/* Price info */} {(alert.currentPrice || alert.entryPrice || alert.pnl) && (
{alert.currentPrice && (
📊 Current: {alert.currentPrice}
)} {alert.entryPrice && (
📈 Your entry: {alert.entryPrice}
)} {alert.pnl && (
💰 Your P&L: {alert.pnl}
)}
)} {/* Warnings */} {alert.warnings && alert.warnings.length > 0 && (
{alert.warnings.map((warning, index) => (
{warning}
))}
)}
{/* AI Recommendation */} {recommendation && (

{recommendation}

)} {/* Action buttons */}
); }