feat: Add folder view to view folder media (#2077)
- Closes: #2068 Note: Renames existing `folder` view to `folders` [experimental functionality]
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
import { z } from 'zod';
|
||||
import { advancedCameraCardCustomActionsBaseSchema } from './base';
|
||||
|
||||
export const folderActionConfigSchema = advancedCameraCardCustomActionsBaseSchema.extend(
|
||||
{
|
||||
advanced_camera_card_action: z.literal('folder'),
|
||||
folder: z.string().optional(),
|
||||
},
|
||||
);
|
||||
export type FolderActionConfig = z.infer<typeof folderActionConfigSchema>;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { z } from 'zod';
|
||||
import { advancedCameraCardCustomActionsBaseSchema } from './base';
|
||||
|
||||
export const foldersViewActionConfigSchema =
|
||||
advancedCameraCardCustomActionsBaseSchema.extend({
|
||||
advanced_camera_card_action: z.literal('folders').or(z.literal('folder')),
|
||||
folder: z.string().optional(),
|
||||
});
|
||||
export type FoldersViewActionConfig = z.infer<typeof foldersViewActionConfigSchema>;
|
||||
@@ -7,14 +7,14 @@ import { advancedCameraCardCustomActionsBaseSchema } from './base';
|
||||
|
||||
type AdvancedCameraCardUserSpecifiedViewWithoutFolder = Exclude<
|
||||
AdvancedCameraCardUserSpecifiedView,
|
||||
'folder'
|
||||
'folder' | 'folders'
|
||||
>;
|
||||
|
||||
export const viewActionConfigSchema = advancedCameraCardCustomActionsBaseSchema.extend({
|
||||
advanced_camera_card_action: z.enum(
|
||||
// The folder view is handled by the `folder` action since it accepts an
|
||||
// The folder/folders views are handled separately as they accept an
|
||||
// optional folder ID.
|
||||
VIEWS_USER_SPECIFIED.filter((view) => view !== 'folder') as [
|
||||
VIEWS_USER_SPECIFIED.filter((view) => view !== 'folder' && view !== 'folders') as [
|
||||
AdvancedCameraCardUserSpecifiedViewWithoutFolder,
|
||||
...AdvancedCameraCardUserSpecifiedViewWithoutFolder[],
|
||||
],
|
||||
|
||||
@@ -3,7 +3,7 @@ import { statusBarItemBaseSchema } from '../common/status-bar';
|
||||
import { advancedCameraCardCustomActionsBaseSchema } from './custom/base';
|
||||
import { cameraSelectActionConfigSchema } from './custom/camera-select';
|
||||
import { viewDisplayModeActionConfigSchema } from './custom/display-mode';
|
||||
import { folderActionConfigSchema } from './custom/folder';
|
||||
import { foldersViewActionConfigSchema } from './custom/folders-view';
|
||||
import { generalActionConfigSchema } from './custom/general';
|
||||
import { internalCallbackActionConfigSchema } from './custom/internal';
|
||||
import { logActionConfigSchema } from './custom/log';
|
||||
@@ -42,7 +42,7 @@ export const statusBarActionConfigSchema: z.ZodSchema<
|
||||
|
||||
const advancedCameraCardCustomActionSchema = z.union([
|
||||
cameraSelectActionConfigSchema,
|
||||
folderActionConfigSchema,
|
||||
foldersViewActionConfigSchema,
|
||||
generalActionConfigSchema,
|
||||
internalCallbackActionConfigSchema,
|
||||
logActionConfigSchema,
|
||||
|
||||
@@ -17,6 +17,7 @@ export const VIEWS_USER_SPECIFIED = [
|
||||
'clip',
|
||||
'clips',
|
||||
'folder',
|
||||
'folders',
|
||||
'snapshot',
|
||||
'snapshots',
|
||||
'recording',
|
||||
|
||||
Reference in New Issue
Block a user