mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-04 00:03:35 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b64692833 | ||
|
|
d3e5402dbe | ||
|
|
1dc0cf4529 | ||
|
|
509a088b84 | ||
|
|
8c95f7c0b5 | ||
|
|
944fee7256 | ||
|
|
0f17aa8c7c |
No files matched your search
@@ -24,72 +24,72 @@ export function AISettingsStep({ onNext, onPrevious, onSkip }: AISettingsStepPro
|
||||
const isValid = localSettings.apiKey.trim() && localSettings.baseUrl.trim() && localSettings.model.trim();
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="text-center space-y-2">
|
||||
<div className="flex justify-center mb-2">
|
||||
<Bot className="h-8 w-8 text-primary" />
|
||||
<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-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
|
||||
</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.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Card className="max-w-lg mx-auto">
|
||||
<CardHeader className="pb-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<Settings className="h-4 w-4 text-primary" />
|
||||
<CardTitle className="text-lg">AI Provider</CardTitle>
|
||||
<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">AI Provider</CardTitle>
|
||||
</div>
|
||||
<CardDescription className="text-xs">
|
||||
<CardDescription className="text-[10px] sm:text-xs">
|
||||
We recommend OpenRouter for easy setup
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="space-y-3">
|
||||
<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-sm">API Key *</Label>
|
||||
<Label htmlFor="apiKey" className="text-xs sm:text-sm">API Key *</Label>
|
||||
<Input
|
||||
id="apiKey"
|
||||
type="password"
|
||||
placeholder="sk-... or your-api-key"
|
||||
value={localSettings.apiKey}
|
||||
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
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<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
|
||||
id="baseUrl"
|
||||
placeholder="https://openrouter.ai/api/v1"
|
||||
value={localSettings.baseUrl}
|
||||
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 className="space-y-1">
|
||||
<Label htmlFor="model" className="text-sm">Model *</Label>
|
||||
<Label htmlFor="model" className="text-xs sm:text-sm">Model *</Label>
|
||||
<Input
|
||||
id="model"
|
||||
placeholder="anthropic/claude-sonnet-4"
|
||||
value={localSettings.model}
|
||||
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>
|
||||
</CardContent>
|
||||
</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
|
||||
onClick={onPrevious}
|
||||
variant="outline"
|
||||
@@ -115,7 +115,7 @@ export function AISettingsStep({ onNext, onPrevious, onSkip }: AISettingsStepPro
|
||||
onClick={onSkip}
|
||||
variant="ghost"
|
||||
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
|
||||
</Button>
|
||||
|
||||
@@ -13,6 +13,7 @@ interface OnboardingDialogProps {
|
||||
currentStep: number;
|
||||
onNextStep: () => void;
|
||||
onPreviousStep: () => void;
|
||||
initialPrompt?: string;
|
||||
}
|
||||
|
||||
const STEPS = [
|
||||
@@ -28,7 +29,8 @@ export function OnboardingDialog({
|
||||
onComplete,
|
||||
currentStep: propCurrentStep,
|
||||
onNextStep,
|
||||
onPreviousStep
|
||||
onPreviousStep,
|
||||
initialPrompt = ''
|
||||
}: OnboardingDialogProps) {
|
||||
const [localStep, setLocalStep] = useState(propCurrentStep);
|
||||
|
||||
@@ -88,6 +90,7 @@ export function OnboardingDialog({
|
||||
onPrevious={handlePrevious}
|
||||
onComplete={handleComplete}
|
||||
onProjectCreated={onProjectCreated}
|
||||
initialPrompt={initialPrompt}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
@@ -97,25 +100,25 @@ export function OnboardingDialog({
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-4xl max-h-[85vh] overflow-y-auto p-0">
|
||||
<div className="sticky top-0 bg-background border-b p-6 pb-4 z-10">
|
||||
<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-2">
|
||||
<div className="space-y-1.5">
|
||||
<div className="flex items-center justify-between">
|
||||
<h2 className="text-lg font-semibold">Getting Started</h2>
|
||||
<span className="text-sm text-muted-foreground">
|
||||
Step {currentStep + 1} of {STEPS.length}
|
||||
<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-2" />
|
||||
<Progress value={progress} className="h-1.5" />
|
||||
</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) => (
|
||||
<span
|
||||
key={step.id}
|
||||
className={index <= currentStep ? 'text-primary font-medium' : ''}
|
||||
className={`text-center ${index <= currentStep ? 'text-primary font-medium' : ''} truncate`}
|
||||
>
|
||||
{step.title}
|
||||
</span>
|
||||
@@ -124,7 +127,7 @@ export function OnboardingDialog({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="p-6 pt-4">
|
||||
<div className="px-2 sm:p-6">
|
||||
{renderStep()}
|
||||
</div>
|
||||
</DialogContent>
|
||||
|
||||
@@ -11,10 +11,11 @@ interface ProjectStepProps {
|
||||
onPrevious: () => void;
|
||||
onComplete: () => void;
|
||||
onProjectCreated?: (projectId: string) => void;
|
||||
initialPrompt?: string;
|
||||
}
|
||||
|
||||
export function ProjectStep({ onPrevious, onComplete, onProjectCreated }: ProjectStepProps) {
|
||||
const [prompt, setPrompt] = useState('');
|
||||
export function ProjectStep({ onPrevious, onComplete, onProjectCreated, initialPrompt = '' }: ProjectStepProps) {
|
||||
const [prompt, setPrompt] = useState(initialPrompt);
|
||||
const [isCreating, setIsCreating] = useState(false);
|
||||
const projectsManager = useProjectsManager();
|
||||
const navigate = useNavigate();
|
||||
@@ -36,50 +37,50 @@ export function ProjectStep({ onPrevious, onComplete, onProjectCreated }: Projec
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="text-center space-y-4">
|
||||
<div className="flex justify-center mb-2">
|
||||
<Sparkles className="h-8 w-8 text-primary" />
|
||||
<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-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
|
||||
</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.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Card className="max-w-2xl mx-auto">
|
||||
<CardHeader>
|
||||
<div className="flex items-center gap-2">
|
||||
<Sparkles className="h-5 w-5 text-primary" />
|
||||
<CardTitle>Project Description</CardTitle>
|
||||
<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>
|
||||
<CardDescription className="text-xs sm:text-sm">
|
||||
Be as detailed as possible about what you want to build
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<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-[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}
|
||||
/>
|
||||
|
||||
<div className="space-y-2">
|
||||
<h3 className="font-medium text-sm">Example prompts:</h3>
|
||||
<ul className="text-xs text-muted-foreground space-y-1">
|
||||
<li>• "Build a social media platform for photographers to share their work and connect with clients"</li>
|
||||
<li>• "Create a blog platform with markdown support and Nostr-based comments"</li>
|
||||
<li>• "Design a marketplace for vintage clothing with categories, filters, and user ratings"</li>
|
||||
<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-4">
|
||||
<div className="flex flex-col items-center gap-2 pt-2 sm:pt-4">
|
||||
<Button
|
||||
onClick={handleCreateProject}
|
||||
disabled={!prompt.trim() || isCreating}
|
||||
|
||||
@@ -9,7 +9,7 @@ interface WelcomeStepProps {
|
||||
|
||||
export function WelcomeStep({ onNext, onSkip }: WelcomeStepProps) {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<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">
|
||||
@@ -20,7 +20,7 @@ export function WelcomeStep({ onNext, onSkip }: WelcomeStepProps) {
|
||||
</p>
|
||||
</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">
|
||||
<CardHeader>
|
||||
<div className="flex justify-center mb-2">
|
||||
|
||||
+63
-21
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { type Project } from '@/lib/ProjectsManager';
|
||||
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
||||
import { useOnboarding } from '@/hooks/useOnboarding';
|
||||
import { useLocalStorage } from '@/hooks/useLocalStorage';
|
||||
import { ProjectSidebar } from '@/components/ProjectSidebar';
|
||||
import { OnboardingDialog } from '@/components/onboarding';
|
||||
|
||||
@@ -20,6 +21,7 @@ export default function Index() {
|
||||
const [projects, setProjects] = useState<Project[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [isCreating, setIsCreating] = useState(false);
|
||||
const [storedPrompt, setStoredPrompt] = useLocalStorage('shakespeare-draft-prompt', '');
|
||||
const navigate = useNavigate();
|
||||
const projectsManager = useProjectsManager();
|
||||
const isMobile = useIsMobile();
|
||||
@@ -32,6 +34,7 @@ export default function Index() {
|
||||
handlePreviousStep,
|
||||
handleCompleteOnboarding,
|
||||
} = useOnboarding();
|
||||
|
||||
const [isSidebarVisible, setIsSidebarVisible] = useState(() => {
|
||||
// Check if we're on mobile immediately to set correct initial state
|
||||
if (typeof window !== 'undefined') {
|
||||
@@ -61,9 +64,26 @@ export default function Index() {
|
||||
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 () => {
|
||||
if (!prompt.trim()) return;
|
||||
|
||||
// Clear stored prompt when creating project
|
||||
setStoredPrompt('');
|
||||
|
||||
setIsCreating(true);
|
||||
try {
|
||||
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">
|
||||
{/* 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">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setIsSidebarVisible(!isSidebarVisible)}
|
||||
>
|
||||
<Menu className="h-4 w-4" />
|
||||
</Button>
|
||||
{projects.length > 0 ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setIsSidebarVisible(!isSidebarVisible)}
|
||||
>
|
||||
<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">
|
||||
Shakespeare
|
||||
</h1>
|
||||
<div className="w-8" /> {/* Spacer */}
|
||||
</header>
|
||||
|
||||
{/* Mobile Sidebar Overlay */}
|
||||
{isSidebarVisible && (
|
||||
{/* Mobile Sidebar Overlay - only show if user has projects */}
|
||||
{projects.length > 0 && isSidebarVisible && (
|
||||
<div className="fixed inset-0 z-50 bg-background/80 backdrop-blur-sm">
|
||||
{/* Backdrop - only covers the area not occupied by the sidebar */}
|
||||
<div
|
||||
@@ -172,7 +196,7 @@ export default function Index() {
|
||||
<Textarea
|
||||
placeholder="e.g., Create a farming equipment marketplace for local farmers to buy and sell tractors, tools, and supplies..."
|
||||
value={prompt}
|
||||
onChange={(e) => setPrompt(e.target.value)}
|
||||
onChange={handlePromptChange}
|
||||
className="min-h-[120px] touch-action-manipulation overscroll-contain text-base leading-relaxed"
|
||||
disabled={isCreating}
|
||||
/>
|
||||
@@ -254,6 +278,20 @@ export default function Index() {
|
||||
</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>
|
||||
);
|
||||
}
|
||||
@@ -267,26 +305,30 @@ export default function Index() {
|
||||
onNextStep={handleNextStep}
|
||||
onPreviousStep={handlePreviousStep}
|
||||
onComplete={handleCompleteOnboarding}
|
||||
initialPrompt={storedPrompt}
|
||||
onProjectCreated={(projectId) => {
|
||||
// Handle project creation during onboarding
|
||||
console.log('Project created during onboarding:', projectId);
|
||||
setStoredPrompt(''); // Clear stored prompt after project creation
|
||||
}}
|
||||
/>
|
||||
<div className="h-screen flex bg-background">
|
||||
{/* Fixed Sidebar */}
|
||||
<div className={cn("w-80 border-r bg-sidebar transition-all duration-300", isSidebarVisible ? "block" : "hidden")}>
|
||||
<ProjectSidebar
|
||||
selectedProject={null}
|
||||
onSelectProject={handleProjectSelect}
|
||||
className="h-full"
|
||||
/>
|
||||
</div>
|
||||
{/* Fixed Sidebar - only show if user has created projects */}
|
||||
{projects.length > 0 && (
|
||||
<div className={cn("w-80 border-r bg-sidebar transition-all duration-300", isSidebarVisible ? "block" : "hidden")}>
|
||||
<ProjectSidebar
|
||||
selectedProject={null}
|
||||
onSelectProject={handleProjectSelect}
|
||||
className="h-full"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Main Content Area */}
|
||||
<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">
|
||||
{/* Header */}
|
||||
{!isSidebarVisible && (
|
||||
{/* Header - only show toggle button if user has projects */}
|
||||
{!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">
|
||||
<Button
|
||||
variant="ghost"
|
||||
@@ -339,7 +381,7 @@ export default function Index() {
|
||||
<Textarea
|
||||
placeholder="e.g., Create a farming equipment marketplace for local farmers to buy and sell tractors, tools, and supplies..."
|
||||
value={prompt}
|
||||
onChange={(e) => setPrompt(e.target.value)}
|
||||
onChange={handlePromptChange}
|
||||
className="min-h-[120px] touch-action-manipulation overscroll-contain text-base leading-relaxed"
|
||||
disabled={isCreating}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user