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 { useAISettings } from '@/hooks/useAISettings'; import { useAICredits } from '@/hooks/useAICredits'; // import { useLocalStorage } from '@/hooks/useLocalStorage'; interface Act1DialogProps { open: boolean; onOpenChange: (open: boolean) => void; } type DialogStep = 'welcome' | 'migration' | 'credits' | 'conclusion'; const SHAKESPEARE_PROVIDER = { id: "shakespeare", baseURL: "https://ai.shakespeare.diy/v1", nostr: true, }; // const MKSTACK_NSP_ADDR = '31999:4bcaa7b5606e3c14df05cd497e588f5d3fe559b4e9a425e8b418a43af1ffb015:mkstack'; export function Act1Dialog({ open, onOpenChange }: Act1DialogProps) { const [step, setStep] = useState('welcome'); // const { setProvider, updateSettings } = useAISettings(); // // Get the selectedNSPAddr from localStorage // const [selectedNSPAddr] = useLocalStorage('selectedNSPAddr', null); // Get user's credits const { data: creditsData } = useAICredits(SHAKESPEARE_PROVIDER); const handleGetStarted = async () => { try { // // Add Shakespeare provider to their config // setProvider(SHAKESPEARE_PROVIDER); // // Configure recently used models based on credits or NSP // const hasCredits = creditsData?.amount && creditsData.amount > 0; // const hasMKStackNSP = selectedNSPAddr === MKSTACK_NSP_ADDR; // if (hasCredits || hasMKStackNSP) { // // User has credits or MKStack NSP - set to shakespeare model // updateSettings({ recentlyUsedModels: ['shakespeare/shakespeare'] }); // } else { // // No credits - set to tybalt model (free) // updateSettings({ recentlyUsedModels: ['shakespeare/tybalt'] }); // } // Move to migration step 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 && creditsData.amount > 0 ? (
${creditsData.amount.toFixed(2)}

Available credits

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

) : (
🆓

Free Access

You can continue using Shakespeare for free with the Tybalt model. It's perfect for learning and building amazing projects!

)}
)} {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{' '}
)}
); }