baseline style

This commit is contained in:
Chad Curtis committed 2025-07-21 01:34:34 +00:00
1 parent 37c16f54ef
commit 03109e63b5
7 files changed
+512 -177

No files matched your search

+46 -44
View File
@@ -241,15 +241,15 @@ When creating new components or pages, follow the existing patterns in the codeb
if (!isConfigured) {
return (
<div className="h-full flex flex-col">
<div className="border-b px-4 py-3 flex justify-between items-center">
<div className="border-b bg-gradient-to-r from-primary/5 to-accent/5 px-4 py-3 flex justify-between items-center">
<div>
<h2 className="font-semibold">AI Assistant</h2>
<h2 className="font-semibold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">AI Assistant</h2>
<p className="text-sm text-muted-foreground">Chat to build your project</p>
</div>
<Button
variant="outline"
size="sm"
className="gap-2"
className="gap-2 hover:bg-primary/10 hover:border-primary/20"
onClick={() => {
// This will be handled by the AISettingsDialog component
const event = new CustomEvent('openAISettings');
@@ -261,18 +261,18 @@ When creating new components or pages, follow the existing patterns in the codeb
</Button>
</div>
<div className="flex-1 flex items-center justify-center">
<div className="text-center space-y-4">
<Bot className="h-12 w-12 mx-auto text-muted-foreground" />
<div className="flex-1 flex items-center justify-center bg-gradient-to-br from-primary/5 to-accent/5">
<div className="text-center space-y-4 max-w-md mx-auto p-6">
<div className="text-4xl mb-4">🤖</div>
<div>
<h3 className="text-lg font-semibold mb-2">AI Assistant Not Configured</h3>
<h3 className="text-lg font-semibold mb-2 bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">AI Assistant Not Configured</h3>
<p className="text-sm text-muted-foreground mb-4">
Please configure your AI settings to start building with AI assistance.
</p>
<Button
variant="outline"
size="sm"
className="gap-2"
className="gap-2 hover:bg-primary/10 hover:border-primary/20"
onClick={() => {
const event = new CustomEvent('openAISettings');
window.dispatchEvent(event);
@@ -306,64 +306,66 @@ When creating new components or pages, follow the existing patterns in the codeb
return (
<div className="h-full flex flex-col">
<div className="border-b px-4 py-3 flex justify-between items-center">
<div>
<h2 className="font-semibold">AI Assistant</h2>
<p className="text-sm text-muted-foreground">Chat to build your project</p>
<div className="border-b bg-gradient-to-r from-primary/5 to-accent/5 px-4 py-3 flex justify-between items-center">
<div className="min-w-0 flex-1">
<h2 className="font-semibold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">AI Assistant</h2>
<p className="text-sm text-muted-foreground hidden sm:block">Chat to build your project</p>
</div>
<div className="flex gap-2">
<Button
variant="outline"
size="sm"
className="gap-1 sm:gap-2 hover:bg-primary/10 hover:border-primary/20"
onClick={runBuild}
>
<Play className="h-4 w-4" />
<span className="hidden sm:inline">Build</span>
</Button>
<Button
variant="outline"
size="sm"
className="gap-1 sm:gap-2 hover:bg-accent/10 hover:border-accent/20"
onClick={runDeploy}
>
<CloudUpload className="h-4 w-4" />
<span className="hidden sm:inline">Deploy</span>
</Button>
</div>
<Button
variant="outline"
size="sm"
className="gap-2"
onClick={runBuild}
>
<Play className="h-4 w-4" />
Build
</Button>
<Button
variant="outline"
size="sm"
className="gap-2"
onClick={runDeploy}
>
<CloudUpload className="h-4 w-4" />
Deploy
</Button>
</div>
<ScrollArea className="flex-1 p-4" ref={scrollAreaRef}>
<div className="space-y-4">
<ScrollArea className="flex-1 p-3 sm:p-4" ref={scrollAreaRef}>
<div className="space-y-3 sm:space-y-4">
{messages.map((message, index) => (
<div
key={index}
className={cn(
'flex gap-3',
'flex gap-2 sm:gap-3',
message.role === 'user' ? 'justify-end' : 'justify-start'
)}
>
<div
className={cn(
'flex gap-2 max-w-[80%]',
'flex gap-2 max-w-[85%] sm:max-w-[80%]',
message.role === 'user' ? 'flex-row-reverse' : 'flex-row'
)}
>
<div
className={cn(
'w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0',
'w-7 h-7 sm:w-8 sm:h-8 rounded-full flex items-center justify-center flex-shrink-0',
message.role === 'user'
? 'bg-primary text-primary-foreground'
: 'bg-muted'
)}
>
{message.role === 'user' ? (
<User className="h-4 w-4" />
<User className="h-3 w-3 sm:h-4 sm:w-4" />
) : (
<Bot className="h-4 w-4" />
<Bot className="h-3 w-3 sm:h-4 sm:w-4" />
)}
</div>
<Card
className={cn(
'px-4 py-2',
'px-3 py-2 sm:px-4',
message.role === 'user'
? 'bg-primary text-primary-foreground'
: 'bg-muted'
@@ -389,10 +391,10 @@ When creating new components or pages, follow the existing patterns in the codeb
{isLoading && (
<div className="flex gap-2">
<div className="w-8 h-8 rounded-full bg-muted flex items-center justify-center flex-shrink-0">
<Bot className="h-4 w-4" />
<div className="w-7 h-7 sm:w-8 sm:h-8 rounded-full bg-muted flex items-center justify-center flex-shrink-0">
<Bot className="h-3 w-3 sm:h-4 sm:w-4" />
</div>
<Card className="px-4 py-2 bg-muted">
<Card className="px-3 py-2 sm:px-4 bg-muted">
<div className="flex space-x-1">
<div className="h-2 w-2 bg-current rounded-full animate-bounce [animation-delay:-0.3s]"></div>
<div className="h-2 w-2 bg-current rounded-full animate-bounce [animation-delay:-0.15s]"></div>
@@ -404,20 +406,20 @@ When creating new components or pages, follow the existing patterns in the codeb
</div>
</ScrollArea>
<div className="border-t p-4">
<div className="border-t p-3 sm:p-4">
<div className="flex gap-2">
<Textarea
value={input}
onChange={(e) => setInput(e.target.value)}
onKeyDown={handleKeyDown}
placeholder="Ask me to add features, edit files, or build your project..."
className="min-h-[60px] resize-none"
className="min-h-[60px] resize-none touch-action-manipulation overscroll-contain focus-ring"
disabled={isLoading}
/>
<Button
onClick={handleSend}
disabled={!input.trim() || isLoading}
className="self-end"
className="self-end focus-ring"
size="icon"
>
<Send className="h-4 w-4" />
+10 -8
View File
@@ -66,27 +66,28 @@ export function FileEditor({ filePath, content, onSave, isLoading }: FileEditorP
return (
<div className="h-full flex flex-col">
<CardHeader className="border-b py-3">
<CardHeader className="border-b py-2 sm:py-3">
<div className="flex items-center justify-between">
<CardTitle className="text-base">{filePath}</CardTitle>
<div className="flex items-center space-x-2">
<CardTitle className="text-sm sm:text-base truncate flex-1 mr-2">{filePath}</CardTitle>
<div className="flex items-center space-x-1 sm:space-x-2">
{hasChanges && (
<span className="text-sm text-muted-foreground">Unsaved changes</span>
<span className="text-xs sm:text-sm text-muted-foreground hidden sm:inline">Unsaved changes</span>
)}
<Button
onClick={handleSave}
disabled={!hasChanges || isSaving || isLoading}
size="sm"
className="focus-ring"
>
{isSaving ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Saving...
<Loader2 className="mr-1 sm:mr-2 h-4 w-4 animate-spin" />
<span className="hidden sm:inline">Saving...</span>
</>
) : (
<>
<Save className="mr-2 h-4 w-4" />
Save
<Save className="mr-1 sm:mr-2 h-4 w-4" />
<span className="hidden sm:inline">Save</span>
</>
)}
</Button>
@@ -109,6 +110,7 @@ export function FileEditor({ filePath, content, onSave, isLoading }: FileEditorP
className={cn(
'w-full h-full resize-none border-0 rounded-none',
'focus:outline-none focus:ring-0',
'touch-action-manipulation overscroll-contain',
getMonospaceFont()
)}
placeholder={`// Edit ${filePath}...`}
+102 -34
View File
@@ -4,7 +4,8 @@ import { useFS } from '@/hooks/useFS';
import { Tabs, TabsContent } from '@/components/ui/tabs';
import { ScrollArea } from '@/components/ui/scroll-area';
import { Button } from '@/components/ui/button';
import { RefreshCw } from 'lucide-react';
import { RefreshCw, FolderOpen, ArrowLeft } from 'lucide-react';
import { useIsMobile } from '@/hooks/useIsMobile';
import { FileTree } from './FileTree';
import { FileEditor } from './FileEditor';
@@ -48,6 +49,8 @@ export function PreviewPane({ projectId, activeTab }: PreviewPaneProps) {
const [selectedFile, setSelectedFile] = useState<string | null>(null);
const [fileContent, setFileContent] = useState<string>('');
const [isLoading, setIsLoading] = useState(false);
const [mobileCodeView, setMobileCodeView] = useState<'explorer' | 'editor'>('explorer');
const isMobile = useIsMobile();
const [hasBuiltProject, setHasBuiltProject] = useState(false);
const iframeRef = useRef<HTMLIFrameElement>(null);
const { fs } = useFS();
@@ -262,6 +265,9 @@ export function PreviewPane({ projectId, activeTab }: PreviewPaneProps) {
const handleFileSelect = (filePath: string) => {
setSelectedFile(filePath);
if (isMobile) {
setMobileCodeView('editor');
}
};
const handleFileSave = async (content: string) => {
@@ -281,13 +287,13 @@ export function PreviewPane({ projectId, activeTab }: PreviewPaneProps) {
<TabsContent value="preview" className="h-full mt-0">
{hasBuiltProject ? (
<div className="h-full w-full flex flex-col">
<div className="flex items-center justify-between p-2 border-b bg-background">
<span className="text-sm text-muted-foreground">Project Preview</span>
<div className="flex items-center justify-between p-2 border-b bg-gradient-to-r from-primary/5 to-accent/5">
<span className="text-sm font-medium bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">Project Preview</span>
<Button
variant="ghost"
size="sm"
onClick={refreshIframe}
className="h-8 w-8 p-0"
className="h-8 w-8 p-0 hover:bg-primary/10"
>
<RefreshCw className="h-4 w-4" />
</Button>
@@ -327,39 +333,101 @@ export function PreviewPane({ projectId, activeTab }: PreviewPaneProps) {
</TabsContent>
<TabsContent value="code" className="h-full mt-0">
<div className="h-full flex">
<div className="w-1/3 border-r">
<div className="p-4 border-b">
<h3 className="font-semibold">File Explorer</h3>
</div>
<ScrollArea className="h-[calc(100%-60px)]">
<FileTree
projectId={projectId}
onFileSelect={handleFileSelect}
selectedFile={selectedFile}
/>
</ScrollArea>
</div>
<div className="flex-1">
{selectedFile ? (
<FileEditor
filePath={selectedFile}
content={fileContent}
onSave={handleFileSave}
isLoading={isLoading}
/>
) : (
<div className="h-full flex items-center justify-center">
<div className="text-center">
<p className="text-muted-foreground">
Select a file from the explorer to edit
</p>
{isMobile ? (
<div className="h-full flex flex-col">
{mobileCodeView === 'explorer' ? (
<>
<div className="p-3 border-b bg-gradient-to-r from-primary/5 to-accent/5">
<h3 className="font-semibold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">File Explorer</h3>
</div>
</div>
<ScrollArea className="flex-1">
<FileTree
projectId={projectId}
onFileSelect={handleFileSelect}
selectedFile={selectedFile}
/>
</ScrollArea>
</>
) : (
<>
<div className="p-3 border-b bg-gradient-to-r from-primary/5 to-accent/5 flex items-center gap-2">
<Button
variant="ghost"
size="sm"
onClick={() => setMobileCodeView('explorer')}
className="p-1"
>
<ArrowLeft className="h-4 w-4" />
</Button>
<h3 className="font-semibold flex-1 truncate bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
{selectedFile ? selectedFile.split('/').pop() : 'File Editor'}
</h3>
</div>
<div className="flex-1">
{selectedFile ? (
<FileEditor
filePath={selectedFile}
content={fileContent}
onSave={handleFileSave}
isLoading={isLoading}
/>
) : (
<div className="h-full flex items-center justify-center">
<div className="text-center">
<FolderOpen className="h-12 w-12 mx-auto text-muted-foreground mb-4" />
<p className="text-muted-foreground">
Select a file from the explorer to edit
</p>
<Button
variant="outline"
size="sm"
onClick={() => setMobileCodeView('explorer')}
className="mt-4"
>
Open File Explorer
</Button>
</div>
</div>
)}
</div>
</>
)}
</div>
</div>
) : (
<div className="h-full flex">
<div className="w-1/3 border-r">
<div className="p-4 border-b bg-gradient-to-r from-primary/5 to-accent/5">
<h3 className="font-semibold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">File Explorer</h3>
</div>
<ScrollArea className="h-[calc(100%-60px)]">
<FileTree
projectId={projectId}
onFileSelect={handleFileSelect}
selectedFile={selectedFile}
/>
</ScrollArea>
</div>
<div className="flex-1">
{selectedFile ? (
<FileEditor
filePath={selectedFile}
content={fileContent}
onSave={handleFileSave}
isLoading={isLoading}
/>
) : (
<div className="h-full flex items-center justify-center">
<div className="text-center">
<p className="text-muted-foreground">
Select a file from the explorer to edit
</p>
</div>
</div>
)}
</div>
</div>
)}
</TabsContent>
</Tabs>
</div>