Compare commits

...
5 changed files with 126 additions and 80 deletions

No files matched your search

+23 -23
View File
@@ -24,72 +24,72 @@ export function AISettingsStep({ onNext, onPrevious, onSkip }: AISettingsStepPro
const isValid = localSettings.apiKey.trim() && localSettings.baseUrl.trim() && localSettings.model.trim(); const isValid = localSettings.apiKey.trim() && localSettings.baseUrl.trim() && localSettings.model.trim();
return ( return (
<div className="space-y-4"> <div className="space-y-2 sm:space-y-4 mb-3 sm:mb-0">
<div className="text-center space-y-2"> <div className="text-center space-y-1 sm:space-y-1.5">
<div className="flex justify-center mb-2"> <div className="flex justify-center mb-0.5 sm:mb-1">
<Bot className="h-8 w-8 text-primary" /> <Bot className="h-5 w-5 sm:h-6 sm:w-6 text-primary" />
</div> </div>
<h1 className="text-2xl font-bold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent"> <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 Configure AI Settings
</h1> </h1>
<p className="text-sm text-muted-foreground max-w-lg mx-auto"> <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. Set up your AI provider to start building with AI assistance.
</p> </p>
</div> </div>
<Card className="max-w-lg mx-auto"> <Card className="max-w-md sm:max-w-lg md:max-w-lg mx-auto">
<CardHeader className="pb-3"> <CardHeader className="pb-2 sm:pb-3">
<div className="flex items-center gap-2"> <div className="flex items-center gap-1.5 sm:gap-2">
<Settings className="h-4 w-4 text-primary" /> <Settings className="h-3.5 w-3.5 sm:h-4 sm:w-4 text-primary" />
<CardTitle className="text-lg">AI Provider</CardTitle> <CardTitle className="text-base sm:text-lg">AI Provider</CardTitle>
</div> </div>
<CardDescription className="text-xs"> <CardDescription className="text-[10px] sm:text-xs">
We recommend OpenRouter for easy setup We recommend OpenRouter for easy setup
</CardDescription> </CardDescription>
</CardHeader> </CardHeader>
<CardContent className="space-y-4"> <CardContent className="space-y-2 sm:space-y-3">
<div className="space-y-3"> <div className="space-y-2 sm:space-y-3">
<div className="space-y-1"> <div className="space-y-1">
<Label htmlFor="apiKey" className="text-sm">API Key *</Label> <Label htmlFor="apiKey" className="text-xs sm:text-sm">API Key *</Label>
<Input <Input
id="apiKey" id="apiKey"
type="password" type="password"
placeholder="sk-... or your-api-key" placeholder="sk-... or your-api-key"
value={localSettings.apiKey} value={localSettings.apiKey}
onChange={(e) => setLocalSettings({ ...localSettings, apiKey: e.target.value })} onChange={(e) => setLocalSettings({ ...localSettings, apiKey: e.target.value })}
className="font-mono text-sm h-9" className="font-mono text-xs sm:text-sm h-8 sm:h-9"
/> />
<p className="text-xs text-muted-foreground"> <p className="text-[10px] sm:text-xs text-muted-foreground">
Stored locally, never shared Stored locally, never shared
</p> </p>
</div> </div>
<div className="space-y-1"> <div className="space-y-1">
<Label htmlFor="baseUrl" className="text-sm">Base URL *</Label> <Label htmlFor="baseUrl" className="text-xs sm:text-sm">Base URL *</Label>
<Input <Input
id="baseUrl" id="baseUrl"
placeholder="https://openrouter.ai/api/v1" placeholder="https://openrouter.ai/api/v1"
value={localSettings.baseUrl} value={localSettings.baseUrl}
onChange={(e) => setLocalSettings({ ...localSettings, baseUrl: e.target.value })} onChange={(e) => setLocalSettings({ ...localSettings, baseUrl: e.target.value })}
className="text-sm h-9" className="text-xs sm:text-sm h-8 sm:h-9"
/> />
</div> </div>
<div className="space-y-1"> <div className="space-y-1">
<Label htmlFor="model" className="text-sm">Model *</Label> <Label htmlFor="model" className="text-xs sm:text-sm">Model *</Label>
<Input <Input
id="model" id="model"
placeholder="anthropic/claude-sonnet-4" placeholder="anthropic/claude-sonnet-4"
value={localSettings.model} value={localSettings.model}
onChange={(e) => setLocalSettings({ ...localSettings, model: e.target.value })} onChange={(e) => setLocalSettings({ ...localSettings, model: e.target.value })}
className="text-sm h-9" className="text-xs sm:text-sm h-8 sm:h-9"
/> />
</div> </div>
</div> </div>
</CardContent> </CardContent>
</Card> </Card>
<div className="flex justify-center gap-3 pt-2"> <div className="flex justify-center gap-2 sm:gap-3 pt-1 sm:pt-2">
<Button <Button
onClick={onPrevious} onClick={onPrevious}
variant="outline" variant="outline"
@@ -115,7 +115,7 @@ export function AISettingsStep({ onNext, onPrevious, onSkip }: AISettingsStepPro
onClick={onSkip} onClick={onSkip}
variant="ghost" variant="ghost"
size="sm" size="sm"
className="text-muted-foreground text-xs h-7" className="text-muted-foreground text-[10px] sm:text-xs h-6 sm:h-7"
> >
Skip for now Skip for now
</Button> </Button>
+14 -11
View File
@@ -13,6 +13,7 @@ interface OnboardingDialogProps {
currentStep: number; currentStep: number;
onNextStep: () => void; onNextStep: () => void;
onPreviousStep: () => void; onPreviousStep: () => void;
initialPrompt?: string;
} }
const STEPS = [ const STEPS = [
@@ -28,7 +29,8 @@ export function OnboardingDialog({
onComplete, onComplete,
currentStep: propCurrentStep, currentStep: propCurrentStep,
onNextStep, onNextStep,
onPreviousStep onPreviousStep,
initialPrompt = ''
}: OnboardingDialogProps) { }: OnboardingDialogProps) {
const [localStep, setLocalStep] = useState(propCurrentStep); const [localStep, setLocalStep] = useState(propCurrentStep);
@@ -88,6 +90,7 @@ export function OnboardingDialog({
onPrevious={handlePrevious} onPrevious={handlePrevious}
onComplete={handleComplete} onComplete={handleComplete}
onProjectCreated={onProjectCreated} onProjectCreated={onProjectCreated}
initialPrompt={initialPrompt}
/> />
); );
default: default:
@@ -97,25 +100,25 @@ export function OnboardingDialog({
return ( return (
<Dialog open={open} onOpenChange={onOpenChange}> <Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-4xl max-h-[85vh] overflow-y-auto p-0"> <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-6 pb-4 z-10"> <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> <DialogTitle className="sr-only">Getting Started Onboarding</DialogTitle>
<DialogDescription className="sr-only">Complete the onboarding process to get started with Shakespeare</DialogDescription> <DialogDescription className="sr-only">Complete the onboarding process to get started with Shakespeare</DialogDescription>
<div className="space-y-2"> <div className="space-y-1.5">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<h2 className="text-lg font-semibold">Getting Started</h2> <h2 className="text-base sm:text-lg font-semibold">Getting Started</h2>
<span className="text-sm text-muted-foreground"> <span className="text-xs sm:text-sm text-muted-foreground">
Step {currentStep + 1} of {STEPS.length} {currentStep + 1} / {STEPS.length}
</span> </span>
</div> </div>
<div className="relative"> <div className="relative">
<Progress value={progress} className="h-2" /> <Progress value={progress} className="h-1.5" />
</div> </div>
<div className="flex justify-between text-xs text-muted-foreground"> <div className="grid grid-cols-3 gap-2 text-[10px] sm:text-xs text-muted-foreground">
{STEPS.map((step, index) => ( {STEPS.map((step, index) => (
<span <span
key={step.id} key={step.id}
className={index <= currentStep ? 'text-primary font-medium' : ''} className={`text-center ${index <= currentStep ? 'text-primary font-medium' : ''} truncate`}
> >
{step.title} {step.title}
</span> </span>
@@ -124,7 +127,7 @@ export function OnboardingDialog({
</div> </div>
</div> </div>
<div className="p-6 pt-4"> <div className="px-2 sm:p-6">
{renderStep()} {renderStep()}
</div> </div>
</DialogContent> </DialogContent>
+24 -23
View File
@@ -11,10 +11,11 @@ interface ProjectStepProps {
onPrevious: () => void; onPrevious: () => void;
onComplete: () => void; onComplete: () => void;
onProjectCreated?: (projectId: string) => void; onProjectCreated?: (projectId: string) => void;
initialPrompt?: string;
} }
export function ProjectStep({ onPrevious, onComplete, onProjectCreated }: ProjectStepProps) { export function ProjectStep({ onPrevious, onComplete, onProjectCreated, initialPrompt = '' }: ProjectStepProps) {
const [prompt, setPrompt] = useState(''); const [prompt, setPrompt] = useState(initialPrompt);
const [isCreating, setIsCreating] = useState(false); const [isCreating, setIsCreating] = useState(false);
const projectsManager = useProjectsManager(); const projectsManager = useProjectsManager();
const navigate = useNavigate(); const navigate = useNavigate();
@@ -36,50 +37,50 @@ export function ProjectStep({ onPrevious, onComplete, onProjectCreated }: Projec
}; };
return ( return (
<div className="space-y-6"> <div className="space-y-3 sm:space-y-6 pb-4">
<div className="text-center space-y-4"> <div className="text-center space-y-1 sm:space-y-4">
<div className="flex justify-center mb-2"> <div className="flex justify-center mb-0.5 sm:mb-2">
<Sparkles className="h-8 w-8 text-primary" /> <Sparkles className="h-5 w-5 sm:h-8 sm:w-8 text-primary" />
</div> </div>
<h1 className="text-3xl font-bold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent"> <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 Create Your First Project
</h1> </h1>
<p className="text-base text-muted-foreground max-w-2xl mx-auto"> <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. Our AI will help you create it step by step.
</p> </p>
</div> </div>
<Card className="max-w-2xl mx-auto"> <Card className="max-w-md sm:max-w-2xl md:max-w-2xl mx-auto">
<CardHeader> <CardHeader className="pb-3 sm:pb-4">
<div className="flex items-center gap-2"> <div className="flex items-center gap-1.5 sm:gap-2">
<Sparkles className="h-5 w-5 text-primary" /> <Sparkles className="h-4 w-4 sm:h-5 sm:w-5 text-primary" />
<CardTitle>Project Description</CardTitle> <CardTitle className="text-base sm:text-lg">Project Description</CardTitle>
</div> </div>
<CardDescription> <CardDescription className="text-xs sm:text-sm">
Be as detailed as possible about what you want to build Be as detailed as possible about what you want to build
</CardDescription> </CardDescription>
</CardHeader> </CardHeader>
<CardContent className="space-y-4"> <CardContent className="space-y-3 sm:space-y-4">
<Textarea <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..." 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} value={prompt}
onChange={(e) => setPrompt(e.target.value)} onChange={(e) => setPrompt(e.target.value)}
className="min-h-[125px] text-sm leading-relaxed" className="min-h-[175px] sm:min-h-[100px] sm:min-h-[125px] text-xs sm:text-sm leading-relaxed"
disabled={isCreating} disabled={isCreating}
/> />
<div className="space-y-2"> <div className="hidden sm:block space-y-1.5 sm:space-y-2">
<h3 className="font-medium text-sm">Example prompts:</h3> <h3 className="font-medium text-xs sm:text-sm">Example prompts:</h3>
<ul className="text-xs text-muted-foreground space-y-1"> <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 to share their work and connect with clients"</li> <li>• "Build a social media platform for photographers"</li>
<li>• "Create a blog platform with markdown support and Nostr-based comments"</li> <li>• "Create a blog with markdown and Nostr comments"</li>
<li>• "Design a marketplace for vintage clothing with categories, filters, and user ratings"</li> <li>• "Design a marketplace with categories and ratings"</li>
</ul> </ul>
</div> </div>
</CardContent> </CardContent>
</Card> </Card>
<div className="flex flex-col items-center gap-2 pt-4"> <div className="flex flex-col items-center gap-2 pt-2 sm:pt-4">
<Button <Button
onClick={handleCreateProject} onClick={handleCreateProject}
disabled={!prompt.trim() || isCreating} disabled={!prompt.trim() || isCreating}
+2 -2
View File
@@ -9,7 +9,7 @@ interface WelcomeStepProps {
export function WelcomeStep({ onNext, onSkip }: WelcomeStepProps) { export function WelcomeStep({ onNext, onSkip }: WelcomeStepProps) {
return ( return (
<div className="space-y-6"> <div className="space-y-6 p-4">
<div className="text-center space-y-4"> <div className="text-center space-y-4">
<div className="text-6xl mb-4">🎭</div> <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"> <h1 className="text-3xl font-bold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
@@ -20,7 +20,7 @@ export function WelcomeStep({ onNext, onSkip }: WelcomeStepProps) {
</p> </p>
</div> </div>
<div className="grid md:grid-cols-3 gap-4 max-w-4xl mx-auto"> <div className="hidden md:grid md:grid-cols-3 gap-4 max-w-4xl mx-auto">
<Card className="text-center"> <Card className="text-center">
<CardHeader> <CardHeader>
<div className="flex justify-center mb-2"> <div className="flex justify-center mb-2">
+63 -21
View File
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom';
import { type Project } from '@/lib/ProjectsManager'; import { type Project } from '@/lib/ProjectsManager';
import { useProjectsManager } from '@/hooks/useProjectsManager'; import { useProjectsManager } from '@/hooks/useProjectsManager';
import { useOnboarding } from '@/hooks/useOnboarding'; import { useOnboarding } from '@/hooks/useOnboarding';
import { useLocalStorage } from '@/hooks/useLocalStorage';
import { ProjectSidebar } from '@/components/ProjectSidebar'; import { ProjectSidebar } from '@/components/ProjectSidebar';
import { OnboardingDialog } from '@/components/onboarding'; import { OnboardingDialog } from '@/components/onboarding';
@@ -20,6 +21,7 @@ export default function Index() {
const [projects, setProjects] = useState<Project[]>([]); const [projects, setProjects] = useState<Project[]>([]);
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const [isCreating, setIsCreating] = useState(false); const [isCreating, setIsCreating] = useState(false);
const [storedPrompt, setStoredPrompt] = useLocalStorage('shakespeare-draft-prompt', '');
const navigate = useNavigate(); const navigate = useNavigate();
const projectsManager = useProjectsManager(); const projectsManager = useProjectsManager();
const isMobile = useIsMobile(); const isMobile = useIsMobile();
@@ -32,6 +34,7 @@ export default function Index() {
handlePreviousStep, handlePreviousStep,
handleCompleteOnboarding, handleCompleteOnboarding,
} = useOnboarding(); } = useOnboarding();
const [isSidebarVisible, setIsSidebarVisible] = useState(() => { const [isSidebarVisible, setIsSidebarVisible] = useState(() => {
// Check if we're on mobile immediately to set correct initial state // Check if we're on mobile immediately to set correct initial state
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
@@ -61,9 +64,26 @@ export default function Index() {
loadProjects(); loadProjects();
}, [loadProjects]); }, [loadProjects]);
// Restore prompt from local storage on mount
useEffect(() => {
if (storedPrompt) {
setPrompt(storedPrompt);
}
}, [storedPrompt]);
// Sync prompt with local storage
const handlePromptChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
const newPrompt = e.target.value;
setPrompt(newPrompt);
setStoredPrompt(newPrompt);
};
const handleCreateProject = async () => { const handleCreateProject = async () => {
if (!prompt.trim()) return; if (!prompt.trim()) return;
// Clear stored prompt when creating project
setStoredPrompt('');
setIsCreating(true); setIsCreating(true);
try { try {
const project = await projectsManager.createProject(prompt.trim()); const project = await projectsManager.createProject(prompt.trim());
@@ -91,21 +111,25 @@ export default function Index() {
<div className="min-h-dvh bg-gradient-to-br from-primary/5 to-accent/5"> <div className="min-h-dvh bg-gradient-to-br from-primary/5 to-accent/5">
{/* Mobile Header */} {/* Mobile Header */}
<header className="border-b bg-gradient-to-r from-primary/10 via-accent/5 to-primary/10 backdrop-blur px-4 py-3 flex items-center justify-between"> <header className="border-b bg-gradient-to-r from-primary/10 via-accent/5 to-primary/10 backdrop-blur px-4 py-3 flex items-center justify-between">
<Button {projects.length > 0 ? (
variant="ghost" <Button
size="sm" variant="ghost"
onClick={() => setIsSidebarVisible(!isSidebarVisible)} size="sm"
> onClick={() => setIsSidebarVisible(!isSidebarVisible)}
<Menu className="h-4 w-4" /> >
</Button> <Menu className="h-4 w-4" />
</Button>
) : (
<div className="w-8" /> /* Spacer when no sidebar */
)}
<h1 className="text-lg font-semibold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent"> <h1 className="text-lg font-semibold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
Shakespeare Shakespeare
</h1> </h1>
<div className="w-8" /> {/* Spacer */} <div className="w-8" /> {/* Spacer */}
</header> </header>
{/* Mobile Sidebar Overlay */} {/* Mobile Sidebar Overlay - only show if user has projects */}
{isSidebarVisible && ( {projects.length > 0 && isSidebarVisible && (
<div className="fixed inset-0 z-50 bg-background/80 backdrop-blur-sm"> <div className="fixed inset-0 z-50 bg-background/80 backdrop-blur-sm">
{/* Backdrop - only covers the area not occupied by the sidebar */} {/* Backdrop - only covers the area not occupied by the sidebar */}
<div <div
@@ -172,7 +196,7 @@ export default function Index() {
<Textarea <Textarea
placeholder="e.g., Create a farming equipment marketplace for local farmers to buy and sell tractors, tools, and supplies..." placeholder="e.g., Create a farming equipment marketplace for local farmers to buy and sell tractors, tools, and supplies..."
value={prompt} value={prompt}
onChange={(e) => setPrompt(e.target.value)} onChange={handlePromptChange}
className="min-h-[120px] touch-action-manipulation overscroll-contain text-base leading-relaxed" className="min-h-[120px] touch-action-manipulation overscroll-contain text-base leading-relaxed"
disabled={isCreating} disabled={isCreating}
/> />
@@ -254,6 +278,20 @@ export default function Index() {
</div> </div>
</div> </div>
</div> </div>
<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('');
}}
/>
</div> </div>
); );
} }
@@ -267,26 +305,30 @@ export default function Index() {
onNextStep={handleNextStep} onNextStep={handleNextStep}
onPreviousStep={handlePreviousStep} onPreviousStep={handlePreviousStep}
onComplete={handleCompleteOnboarding} onComplete={handleCompleteOnboarding}
initialPrompt={storedPrompt}
onProjectCreated={(projectId) => { onProjectCreated={(projectId) => {
// Handle project creation during onboarding // Handle project creation during onboarding
console.log('Project created during onboarding:', projectId); console.log('Project created during onboarding:', projectId);
setStoredPrompt(''); // Clear stored prompt after project creation
}} }}
/> />
<div className="h-screen flex bg-background"> <div className="h-screen flex bg-background">
{/* Fixed Sidebar */} {/* Fixed Sidebar - only show if user has created projects */}
<div className={cn("w-80 border-r bg-sidebar transition-all duration-300", isSidebarVisible ? "block" : "hidden")}> {projects.length > 0 && (
<ProjectSidebar <div className={cn("w-80 border-r bg-sidebar transition-all duration-300", isSidebarVisible ? "block" : "hidden")}>
selectedProject={null} <ProjectSidebar
onSelectProject={handleProjectSelect} selectedProject={null}
className="h-full" onSelectProject={handleProjectSelect}
/> className="h-full"
</div> />
</div>
)}
{/* Main Content Area */} {/* Main Content Area */}
<div className="flex-1 flex flex-col overflow-hidden bg-background"> <div className="flex-1 flex flex-col overflow-hidden bg-background">
<div className="min-h-full bg-gradient-to-br from-primary/5 to-accent/5"> <div className="min-h-full bg-gradient-to-br from-primary/5 to-accent/5">
{/* Header */} {/* Header - only show toggle button if user has projects */}
{!isSidebarVisible && ( {!isSidebarVisible && projects.length > 0 && (
<header className="border-b bg-gradient-to-r from-primary/10 via-accent/5 to-primary/10 backdrop-blur px-4 py-3 flex items-center"> <header className="border-b bg-gradient-to-r from-primary/10 via-accent/5 to-primary/10 backdrop-blur px-4 py-3 flex items-center">
<Button <Button
variant="ghost" variant="ghost"
@@ -339,7 +381,7 @@ export default function Index() {
<Textarea <Textarea
placeholder="e.g., Create a farming equipment marketplace for local farmers to buy and sell tractors, tools, and supplies..." placeholder="e.g., Create a farming equipment marketplace for local farmers to buy and sell tractors, tools, and supplies..."
value={prompt} value={prompt}
onChange={(e) => setPrompt(e.target.value)} onChange={handlePromptChange}
className="min-h-[120px] touch-action-manipulation overscroll-contain text-base leading-relaxed" className="min-h-[120px] touch-action-manipulation overscroll-contain text-base leading-relaxed"
disabled={isCreating} disabled={isCreating}
/> />