Do not require all title popup options be specified.

This commit is contained in:
Dermot Duffy
2023-10-03 19:53:02 -07:00
parent 6bba16cb86
commit 913355ad1d
3 changed files with 36 additions and 11 deletions
+11 -9
View File
@@ -390,7 +390,7 @@ export const conditionalSchema = z.object({
export const customSchema = z
.object({
// Insist that Frigate card custom elements are handled by other schemas.
type: z.string().superRefine((val, ctx) => {
type: z.string().superRefine((val, ctx) => {
if (!val.match(/^custom:(?!frigate-card).+/)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
@@ -723,14 +723,16 @@ export type NextPreviousControlConfig = z.infer<typeof nextPreviousControlConfig
// *************************************************************************
const titleControlConfigSchema = z.object({
mode: z.enum([
'none',
'popup-top-right',
'popup-top-left',
'popup-bottom-right',
'popup-bottom-left',
]),
duration_seconds: z.number().min(0).max(60),
mode: z
.enum([
'none',
'popup-top-right',
'popup-top-left',
'popup-bottom-right',
'popup-bottom-left',
])
.optional(),
duration_seconds: z.number().min(0).max(60).optional(),
});
export type TitleControlConfig = z.infer<typeof titleControlConfigSchema>;