Remove onboarding for now

This commit is contained in:
Alex Gleason committed 2025-08-25 16:27:09 -05:00
1 parent cd378f537e
commit eb54b1eb9d
7 files changed
+2 -561

No files matched your search

@@ -1,124 +0,0 @@
import { useState } from 'react';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { ArrowLeft, ArrowRight, Settings, Bot } from 'lucide-react';
import { useAISettings } from '@/hooks/useAISettings';
import type { AIConnection } from '@/contexts/AISettingsContext';
interface AISettingsStepProps {
onNext: () => void;
onPrevious: () => void;
onSkip: () => void;
}
export function AISettingsStep({ onNext, onPrevious, onSkip }: AISettingsStepProps) {
const { settings, updateProvider } = useAISettings();
const [localProvider, setLocalProvider] = useState<AIConnection>(
settings.providers.openrouter || { baseURL: 'https://openrouter.ai/api/v1', apiKey: '' }
);
const handleSave = () => {
updateProvider('openrouter', localProvider);
onNext();
};
const isValid = localProvider.apiKey.trim() && localProvider.baseURL.trim();
return (
<div className="space-y-2 sm:space-y-4 mb-3 sm:mb-0">
<div className="text-center space-y-1 sm:space-y-1.5">
<div className="flex justify-center mb-0.5 sm:mb-1">
<Bot className="h-5 w-5 sm:h-6 sm:w-6 text-primary" />
</div>
<h1 className="text-base sm:text-lg md:text-xl font-bold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent leading-tight">
Configure AI Settings
</h1>
<p className="text-xs sm:text-sm text-muted-foreground max-w-md mx-auto px-2">
Set up your AI provider to start building with AI assistance.
</p>
</div>
<Card className="max-w-md sm:max-w-lg md:max-w-lg mx-auto">
<CardHeader className="pb-2 sm:pb-3">
<div className="flex items-center gap-1.5 sm:gap-2">
<Settings className="h-3.5 w-3.5 sm:h-4 sm:w-4 text-primary" />
<CardTitle className="text-base sm:text-lg">OpenRouter Provider</CardTitle>
</div>
<CardDescription className="text-[10px] sm:text-xs">
We recommend OpenRouter for easy setup with multiple models
</CardDescription>
</CardHeader>
<CardContent className="space-y-2 sm:space-y-3">
<div className="space-y-2 sm:space-y-3">
<div className="space-y-1">
<Label htmlFor="apiKey" className="text-xs sm:text-sm">API Key *</Label>
<Input
id="apiKey"
type="password"
placeholder="sk-... or your-api-key"
value={localProvider.apiKey}
onChange={(e) => setLocalProvider({ ...localProvider, apiKey: e.target.value })}
className="font-mono text-xs sm:text-sm h-8 sm:h-9"
/>
<p className="text-[10px] sm:text-xs text-muted-foreground">
Stored locally, never shared
</p>
</div>
<div className="space-y-1">
<Label htmlFor="baseURL" className="text-xs sm:text-sm">Base URL *</Label>
<Input
id="baseURL"
placeholder="https://openrouter.ai/api/v1"
value={localProvider.baseURL}
onChange={(e) => setLocalProvider({ ...localProvider, baseURL: e.target.value })}
className="text-xs sm:text-sm h-8 sm:h-9"
/>
</div>
</div>
<div className="bg-muted/50 rounded-lg p-2 space-y-1">
<p className="text-[10px] sm:text-xs font-medium">Usage in chat:</p>
<p className="text-[10px] sm:text-xs text-muted-foreground">
Use <code className="bg-background px-1 rounded">openrouter/anthropic/claude-sonnet-4</code> to specify model
</p>
</div>
</CardContent>
</Card>
<div className="flex justify-center gap-2 sm:gap-3 pt-1 sm:pt-2">
<Button
onClick={onPrevious}
variant="outline"
size="sm"
className="gap-1 h-8 text-sm"
>
<ArrowLeft className="h-3 w-3" />
Back
</Button>
<Button
onClick={handleSave}
disabled={!isValid}
size="sm"
className="gap-1 h-8 text-sm bg-gradient-to-r from-primary to-primary/90"
>
Continue
<ArrowRight className="h-3 w-3" />
</Button>
</div>
<div className="text-center">
<Button
onClick={onSkip}
variant="ghost"
size="sm"
className="text-muted-foreground text-[10px] sm:text-xs h-6 sm:h-7"
>
Skip for now
</Button>
</div>
</div>
);
}
@@ -1,136 +0,0 @@
import { useState, useEffect } from 'react';
import { Dialog, DialogContent, DialogTitle, DialogDescription } from '@/components/ui/dialog';
import { Progress } from '@/components/ui/progress';
import { WelcomeStep } from './WelcomeStep';
import { AISettingsStep } from './AISettingsStep';
import { ProjectStep } from './ProjectStep';
interface OnboardingDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
onProjectCreated?: (projectId: string) => void;
onComplete: () => void;
currentStep: number;
onNextStep: () => void;
onPreviousStep: () => void;
initialPrompt?: string;
}
const STEPS = [
{ id: 'welcome', title: 'Welcome' },
{ id: 'ai-settings', title: 'AI Settings' },
{ id: 'project', title: 'Create Project' },
];
export function OnboardingDialog({
open,
onOpenChange,
onProjectCreated,
onComplete,
currentStep: propCurrentStep,
onNextStep,
onPreviousStep,
initialPrompt = ''
}: OnboardingDialogProps) {
const [localStep, setLocalStep] = useState(propCurrentStep);
// Sync local step with prop when it changes
useEffect(() => {
setLocalStep(propCurrentStep);
}, [propCurrentStep]);
const currentStep = Math.min(localStep, STEPS.length - 1);
const progress = ((currentStep + 1) / STEPS.length) * 100;
const handleNext = () => {
if (currentStep < STEPS.length - 1) {
setLocalStep(prev => prev + 1);
onNextStep();
}
};
const handlePrevious = () => {
if (currentStep > 0) {
setLocalStep(prev => prev - 1);
onPreviousStep();
}
};
const handleSkip = () => {
onComplete();
onOpenChange(false);
};
const handleComplete = () => {
onComplete();
onOpenChange(false);
};
const renderStep = () => {
switch (STEPS[currentStep]?.id) {
case 'welcome':
return (
<WelcomeStep
onNext={handleNext}
onSkip={handleSkip}
/>
);
case 'ai-settings':
return (
<AISettingsStep
onNext={handleNext}
onPrevious={handlePrevious}
onSkip={handleSkip}
/>
);
case 'project':
return (
<ProjectStep
onNext={handleSkip} // Skip to complete
onPrevious={handlePrevious}
onComplete={handleComplete}
onProjectCreated={onProjectCreated}
initialPrompt={initialPrompt}
/>
);
default:
return null;
}
};
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-lg w-[95vw] max-h-[90vh] overflow-y-auto p-0 sm:max-w-xl md:max-w-4xl">
<div className="sticky top-0 bg-background border-b p-4 sm:p-5 pb-3 z-10">
<DialogTitle className="sr-only">Getting Started Onboarding</DialogTitle>
<DialogDescription className="sr-only">Complete the onboarding process to get started with Shakespeare</DialogDescription>
<div className="space-y-1.5">
<div className="flex items-center justify-between">
<h2 className="text-base sm:text-lg font-semibold">Getting Started</h2>
<span className="text-xs sm:text-sm text-muted-foreground">
{currentStep + 1} / {STEPS.length}
</span>
</div>
<div className="relative">
<Progress value={progress} className="h-1.5" />
</div>
<div className="grid grid-cols-3 gap-2 text-[10px] sm:text-xs text-muted-foreground">
{STEPS.map((step, index) => (
<span
key={step.id}
className={`text-center ${index <= currentStep ? 'text-primary font-medium' : ''} truncate`}
>
{step.title}
</span>
))}
</div>
</div>
</div>
<div className="px-2 sm:p-6">
{renderStep()}
</div>
</DialogContent>
</Dialog>
);
}
-114
View File
@@ -1,114 +0,0 @@
import { useState } from 'react';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Textarea } from '@/components/ui/textarea';
import { ArrowLeft, Plus, Sparkles } from 'lucide-react';
import { useProjectsManager } from '@/hooks/useProjectsManager';
import { useNavigate } from 'react-router-dom';
interface ProjectStepProps {
onNext: () => void;
onPrevious: () => void;
onComplete: () => void;
onProjectCreated?: (projectId: string) => void;
initialPrompt?: string;
}
export function ProjectStep({ onPrevious, onComplete, onProjectCreated, initialPrompt = '' }: ProjectStepProps) {
const [prompt, setPrompt] = useState(initialPrompt);
const [isCreating, setIsCreating] = useState(false);
const projectsManager = useProjectsManager();
const navigate = useNavigate();
const handleCreateProject = async () => {
if (!prompt.trim()) return;
setIsCreating(true);
try {
const project = await projectsManager.createProject(prompt.trim());
onProjectCreated?.(project.id);
onComplete();
navigate(`/project/${project.id}`);
} catch (error) {
console.error('Failed to create project:', error);
} finally {
setIsCreating(false);
}
};
return (
<div className="space-y-3 sm:space-y-6 pb-4">
<div className="text-center space-y-1 sm:space-y-4">
<div className="flex justify-center mb-0.5 sm:mb-2">
<Sparkles className="h-5 w-5 sm:h-8 sm:w-8 text-primary" />
</div>
<h1 className="text-base sm:text-2xl md:text-3xl font-bold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent leading-tight">
Create Your First Project
</h1>
<p className="text-xs sm:text-base text-muted-foreground max-w-md sm:max-w-2xl mx-auto px-2">
Our AI will help you create it step by step.
</p>
</div>
<Card className="max-w-md sm:max-w-2xl md:max-w-2xl mx-auto">
<CardHeader className="pb-3 sm:pb-4">
<div className="flex items-center gap-1.5 sm:gap-2">
<Sparkles className="h-4 w-4 sm:h-5 sm:w-5 text-primary" />
<CardTitle className="text-base sm:text-lg">Project Description</CardTitle>
</div>
<CardDescription className="text-xs sm:text-sm">
Be as detailed as possible about what you want to build
</CardDescription>
</CardHeader>
<CardContent className="space-y-3 sm:space-y-4">
<Textarea
placeholder="e.g., Create a farming equipment marketplace for local farmers to buy and sell tractors, tools, and supplies. Include user profiles, product listings with images, search functionality, and direct messaging between buyers and sellers..."
value={prompt}
onChange={(e) => setPrompt(e.target.value)}
className="min-h-[175px] sm:min-h-[100px] sm:min-h-[125px] text-xs sm:text-sm leading-relaxed"
disabled={isCreating}
/>
<div className="hidden sm:block space-y-1.5 sm:space-y-2">
<h3 className="font-medium text-xs sm:text-sm">Example prompts:</h3>
<ul className="text-[10px] sm:text-xs text-muted-foreground space-y-0.5 sm:space-y-1">
<li>• "Build a social media platform for photographers"</li>
<li>• "Create a blog with markdown and Nostr comments"</li>
<li>• "Design a marketplace with categories and ratings"</li>
</ul>
</div>
</CardContent>
</Card>
<div className="flex flex-col items-center gap-2 pt-2 sm:pt-4">
<Button
onClick={handleCreateProject}
disabled={!prompt.trim() || isCreating}
size="lg"
className="gap-2 bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary/80"
>
{isCreating ? (
<>
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-1"></div>
Creating...
</>
) : (
<>
<Plus className="h-4 w-4" />
Create Project
</>
)}
</Button>
<Button
onClick={onPrevious}
variant="ghost"
size="sm"
className="text-muted-foreground text-xs h-7"
>
<ArrowLeft className="h-3 w-3" />
Back
</Button>
</div>
</div>
);
}
-83
View File
@@ -1,83 +0,0 @@
import { Button } from '@/components/ui/button';
import { Card, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { ArrowRight, Zap, GlobeLock, Palette } from 'lucide-react';
interface WelcomeStepProps {
onNext: () => void;
onSkip: () => void;
}
export function WelcomeStep({ onNext, onSkip }: WelcomeStepProps) {
return (
<div className="space-y-6 p-4">
<div className="text-center space-y-4">
<div className="text-6xl mb-4">🎭</div>
<h1 className="text-3xl font-bold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
Welcome to Shakespeare
</h1>
<p className="text-base text-muted-foreground max-w-2xl mx-auto">
Build custom Nostr websites with AI assistance. Let's get you set up in just a few steps.
</p>
</div>
<div className="hidden md:grid md:grid-cols-3 gap-4 max-w-4xl mx-auto">
<Card className="text-center">
<CardHeader>
<div className="flex justify-center mb-2">
<Zap className="h-8 w-8 text-primary" />
</div>
<CardTitle className="text-lg">AI-Powered</CardTitle>
<CardDescription>
Describe your vision and let AI build your Nostr website
</CardDescription>
</CardHeader>
</Card>
<Card className="text-center">
<CardHeader>
<div className="flex justify-center mb-2">
<GlobeLock className="h-8 w-8 text-primary" />
</div>
<CardTitle className="text-lg">Decentralized</CardTitle>
<CardDescription>
Built with the Nostr protocol for censorship resistance
</CardDescription>
</CardHeader>
</Card>
<Card className="text-center">
<CardHeader>
<div className="flex justify-center mb-2">
<Palette className="h-8 w-8 text-primary" />
</div>
<CardTitle className="text-lg">Customizable</CardTitle>
<CardDescription>
Edit code directly or let AI make changes based on your feedback
</CardDescription>
</CardHeader>
</Card>
</div>
<div className="flex flex-col items-center gap-2 pt-4">
<Button
onClick={onNext}
size="lg"
className="gap-2 bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary/80"
>
Get Started
<ArrowRight className="h-4 w-4" />
</Button>
<Button
onClick={onSkip}
variant="ghost"
size="sm"
className="text-muted-foreground text-xs h-7"
>
Skip for now
</Button>
</div>
</div>
);
}
-4
View File
@@ -1,4 +0,0 @@
export { OnboardingDialog } from './OnboardingDialog';
export { WelcomeStep } from './WelcomeStep';
export { AISettingsStep } from './AISettingsStep';
export { ProjectStep } from './ProjectStep';
-48
View File
@@ -1,48 +0,0 @@
import { useState, useEffect } from 'react';
import { useLocalStorage } from './useLocalStorage';
export function useOnboarding() {
const [hasCompletedOnboarding, setHasCompletedOnboarding] = useLocalStorage(
'shakespeare-onboarding-completed',
false
);
const [currentStep, setCurrentStep] = useState(0);
const [isOnboardingOpen, setIsOnboardingOpen] = useState(false);
// Check if onboarding should be shown on first load
useEffect(() => {
if (!hasCompletedOnboarding) {
setIsOnboardingOpen(true);
}
}, [hasCompletedOnboarding]);
const handleNextStep = () => {
setCurrentStep(prev => Math.min(prev + 1, 2));
};
const handlePreviousStep = () => {
setCurrentStep(prev => Math.max(prev - 1, 0));
};
const handleCompleteOnboarding = () => {
setHasCompletedOnboarding(true);
setIsOnboardingOpen(false);
setCurrentStep(0);
};
const handleRestartOnboarding = () => {
setCurrentStep(0);
setIsOnboardingOpen(true);
};
return {
hasCompletedOnboarding,
currentStep,
isOnboardingOpen,
setIsOnboardingOpen,
handleNextStep,
handlePreviousStep,
handleCompleteOnboarding,
handleRestartOnboarding,
};
}
+2 -52
View File
@@ -1,16 +1,14 @@
import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { useProjectsManager } from '@/hooks/useProjectsManager';
import { useOnboarding } from '@/hooks/useOnboarding';
import { useLocalStorage } from '@/hooks/useLocalStorage';
import { useCurrentUser } from '@/hooks/useCurrentUser';
import { AppLayout } from '@/components/AppLayout';
import { OnboardingDialog } from '@/components/onboarding';
import { Button } from '@/components/ui/button';
import { Textarea } from '@/components/ui/textarea';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Plus, Sparkles } from 'lucide-react';
import { Plus } from 'lucide-react';
import { useSeoMeta } from '@unhead/react';
export default function Index() {
@@ -20,15 +18,6 @@ export default function Index() {
const navigate = useNavigate();
const projectsManager = useProjectsManager();
const { user: _user } = useCurrentUser();
const {
hasCompletedOnboarding,
currentStep,
isOnboardingOpen,
setIsOnboardingOpen,
handleNextStep,
handlePreviousStep,
handleCompleteOnboarding,
} = useOnboarding();
useSeoMeta({
title: 'Shakespeare - AI-Powered Nostr Development',
@@ -66,21 +55,7 @@ export default function Index() {
}
};
const headerContent = (
<>
{hasCompletedOnboarding && (
<Button
onClick={() => setIsOnboardingOpen(true)}
variant="ghost"
size="sm"
className="gap-2"
>
<Sparkles className="h-4 w-4" />
Restart Onboarding
</Button>
)}
</>
);
const headerContent = null;
return (
<>
@@ -99,17 +74,6 @@ export default function Index() {
Vibed with MKStack
</a>
</p>
{hasCompletedOnboarding && (
<Button
onClick={() => setIsOnboardingOpen(true)}
variant="ghost"
size="sm"
className="mt-4 gap-2"
>
<Sparkles className="h-4 w-4" />
Restart Onboarding
</Button>
)}
</div>
<div className="mb-8 md:mb-12">
@@ -158,20 +122,6 @@ export default function Index() {
</div>
</div>
</AppLayout>
<OnboardingDialog
open={isOnboardingOpen}
onOpenChange={setIsOnboardingOpen}
currentStep={currentStep}
onNextStep={handleNextStep}
onPreviousStep={handlePreviousStep}
onComplete={handleCompleteOnboarding}
initialPrompt={storedPrompt}
onProjectCreated={(projectId) => {
console.log('Project created during onboarding:', projectId);
setStoredPrompt('');
}}
/>
</>
);
}