Improve Preview and Code buttons visually

This commit is contained in:
Alex Gleason committed 2025-09-22 02:50:34 -05:00
1 parent d52d7b57a6
commit 3c46c72bba
2 files changed
+36 -6

No files matched your search

+9
View File
@@ -35,6 +35,15 @@ describe('deployProject', () => {
mockFS = {
readFile: vi.fn().mockResolvedValue('mock file content'),
readdir: vi.fn().mockResolvedValue([]),
writeFile: vi.fn().mockResolvedValue(undefined),
mkdir: vi.fn().mockResolvedValue(undefined),
stat: vi.fn().mockResolvedValue({ isDirectory: () => false, isFile: () => true }),
lstat: vi.fn().mockResolvedValue({ isDirectory: () => false, isFile: () => true }),
unlink: vi.fn().mockResolvedValue(undefined),
rmdir: vi.fn().mockResolvedValue(undefined),
rename: vi.fn().mockResolvedValue(undefined),
readlink: vi.fn().mockResolvedValue(''),
symlink: vi.fn().mockResolvedValue(undefined),
} as JSRuntimeFS;
mockSigner = {} as NostrSigner;
+27 -6
View File
@@ -413,27 +413,48 @@ export function ProjectView() {
<ResizablePanel defaultSize={60} minSize={30}>
<div className="h-full flex flex-col">
{/* Preview Header */}
<div className="h-12 px-4 border-b flex-shrink-0">
<div className="h-12 px-4 border-b flex-shrink-0 bg-gradient-to-r from-background via-muted/20 to-background">
<div className="flex items-center justify-between h-12">
<div className="flex space-x-2">
<div className="flex">
<Button
variant={activeTab === 'preview' ? 'default' : 'ghost'}
variant="ghost"
size="sm"
onClick={() => setActiveTab('preview')}
disabled={!project}
className={`
relative px-4 py-2 rounded-none border-b-2 transition-all duration-200 ease-in-out
${activeTab === 'preview'
? 'border-primary bg-primary/5 text-primary font-medium shadow-sm'
: 'border-transparent hover:border-muted-foreground/20 hover:bg-muted/50 text-muted-foreground hover:text-foreground'
}
`}
>
<Eye className="h-4 w-4 mr-2" />
{t('preview')}
{activeTab === 'preview' && (
<div className="absolute bottom-0 left-0 right-0 h-0.5 bg-gradient-to-r from-primary/50 via-primary to-primary/50 rounded-full" />
)}
</Button>
<Button
variant={activeTab === 'code' ? 'default' : 'ghost'}
variant="ghost"
size="sm"
onClick={() => setActiveTab('code')}
className="gap-2"
disabled={!project}
className={`
relative px-4 py-2 rounded-none border-b-2 transition-all duration-200 ease-in-out
${activeTab === 'code'
? 'border-primary bg-primary/5 text-primary font-medium shadow-sm'
: 'border-transparent hover:border-muted-foreground/20 hover:bg-muted/50 text-muted-foreground hover:text-foreground'
}
`}
>
<Code className="h-4 w-4 mr-2" />
{t('code')}
{activeTab !== 'code' && project && (
<GitStatusIndicator projectId={project.id} />
<GitStatusIndicator projectId={project.id} className="ml-1" />
)}
{activeTab === 'code' && (
<div className="absolute bottom-0 left-0 right-0 h-0.5 bg-gradient-to-r from-primary/50 via-primary to-primary/50 rounded-full" />
)}
</Button>
</div>