Skip to content

Commit 1b60a1b

Browse files
committed
Changes required to fix fast restart
1 parent 100f43a commit 1b60a1b

File tree

10 files changed

+67
-57
lines changed

10 files changed

+67
-57
lines changed

src/App.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import CodeDisplay from './reactComponents/CodeDisplay';
2929
import BlocklyComponent, {BlocklyComponentType} from './reactComponents/BlocklyComponent';
3030
import ToolboxSettingsModal from './reactComponents/ToolboxSettings';
3131
import * as Tabs from './reactComponents/Tabs';
32+
import {TabType } from './types/TabType';
3233

3334
import {createGeneratorContext, GeneratorContext} from './editor/generator_context';
3435
import * as editor from './editor/editor';
@@ -230,23 +231,23 @@ const App: React.FC = (): React.JSX.Element => {
230231
{
231232
key: projectData.modulePath,
232233
title: 'Robot',
233-
type: Tabs.TabType.ROBOT,
234+
type: TabType.ROBOT,
234235
},
235236
];
236237

237238
projectData.mechanisms.forEach((mechanism) => {
238239
tabs.push({
239240
key: mechanism.modulePath,
240241
title: mechanism.className,
241-
type: Tabs.TabType.MECHANISM,
242+
type: TabType.MECHANISM,
242243
});
243244
});
244245

245246
projectData.opModes.forEach((opmode) => {
246247
tabs.push({
247248
key: opmode.modulePath,
248249
title: opmode.className,
249-
type: Tabs.TabType.OPMODE,
250+
type: TabType.OPMODE,
250251
});
251252
});
252253

src/editor/extended_python_generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export class ExtendedPythonGenerator extends PythonGenerator {
270270
}
271271
});
272272
if (exported) {
273-
const variableName = variableModel.getName();
273+
const variableName = variableModel.name;
274274
const actualVariableName = super.getVariableName(variableModel.getId());
275275
const getPythonModuleVariableBlock = {
276276
'kind': 'block',

src/reactComponents/AddTabDialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
/**
1919
* @author [email protected] (Alan Smith)
2020
*/
21-
import {TabItem, TabType, TabTypeUtils} from './Tabs';
21+
import {TabItem} from './Tabs';
22+
import {TabType, TabTypeUtils } from '../types/TabType';
2223
import * as Antd from 'antd';
2324
import * as I18Next from 'react-i18next';
2425
import * as React from 'react';

src/reactComponents/FileManageModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* @author [email protected] (Alan Smith)
2020
*/
21-
import {TabType, TabTypeUtils} from './Tabs';
21+
import {TabType, TabTypeUtils } from '../types/TabType';
2222
import * as Antd from 'antd';
2323
import * as I18Next from 'react-i18next';
2424
import * as React from 'react';

src/reactComponents/Menu.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import * as Antd from 'antd';
2222
import * as React from 'react';
2323
import * as commonStorage from '../storage/common_storage';
2424
import * as I18Next from 'react-i18next';
25-
import {TabType} from './Tabs';
25+
import {TabType } from '../types/TabType';
26+
2627
import {
2728
SettingOutlined,
2829
CodeOutlined,

src/reactComponents/ModuleNameComponent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
/**
1919
* @author [email protected] (Alan Smith)
2020
*/
21-
import {TabType} from './Tabs';
21+
import {TabType } from '../types/TabType';
22+
2223
import * as Antd from 'antd';
2324
import * as I18Next from 'react-i18next';
2425
import * as React from 'react';

src/reactComponents/ProjectManageModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* @author [email protected] (Alan Smith)
2020
*/
21-
import {TabType} from './Tabs';
21+
import {TabType} from '../types/TabType';
2222
import * as Antd from 'antd';
2323
import * as I18Next from 'react-i18next';
2424
import * as React from 'react';

src/reactComponents/Tabs.tsx

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -34,48 +34,7 @@ import {
3434
} from '@ant-design/icons';
3535
import AddTabDialog from './AddTabDialog';
3636
import ModuleNameComponent from './ModuleNameComponent';
37-
38-
/** Enumeration of tab types. */
39-
export enum TabType {
40-
ROBOT,
41-
MECHANISM,
42-
OPMODE,
43-
}
44-
45-
/** Utility functions for working with TabType enum. */
46-
export namespace TabTypeUtils {
47-
/**
48-
* Converts a TabType to its string representation.
49-
*/
50-
export function toString(type: TabType): string {
51-
switch (type) {
52-
case TabType.ROBOT:
53-
return 'Robot';
54-
case TabType.MECHANISM:
55-
return 'Mechanism';
56-
case TabType.OPMODE:
57-
return 'OpMode';
58-
default:
59-
return '';
60-
}
61-
}
62-
63-
/**
64-
* Gets the appropriate icon for a given TabType.
65-
*/
66-
export function getIcon(type: TabType): React.JSX.Element {
67-
switch (type) {
68-
case TabType.ROBOT:
69-
return <RobotOutlined />;
70-
case TabType.MECHANISM:
71-
return <BlockOutlined />;
72-
case TabType.OPMODE:
73-
return <CodeOutlined />;
74-
default:
75-
return <></>;
76-
}
77-
}
78-
}
37+
import { TabType, TabTypeUtils } from '../types/TabType';
7938

8039
/** Represents a tab item in the tab bar. */
8140
export interface TabItem {

src/reportWebVitals.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
const reportWebVitals = (onPerfEntry?: (metric: any) => void) => {
22
if (onPerfEntry && onPerfEntry instanceof Function) {
3-
import('web-vitals').then(({ onCLS, onINP, onFCP, onLCP, onTTFB }) => {
4-
onCLS(onPerfEntry);
5-
onINP(onPerfEntry);
6-
onFCP(onPerfEntry);
7-
onLCP(onPerfEntry);
8-
onTTFB(onPerfEntry);
3+
import('web-vitals').then(({ getCLS, getFCP, getLCP, getTTFB }) => {
4+
getCLS(onPerfEntry);
5+
getFCP(onPerfEntry);
6+
getLCP(onPerfEntry);
7+
getTTFB(onPerfEntry);
98
});
109
}
1110
};

src/types/TabType.tsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import * as React from 'react';
2+
import {
3+
RobotOutlined,
4+
CodeOutlined,
5+
BlockOutlined,
6+
} from '@ant-design/icons';
7+
8+
/** Enumeration of tab types. */
9+
export enum TabType {
10+
ROBOT,
11+
MECHANISM,
12+
OPMODE,
13+
}
14+
15+
/** Utility functions for working with TabType enum. */
16+
export const TabTypeUtils = {
17+
/**
18+
* Converts a TabType to its string representation.
19+
*/
20+
toString(type: TabType): string {
21+
switch (type) {
22+
case TabType.ROBOT:
23+
return 'Robot';
24+
case TabType.MECHANISM:
25+
return 'Mechanism';
26+
case TabType.OPMODE:
27+
return 'OpMode';
28+
default:
29+
return '';
30+
}
31+
},
32+
33+
/**
34+
* Gets the appropriate icon for a given TabType.
35+
*/
36+
getIcon(type: TabType): React.JSX.Element {
37+
switch (type) {
38+
case TabType.ROBOT:
39+
return <RobotOutlined />;
40+
case TabType.MECHANISM:
41+
return <BlockOutlined />;
42+
case TabType.OPMODE:
43+
return <CodeOutlined />;
44+
default:
45+
return <></>;
46+
}
47+
},
48+
};

0 commit comments

Comments
 (0)