From f916143f156539dd67062b8df7101ac2afd3ea9e Mon Sep 17 00:00:00 2001 From: Polaris Date: Sun, 21 Jul 2024 13:24:31 -0400 Subject: [PATCH] added getavatarpart --- components/avatarcustomization/avatar.ts | 0 components/avatarcustomization/page.tsx | 348 ++++++----------------- components/scoreplaylog/colums.tsx | 3 +- lib/api.ts | 25 ++ 4 files changed, 120 insertions(+), 256 deletions(-) create mode 100644 components/avatarcustomization/avatar.ts diff --git a/components/avatarcustomization/avatar.ts b/components/avatarcustomization/avatar.ts new file mode 100644 index 0000000..e69de29 diff --git a/components/avatarcustomization/page.tsx b/components/avatarcustomization/page.tsx index 6996a25..490e336 100644 --- a/components/avatarcustomization/page.tsx +++ b/components/avatarcustomization/page.tsx @@ -32,15 +32,10 @@ import { import { toast } from "@/components/ui/use-toast"; const AvatarParts = [ - { label: "English", value: "en" }, - { label: "French", value: "fr" }, - { label: "German", value: "de" }, - { label: "Spanish", value: "es" }, - { label: "Portuguese", value: "pt" }, - { label: "Russian", value: "ru" }, - { label: "Japanese", value: "ja" }, - { label: "Korean", value: "ko" }, - { label: "Chinese", value: "zh" }, + { label: "Head", value: "avatarHead", src: "/path/to/head.png" }, + { label: "Body", value: "avatarBody", src: "/path/to/body.png" }, + { label: "Face", value: "avatarFace", src: "/path/to/face.png" }, + { label: "Back", value: "avatarBack", src: "/path/to/back.png" }, ] as const; const FormSchema = z.object({ @@ -75,250 +70,95 @@ export function AvatarCustomization() { } return ( -
- - ( - - Avatar Head Item - - - - - - - - - - - No head item found. - - {AvatarParts.map((part) => ( - { - form.setValue("AvatarHead", part.value); - }} - > - - {part.label} - - ))} - - - - - - - - - )} - /> - ( - - Avatar Body Item - - - - - - - - - - - No body item found. - - {AvatarParts.map((part) => ( - { - form.setValue("AvatarBody", part.value); - }} - > - - {part.label} - - ))} - - - - - - - - - )} - /> - ( - - Avatar Face Item - - - - - - - - - - - No face item found. - - {AvatarParts.map((part) => ( - { - form.setValue("AvatarFace", part.value); - }} - > - - {part.label} - - ))} - - - - - - - - - )} - /> - ( - - Avatar Back Item - - - - - - - - - - - No back item found. - - {AvatarParts.map((part) => ( - { - form.setValue("AvatarBack", part.value); - }} - > - - {part.label} - - ))} - - - - - - - - - )} - /> - - - +
+
+
+
+ {AvatarParts.map(({ value, src }) => ( +
+ {value} +
+ ))} +
+
+
+
+ + {AvatarParts.map((part) => ( + } + render={({ field }) => ( + + {`Avatar ${part.label} Item`} + + + + + + + + + + + + No {part.label.toLowerCase()} item found. + + + {AvatarParts.map((item) => ( + { + form.setValue( + part.value as keyof z.infer< + typeof FormSchema + >, + item.value + ); + }} + > + + {item.label} + + ))} + + + + + + + + )} + /> + ))} + + + +
); } diff --git a/components/scoreplaylog/colums.tsx b/components/scoreplaylog/colums.tsx index fa23424..f05e7fe 100644 --- a/components/scoreplaylog/colums.tsx +++ b/components/scoreplaylog/colums.tsx @@ -34,10 +34,9 @@ export const columns: ColumnDef[] = [ const [isLoading, setIsLoading] = useState(true); return (
- {isLoading || !jacketPath ? ( + {!jacketPath ? ( ) : ( - // eslint-disable-next-line @next/next/no-img-element