Move "Add model" into the library page
The add form now opens inline from the library instead of living on its own page with a separate menu entry. After adding, the panel closes and the new model's download progress shows in the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
49440154a2
commit
c7cb6ed433
6 files changed
+53
-42
No files matched your search
+6
-21
@@ -1,33 +1,18 @@
|
||||
import Link from "next/link";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { listLibrary } from "@/lib/library";
|
||||
import { getWorkerStatus } from "@/lib/worker-status";
|
||||
import { AddModelPanel } from "./add-model-panel";
|
||||
import { LibraryTable } from "./library-table";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function LibraryPage() {
|
||||
const rows = await listLibrary();
|
||||
const [rows, worker] = await Promise.all([listLibrary(), getWorkerStatus()]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-xl font-semibold">Library</h1>
|
||||
<Link href="/models/new" className={buttonVariants()}>
|
||||
Add model
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
{rows.length === 0 ? (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>No models yet</CardTitle>
|
||||
<CardDescription>Add a Hugging Face repo to get started.</CardDescription>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
) : (
|
||||
<LibraryTable rows={rows} />
|
||||
)}
|
||||
{/* Opens by default while the library is empty. */}
|
||||
<AddModelPanel freeBytes={worker.online ? worker.modelsDirFreeBytes : null} defaultOpen={rows.length === 0} />
|
||||
{rows.length > 0 && <LibraryTable rows={rows} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user