import { useState, useEffect } from 'react'; import { ArrowRight, ArrowLeft, Download, Upload, ExternalLink, Sparkles } from 'lucide-react'; import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { useAICredits } from '@/hooks/useAICredits'; import { getShakespeareProvider } from '@/lib/aiProviderPresets'; interface Act1DialogProps { open: boolean; onOpenChange: (open: boolean) => void; } type DialogStep = 'welcome' | 'migration' | 'credits' | 'conclusion'; export function Act1Dialog({ open, onOpenChange }: Act1DialogProps) { const [step, setStep] = useState('welcome'); const { data: creditsData } = useAICredits(getShakespeareProvider()); const handleGetStarted = async () => { try { setStep('migration'); } catch (error) { console.error('Failed to configure Shakespeare provider:', error); } }; const handleContinue = () => { setStep('credits'); }; const handleCreditsNext = () => { setStep('conclusion'); }; const handleFinish = () => { // Mark that the user is a previous Act 1 user localStorage.setItem('act1', 'true'); // Remove the selectedNSPAddr from localStorage localStorage.removeItem('selectedNSPAddr'); onOpenChange(false); }; const handleVisitAct1 = () => { window.open('https://act1.shakespeare.diy', '_blank'); }; // Reset state when dialog opens/closes useEffect(() => { if (open) { setStep('welcome'); } }, [open]); return ( {step === 'migration' && ( )} {step === 'credits' && ( )} {step === 'conclusion' && ( )}
{step === 'welcome' && (
🎭✨

Welcome to Act 2!

We're excited to see you again! Shakespeare has been completely rebuilt with new features, improved performance, and a better development experience.

🔄 What's Changed
New

Use any AI Provider

Your browser connects to AI providers directly

New

Git Integration

Push to GitHub, Nostr relays, and more

New

Your Files

Files are stored on your device directly in your browser

⚠️

Act 2 is in Development

While we're working hard to make Act 2 stable, you may encounter bugs. Your Act 1 projects remain safe and accessible.

)} {step === 'migration' && (

Your Act 1 Projects & Credits

All your Act 1 projects and credits are safe and still accessible. Here's how to work with them in Act 2.

Export from Act 1

In Act 1, you can export your projects as ZIP files using the project menu.

Import to Act 2

In Act 2, use the "Import Project" option in the sidebar to upload your exported ZIP files.

)} {step === 'credits' && (
💳

Your Credits

Your Act 1 credits are still available through the Shakespeare AI provider.

${(creditsData?.amount ?? 0).toFixed(2)}

Available credits

✅ You're all set! We've configured the premium Shakespeare model for you.

)} {step === 'conclusion' && (
🎉

Welcome to the Future!

You're all up to speed with Act 2! Get ready to build amazing Nostr applications.

Remember: You can always access Act 1 at{' '}
)}
); }