'use client'; import { useState, useEffect } from 'react'; import { Button } from '../ui/button'; import { Card, CardHeader, CardTitle, CardDescription, CardContent, } from '../ui/card'; import { Checkbox } from '../ui/checkbox'; import { Label } from '../ui/label'; import { Sparkles, PlayCircle, HelpCircle, X } from 'lucide-react'; const STORAGE_KEY = 'workflow_guidance_dismissed'; export interface WorkflowEmptyStateProps { onOpenTemplateGallery: () => void; onStartFromScratch: () => void; onOpenHelp?: () => void; } /** * Empty State Component for Workflow Canvas * * Provides first-time user guidance with two paths: * 1. Template Gallery - Pre-built workflows to learn from * 2. Start From Scratch - Opens node palette with guidance * * Features: * - localStorage-based dismissal (respects user preference) * - Non-intrusive inline design (not a modal) * - Action-oriented messaging (not "Welcome!") * - Re-accessible via help button */ export function WorkflowEmptyState({ onOpenTemplateGallery, onStartFromScratch, onOpenHelp, }: WorkflowEmptyStateProps) { const [isDismissed, setIsDismissed] = useState(true); const [dontShowAgain, setDontShowAgain] = useState(false); useEffect(() => { // Check if user has dismissed guidance const dismissed = localStorage.getItem(STORAGE_KEY) === 'true'; setIsDismissed(dismissed); }, []); const handleTemplateGalleryClick = () => { if (dontShowAgain) { localStorage.setItem(STORAGE_KEY, 'true'); } setIsDismissed(true); onOpenTemplateGallery(); }; const handleStartFromScratchClick = () => { if (dontShowAgain) { localStorage.setItem(STORAGE_KEY, 'true'); } setIsDismissed(true); onStartFromScratch(); }; const handleDismiss = () => { if (dontShowAgain) { localStorage.setItem(STORAGE_KEY, 'true'); } setIsDismissed(true); }; if (isDismissed) { // Show persistent help button for returning users return (