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:
Pascal LinxweilerandClaude Opus 5.5 committed 2026-10-05 17:06:09 +02:00
1 parent 49440154a2
commit c7cb6ed433
6 files changed
+53 -42

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
"use client";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { AddModelForm } from "./add-model-form";
/** Library header with an "Add model" toggle that opens the lookup/selection form inline. */
export function AddModelPanel({ freeBytes, defaultOpen }: { freeBytes: number | null; defaultOpen: boolean }) {
const router = useRouter();
const [open, setOpen] = useState(defaultOpen);
return (
<>
<div className="flex items-center justify-between">
<h1 className="text-xl font-semibold">Library</h1>
<Button variant={open ? "outline" : "default"} onClick={() => setOpen((o) => !o)}>
{open ? "Close" : "Add model"}
</Button>
</div>
{open && (
<AddModelForm
freeBytes={freeBytes}
onAdded={() => {
setOpen(false);
router.refresh();
}}
/>
)}
</>
);
}