mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 09:36:27 +00:00
This refactors the new file wizard to be more independent. Most of the control is now done through the saga instead of splitting it between react and the sagas. Also fix a few issues while we are touching this: - pressing enter now accepts the dialog - newly created file is now activated in the editor
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
// SPDX-License-Identifier: MIT
|
|
// Copyright (c) 2022 The Pybricks Authors
|
|
|
|
import { createAction } from '../../actions';
|
|
|
|
import { pythonFileExtension } from '../../pybricksMicropython/lib';
|
|
|
|
/** Supported file extensions. */
|
|
type SupportedFileExtension = typeof pythonFileExtension;
|
|
|
|
/** Supported hub types. */
|
|
export enum Hub {
|
|
/** BOOST Move hub */
|
|
Move = 'movehub',
|
|
/** City hub */
|
|
City = 'cityhub',
|
|
/** Technic hub */
|
|
Technic = 'technichub',
|
|
/** MINDSTORMS Robot Inventor hub */
|
|
Inventor = 'inventorhub',
|
|
/** SPIKE Prime hub */
|
|
Prime = 'primehub',
|
|
/** SPIKE Essential hub */
|
|
Essential = 'essentialhub',
|
|
}
|
|
|
|
export const newFileWizardShow = createAction(() => ({
|
|
type: 'explorer.newFileWizard.action.show',
|
|
}));
|
|
|
|
export const newFileWizardDidAccept = createAction(
|
|
(fileName: string, fileExtension: SupportedFileExtension, hubType: Hub) => ({
|
|
type: 'explorer.newFileWizard.action.didAccept',
|
|
fileName,
|
|
fileExtension,
|
|
hubType,
|
|
}),
|
|
);
|
|
|
|
export const newFileWizardDidCancel = createAction(() => ({
|
|
type: 'explorer.newFileWizard.action.didCancel',
|
|
}));
|