diff --git a/prisma/dev.db b/prisma/dev.db index 9c6c0b9..124ecb9 100644 Binary files a/prisma/dev.db and b/prisma/dev.db differ diff --git a/src/app/publication/columns.tsx b/src/app/publication/columns.tsx index 144282c..2962191 100644 --- a/src/app/publication/columns.tsx +++ b/src/app/publication/columns.tsx @@ -8,6 +8,7 @@ import { TextInputCell } from "app/ui/tables/inputs/textInput" import { selectCol } from "app/ui/tables/selectColumn" import NumberInputCell from "app/ui/tables/inputs/numberInput" import { formSchema } from "app/ui/forms/pub" +import GenrePickerInputCell from "app/ui/tables/inputs/genrePickerInput" const columnHelper = createColumnHelper() @@ -39,11 +40,7 @@ export const columns: ColumnDef[] = [ }, columnHelper.accessor("genres", { - cell: props => { - const genres = props.getValue() - .map(e => {e.name}) - return genres - }, + cell: GenrePickerInputCell, filterFn: "arrIncludes" //TODO - write custom filter function, to account for an array of objects }), diff --git a/src/app/publication/page.tsx b/src/app/publication/page.tsx index 4162619..56dfc55 100644 --- a/src/app/publication/page.tsx +++ b/src/app/publication/page.tsx @@ -13,7 +13,7 @@ export default async function Page() { const pubs = await getPubsWithGenres() return (
- + diff --git a/src/app/submission/columns.tsx b/src/app/submission/columns.tsx index fb1dd37..c80c6d8 100644 --- a/src/app/submission/columns.tsx +++ b/src/app/submission/columns.tsx @@ -4,6 +4,7 @@ import { ArrowUpDown } from "lucide-react" import { Button } from "@/components/ui/button" import { SubComplete } from "./page" import { selectCol } from "app/ui/tables/selectColumn" +import TitleContainer from "app/ui/titleContainer" @@ -18,7 +19,7 @@ export const columns: ColumnDef[] = [ }, id: "story", header: "Story", - cell: (props: CellContext) => (

{props.getValue()}

) + cell: (props: CellContext) => ({props.getValue()}) }, { accessorFn: row => { @@ -29,7 +30,7 @@ export const columns: ColumnDef[] = [ }, id: "pub", header: "Publication", - cell: (props: CellContext) => (

{props.getValue()}

) + cell: (props: CellContext) => ({props.getValue()}) }, { accessorFn: row => new Date(row.submitted), diff --git a/src/app/submission/edit.tsx b/src/app/submission/edit.tsx index c1b5750..2ae4c96 100644 --- a/src/app/submission/edit.tsx +++ b/src/app/submission/edit.tsx @@ -16,7 +16,7 @@ export default function EditSubmissionDialog({ stories, pubs, responses, default Edit Submission Change response status, edit dates etc - + diff --git a/src/app/tailwind.css b/src/app/tailwind.css index c0fc71c..bfe7073 100644 --- a/src/app/tailwind.css +++ b/src/app/tailwind.css @@ -1092,10 +1092,6 @@ body { justify-content: space-between; } -.justify-around { - justify-content: space-around; -} - .gap-1 { gap: 0.25rem; } diff --git a/src/app/ui/forms/sub.tsx b/src/app/ui/forms/sub.tsx index 5472f89..444a980 100644 --- a/src/app/ui/forms/sub.tsx +++ b/src/app/ui/forms/sub.tsx @@ -33,6 +33,7 @@ import { } from "@/components/ui/select" import { useState } from "react" import { editSubmission } from "app/lib/edit" +import { createSub } from "app/lib/create" export const formSchema = z.object({ id: z.number().optional(), @@ -76,7 +77,7 @@ export const formSchema = z.object({ export type SubForm = z.infer -export default function SubmissionForm({ stories, pubs, responses, createSub, defaults }) { +export default function SubmissionForm({ stories, pubs, responses, defaults }) { const form = useForm>({ resolver: zodResolver(formSchema), defaultValues: { diff --git a/src/app/ui/tables/actions.tsx b/src/app/ui/tables/actions.tsx deleted file mode 100644 index 4ee5e80..0000000 --- a/src/app/ui/tables/actions.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { Dialog, DialogTrigger, DialogClose, DialogDescription, DialogContent, DialogTitle, DialogHeader, DialogFooter } from "@/components/ui/dialog" -import Link from "next/link" -import { Trash2, Search, Pencil } from "lucide-react" -import { Button } from "@/components/ui/button" - -export function actions({ pathname, deleteFn }: { pathname: string, deleteFn: (id: number) => void }) { - return { - id: "actions", - // header: "Actions", - cell: ({ row }) => { - return
- {!(pathname === "/submission") ? - - : "" - } - - - - - - - - - - Are you sure? - - Deleting a {pathname.slice(1)} cannot be undone! - - - - - - - - - -
- } - } -} - diff --git a/src/app/ui/tables/inputs/textInput.tsx b/src/app/ui/tables/inputs/textInput.tsx index 7a5afd3..cc35c45 100644 --- a/src/app/ui/tables/inputs/textInput.tsx +++ b/src/app/ui/tables/inputs/textInput.tsx @@ -8,6 +8,7 @@ import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { toast } from "@/components/ui/use-toast"; import { Form, FormControl, FormField, FormItem, FormMessage } from "@/components/ui/form"; +import TitleContainer from "app/ui/titleContainer"; export function TextInputCell(props: CellContext) { const [isActive, setIsActive] = useState(false) @@ -82,6 +83,7 @@ export function TextInputCell(props: CellContext) { ) { - :

{props.cell.getValue()}

+ : {props.cell.getValue()} }
) diff --git a/src/app/ui/titleContainer.tsx b/src/app/ui/titleContainer.tsx new file mode 100644 index 0000000..edee6ff --- /dev/null +++ b/src/app/ui/titleContainer.tsx @@ -0,0 +1,11 @@ +import { ComponentProps } from "react"; + +export default function itleContainer({ children }: ComponentProps<"div">) { + let classes = "w-full text-left m-auto" + console.table(children) + if (children == "RECORD DELETED") { + console.log("BINGO") + classes = classes + " text-destructive font-bold" + } + return

{children}

+}