fixed version selection default value and added proper avatar names to the dropdown preview
This commit is contained in:
@ -50,7 +50,7 @@ export const MapIconCustomization: FC<SystemVoiceSelectionProps> = ({
|
||||
}) => {
|
||||
const FormSchema = z.object({
|
||||
mapIconId: z.number({
|
||||
required_error: "Please select an Avatar Head Item.",
|
||||
required_error: "Please select an Map Icon.",
|
||||
}),
|
||||
});
|
||||
|
||||
@ -59,13 +59,13 @@ export const MapIconCustomization: FC<SystemVoiceSelectionProps> = ({
|
||||
});
|
||||
|
||||
const [mapIconId, setMapIconId] = useState<number | undefined>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchMapIcons = async () => {
|
||||
try {
|
||||
const data = await getCurrentMapIcon();
|
||||
if (data.length > 0) {
|
||||
setMapIconId(data[0].mapIconId!);
|
||||
setMapIconId(data[0].mapIconId ?? undefined); // Handle null as undefined
|
||||
form.setValue("mapIconId", data[0].mapIconId as number);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error fetching avatar parts:", error);
|
||||
@ -146,7 +146,7 @@ export const MapIconCustomization: FC<SystemVoiceSelectionProps> = ({
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
className={cn(
|
||||
"w-[300px] justify-between",
|
||||
"w-[400px] justify-between",
|
||||
!field.value && "text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
@ -159,7 +159,7 @@ export const MapIconCustomization: FC<SystemVoiceSelectionProps> = ({
|
||||
</Button>
|
||||
</FormControl>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-[300px] p-0">
|
||||
<PopoverContent className="w-[400px] p-0">
|
||||
<Command>
|
||||
<CommandList>
|
||||
<CommandEmpty>No name plate found.</CommandEmpty>
|
||||
|
Reference in New Issue
Block a user