From 158d73a6df98f351abdcbd778b8150cb2e7df7c6 Mon Sep 17 00:00:00 2001 From: andrzej Date: Fri, 20 Sep 2024 16:00:05 +0200 Subject: [PATCH] trim --- prisma/dev.db | Bin 69632 -> 69632 bytes src/app/lib/update.ts | 3 +- src/app/submission/charts.tsx | 39 ------ src/app/submission/page.tsx | 1 + src/app/ui/forms/fancyForm.tsx | 115 ------------------ src/app/ui/tables/data-table.tsx | 1 - src/app/ui/tables/inputs/genrePickerInput.tsx | 1 - src/app/ui/titleContainer.tsx | 2 - 8 files changed, 2 insertions(+), 160 deletions(-) delete mode 100644 src/app/submission/charts.tsx delete mode 100644 src/app/ui/forms/fancyForm.tsx diff --git a/prisma/dev.db b/prisma/dev.db index a38ac4143ce1f4ba29ebb3d7fa8bd6b03f09671d..c41b84d66bf292aabc7704323c5492d41a65f657 100644 GIT binary patch delta 42 ycmZozz|ydQWr8$g!$cWp#)ig(tqF{}9E?WO`#2cyFse^yu{+5$bm<<3R6%1tn delta 42 ycmZozz|ydQWr8$g%|sbz#+t^2tqF{}9E>v4`#2cyFv?G7u{+5$bm<<3O9}GVL diff --git a/src/app/lib/update.ts b/src/app/lib/update.ts index b8125a5..88c4807 100644 --- a/src/app/lib/update.ts +++ b/src/app/lib/update.ts @@ -47,13 +47,12 @@ export async function updateSub(data: Sub): Promise { try { subSchema.parse(data) const res = await prisma.sub.update({ where: { id: data.id }, data }) - revalidatePath("/submission") + revalidatePath("submission") return res } catch (error) { console.error(error) return undefined } - } diff --git a/src/app/submission/charts.tsx b/src/app/submission/charts.tsx deleted file mode 100644 index fba4b91..0000000 --- a/src/app/submission/charts.tsx +++ /dev/null @@ -1,39 +0,0 @@ -"use client" -import { LineChart, Line, CartesianGrid, XAxis, YAxis, PieChart, Pie } from "recharts" -import { SubComplete } from "./page" -export function SubsChart({ data }: { data: Array }) { - const pieData: Array<{ story: string, occurrences: number }> = [] - data.forEach(dataRow => { - const story = dataRow.story.title - const exists = pieData.findIndex(pieRow => story === pieRow.story) - if (exists === -1) { - //add the story to pieData if it doesn't already exist - pieData.push({ story: story, occurrences: 0 }) - return - } - pieData[exists].occurrences++ - }) - console.log(pieData) - - - - return ( - <> - - - - - - - - - - - - - - - - - ) -} diff --git a/src/app/submission/page.tsx b/src/app/submission/page.tsx index d43977f..2622dec 100644 --- a/src/app/submission/page.tsx +++ b/src/app/submission/page.tsx @@ -16,6 +16,7 @@ export default async function Page() { const pubs = await getPubs() const responses = await getResponses() const genres = await getGenres() + return (
>({ - resolver: zodResolver(storySchema), - defaultValues: { - title: "", - word_count: 0, - genres: genres - }, - }) - // 2. Define a submit handler. - function onSubmit(values: z.infer) { - // Do something with the form values. - // ✅ This will be type-safe and validated. - console.log(values) - } - return ( -
- - ( - - Title - - - - - - )} - /> - ( - - Word count - - - - - )} - /> - ( - -
- Genres - genres baby -
- {genres.map((item) => ( - { - return ( - - - { - return checked - ? field.onChange([...field.value, item.id]) - : field.onChange( - field.value?.filter( - (value) => value !== item.id - ) - ) - }} - /> - - - {item.name} - - - ) - }} - /> - ))} -
- )} - - /> - - - - ) -} diff --git a/src/app/ui/tables/data-table.tsx b/src/app/ui/tables/data-table.tsx index ae78d74..90fd360 100644 --- a/src/app/ui/tables/data-table.tsx +++ b/src/app/ui/tables/data-table.tsx @@ -210,7 +210,6 @@ export function DataTable({ const selectedRows = table.getState().rowSelection const rowIds = Object.keys(selectedRows) const recordIds = rowIds.map(id => Number(table.getRow(id).original.id)) - console.table(recordIds) deleteRecords(recordIds, pathname) }}> Yes, delete them! diff --git a/src/app/ui/tables/inputs/genrePickerInput.tsx b/src/app/ui/tables/inputs/genrePickerInput.tsx index 8cf61eb..a7dac0a 100644 --- a/src/app/ui/tables/inputs/genrePickerInput.tsx +++ b/src/app/ui/tables/inputs/genrePickerInput.tsx @@ -100,7 +100,6 @@ export default function GenrePickerInputCell(props: CellContext) { { - console.log(field.value) return checked ? field.onChange( [...field.value, item.id] diff --git a/src/app/ui/titleContainer.tsx b/src/app/ui/titleContainer.tsx index edee6ff..94182a9 100644 --- a/src/app/ui/titleContainer.tsx +++ b/src/app/ui/titleContainer.tsx @@ -2,9 +2,7 @@ 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}