项目文件夹

文件
wehub-resource-sync c48612c494
CI / E2E Tests (push) Has been cancelled
CI / Lint, Typecheck & Unit Tests (push) Has been cancelled
Docs Build / Build docs site (push) Has been cancelled
Publish @openmaic packages / Build, validate & publish (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:03:23 +08:00

26 行
1.0 KiB
TypeScript

import type { Action } from '@/lib/types/action';
import type { SceneType } from '@/lib/types/stage';
import { hasDiscussion } from './actions-edit';
import { ELEMENT_BOUND } from './cue-meta';
/** Addable cue types offered in the picker's "action" group (before discussion). */
const CUE_ORDER = ['speech', 'spotlight', 'laser'] as const;
export type PickerType = (typeof CUE_ORDER)[number] | 'discussion';
export interface PickerOption {
type: PickerType;
disabled: boolean;
}
/**
* Element-bound cues (spotlight/laser) need a slide canvas to bind to, so they
* are only offered on slide scenes — mirrors the old header-palette filter.
* Discussion is terminal + at-most-one, so it is disabled when one exists.
*/
export function pickerOptions(sceneType: SceneType, actions: Action[]): PickerOption[] {
const cues = CUE_ORDER.filter((t) => sceneType === 'slide' || !ELEMENT_BOUND.has(t)).map(
(type) => ({ type, disabled: false }),
);
return [...cues, { type: 'discussion' as const, disabled: hasDiscussion(actions) }];
}