From 8f1830cab8c0ca29aaf286bd39f4df1d47179c0e Mon Sep 17 00:00:00 2001 From: Delba de Oliveira Date: Wed, 11 Oct 2023 11:32:27 +0100 Subject: [PATCH] Update forms --- .../15-final/app/ui/invoices/create-form.tsx | 272 ++++++++--------- .../15-final/app/ui/invoices/edit-form.tsx | 281 +++++++++--------- 2 files changed, 269 insertions(+), 284 deletions(-) diff --git a/dashboard/15-final/app/ui/invoices/create-form.tsx b/dashboard/15-final/app/ui/invoices/create-form.tsx index e262084a..a24c8881 100644 --- a/dashboard/15-final/app/ui/invoices/create-form.tsx +++ b/dashboard/15-final/app/ui/invoices/create-form.tsx @@ -1,10 +1,7 @@ 'use client'; -import { createInvoice } from '@/app/lib/actions'; -import { CustomerName } from '@/app/lib/definitions'; +import { CustomerField } from '@/app/lib/definitions'; import Link from 'next/link'; -// @ts-ignore React types do not yet include useFormState -import { experimental_useFormState as useFormState } from 'react-dom'; import { CheckIcon, ClockIcon, @@ -12,161 +9,156 @@ import { UserCircleIcon, } from '@heroicons/react/24/outline'; import { Button } from '../button'; +import { createInvoice } from '@/app/lib/actions'; +// @ts-ignore React types do not yet include useFormState +import { experimental_useFormState as useFormState } from 'react-dom'; -export default function Form({ - customerNames, -}: { - customerNames: CustomerName[]; -}) { +export default function Form({ customers }: { customers: CustomerField[] }) { const initialState = { message: null, errors: [] }; const [state, dispatch] = useFormState(createInvoice, initialState); return ( -
-
- {/* Customer Name */} -
-