nav bar
This commit is contained in:
parent
2501c66ce4
commit
82875856b5
3 changed files with 92 additions and 88 deletions
|
|
@ -10,39 +10,31 @@ export function Navigation() {
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className="border-b bg-card">
|
<aside className="h-screen w-56 bg-card border-r flex flex-col items-center py-8 gap-4">
|
||||||
<div className="container mx-auto px-4">
|
<nav className="flex flex-col gap-2 w-full px-4">
|
||||||
<div className="flex h-16 items-center justify-between">
|
<Button
|
||||||
<div className="flex items-center space-x-8">
|
variant={pathname === "/" ? "default" : "ghost"}
|
||||||
<Link href="/" className="text-2xl font-bold text-primary">
|
size="sm"
|
||||||
GenDB
|
asChild
|
||||||
</Link>
|
className="justify-start w-full"
|
||||||
<div className="flex items-center space-x-4">
|
>
|
||||||
<Button
|
<Link href="/">
|
||||||
variant={pathname === "/" ? "default" : "ghost"}
|
<Search className="h-4 w-4 mr-2" />
|
||||||
size="sm"
|
Search
|
||||||
asChild
|
</Link>
|
||||||
>
|
</Button>
|
||||||
<Link href="/">
|
<Button
|
||||||
<Search className="h-4 w-4 mr-2" />
|
variant={pathname === "/admin" ? "default" : "ghost"}
|
||||||
Search
|
size="sm"
|
||||||
</Link>
|
asChild
|
||||||
</Button>
|
className="justify-start w-full"
|
||||||
<Button
|
>
|
||||||
variant={pathname === "/admin" ? "default" : "ghost"}
|
<Link href="/admin">
|
||||||
size="sm"
|
<Settings className="h-4 w-4 mr-2" />
|
||||||
asChild
|
Admin
|
||||||
>
|
</Link>
|
||||||
<Link href="/admin">
|
</Button>
|
||||||
<Settings className="h-4 w-4 mr-2" />
|
</nav>
|
||||||
Admin
|
</aside>
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<ModeToggle />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ import { Geist, Geist_Mono } from "next/font/google";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
import { ThemeProvider } from "@/components/theme-provider";
|
import { ThemeProvider } from "@/components/theme-provider";
|
||||||
import { Navigation } from "@/components/navigation";
|
import { Navigation } from "@/components/navigation";
|
||||||
|
import { ModeToggle } from "@/components/mode-toggle";
|
||||||
|
|
||||||
const geistSans = Geist({
|
const geistSans = Geist({
|
||||||
variable: "--font-geist-sans",
|
variable: "--font-geist-sans",
|
||||||
|
|
@ -35,11 +36,19 @@ export default function RootLayout({
|
||||||
enableSystem
|
enableSystem
|
||||||
disableTransitionOnChange
|
disableTransitionOnChange
|
||||||
>
|
>
|
||||||
<div className="min-h-screen bg-background">
|
<div className="min-h-screen bg-background flex">
|
||||||
<Navigation />
|
<Navigation />
|
||||||
<main className="container mx-auto px-4 py-8">
|
<div className="flex-1 flex flex-col min-h-screen">
|
||||||
{children}
|
<header className="w-full py-6 border-b flex items-center justify-center relative">
|
||||||
</main>
|
<h1 className="text-3xl font-bold text-primary mx-auto">GenDB</h1>
|
||||||
|
<div className="absolute right-8 top-1/2 -translate-y-1/2">
|
||||||
|
<ModeToggle />
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<main className="flex-1 container mx-auto px-4 py-8 flex flex-col items-center justify-center">
|
||||||
|
{children}
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ export default function SearchPage() {
|
||||||
<p className="text-muted-foreground">Search through your indexed documents</p>
|
<p className="text-muted-foreground">Search through your indexed documents</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Card>
|
<Card className="max-w-2xl w-full mx-auto">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle className="flex items-center gap-2">
|
<CardTitle className="flex items-center gap-2">
|
||||||
<Search className="h-5 w-5" />
|
<Search className="h-5 w-5" />
|
||||||
|
|
@ -104,57 +104,60 @@ export default function SearchPage() {
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
|
{/* Always render the results area, but show it empty if no search has been performed */}
|
||||||
|
<div className="mt-8">
|
||||||
|
{searchPerformed ? (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<h2 className="text-xl font-semibold">Search Results</h2>
|
||||||
|
<span className="text-sm text-muted-foreground">
|
||||||
|
{results.length} result{results.length !== 1 ? 's' : ''} found
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{results.length === 0 ? (
|
||||||
|
<Card>
|
||||||
|
<CardContent className="pt-6">
|
||||||
|
<p className="text-center text-muted-foreground">
|
||||||
|
No documents found matching your search query.
|
||||||
|
</p>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
) : (
|
||||||
|
<div className="space-y-4">
|
||||||
|
{results.map((result, index) => (
|
||||||
|
<Card key={index}>
|
||||||
|
<CardHeader className="pb-3">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<CardTitle className="text-lg flex items-center gap-2">
|
||||||
|
<FileText className="h-4 w-4" />
|
||||||
|
{result.filename}
|
||||||
|
</CardTitle>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
Score: {result.score.toFixed(2)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<CardDescription>
|
||||||
|
Type: {result.mimetype} • Page {result.page}
|
||||||
|
</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<div className="border-l-2 border-primary pl-4">
|
||||||
|
<p className="text-sm leading-relaxed">
|
||||||
|
{result.text}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div style={{ minHeight: 120 }} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{searchPerformed && (
|
|
||||||
<div className="space-y-4">
|
|
||||||
<div className="flex items-center justify-between">
|
|
||||||
<h2 className="text-xl font-semibold">Search Results</h2>
|
|
||||||
<span className="text-sm text-muted-foreground">
|
|
||||||
{results.length} result{results.length !== 1 ? 's' : ''} found
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{results.length === 0 ? (
|
|
||||||
<Card>
|
|
||||||
<CardContent className="pt-6">
|
|
||||||
<p className="text-center text-muted-foreground">
|
|
||||||
No documents found matching your search query.
|
|
||||||
</p>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
) : (
|
|
||||||
<div className="space-y-4">
|
|
||||||
{results.map((result, index) => (
|
|
||||||
<Card key={index}>
|
|
||||||
<CardHeader className="pb-3">
|
|
||||||
<div className="flex items-center justify-between">
|
|
||||||
<CardTitle className="text-lg flex items-center gap-2">
|
|
||||||
<FileText className="h-4 w-4" />
|
|
||||||
{result.filename}
|
|
||||||
</CardTitle>
|
|
||||||
<div className="text-sm text-muted-foreground">
|
|
||||||
Score: {result.score.toFixed(2)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<CardDescription>
|
|
||||||
Type: {result.mimetype} • Page {result.page}
|
|
||||||
</CardDescription>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent>
|
|
||||||
<div className="border-l-2 border-primary pl-4">
|
|
||||||
<p className="text-sm leading-relaxed">
|
|
||||||
{result.text}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue