// File: components/ai/ai-suggestion-button.tsx
// Change Log
// - 2026-05-21: เพิ่มปุ่ม AI Suggestion พร้อม soft fallback เมื่อ AI ถูกปิด.
'use client';
import { Sparkles } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card';
const DEFAULT_DISABLED_MESSAGE = 'ระบบ AI ไม่พร้อมใช้งานชั่วคราว กรุณากรอกข้อมูลด้วยตนเอง';
interface AiSuggestionButtonProps {
aiEnabled: boolean;
isLoading?: boolean;
label?: string;
disabledMessage?: string;
onClick?: () => void;
}
/** ปุ่มเรียก AI suggestion ที่แสดง fallback ชัดเจนเมื่อระบบ AI ปิด */
export function AiSuggestionButton({
aiEnabled,
isLoading = false,
label = 'AI Suggestion',
disabledMessage = DEFAULT_DISABLED_MESSAGE,
onClick,
}: AiSuggestionButtonProps) {
const disabled = !aiEnabled || isLoading;
const button = (
);
if (aiEnabled) return button;
return (
{button}
{disabledMessage}
{disabledMessage}
);
}