diff --git a/src/App.tsx b/src/App.tsx index 971d69a2..d5b8b3d0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -29,6 +29,7 @@ import CodeDisplay from './reactComponents/CodeDisplay'; import BlocklyComponent, {BlocklyComponentType} from './reactComponents/BlocklyComponent'; import ToolboxSettingsModal from './reactComponents/ToolboxSettings'; import * as Tabs from './reactComponents/Tabs'; +import {TabType } from './types/TabType'; import {createGeneratorContext, GeneratorContext} from './editor/generator_context'; import * as editor from './editor/editor'; @@ -230,7 +231,7 @@ const App: React.FC = (): React.JSX.Element => { { key: projectData.modulePath, title: 'Robot', - type: Tabs.TabType.ROBOT, + type: TabType.ROBOT, }, ]; @@ -238,7 +239,7 @@ const App: React.FC = (): React.JSX.Element => { tabs.push({ key: mechanism.modulePath, title: mechanism.className, - type: Tabs.TabType.MECHANISM, + type: TabType.MECHANISM, }); }); @@ -246,7 +247,7 @@ const App: React.FC = (): React.JSX.Element => { tabs.push({ key: opmode.modulePath, title: opmode.className, - type: Tabs.TabType.OPMODE, + type: TabType.OPMODE, }); }); diff --git a/src/reactComponents/AddTabDialog.tsx b/src/reactComponents/AddTabDialog.tsx index 0d79bd0f..519b8f9e 100644 --- a/src/reactComponents/AddTabDialog.tsx +++ b/src/reactComponents/AddTabDialog.tsx @@ -18,7 +18,8 @@ /** * @author alan@porpoiseful.com (Alan Smith) */ -import {TabItem, TabType, TabTypeUtils} from './Tabs'; +import {TabItem} from './Tabs'; +import {TabType, TabTypeUtils } from '../types/TabType'; import * as Antd from 'antd'; import * as I18Next from 'react-i18next'; import * as React from 'react'; diff --git a/src/reactComponents/FileManageModal.tsx b/src/reactComponents/FileManageModal.tsx index 608f30ff..14a2f714 100644 --- a/src/reactComponents/FileManageModal.tsx +++ b/src/reactComponents/FileManageModal.tsx @@ -18,7 +18,7 @@ /** * @author alan@porpoiseful.com (Alan Smith) */ -import {TabType, TabTypeUtils} from './Tabs'; +import {TabType, TabTypeUtils } from '../types/TabType'; import * as Antd from 'antd'; import * as I18Next from 'react-i18next'; import * as React from 'react'; diff --git a/src/reactComponents/Menu.tsx b/src/reactComponents/Menu.tsx index 0c9ba0a4..5c348d41 100644 --- a/src/reactComponents/Menu.tsx +++ b/src/reactComponents/Menu.tsx @@ -22,7 +22,8 @@ import * as Antd from 'antd'; import * as React from 'react'; import * as commonStorage from '../storage/common_storage'; import * as I18Next from 'react-i18next'; -import {TabType} from './Tabs'; +import {TabType } from '../types/TabType'; + import { SettingOutlined, CodeOutlined, diff --git a/src/reactComponents/ModuleNameComponent.tsx b/src/reactComponents/ModuleNameComponent.tsx index b845b992..74ba0307 100644 --- a/src/reactComponents/ModuleNameComponent.tsx +++ b/src/reactComponents/ModuleNameComponent.tsx @@ -18,7 +18,8 @@ /** * @author alan@porpoiseful.com (Alan Smith) */ -import {TabType} from './Tabs'; +import {TabType } from '../types/TabType'; + import * as Antd from 'antd'; import * as I18Next from 'react-i18next'; import * as React from 'react'; diff --git a/src/reactComponents/ProjectManageModal.tsx b/src/reactComponents/ProjectManageModal.tsx index 8abf7003..047258af 100644 --- a/src/reactComponents/ProjectManageModal.tsx +++ b/src/reactComponents/ProjectManageModal.tsx @@ -18,7 +18,7 @@ /** * @author alan@porpoiseful.com (Alan Smith) */ -import {TabType} from './Tabs'; +import {TabType} from '../types/TabType'; import * as Antd from 'antd'; import * as I18Next from 'react-i18next'; import * as React from 'react'; diff --git a/src/reactComponents/Tabs.tsx b/src/reactComponents/Tabs.tsx index 5a168e03..253e1147 100644 --- a/src/reactComponents/Tabs.tsx +++ b/src/reactComponents/Tabs.tsx @@ -34,48 +34,7 @@ import { } from '@ant-design/icons'; import AddTabDialog from './AddTabDialog'; import ModuleNameComponent from './ModuleNameComponent'; - -/** Enumeration of tab types. */ -export enum TabType { - ROBOT, - MECHANISM, - OPMODE, -} - -/** Utility functions for working with TabType enum. */ -export namespace TabTypeUtils { - /** - * Converts a TabType to its string representation. - */ - export function toString(type: TabType): string { - switch (type) { - case TabType.ROBOT: - return 'Robot'; - case TabType.MECHANISM: - return 'Mechanism'; - case TabType.OPMODE: - return 'OpMode'; - default: - return ''; - } - } - - /** - * Gets the appropriate icon for a given TabType. - */ - export function getIcon(type: TabType): React.JSX.Element { - switch (type) { - case TabType.ROBOT: - return ; - case TabType.MECHANISM: - return ; - case TabType.OPMODE: - return ; - default: - return <>; - } - } -} +import { TabType, TabTypeUtils } from '../types/TabType'; /** Represents a tab item in the tab bar. */ export interface TabItem { diff --git a/src/types/TabType.tsx b/src/types/TabType.tsx new file mode 100644 index 00000000..b88fd61b --- /dev/null +++ b/src/types/TabType.tsx @@ -0,0 +1,48 @@ +import * as React from 'react'; +import { + RobotOutlined, + CodeOutlined, + BlockOutlined, +} from '@ant-design/icons'; + +/** Enumeration of tab types. */ +export enum TabType { + ROBOT, + MECHANISM, + OPMODE, +} + +/** Utility functions for working with TabType enum. */ +export const TabTypeUtils = { + /** + * Converts a TabType to its string representation. + */ + toString(type: TabType): string { + switch (type) { + case TabType.ROBOT: + return 'Robot'; + case TabType.MECHANISM: + return 'Mechanism'; + case TabType.OPMODE: + return 'OpMode'; + default: + return ''; + } + }, + + /** + * Gets the appropriate icon for a given TabType. + */ + getIcon(type: TabType): React.JSX.Element { + switch (type) { + case TabType.ROBOT: + return ; + case TabType.MECHANISM: + return ; + case TabType.OPMODE: + return ; + default: + return <>; + } + }, +}; \ No newline at end of file