2024-06-26 17:55:18 +00:00
|
|
|
|
|
|
|
"use client"
|
2024-06-30 15:36:44 +00:00
|
|
|
import { createSub } from "app/lib/create"
|
2024-06-26 17:55:18 +00:00
|
|
|
import { Dialog, DialogHeader, DialogTrigger, DialogContent, DialogClose, DialogTitle, DialogFooter, DialogDescription } from "@/components/ui/dialog";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
import { ComponentProps } from "react";
|
2024-06-30 15:36:44 +00:00
|
|
|
import { Pub, Response, Story } from "@prisma/client";
|
2024-06-26 17:55:18 +00:00
|
|
|
import SubmissionForm from "app/ui/forms/sub";
|
2024-09-24 11:32:26 +00:00
|
|
|
import { Plus } from "lucide-react";
|
2024-09-25 16:48:03 +00:00
|
|
|
import { useState } from "react";
|
2024-06-26 17:55:18 +00:00
|
|
|
|
|
|
|
|
2024-07-19 15:23:07 +00:00
|
|
|
|
2024-09-26 10:37:52 +00:00
|
|
|
export default function CreateSubmissionDialog({ stories, pubs, responses }: ComponentProps<"div"> & { stories: Story[], pubs: Pub[], responses: Response[] }) {
|
2024-06-26 17:55:18 +00:00
|
|
|
|
2024-09-25 16:48:03 +00:00
|
|
|
const [isOpen, setIsOpen] = useState(false)
|
|
|
|
function closeDialog() {
|
|
|
|
setIsOpen(false)
|
|
|
|
}
|
|
|
|
|
2024-06-26 17:55:18 +00:00
|
|
|
return (
|
2024-09-25 16:48:03 +00:00
|
|
|
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
2024-06-26 17:55:18 +00:00
|
|
|
<DialogTrigger asChild>
|
2024-09-24 11:32:26 +00:00
|
|
|
<Button>
|
|
|
|
<span className="hidden md:block">Create new submission</span>
|
|
|
|
<Plus className="block md:hidden" />
|
|
|
|
</Button>
|
2024-06-26 17:55:18 +00:00
|
|
|
</DialogTrigger>
|
2024-09-25 17:36:46 +00:00
|
|
|
<DialogContent className="text-xs md:text-sm">
|
2024-06-26 17:55:18 +00:00
|
|
|
<DialogHeader>
|
2024-06-26 19:41:52 +00:00
|
|
|
<DialogTitle>New submission</DialogTitle>
|
2024-06-26 17:55:18 +00:00
|
|
|
<DialogDescription>Create an entry for a new story i.e. a thing you intend to submit for publication.</DialogDescription>
|
|
|
|
</DialogHeader>
|
2024-09-26 10:37:52 +00:00
|
|
|
<SubmissionForm pubs={pubs} responses={responses} stories={stories} closeDialog={closeDialog} />
|
2024-06-26 17:55:18 +00:00
|
|
|
<DialogFooter>
|
|
|
|
<Button form="subform">Submit</Button>
|
|
|
|
</DialogFooter>
|
|
|
|
</DialogContent>
|
|
|
|
</Dialog>
|
|
|
|
)
|
|
|
|
}
|