Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -230,23 +231,23 @@ const App: React.FC = (): React.JSX.Element => {
{
key: projectData.modulePath,
title: 'Robot',
type: Tabs.TabType.ROBOT,
type: TabType.ROBOT,
},
];

projectData.mechanisms.forEach((mechanism) => {
tabs.push({
key: mechanism.modulePath,
title: mechanism.className,
type: Tabs.TabType.MECHANISM,
type: TabType.MECHANISM,
});
});

projectData.opModes.forEach((opmode) => {
tabs.push({
key: opmode.modulePath,
title: opmode.className,
type: Tabs.TabType.OPMODE,
type: TabType.OPMODE,
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/editor/extended_python_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export class ExtendedPythonGenerator extends PythonGenerator {
}
});
if (exported) {
const variableName = variableModel.getName();
const variableName = variableModel.name;
const actualVariableName = super.getVariableName(variableModel.getId());
const getPythonModuleVariableBlock = {
'kind': 'block',
Expand Down
3 changes: 2 additions & 1 deletion src/reactComponents/AddTabDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
/**
* @author [email protected] (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';
Expand Down
2 changes: 1 addition & 1 deletion src/reactComponents/FileManageModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @author [email protected] (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';
Expand Down
3 changes: 2 additions & 1 deletion src/reactComponents/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/reactComponents/ModuleNameComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
/**
* @author [email protected] (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';
Expand Down
2 changes: 1 addition & 1 deletion src/reactComponents/ProjectManageModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @author [email protected] (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';
Expand Down
43 changes: 1 addition & 42 deletions src/reactComponents/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <RobotOutlined />;
case TabType.MECHANISM:
return <BlockOutlined />;
case TabType.OPMODE:
return <CodeOutlined />;
default:
return <></>;
}
}
}
import { TabType, TabTypeUtils } from '../types/TabType';

/** Represents a tab item in the tab bar. */
export interface TabItem {
Expand Down
11 changes: 5 additions & 6 deletions src/reportWebVitals.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
const reportWebVitals = (onPerfEntry?: (metric: any) => void) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ onCLS, onINP, onFCP, onLCP, onTTFB }) => {
onCLS(onPerfEntry);
onINP(onPerfEntry);
onFCP(onPerfEntry);
onLCP(onPerfEntry);
onTTFB(onPerfEntry);
import('web-vitals').then(({ getCLS, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
Expand Down
48 changes: 48 additions & 0 deletions src/types/TabType.tsx
Original file line number Diff line number Diff line change
@@ -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 <RobotOutlined />;
case TabType.MECHANISM:
return <BlockOutlined />;
case TabType.OPMODE:
return <CodeOutlined />;
default:
return <></>;
}
},
};