diff --git a/src/components/ProjectsContextProvider.tsx b/src/components/ProjectsContextProvider.tsx index d883bcab6..2fa977eb4 100644 --- a/src/components/ProjectsContextProvider.tsx +++ b/src/components/ProjectsContextProvider.tsx @@ -22,9 +22,10 @@ import { import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext' import useStateMachineCommands from 'hooks/useStateMachineCommands' import { projectsCommandBarConfig } from 'lib/commandBarConfigs/projectsCommandConfig' +import { isDesktop } from 'lib/isDesktop' type MachineContext = { - state: StateFrom + state?: StateFrom send: Prop, 'send'> } @@ -32,10 +33,42 @@ export const ProjectsMachineContext = createContext( {} as MachineContext ) +/** + * Watches the project directory and provides project management-related commands, + * like "Create project", "Open project", "Delete project", etc. + * + * If in the future we implement full-fledge project management in the web version, + * we can unify these components but for now, we need this to be only for the desktop version. + */ export const ProjectsContextProvider = ({ children, }: { children: React.ReactNode +}) => { + return isDesktop() ? ( + {children} + ) : ( + {children} + ) +} + +const ProjectsContextWeb = ({ children }: { children: React.ReactNode }) => { + return ( + {}, + }} + > + {children} + + ) +} + +const ProjectsContextDesktop = ({ + children, +}: { + children: React.ReactNode }) => { const navigate = useNavigate() const location = useLocation() diff --git a/src/lib/commandBarConfigs/projectsCommandConfig.ts b/src/lib/commandBarConfigs/projectsCommandConfig.ts index f2a947989..deec0a8bd 100644 --- a/src/lib/commandBarConfigs/projectsCommandConfig.ts +++ b/src/lib/commandBarConfigs/projectsCommandConfig.ts @@ -54,10 +54,11 @@ export const projectsCommandBarConfig: StateMachineCommandSetConfig< icon: 'close', description: 'Delete a project', needsReview: true, - reviewMessage: ({ argumentsToSubmit }) => CommandBarOverwriteWarning({ - heading: 'Are you sure you want to delete?', - message: `This will permanently delete the project "${argumentsToSubmit.name}" and all its contents.`, - }), + reviewMessage: ({ argumentsToSubmit }) => + CommandBarOverwriteWarning({ + heading: 'Are you sure you want to delete?', + message: `This will permanently delete the project "${argumentsToSubmit.name}" and all its contents.`, + }), args: { name: { inputType: 'options', diff --git a/src/machines/projectsMachine.ts b/src/machines/projectsMachine.ts index 925a1852a..86f0958b7 100644 --- a/src/machines/projectsMachine.ts +++ b/src/machines/projectsMachine.ts @@ -206,7 +206,7 @@ export const projectsMachine = setup({ onDone: [ { target: '#Home machine.Reading projects', - actions: ['toastSuccess', "navigateToProjectIfNeeded"], + actions: ['toastSuccess', 'navigateToProjectIfNeeded'], }, ], onError: [