Skip to content

Commit f45e429

Browse files
Merge branch 'folders-public-wip' of github.com:source-academy/frontend into folders-public-wip
2 parents 292b1ef + 9ce24c8 commit f45e429

File tree

217 files changed

+7172
-2486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+7172
-2486
lines changed

.eslintrc.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
2-
"extends": ["react-app", "plugin:@typescript-eslint/recommended"],
2+
"extends": [
3+
// "eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"plugin:react-hooks/recommended"
6+
// "plugin:react/recommended",
7+
// "plugin:react/jsx-runtime"
8+
],
39
"plugins": ["simple-import-sort"],
410
"rules": {
511
"no-restricted-imports": [
@@ -18,6 +24,8 @@
1824
]
1925
}
2026
],
27+
"@typescript-eslint/no-unused-vars": "off",
28+
"@typescript-eslint/no-duplicate-enum-values": "off",
2129
"@typescript-eslint/no-empty-function": "off",
2230
"@typescript-eslint/interface-name-prefix": "off",
2331
"@typescript-eslint/camelcase": "off",

craco.config.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const cracoConfig = {
1818
plugin => plugin.constructor.name === 'InjectManifest'
1919
);
2020
if (injectManifestPlugin) {
21-
injectManifestPlugin.config.maximumFileSizeToCacheInBytes = 17 * 1024 * 1024;
21+
injectManifestPlugin.config.maximumFileSizeToCacheInBytes = 20 * 1024 * 1024;
2222
}
2323

2424
// add rules to pack WASM (for Sourceror)
@@ -47,9 +47,10 @@ const cracoConfig = {
4747
'https': require.resolve('https-browserify'),
4848
'os': require.resolve('os-browserify/browser'),
4949
'path/posix': require.resolve('path-browserify'),
50+
'process/browser': require.resolve('process/browser'),
5051
'stream': require.resolve('stream-browserify'),
5152
'timers': require.resolve('timers-browserify'),
52-
'url': require.resolve('url/')
53+
'url': require.resolve('url/'),
5354
};
5455

5556
// workaround .mjs files by Acorn
@@ -138,6 +139,7 @@ const cracoConfig = {
138139
'split-on-first',
139140
'filter-obj',
140141
'@sourceacademy/c-slang',
142+
'java-parser'
141143
),
142144
'^.+\\.module\\.(css|sass|scss)$'
143145
];

package.json

+10-8
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@
2626
"prepare": "husky"
2727
},
2828
"dependencies": {
29-
"@blueprintjs/core": "^5.7.0",
30-
"@blueprintjs/datetime2": "^2.2.7",
31-
"@blueprintjs/icons": "^5.5.0",
32-
"@blueprintjs/popover2": "^2.0.0",
33-
"@blueprintjs/select": "^5.0.0",
29+
"@blueprintjs/core": "^5.10.1",
30+
"@blueprintjs/datetime2": "^2.3.3",
31+
"@blueprintjs/icons": "^5.9.0",
32+
"@blueprintjs/select": "^5.1.3",
3433
"@mantine/hooks": "^7.7.0",
3534
"@octokit/rest": "^20.0.0",
3635
"@reduxjs/toolkit": "^1.9.7",
@@ -52,8 +51,8 @@
5251
"flexboxgrid-helpers": "^1.1.3",
5352
"google-oauth-gsi": "^4.0.0",
5453
"hastscript": "^9.0.0",
55-
"java-slang": "^1.0.6",
56-
"js-slang": "^1.0.66",
54+
"js-slang": "^1.0.69",
55+
"java-slang": "^1.0.13",
5756
"js-yaml": "^4.1.0",
5857
"konva": "^9.2.0",
5958
"lodash": "^4.17.21",
@@ -129,13 +128,16 @@
129128
"@types/showdown": "^2.0.1",
130129
"@types/uuid": "^9.0.0",
131130
"@types/xml2js": "^0.4.11",
131+
"@typescript-eslint/eslint-plugin": "^7.4.0",
132+
"@typescript-eslint/parser": "^7.4.0",
132133
"babel-core": "6",
133134
"babel-runtime": "^6.26.0",
134135
"buffer": "^6.0.3",
135136
"canvas": "^2.11.2",
136137
"constants-browserify": "^1.0.0",
137138
"coveralls": "^3.1.1",
138139
"cross-env": "^7.0.3",
140+
"eslint": "^8.57.0",
139141
"eslint-plugin-simple-import-sort": "^12.0.0",
140142
"https-browserify": "^1.0.0",
141143
"husky": "^9.0.0",
@@ -153,7 +155,7 @@
153155
"stream-browserify": "^3.0.0",
154156
"stream-http": "^3.2.0",
155157
"timers-browserify": "^2.0.12",
156-
"typescript": "~4.9.0",
158+
"typescript": "^5.4.3",
157159
"url": "^0.11.1",
158160
"webpack-bundle-analyzer": "^4.9.0"
159161
},

src/commons/SimpleDropdown.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { Button, Menu, MenuItem } from '@blueprintjs/core';
2-
import { Popover2 } from '@blueprintjs/popover2';
1+
import { Button, Menu, MenuItem, Popover } from '@blueprintjs/core';
32

43
type OptionType = { value: any; label: string };
54
type Props<T extends OptionType> = {
65
options: T[];
76
selectedValue?: T['value'];
87
onClick?: (v: T['value']) => void;
98
buttonProps?: Partial<React.ComponentProps<typeof Button> & { 'data-testid': string }>;
10-
popoverProps?: Partial<React.ComponentProps<typeof Popover2>>;
9+
popoverProps?: Partial<React.ComponentProps<typeof Popover>>;
1110
};
1211

1312
const SimpleDropdown = <T extends OptionType>({
@@ -27,7 +26,7 @@ const SimpleDropdown = <T extends OptionType>({
2726
};
2827

2928
return (
30-
<Popover2
29+
<Popover
3130
{...popoverProps}
3231
interactionKind="click"
3332
content={
@@ -39,7 +38,7 @@ const SimpleDropdown = <T extends OptionType>({
3938
}
4039
>
4140
<Button {...buttonProps}>{buttonLabel()}</Button>
42-
</Popover2>
41+
</Popover>
4342
);
4443
};
4544

src/commons/XMLParser/XMLParserHelper.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
AssessmentType,
1010
BaseQuestion,
1111
emptyLibrary,
12-
GradingStatuses,
1312
IMCQQuestion,
1413
IProgrammingQuestion,
1514
Library,
@@ -72,6 +71,7 @@ const makeAssessmentOverview = (result: any, maxXpVal: number): AssessmentOvervi
7271
return {
7372
type: capitalizeFirstLetter(rawOverview.kind) as AssessmentType,
7473
isManuallyGraded: true, // TODO: This is temporarily hardcoded to true. To be redone when overhauling MissionControl
74+
isPublished: false,
7575
closeAt: rawOverview.duedate,
7676
coverImage: rawOverview.coverimage,
7777
id: EDITING_ID,
@@ -84,8 +84,8 @@ const makeAssessmentOverview = (result: any, maxXpVal: number): AssessmentOvervi
8484
shortSummary: task.WEBSUMMARY ? task.WEBSUMMARY[0] : '',
8585
status: AssessmentStatuses.attempting,
8686
story: rawOverview.story,
87+
isGradingPublished: false,
8788
xp: 0,
88-
gradingStatus: 'none' as GradingStatuses,
8989
maxTeamSize: 1,
9090
hasVotingFeatures: false
9191
};
@@ -167,7 +167,11 @@ const makeQuestions = (task: XmlParseStrTask): [Question[], number] => {
167167

168168
const makeMCQ = (problem: XmlParseStrCProblem, question: BaseQuestion): IMCQQuestion => {
169169
const choicesVal: MCQChoice[] = [];
170-
const solution = problem.SNIPPET ? problem.SNIPPET[0].SOLUTION : undefined;
170+
const snippet = problem.SNIPPET;
171+
// FIXME: I think `XmlParseStrCProblem` type definition is incorrect
172+
// FIXME: Remove `as unknown as keyof typeof snippet` when fixed
173+
// @ts-expect-error broken type definition to be fixed above
174+
const solution = snippet ? snippet[0 as unknown as keyof typeof snippet].SOLUTION : undefined;
171175
let solutionVal = 0;
172176
problem.CHOICE.forEach((choice: XmlParseStrProblemChoice, i: number) => {
173177
choicesVal.push({
@@ -269,7 +273,8 @@ const exportLibrary = (library: Library) => {
269273
name: library.external.name
270274
}
271275
}
272-
};
276+
// FIXME: Replace any with proper type
277+
} as any;
273278

274279
if (library.external.symbols.length !== 0) {
275280
/* tslint:disable:no-string-literal */
@@ -327,7 +332,8 @@ export const assessmentToXml = (
327332
},
328333
TEXT: question.content,
329334
CHOICE: [] as any[]
330-
};
335+
// FIXME: Replace any with proper type
336+
} as any;
331337

332338
if (question.library.chapter !== -1) {
333339
/* tslint:disable:no-string-literal */

src/commons/achievement/control/achievementEditor/AchievementSettings.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { Button, Checkbox, Dialog, EditableText } from '@blueprintjs/core';
1+
import { Button, Checkbox, Dialog, EditableText, Tooltip } from '@blueprintjs/core';
22
import { IconNames } from '@blueprintjs/icons';
3-
import { Tooltip2 } from '@blueprintjs/popover2';
43
import React, { useState } from 'react';
54
import { AchievementItem } from 'src/features/achievement/AchievementTypes';
65

@@ -33,9 +32,9 @@ const AchievementSettings: React.FC<Props> = ({
3332

3433
return (
3534
<>
36-
<Tooltip2 content="More Settings">
35+
<Tooltip content="More Settings">
3736
<Button icon={IconNames.WRENCH} onClick={toggleOpen} />
38-
</Tooltip2>
37+
</Tooltip>
3938

4039
<Dialog title="More Settings" icon={IconNames.WRENCH} isOpen={isOpen} onClose={toggleOpen}>
4140
<div style={{ padding: '0 0.5em' }}>

src/commons/achievement/control/achievementEditor/AchievementUuidCopier.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { Button } from '@blueprintjs/core';
1+
import { Button, Tooltip } from '@blueprintjs/core';
22
import { IconNames } from '@blueprintjs/icons';
3-
import { Tooltip2 } from '@blueprintjs/popover2';
43
import React from 'react';
54
import { showSuccessMessage } from 'src/commons/utils/notifications/NotificationsHelper';
65

@@ -16,9 +15,9 @@ const AchievmenetUuidCopier: React.FC<Props> = ({ uuid }) => {
1615
};
1716

1817
return (
19-
<Tooltip2 content={hoverText}>
18+
<Tooltip content={hoverText}>
2019
<Button icon={IconNames.CLIPBOARD} onClick={copy} />
21-
</Tooltip2>
20+
</Tooltip>
2221
);
2322
};
2423

src/commons/achievement/control/achievementEditor/EditableCard.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { EditableText, NumericInput } from '@blueprintjs/core';
1+
import { EditableText, NumericInput, Tooltip } from '@blueprintjs/core';
22
import { IconNames } from '@blueprintjs/icons';
3-
import { Tooltip2 } from '@blueprintjs/popover2';
43
import { cloneDeep } from 'lodash';
54
import React, { useContext, useMemo, useReducer, useState } from 'react';
65

@@ -225,7 +224,7 @@ const EditableCard: React.FC<Props> = ({
225224
<EditableText onChange={changeTitle} placeholder="Enter your title here" value={title} />
226225
</h3>
227226
<div className="xp">
228-
<Tooltip2 content="XP">
227+
<Tooltip content="XP">
229228
<NumericInput
230229
value={xp}
231230
min={0}
@@ -234,7 +233,7 @@ const EditableCard: React.FC<Props> = ({
234233
placeholder="XP"
235234
onValueChange={changeXp}
236235
/>
237-
</Tooltip2>
236+
</Tooltip>
238237
</div>
239238
<div className="details">
240239
<EditableDate changeDate={changeRelease} date={release} type="Release" />

src/commons/achievement/control/achievementEditor/EditableDate.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { Button, Dialog } from '@blueprintjs/core';
1+
import { Button, Dialog, Tooltip } from '@blueprintjs/core';
22
import { DatePicker } from '@blueprintjs/datetime';
3-
import { Tooltip2 } from '@blueprintjs/popover2';
43
import React, { useState } from 'react';
54
import { prettifyDate } from 'src/commons/achievement/utils/DateHelper';
65

@@ -18,9 +17,9 @@ const EditableDate: React.FC<Props> = ({ type, date, changeDate }) => {
1817

1918
return (
2019
<>
21-
<Tooltip2 content={hoverText}>
20+
<Tooltip content={hoverText}>
2221
<Button minimal={true} onClick={toggleOpen} outlined={true}>{`${type}`}</Button>
23-
</Tooltip2>
22+
</Tooltip>
2423
<Dialog
2524
isCloseButtonShown={false}
2625
isOpen={isOpen}

src/commons/achievement/control/achievementEditor/EditableView.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { Button, Dialog, EditableText } from '@blueprintjs/core';
1+
import { Button, Dialog, EditableText, Tooltip } from '@blueprintjs/core';
22
import { IconNames } from '@blueprintjs/icons';
3-
import { Tooltip2 } from '@blueprintjs/popover2';
43
import React, { useState } from 'react';
54
import { AchievementView } from 'src/features/achievement/AchievementTypes';
65

@@ -25,9 +24,9 @@ const EditableView: React.FC<Props> = ({ changeView, view }) => {
2524

2625
return (
2726
<>
28-
<Tooltip2 content="Edit View">
27+
<Tooltip content="Edit View">
2928
<Button icon={IconNames.WIDGET_HEADER} onClick={toggleOpen} />
30-
</Tooltip2>
29+
</Tooltip>
3130

3231
<Dialog title="Edit View" icon={IconNames.WIDGET_HEADER} isOpen={isOpen} onClose={toggleOpen}>
3332
<div style={{ padding: '0 0.5em' }}>

src/commons/achievement/control/common/ItemDeleter.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { Button } from '@blueprintjs/core';
1+
import { Button, Tooltip } from '@blueprintjs/core';
22
import { IconNames } from '@blueprintjs/icons';
3-
import { Tooltip2 } from '@blueprintjs/popover2';
43
import React from 'react';
54
import { showSimpleConfirmDialog } from 'src/commons/utils/DialogHelper';
65

@@ -23,9 +22,9 @@ const ItemDeleter: React.FC<Props> = ({ deleteItem, item }) => {
2322
};
2423

2524
return (
26-
<Tooltip2 content="Delete">
25+
<Tooltip content="Delete">
2726
<Button icon={IconNames.TRASH} intent="danger" onClick={confirmDelete} />
28-
</Tooltip2>
27+
</Tooltip>
2928
);
3029
};
3130

src/commons/achievement/control/common/ItemSaver.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { Button } from '@blueprintjs/core';
1+
import { Button, Tooltip } from '@blueprintjs/core';
22
import { IconNames } from '@blueprintjs/icons';
3-
import { Tooltip2 } from '@blueprintjs/popover2';
43
import React from 'react';
54
import {
65
showSuccessMessage,
@@ -25,13 +24,13 @@ const ItemSaver: React.FC<Props> = ({ discardChanges, saveChanges }) => {
2524

2625
return (
2726
<>
28-
<Tooltip2 content="Save Changes">
27+
<Tooltip content="Save Changes">
2928
<Button icon={IconNames.FLOPPY_DISK} intent="primary" onClick={handleSaveChanges} />
30-
</Tooltip2>
29+
</Tooltip>
3130

32-
<Tooltip2 content="Discard Changes">
31+
<Tooltip content="Discard Changes">
3332
<Button icon={IconNames.CROSS} intent="danger" onClick={handleDiscardChanges} />
34-
</Tooltip2>
33+
</Tooltip>
3534
</>
3635
);
3736
};

src/commons/achievement/control/goalEditor/EditableDate.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { Button, Dialog } from '@blueprintjs/core';
1+
import { Button, Dialog, Tooltip } from '@blueprintjs/core';
22
import { DatePicker } from '@blueprintjs/datetime';
3-
import { Tooltip2 } from '@blueprintjs/popover2';
43
import React, { useState } from 'react';
54
import { prettifyDate } from 'src/commons/achievement/utils/DateHelper';
65

@@ -18,9 +17,9 @@ const EditableDate: React.FC<Props> = ({ type, date, changeDate }) => {
1817

1918
return (
2019
<>
21-
<Tooltip2 content={hoverText}>
20+
<Tooltip content={hoverText}>
2221
<Button minimal={true} onClick={toggleOpen} outlined={true}>{`${type}`}</Button>
23-
</Tooltip2>
22+
</Tooltip>
2423
<Dialog
2524
isCloseButtonShown={false}
2625
isOpen={isOpen}

src/commons/achievement/control/goalEditor/EditableMeta.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Button, MenuItem } from '@blueprintjs/core';
2-
import { Tooltip2 } from '@blueprintjs/popover2';
1+
import { Button, MenuItem, Tooltip } from '@blueprintjs/core';
32
import { ItemRenderer, Select } from '@blueprintjs/select';
43
import React from 'react';
54
import {
@@ -51,7 +50,7 @@ const EditableMeta: React.FC<Props> = ({ changeMeta, meta }) => {
5150

5251
return (
5352
<>
54-
<Tooltip2 content="Change Goal Type">
53+
<Tooltip content="Change Goal Type">
5554
<TypeSelect
5655
filterable={false}
5756
itemRenderer={typeRenderer}
@@ -60,7 +59,7 @@ const EditableMeta: React.FC<Props> = ({ changeMeta, meta }) => {
6059
>
6160
<Button minimal={true} outlined={true} text={type} />
6261
</TypeSelect>
63-
</Tooltip2>
62+
</Tooltip>
6463
{editableMetaDetails(type)}
6564
</>
6665
);

0 commit comments

Comments
 (0)