feat: Update Navbar and HistorySidebar layout for improved navigation and styling
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { useRef, useEffect } from 'react'
|
import { useRef, useEffect } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { Link } from 'react-router-dom'
|
||||||
import { useHistoryContext } from '@/contexts/HistoryContext'
|
import { useHistoryContext } from '@/contexts/HistoryContext'
|
||||||
import { HistoryItem } from '@/components/HistoryItem'
|
import { HistoryItem } from '@/components/HistoryItem'
|
||||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||||
@@ -36,7 +37,13 @@ function HistorySidebarContent() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col h-full">
|
<div className="flex flex-col h-full">
|
||||||
<div className="px-4 pt-4 pb-6">
|
<div className="px-4 pt-4 pb-3">
|
||||||
|
<Link to="/" className="flex items-center gap-2 mb-6">
|
||||||
|
<img src="/qwen.svg" alt="Qwen" className="h-6 w-6" />
|
||||||
|
<h1 className="text-xl font-bold cursor-pointer hover:opacity-80 transition-opacity">
|
||||||
|
Qwen3-TTS-WebUI
|
||||||
|
</h1>
|
||||||
|
</Link>
|
||||||
<h2 className="text-lg font-semibold">{t('historyTitle')}</h2>
|
<h2 className="text-lg font-semibold">{t('historyTitle')}</h2>
|
||||||
<p className="text-sm text-muted-foreground">{t('historyCount', { count: jobs.length })}</p>
|
<p className="text-sm text-muted-foreground">{t('historyCount', { count: jobs.length })}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,69 +22,58 @@ export function Navbar({ onToggleSidebar }: NavbarProps) {
|
|||||||
const { t, i18n } = useTranslation(['nav', 'constants'])
|
const { t, i18n } = useTranslation(['nav', 'constants'])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className="h-16 border-b bg-background flex items-center px-4 gap-4">
|
<nav className="h-16 bg-background flex items-center justify-end px-4 gap-2">
|
||||||
{onToggleSidebar && (
|
{onToggleSidebar && (
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
onClick={onToggleSidebar}
|
onClick={onToggleSidebar}
|
||||||
className="lg:hidden"
|
className="lg:hidden mr-auto"
|
||||||
>
|
>
|
||||||
<Menu className="h-5 w-5" />
|
<Menu className="h-5 w-5" />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="flex-1">
|
{user?.is_superuser && (
|
||||||
<Link to="/" className="flex items-center gap-2">
|
<Link to="/users">
|
||||||
<img src="/qwen.svg" alt="Qwen" className="h-6 w-6" />
|
|
||||||
<h1 className="hidden md:block text-xl font-bold cursor-pointer hover:opacity-80 transition-opacity">
|
|
||||||
Qwen3-TTS-WebUI
|
|
||||||
</h1>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
{user?.is_superuser && (
|
|
||||||
<Link to="/users">
|
|
||||||
<Button variant="ghost" size="icon">
|
|
||||||
<Users className="h-5 w-5" />
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
<Link to="/settings">
|
|
||||||
<Button variant="ghost" size="icon">
|
<Button variant="ghost" size="icon">
|
||||||
<Settings className="h-5 w-5" />
|
<Users className="h-5 w-5" />
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
<ThemeToggle />
|
)}
|
||||||
<DropdownMenu>
|
<Link to="/settings">
|
||||||
<DropdownMenuTrigger asChild>
|
<Button variant="ghost" size="icon">
|
||||||
<Button variant="ghost" size="icon">
|
<Settings className="h-5 w-5" />
|
||||||
<Globe className="h-5 w-5" />
|
|
||||||
</Button>
|
|
||||||
</DropdownMenuTrigger>
|
|
||||||
<DropdownMenuContent align="end">
|
|
||||||
<DropdownMenuItem onClick={() => changeLanguage('zh-CN')}>
|
|
||||||
{t('constants:uiLanguages.zh-CN')} {i18n.language === 'zh-CN' && '✓'}
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem onClick={() => changeLanguage('zh-TW')}>
|
|
||||||
{t('constants:uiLanguages.zh-TW')} {i18n.language === 'zh-TW' && '✓'}
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem onClick={() => changeLanguage('en-US')}>
|
|
||||||
{t('constants:uiLanguages.en-US')} {i18n.language === 'en-US' && '✓'}
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem onClick={() => changeLanguage('ja-JP')}>
|
|
||||||
{t('constants:uiLanguages.ja-JP')} {i18n.language === 'ja-JP' && '✓'}
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem onClick={() => changeLanguage('ko-KR')}>
|
|
||||||
{t('constants:uiLanguages.ko-KR')} {i18n.language === 'ko-KR' && '✓'}
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</DropdownMenuContent>
|
|
||||||
</DropdownMenu>
|
|
||||||
<Button variant="ghost" size="icon" onClick={logout}>
|
|
||||||
<LogOut className="h-5 w-5" />
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</Link>
|
||||||
|
<ThemeToggle />
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<Button variant="ghost" size="icon">
|
||||||
|
<Globe className="h-5 w-5" />
|
||||||
|
</Button>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent align="end">
|
||||||
|
<DropdownMenuItem onClick={() => changeLanguage('zh-CN')}>
|
||||||
|
{t('constants:uiLanguages.zh-CN')} {i18n.language === 'zh-CN' && '✓'}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem onClick={() => changeLanguage('zh-TW')}>
|
||||||
|
{t('constants:uiLanguages.zh-TW')} {i18n.language === 'zh-TW' && '✓'}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem onClick={() => changeLanguage('en-US')}>
|
||||||
|
{t('constants:uiLanguages.en-US')} {i18n.language === 'en-US' && '✓'}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem onClick={() => changeLanguage('ja-JP')}>
|
||||||
|
{t('constants:uiLanguages.ja-JP')} {i18n.language === 'ja-JP' && '✓'}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem onClick={() => changeLanguage('ko-KR')}>
|
||||||
|
{t('constants:uiLanguages.ko-KR')} {i18n.language === 'ko-KR' && '✓'}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
<Button variant="ghost" size="icon" onClick={logout}>
|
||||||
|
<LogOut className="h-5 w-5" />
|
||||||
|
</Button>
|
||||||
</nav>
|
</nav>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,19 +33,19 @@ function Home() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-screen overflow-hidden flex flex-col bg-background">
|
<div className="h-screen overflow-hidden flex bg-background">
|
||||||
<OnboardingDialog
|
<OnboardingDialog
|
||||||
open={showOnboarding}
|
open={showOnboarding}
|
||||||
onComplete={() => setShowOnboarding(false)}
|
onComplete={() => setShowOnboarding(false)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Navbar onToggleSidebar={() => setSidebarOpen(!sidebarOpen)} />
|
<HistorySidebar
|
||||||
|
open={sidebarOpen}
|
||||||
|
onOpenChange={setSidebarOpen}
|
||||||
|
/>
|
||||||
|
|
||||||
<div className="flex-1 flex overflow-hidden">
|
<div className="flex-1 flex flex-col overflow-hidden">
|
||||||
<HistorySidebar
|
<Navbar onToggleSidebar={() => setSidebarOpen(!sidebarOpen)} />
|
||||||
open={sidebarOpen}
|
|
||||||
onOpenChange={setSidebarOpen}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<main className="flex-1 overflow-y-auto flex items-start md:items-center justify-center">
|
<main className="flex-1 overflow-y-auto flex items-start md:items-center justify-center">
|
||||||
<div className="w-full container mx-auto p-3 md:p-6 max-w-[800px] md:max-w-[700px]">
|
<div className="w-full container mx-auto p-3 md:p-6 max-w-[800px] md:max-w-[700px]">
|
||||||
|
|||||||
Reference in New Issue
Block a user