diff --git a/src/app/mobile/page.tsx b/src/app/mobile/page.tsx index c44fcf5..07bd16d 100644 --- a/src/app/mobile/page.tsx +++ b/src/app/mobile/page.tsx @@ -21,7 +21,13 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' -import { CaretSortIcon, ChevronLeftIcon, DotsHorizontalIcon } from '@radix-ui/react-icons' +import { + CaretSortIcon, + ChevronLeftIcon, + DotsHorizontalIcon, + CheckIcon, + SlashIcon, +} from '@radix-ui/react-icons' import { cn } from '@/lib/utils' import { Toaster } from '@/components/ui/toaster' import { useToast } from '@/components/ui/use-toast' @@ -37,135 +43,262 @@ import { AlertDialogTrigger, } from '@/components/ui/alert-dialog' import { CommandList } from 'cmdk' +import { + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form' +import { useFieldArray, useForm } from 'react-hook-form' +import { zodResolver } from '@hookform/resolvers/zod' +import * as z from 'zod' const members = 'ar,arsenicum,cfk,daz,dfgg,drozdziak1,elia,emeryth,enki,gadzber,gawron52,kaneda_,kosa,liryk,mi,micky,mike,minikdo,nietaki,nuke,obst,palid,pl,q3k,qrde,radex,red_labs,rureq,sdomi,vuko,wrx,zuzu'.split( ',', ) +const formSchema = z.object({ + parent: z.string(), + name: z.string().min(2).max(50), + description: z.string().max(512).optional(), + owner: z.string().optional(), +}) +type ItemFormValues = z.infer + export default function InventoryMobileTest() { const { toast } = useToast() const [isDeleteConfirmOpen, setDeleteConfirmOpen] = React.useState(false) const [isOwnerPickerOpen, setOwnerPickerOpen] = React.useState(false) - const [selectedMember, setSelectedMember] = React.useState('arsenicum') + + const form = useForm({ + resolver: zodResolver(formSchema), + defaultValues: { + parent: 'arcade', + name: '', + }, + }) + + const onSubmit = (values: ItemFormValues) => { + console.log(values) + toast({ + title: 'Item saved', + description: ( +
+          {JSON.stringify(values, null, 2)}
+        
+ ), + }) + } return ( -
-
- -

Edit item

- - - - - - setDeleteConfirmOpen(true)} - > - Delete - - - - - - - Are you absolutely sure? - - This action cannot be undone. This will permanently delete this item. - - - - Cancel - Delete - - - - -
-
-
-
- - -
-
- -