17 lines
1.1 KiB
TypeScript
17 lines
1.1 KiB
TypeScript
import Link from "next/link";
|
|
import { Button } from "@/components/ui/button";
|
|
import AdminPageHeader from "@/components/admin/admin-page-header";
|
|
import MelodyForm from "@/components/admin/melody-form";
|
|
import { prisma } from "@/lib/db";
|
|
import type { MelodyInput } from "@/lib/validations/melody";
|
|
|
|
export default async function NewMelodyPage() {
|
|
const categories = await prisma.category.findMany({ where: { kind: "MELODY" }, orderBy: [{ order: "asc" }, { nameEn: "asc" }], select: { id: true, nameAr: true, nameEn: true } });
|
|
const defaultValues: MelodyInput = {
|
|
slug: "", titleAr: "", titleEn: "", descAr: "", descEn: "", audioFile: "", coverImage: "", durationSec: null,
|
|
isDownloadable: false, status: "DRAFT", isFeatured: false, sortOrder: 0, categoryId: "",
|
|
};
|
|
|
|
return <div className="mx-auto w-full max-w-7xl"><AdminPageHeader title="New melody" description="Create an audio track with its cover, category, and publishing controls." actions={<Button asChild variant="outline"><Link href="/admin/melodies">Back to melodies</Link></Button>} /><MelodyForm mode="create" categories={categories} defaultValues={defaultValues} /></div>;
|
|
}
|