feat: Make cameras optional (#2343)
This commit is contained in:
@@ -329,7 +329,4 @@ export const cameraConfigSchema = z
|
||||
.default(cameraConfigDefault);
|
||||
export type CameraConfig = z.infer<typeof cameraConfigSchema>;
|
||||
|
||||
// Avoid using .nonempty() to avoid changing the inferred type
|
||||
// (https://github.com/colinhacks/zod#minmaxlength).
|
||||
export const camerasConfigSchema = cameraConfigSchema.array().min(1);
|
||||
export type CamerasConfig = z.infer<typeof camerasConfigSchema>;
|
||||
export const camerasConfigSchema = cameraConfigSchema.array().optional();
|
||||
|
||||
@@ -8,10 +8,7 @@ export const STATUS_BAR_PRIORITY_MAX = 100;
|
||||
|
||||
export const BUTTON_SIZE_MIN = 20;
|
||||
|
||||
// The default view (may not be supported on all cameras).
|
||||
export const VIEW_DEFAULT = 'live' as const;
|
||||
|
||||
export const VIEWS_USER_SPECIFIED = [
|
||||
const VIEWS = [
|
||||
'diagnostics',
|
||||
'live',
|
||||
'clip',
|
||||
@@ -29,5 +26,7 @@ export const VIEWS_USER_SPECIFIED = [
|
||||
'image',
|
||||
'timeline',
|
||||
] as const;
|
||||
export type AdvancedCameraCardView = (typeof VIEWS)[number];
|
||||
|
||||
export const VIEWS_USER_SPECIFIED = ['auto', ...VIEWS] as const;
|
||||
export type AdvancedCameraCardUserSpecifiedView = (typeof VIEWS_USER_SPECIFIED)[number];
|
||||
export type AdvancedCameraCardView = AdvancedCameraCardUserSpecifiedView | 'diagnostics';
|
||||
|
||||
@@ -13,4 +13,3 @@ export const menuBaseSchema = z.object({
|
||||
icon: z.string().optional(),
|
||||
permanent: z.boolean().default(false).optional(),
|
||||
});
|
||||
export type MenuItemBase = z.infer<typeof menuBaseSchema>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
import { actionsSchema } from './actions/types';
|
||||
import { VIEW_DEFAULT, VIEWS_USER_SPECIFIED } from './common/const';
|
||||
import { VIEWS_USER_SPECIFIED } from './common/const';
|
||||
|
||||
const keyboardShortcut = z.object({
|
||||
key: z.string(),
|
||||
@@ -46,7 +46,7 @@ export type PTZKeyboardShortcutName =
|
||||
| 'ptz_zoom_out';
|
||||
|
||||
export const viewConfigDefault = {
|
||||
default: VIEW_DEFAULT,
|
||||
default: 'auto' as const,
|
||||
camera_select: 'current' as const,
|
||||
interaction_seconds: 300,
|
||||
default_reset: {
|
||||
|
||||
Reference in New Issue
Block a user