addded nameplates

This commit is contained in:
Polaris
2024-07-26 14:08:36 -04:00
parent 5af3b9236b
commit ce82e860bd
5 changed files with 284 additions and 28 deletions

View File

@ -40,13 +40,13 @@ const getAvatarTextureSrc = (id: number | undefined) => {
type static_trophies = cozynet_chuni_static_trophies;
type AvatarSelectionProps = {
allTrophies: {
playerTrophySelectionData: {
statictrophies: static_trophies[];
};
};
export const TrophyCustomization: FC<AvatarSelectionProps> = ({
allTrophies,
playerTrophySelectionData,
}) => {
const FormSchema = z.object({
trophies: z.number({
@ -109,7 +109,7 @@ export const TrophyCustomization: FC<AvatarSelectionProps> = ({
)}
>
{field.value
? allTrophies.statictrophies.find(
? playerTrophySelectionData.statictrophies.find(
(part) => part.id === field.value
)?.str
: "Select Trophy"}
@ -122,25 +122,27 @@ export const TrophyCustomization: FC<AvatarSelectionProps> = ({
<CommandList>
<CommandEmpty>No avatar part found.</CommandEmpty>
<CommandGroup>
{allTrophies.statictrophies.map((part) => (
<CommandItem
value={part.id.toString()}
key={part.id}
onSelect={() => {
form.setValue("trophies", part.id);
}}
>
<Check
className={cn(
"mr-2 h-4 w-4",
part.id === field.value
? "opacity-100"
: "opacity-0"
)}
/>
{part.str}
</CommandItem>
))}
{playerTrophySelectionData.statictrophies.map(
(part) => (
<CommandItem
value={part.id.toString()}
key={part.id}
onSelect={() => {
form.setValue("trophies", part.id);
}}
>
<Check
className={cn(
"mr-2 h-4 w-4",
part.id === field.value
? "opacity-100"
: "opacity-0"
)}
/>
{part.str}
</CommandItem>
)
)}
</CommandGroup>
</CommandList>
</Command>
@ -150,7 +152,9 @@ export const TrophyCustomization: FC<AvatarSelectionProps> = ({
</FormItem>
)}
/>
<Button type="submit">Submit</Button>
<div className="flex justify-end">
<Button type="submit">Submit</Button>
</div>
</form>
</Form>
</div>