2024-09-26 10:37:52 +00:00
|
|
|
"use client"
|
2024-09-30 10:06:37 +00:00
|
|
|
import { DialogHeader, DialogTitle, DialogFooter, DialogDescription } from "@/components/ui/dialog";
|
2024-09-26 10:37:52 +00:00
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
import { ComponentProps, useState } from "react";
|
2024-09-30 12:44:47 +00:00
|
|
|
import { Genre, Story } from "@prisma/client";
|
2024-09-26 10:37:52 +00:00
|
|
|
import StoryForm from "app/ui/forms/story";
|
2024-09-27 10:17:37 +00:00
|
|
|
import { StoryWithGenres } from "./page";
|
2024-09-26 10:37:52 +00:00
|
|
|
|
|
|
|
|
2024-09-30 12:44:47 +00:00
|
|
|
export default function EditStoryDialog({ genres, closeDialog, defaults, dbAction }: ComponentProps<"div"> & { genres: Genre[], closeDialog: () => void, defaults: StoryWithGenres, dbAction: (data: Story & { genres: number[] }) => Promise<{ success: string }> }) {
|
2024-09-26 10:37:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<DialogHeader>
|
|
|
|
<DialogTitle>Edit story</DialogTitle>
|
|
|
|
<DialogDescription>Create an entry for a new story i.e. a thing you intend to submit for publication.</DialogDescription>
|
|
|
|
</DialogHeader>
|
2024-09-27 10:17:37 +00:00
|
|
|
<StoryForm dbAction={dbAction} genres={genres} className="" closeDialog={closeDialog} defaults={defaults} />
|
2024-09-26 10:37:52 +00:00
|
|
|
<DialogFooter>
|
|
|
|
<Button form="storyform">Submit</Button>
|
|
|
|
</DialogFooter>
|
|
|
|
</>
|
|
|
|
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|