30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
"use client"
|
|
import { Dialog, DialogHeader, DialogTrigger, DialogContent, DialogClose, DialogTitle, DialogFooter, DialogDescription } from "@/components/ui/dialog";
|
|
import { Button } from "@/components/ui/button";
|
|
import { ComponentProps } from "react";
|
|
import { Genre, Pub } from "@prisma/client";
|
|
import { createPub } from "app/lib/create";
|
|
import PubForm from "app/ui/forms/pub";
|
|
import { Plus } from "lucide-react";
|
|
import { useState } from "react";
|
|
import { PubWithGenres } from "./page";
|
|
|
|
export default function EditPubDialog({ genres, closeDialog, defaults, dbAction }: ComponentProps<"div"> & { genres: Genre[], closeDialog: () => void, defaults: PubWithGenres, dbAction: (data: Pub & { genres: number[] }) => Promise<{ success: string }> }) {
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
<DialogHeader>
|
|
<DialogTitle>Edit publication</DialogTitle>
|
|
<DialogDescription>Modify an entry for an existing publication.</DialogDescription>
|
|
</DialogHeader>
|
|
<PubForm dbAction={dbAction} genres={genres} closeDialog={closeDialog} defaults={defaults} />
|
|
<DialogFooter>
|
|
<Button form="pubform">Submit</Button>
|
|
</DialogFooter>
|
|
</>
|
|
|
|
)
|
|
}
|