Show a warning in the command palette for deleting a project
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
import { CommandBarOverwriteWarning } from 'components/CommandBarOverwriteWarning'
|
||||||
import { StateMachineCommandSetConfig } from 'lib/commandTypes'
|
import { StateMachineCommandSetConfig } from 'lib/commandTypes'
|
||||||
import { projectsMachine } from 'machines/projectsMachine'
|
import { projectsMachine } from 'machines/projectsMachine'
|
||||||
|
|
||||||
@ -53,6 +54,10 @@ export const projectsCommandBarConfig: StateMachineCommandSetConfig<
|
|||||||
icon: 'close',
|
icon: 'close',
|
||||||
description: 'Delete a project',
|
description: 'Delete a project',
|
||||||
needsReview: true,
|
needsReview: true,
|
||||||
|
reviewMessage: ({ argumentsToSubmit }) => CommandBarOverwriteWarning({
|
||||||
|
heading: 'Are you sure?',
|
||||||
|
message: `This will permanently delete the project "${argumentsToSubmit.name}".`,
|
||||||
|
}),
|
||||||
args: {
|
args: {
|
||||||
name: {
|
name: {
|
||||||
inputType: 'options',
|
inputType: 'options',
|
||||||
|
@ -111,6 +111,9 @@ export function createMachineCommand<
|
|||||||
if ('displayName' in commandConfig) {
|
if ('displayName' in commandConfig) {
|
||||||
command.displayName = commandConfig.displayName
|
command.displayName = commandConfig.displayName
|
||||||
}
|
}
|
||||||
|
if ('reviewMessage' in commandConfig) {
|
||||||
|
command.reviewMessage = commandConfig.reviewMessage
|
||||||
|
}
|
||||||
|
|
||||||
return command
|
return command
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user