sendou.ink/app/features/settings/settings-schemas.ts
2026-01-18 18:21:19 +02:00

46 lines
1.3 KiB
TypeScript

import { z } from "zod";
import { select, stringConstant, toggle } from "~/form/fields";
export const clockFormatSchema = z.object({
_action: stringConstant("UPDATE_CLOCK_FORMAT"),
newValue: select({
label: "labels.clockFormat",
items: [
{ value: "auto", label: "options.clockFormat.auto" },
{ value: "24h", label: "options.clockFormat.24h" },
{ value: "12h", label: "options.clockFormat.12h" },
],
}),
});
export const disableBuildAbilitySortingSchema = z.object({
_action: stringConstant("UPDATE_DISABLE_BUILD_ABILITY_SORTING"),
newValue: toggle({
label: "labels.disableBuildAbilitySorting",
bottomText: "bottomTexts.disableBuildAbilitySorting",
}),
});
export const disallowScrimPickupsFromUntrustedSchema = z.object({
_action: stringConstant("DISALLOW_SCRIM_PICKUPS_FROM_UNTRUSTED"),
newValue: toggle({
label: "labels.disallowScrimPickupsFromUntrusted",
bottomText: "bottomTexts.disallowScrimPickupsFromUntrusted",
}),
});
export const updateNoScreenSchema = z.object({
_action: stringConstant("UPDATE_NO_SCREEN"),
newValue: toggle({
label: "labels.noScreen",
bottomText: "bottomTexts.noScreen",
}),
});
export const settingsEditSchema = z.union([
disableBuildAbilitySortingSchema,
disallowScrimPickupsFromUntrustedSchema,
updateNoScreenSchema,
clockFormatSchema,
]);