fixed customization erros all using avatar instead of respected item

This commit is contained in:
Polaris
2024-08-26 16:38:35 -04:00
parent 23fe043cf1
commit 81b8a88397
4 changed files with 8 additions and 18 deletions

View File

@ -68,7 +68,7 @@ export const MapIconCustomization: FC<SystemVoiceSelectionProps> = ({
form.setValue("mapIconId", data[0].mapIconId as number); form.setValue("mapIconId", data[0].mapIconId as number);
} }
} catch (error) { } catch (error) {
console.error("Error fetching avatar parts:", error); console.error("Error fetching map icons:", error);
} }
}; };

View File

@ -41,18 +41,18 @@ const getNamePlateTextures = (id: number | undefined) => {
type player_nameplates = cozynet_chuni_static_nameplate; type player_nameplates = cozynet_chuni_static_nameplate;
type AvatarSelectionProps = { type NamePlateSelectionProps = {
playerNamePlateSelectionData: { playerNamePlateSelectionData: {
namePlates: player_nameplates[]; namePlates: player_nameplates[];
}; };
}; };
export const NameplateCustomization: FC<AvatarSelectionProps> = ({ export const NameplateCustomization: FC<NamePlateSelectionProps> = ({
playerNamePlateSelectionData, playerNamePlateSelectionData,
}) => { }) => {
const FormSchema = z.object({ const FormSchema = z.object({
nameplateId: z.number({ nameplateId: z.number({
required_error: "Please select an Avatar Head Item.", required_error: "Please select an NamePlate Head Item.",
}), }),
}); });
@ -70,7 +70,7 @@ export const NameplateCustomization: FC<AvatarSelectionProps> = ({
form.setValue("nameplateId", data[0].nameplateId as number); form.setValue("nameplateId", data[0].nameplateId as number);
} }
} catch (error) { } catch (error) {
console.error("Error fetching avatar parts:", error); console.error("Error fetching NamePlate parts:", error);
} }
}; };

View File

@ -1,7 +1,6 @@
"use client"; "use client";
import React, { FC, useEffect, useState } from "react"; import React, { FC, useEffect, useState } from "react";
import { chuni_static_avatar } from "@/prisma/schemas/artemis/generated/artemis";
import { Check, ChevronsUpDown } from "lucide-react"; import { Check, ChevronsUpDown } from "lucide-react";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
@ -31,11 +30,7 @@ import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import { toast } from "../../ui/use-toast"; import { toast } from "../../ui/use-toast";
import { cozynet_chuni_static_systemvoice } from "@/prisma/schemas/artemis/generated/artemis"; import { cozynet_chuni_static_systemvoice } from "@/prisma/schemas/artemis/generated/artemis";
import { import { getCurrentSystemVoice, updatePlayerSystemVoiceId } from "./actions";
getCurrentSystemVoice,
getSystemVoices,
updatePlayerSystemVoiceId,
} from "./actions";
const getNamePlateTextures = (id: number | undefined) => { const getNamePlateTextures = (id: number | undefined) => {
if (id === undefined) return ""; if (id === undefined) return "";

View File

@ -15,7 +15,6 @@ import {
import { import {
Form, Form,
FormControl, FormControl,
FormDescription,
FormField, FormField,
FormItem, FormItem,
FormLabel, FormLabel,
@ -32,10 +31,6 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { toast } from "../../ui/use-toast"; import { toast } from "../../ui/use-toast";
import { getCurrentTrophies, updatePlayerTrophy } from "./actions"; import { getCurrentTrophies, updatePlayerTrophy } from "./actions";
import { cozynet_chuni_static_trophies } from "@/prisma/schemas/artemis/generated/artemis"; import { cozynet_chuni_static_trophies } from "@/prisma/schemas/artemis/generated/artemis";
const getAvatarTextureSrc = (id: number | undefined) => {
if (id === undefined) return "";
return `avatarAccessory/CHU_UI_Avatar_Tex_0${id}.png`;
};
type static_trophies = cozynet_chuni_static_trophies; type static_trophies = cozynet_chuni_static_trophies;
@ -69,7 +64,7 @@ export const TrophyCustomization: FC<AvatarSelectionProps> = ({
form.setValue("trophies", data[0].trophyId as number); form.setValue("trophies", data[0].trophyId as number);
} }
} catch (error) { } catch (error) {
console.error("Error fetching avatar parts:", error); console.error("Error fetching trophies:", error);
} }
}; };
@ -135,7 +130,7 @@ export const TrophyCustomization: FC<AvatarSelectionProps> = ({
<PopoverContent className="w-[400px] p-0"> <PopoverContent className="w-[400px] p-0">
<Command> <Command>
<CommandList> <CommandList>
<CommandEmpty>No avatar part found.</CommandEmpty> <CommandEmpty>No trophies part found.</CommandEmpty>
<CommandGroup> <CommandGroup>
{playerTrophySelectionData.statictrophies.map( {playerTrophySelectionData.statictrophies.map(
(part) => ( (part) => (