diff --git a/src/lib/commandBarConfigs/modelingCommandConfig.ts b/src/lib/commandBarConfigs/modelingCommandConfig.ts index 46a5f6737..006028d97 100644 --- a/src/lib/commandBarConfigs/modelingCommandConfig.ts +++ b/src/lib/commandBarConfigs/modelingCommandConfig.ts @@ -279,6 +279,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig< Fillet: { description: 'Fillet edge', icon: 'fillet', + status: 'development', needsReview: true, args: { selection: { diff --git a/src/lib/commandTypes.ts b/src/lib/commandTypes.ts index ccbfd6df1..3ab58d550 100644 --- a/src/lib/commandTypes.ts +++ b/src/lib/commandTypes.ts @@ -96,6 +96,7 @@ export type CommandConfig< 'name' | 'groupId' | 'onSubmit' | 'onCancel' | 'args' | 'needsReview' > & { needsReview?: true + status?: 'active' | 'development' | 'inactive' args?: { [ArgName in keyof CommandSchema]: CommandArgumentConfig< CommandSchema[ArgName], diff --git a/src/lib/createMachineCommand.ts b/src/lib/createMachineCommand.ts index 0c4d89a5f..203ef7b3c 100644 --- a/src/lib/createMachineCommand.ts +++ b/src/lib/createMachineCommand.ts @@ -14,6 +14,7 @@ import { StateMachineCommandSetConfig, StateMachineCommandSetSchema, } from './commandTypes' +import { DEV } from 'env' interface CreateMachineCommandProps< T extends AnyStateMachine, @@ -48,6 +49,7 @@ export function createMachineCommand< const commandConfig = commandBarConfig && commandBarConfig[type] // There may be no command config for this event type, + // or the command may be inactive or hidden, // or there may be multiple commands to create. if (!commandConfig) { return null @@ -72,13 +74,17 @@ export function createMachineCommand< .filter((c) => c !== null) as Command[] } - // Hide commands based on platform by returning `null` + // Hide commands based on platform or development status by returning `null` // so the consumer can filter them out if ('hide' in commandConfig) { const { hide } = commandConfig if (hide === 'both') return null else if (hide === 'desktop' && isDesktop()) return null else if (hide === 'web' && !isDesktop()) return null + } else if ('status' in commandConfig) { + const { status } = commandConfig + if (status === 'inactive') return null + if (status === 'development' && !DEV) return null } const icon = ('icon' in commandConfig && commandConfig.icon) || undefined