"use client"
import { createStory } from "app/lib/create"
import { Dialog, DialogHeader, DialogTrigger, DialogContent, DialogClose, DialogTitle, DialogFooter, DialogDescription } from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { ComponentProps, useState } from "react";
import { Genre, Story } from "@prisma/client";
import StoryForm from "app/ui/forms/story";


export default function EditStoryDialog({ genres, closeDialog, defaults }: ComponentProps<"div"> & { genres: Genre[], closeDialog: () => void, defaults: Story }) {


  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>
      <StoryForm dbAction={createStory} genres={genres} className="" closeDialog={closeDialog} defaults={defaults} />
      <DialogFooter>
        <Button form="storyform">Submit</Button>
      </DialogFooter>
    </>

  )
}

