forked from PolarisPyra/daphnis
added display of current gameversion in the gameversion selection setting card
This commit is contained in:
parent
ee4ec5d651
commit
1004cdd742
@ -36,11 +36,9 @@ type ChunithmGameVersionSelectionProps = {
|
|||||||
gameVersions: { gameVersion: GameVersion }[];
|
gameVersions: { gameVersion: GameVersion }[];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
export function PlayerChangableChunithmGameVersionSelection({
|
export function PlayerChangableChunithmGameVersionSelection({}: ChunithmGameVersionSelectionProps) {
|
||||||
chunithmGameVersionNumber,
|
|
||||||
}: ChunithmGameVersionSelectionProps) {
|
|
||||||
const FormSchema = z.object({
|
const FormSchema = z.object({
|
||||||
mapIconId: z.string({
|
gameVersion: z.string({
|
||||||
required_error: "Please select a Game Version.",
|
required_error: "Please select a Game Version.",
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@ -52,7 +50,7 @@ export function PlayerChangableChunithmGameVersionSelection({
|
|||||||
string | undefined
|
string | undefined
|
||||||
>(Object.values(GameVersion)[0]);
|
>(Object.values(GameVersion)[0]);
|
||||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
const newGameVersion = data.mapIconId ?? selectedGameVersion;
|
const newGameVersion = data.gameVersion ?? selectedGameVersion;
|
||||||
|
|
||||||
// console.log("Submitted Game Version:", newGameVersion);
|
// console.log("Submitted Game Version:", newGameVersion);
|
||||||
|
|
||||||
@ -72,7 +70,7 @@ export function PlayerChangableChunithmGameVersionSelection({
|
|||||||
setSelectedGameVersion(newGameVersion);
|
setSelectedGameVersion(newGameVersion);
|
||||||
|
|
||||||
form.reset({
|
form.reset({
|
||||||
mapIconId: undefined,
|
gameVersion: undefined,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@ -94,10 +92,17 @@ export function PlayerChangableChunithmGameVersionSelection({
|
|||||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="mapIconId"
|
name="gameVersion"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="flex flex-col">
|
<FormItem className="flex flex-col">
|
||||||
<FormLabel className="pb-2">Chunithm</FormLabel>
|
<FormLabel className="pb-2">
|
||||||
|
Chunithm:
|
||||||
|
{selectedGameVersion
|
||||||
|
? GameVersion[
|
||||||
|
selectedGameVersion as keyof typeof GameVersion
|
||||||
|
]
|
||||||
|
: "No game version... Please select a game version"}
|
||||||
|
</FormLabel>{" "}
|
||||||
<Popover>
|
<Popover>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
@ -126,7 +131,7 @@ export function PlayerChangableChunithmGameVersionSelection({
|
|||||||
value={version}
|
value={version}
|
||||||
key={version}
|
key={version}
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
form.setValue("mapIconId", version);
|
form.setValue("gameVersion", version);
|
||||||
setSelectedGameVersion(version);
|
setSelectedGameVersion(version);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -146,7 +151,6 @@ export function PlayerChangableChunithmGameVersionSelection({
|
|||||||
</Command>
|
</Command>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user