Rename homeMachine
and accessories to projectsMachine
This commit is contained in:
91
src/lib/commandBarConfigs/projectsCommandConfig.ts
Normal file
91
src/lib/commandBarConfigs/projectsCommandConfig.ts
Normal file
@ -0,0 +1,91 @@
|
||||
import { StateMachineCommandSetConfig } from 'lib/commandTypes'
|
||||
import { projectsMachine } from 'machines/projectsMachine'
|
||||
|
||||
export type ProjectsCommandSchema = {
|
||||
'Read projects': {}
|
||||
'Create project': {
|
||||
name: string
|
||||
}
|
||||
'Open project': {
|
||||
name: string
|
||||
}
|
||||
'Delete project': {
|
||||
name: string
|
||||
}
|
||||
'Rename project': {
|
||||
oldName: string
|
||||
newName: string
|
||||
}
|
||||
}
|
||||
|
||||
export const projectsCommandBarConfig: StateMachineCommandSetConfig<
|
||||
typeof projectsMachine,
|
||||
ProjectsCommandSchema
|
||||
> = {
|
||||
'Open project': {
|
||||
icon: 'arrowRight',
|
||||
description: 'Open a project',
|
||||
args: {
|
||||
name: {
|
||||
inputType: 'options',
|
||||
required: true,
|
||||
options: [],
|
||||
optionsFromContext: (context) =>
|
||||
context.projects.map((p) => ({
|
||||
name: p.name!,
|
||||
value: p.name!,
|
||||
})),
|
||||
},
|
||||
},
|
||||
},
|
||||
'Create project': {
|
||||
icon: 'folderPlus',
|
||||
description: 'Create a project',
|
||||
args: {
|
||||
name: {
|
||||
inputType: 'string',
|
||||
required: true,
|
||||
defaultValueFromContext: (context) => context.defaultProjectName,
|
||||
},
|
||||
},
|
||||
},
|
||||
'Delete project': {
|
||||
icon: 'close',
|
||||
description: 'Delete a project',
|
||||
needsReview: true,
|
||||
args: {
|
||||
name: {
|
||||
inputType: 'options',
|
||||
required: true,
|
||||
options: [],
|
||||
optionsFromContext: (context) =>
|
||||
context.projects.map((p) => ({
|
||||
name: p.name!,
|
||||
value: p.name!,
|
||||
})),
|
||||
},
|
||||
},
|
||||
},
|
||||
'Rename project': {
|
||||
icon: 'folder',
|
||||
description: 'Rename a project',
|
||||
needsReview: true,
|
||||
args: {
|
||||
oldName: {
|
||||
inputType: 'options',
|
||||
required: true,
|
||||
options: [],
|
||||
optionsFromContext: (context) =>
|
||||
context.projects.map((p) => ({
|
||||
name: p.name!,
|
||||
value: p.name!,
|
||||
})),
|
||||
},
|
||||
newName: {
|
||||
inputType: 'string',
|
||||
required: true,
|
||||
defaultValueFromContext: (context) => context.defaultProjectName,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user