Fix to tools mode not being preselected when editing calendar event

This commit is contained in:
Kalle
2023-04-25 00:13:04 +03:00
parent 6522c3528d
commit dd2318f499
3 changed files with 6 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ select
"CalendarEvent"."tags",
"CalendarEvent"."participantCount",
"CalendarEvent"."toToolsEnabled",
"CalendarEvent"."toToolsMode",
"User"."id" as "authorId",
exists (
select

View File

@@ -355,6 +355,7 @@ export function findById(id: CalendarEvent["id"]) {
| "authorId"
| "participantCount"
| "toToolsEnabled"
| "toToolsMode"
> &
Pick<CalendarEventDate, "startTime" | "eventId"> &
Pick<

View File

@@ -599,7 +599,9 @@ function TOToolsAndMapPool() {
const [checked, setChecked] = React.useState(
Boolean(eventToEdit?.toToolsEnabled)
);
const [mode, setMode] = React.useState<"ALL" | RankedModeShort>("ALL");
const [mode, setMode] = React.useState<"ALL" | RankedModeShort>(
eventToEdit?.toToolsMode ?? "ALL"
);
return (
<>
@@ -612,6 +614,7 @@ function TOToolsAndMapPool() {
className="calendar-new__select"
onChange={(e) => setMode(e.target.value as RankedModeShort)}
name="toToolsMode"
defaultValue={mode}
>
<option value="ALL">All modes</option>
<option value="SZ">SZ only</option>