Skip to content

Commit 83dd88c

Browse files
committed
Squashed commit of the following:
commit 27f3fe4 Author: Martin Henz <henz@comp.nus.edu.sg> Date: Sun Apr 14 15:21:16 2024 +0800 bumping js-slang (source-academy#2934) commit 812393a Author: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Sun Apr 14 13:28:11 2024 +0800 Migrate to TypeScript v5 (source-academy#2850) * Bump TypeScript to v5.4 Also updated tsconfig.json to remove a deprecated config. * Fix type error * Fix type error * Fix type error * Fix type error * Fix type error * Fix lint dependencies and config * Fix type errors * Fix type error * Fix format * Fix type errors Also standardized React hooks import style. * Fix type error * Fix type error * Fix format * Bump typescript to v5.4.3 * Fix type errors * Add some `as any` assertions FIXMEs were also incorporated for future refactoring. * Update lockfile post-merge * Bump dependencies * Update lockfile post-merge * Create type-safe object helpers * Fix type error * Fix type error * Fix type error * Create more type helpers * Fix type error * Fix type error Also removed unnecessary type annotation. * Fix type error * Fix type error * Fix type errors * Fix type error * Fix type error * Fix type errors * Fix type error * Fix type error * Refactor filter logic to fix type error * Fix types * Address comments commit 87e646d Author: CZX <CZX123@users.noreply.github.com> Date: Sat Apr 13 23:05:04 2024 +0800 CSE UI/UX: Animations & UI improvements (source-academy#2931) * display array indices * animate moving numbers from agenda to stash * add code to read from previous agenda * Add animation components and some abstraction * Change test cases * Fix bug Properly disable animations when control and stash option is not enabled * display array indices * animate moving numbers from agenda to stash * add code to read from previous agenda * Add animation components and some abstraction * Change test cases * Fix bug Properly disable animations when control and stash option is not enabled * Fix issues with names after rebase * Fix animation bugs and refactoring of animation classes and logic * Fix mistake in test snapshot * Revert "Merge branch 'cse-uiux' of https://github.com/source-academy/frontend into cse-uiux" This reverts commit 7ef87d8, reversing changes made to efa8c57. * Restructure animation classes * Add binary operator animation * Add unary operator animation * Begin work on block separation animation * Improve binary operation animation, and improve the versatility of the base animation components * Improve the unary operation and block animations * Update test cases and remove block animation conditions * Add pop animation (linear movement) * Improve pop animation, and cleanup code for pull request * Revert envVisualizer test snapshot changes * Add assignment animation * Work on binding lookup function * Improve assignment animation and touch up on other animations, added experimental Column component * Add lookup animation (Identifier) * Improve lookup animation * Hide arrows for lookup animation and show them when it's finished * Remove AnimationUtils.tsx file replaced with AnimationUtils.ts * Slow down assignment and lookup animations * Fix issues with merging * Add environment animation * Refactor setDestination and animate to new method animateTo * Improve env animation and rename a utility function * Added animated arrows and also modified GenericArrow and improve assignment animation * Update test snapshot and formatting changes * Add arrow animation to lookup animation, and fix animateTo function behavior * Add FrameCreationAnimation * Rewrote all animation components for greater flexibility and performance * Shorten duration and delay names, and add listener functionality * Move experimental file * Fix issues with `this` keyword * Rewrite AnimatedTextbox to make it easier for both Text and Rect within it to be individually animated * Improve FrameCreationAnimation and bunch of other fixes * Fix some issues with `undefined` inside the control and stash * Make compact components the new default and remove any mentions to the old components. Also removes the experimental button toggle. * Update test snapshots * Clean up testing code a little * Formatting changes * Fix issues after merge * Revert some incorrect merges * Add FunctionFrameCreationAnimation if possible, reusing AssignmentAnimation would make handling fade-in of values easier * Add getNodeDimensions and getNodeLocation * Add ArrowFunctionExpressionAnimation * Add BranchAnimation simple animation for replacing a branch item in the control with the correct code block * Sort instr types in alphabetical order * Add ArrayLiteralAnimation * Added cases for block splitting for/while loops and conditional expressions * Improve animations for arrow functions and branch instruction * Update function application animation * Special changes for js-slang branch: add new objectCount property and filter program bindings * Change dummy binding behavior to match js-slang update * Fix array references being lost in frames due to cloning property descriptors * Simplify code * Add ArrayAccessAnimation * Begin work on ArrayAssignmentAnimation todo: animate arrows for object assignment * Fix application animation for predeclared funcs * Changes to solve issue 2700 and some fixes regarding global frame * Re-add animations * Fix many issues regarding displaying objects on global frame * Formatting * Simplify merging of environment heaps and drawing of bindings * Fix infinite loop in `findObjects` * Disable animations if control is truncated Could allow such functionality in the future, but currently animations break with a truncated control. * Fix AssignmentAnimation previous use of binding.height() causes positioning issues with nested array assignment * Increase space between closure and frame * Change for/while instr to use BranchAnimation * Initial Commit * More fixes and added faded gc objects * Disable variadic function animation * Increase spacing for global closure between closure circles and global frame border * Add missing case 'FunctionExpression' animates the moving of a functionexpression to the stash as a closure * Fix variadic function checker * Improve FunctionApplicationAnimation for nullary functions, allow the closure stash item to fade away * Improve assignment animation * Run format * Simplify check frame creation * Fix params text and added SourceObject to display runes correctly * bumping js-slang * Revamp unreferenced behavior and update snapshots * Run format * Update snapshot * Bump js-slang * Fix issues after merge * Fix frames creeping to the left * Improve rune display, revamp color system and add color interpolation * UI & animation improvements * Big improvements for many animations * More improvements, better transitions between border colors * More improvements and update snapshot * Update types * Remove explicit fragment * Remove explicit fragment again * Update typings * Merge branch 'cse-uiux2' of https://github.com/source-academy/frontend into cse-uiux2 * Fix findObjects * Add docs * Re-add color dependencies for Java CSE * Re-add color dependencies for Java CSE * Fix format * Array access & asgn animation improvements, general polish * Cleanup and update java cse machine colors to use new functions * Move type helpers from animation utils to global type helpers file * Run format * Fix fn to frame arrow, and cleanup arrow code --------- Co-authored-by: notnotmax <156508404+notnotmax@users.noreply.github.com> Co-authored-by: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Co-authored-by: henz <henz@comp.nus.edu.sg> commit 4f6be6b Author: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Sat Apr 13 21:05:41 2024 +0800 Refactor frontend part 7 (source-academy#2846) * Improve useRef type arguments for HTML elements * Use named imports for React hooks * Refactor MobileWorkspace * Replace if statements with optional invocation * Move constant `SideContentTab`s out of FC body * Simplify classnames call * Remove unnecessary braces around string attributes Only done for non-UI (non-message/label) strings as these UI strings will be pulled out for internationalization in the future. * Deduplicate dependencies * Create `useTokens` hook * Update default throw behavior for `useTokens` * Render SICP chatbot only when logged in * Fix overloaded types for `useTokens` Done following default behavior change. * Use `useTokens` where applicable * Refactor SICP chatbox * Use `useTokens` * Move API call to separate file * Update React import to default import * Refactor SICP chatbox further * Update imports * Create and use ChatMessage type alias * Reorganize SICP chatbot files * Refactor chat completion logic * Use dependency injection in prompt builder * Refactor prompt builder logic * Refactor prompt builder to separate file * Create type definitions * Move, type, rename SICP section summaries * Improve typing * Refactor SICP chat box component * Remove unnecessary template literal * Refactor constants out of component * Create type definitions * Create `CONTEXT_SIZE` constant to replace magic numbers * Refactor logic to use `CONTEXT_SIZE` constant * Remove unnecessary state variables * Refactor payload generation * Move fetching logic from event handler to effect callback instead * Rename `cleanMessage` to `resetChat` * Decouple rendering logic from chat completion logic * Only store string content in `ChatMessage` type * Move rendering function outside component to prevent unnecessary recreation * Update render function signature * Restore GPT-generated output warning for bot messages * Refactor render function logic * Fix React render warnings * Add TODOs for full Markdown/stories-like parsing Also uses non-greedy regex to match and split code blocks: * Only match JavaScript code blocks * Fix false matches * Supports multiple code blocks in a single message * Fix whitespace issue * Fix filename capitalization * Remove duplicated badge code * Fix double request * Block chat input when loading response commit c1abec1 Author: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Sat Apr 13 20:35:47 2024 +0800 Bump Blueprint; remove obsolete hotfixes, deprecations (source-academy#2773) * Bump minimum Blueprint version Done to allow compatibility with new React 18 `createRoot`. * Migrate from deprecated `Tooltip2`, `Popover2` Done partially so far, with the full migration in a subsequent commit. * Migrate more components to fix deprecations * Update test snapshots * Migrate remaining components to fix deprecations * Remove deprecated package from `requireProvider` This would necessitate a corresponding change in modules to ensure they don't import the deprecated package, or simply just mark it as non-external. * Remove `@blueprintjs/popover2` package completely * Fix format * Fix format * Reformat files post-merge * Bump Blueprint version * Use BP `Classes` utility instead of raw strings Prevents regressions when the CSS namespace changes in the meantime while we still have yet to migrate away fully from the CSS API. * Fix lint * Migrate to new notifications API Removes the old hotfix now that Blueprint supports it. commit d2b322a Author: Josh Thoo Jen Sen <110712708+josh1248@users.noreply.github.com> Date: Sat Apr 13 20:03:17 2024 +0800 Implement isGradingPublished (plus related features) (source-academy#2856) * Dummy publish grading function * skeleton redux loop for publishGrading, update GradingOverview * New column filter for isPublished (WIP) * Implement anticipated backend format and route implementations for publish and unpublish buttons * Remove misleading devnote and simplify message contents * fix: Change gradingOverviews to use backend response * Readjust publish button from HTML icon button to Blueprintjs text button * Publish and unpublish buttons set up * set up frontend-only type submissionProgress derived from backend status and isPublished * Implement derived submissionProgress frontend field from status and isGradingPublished from backend * Improve type safety in Grading page * Implement business logic to disable unsubmission if published or not submitted * Use notPublished param in backend * minor type safety change * Update new actions post-merge conflicts * Update tests * Update jsdocs and field names from ungraded to unpublished * adjust field names in test from unpublishedFilter to publishedFilter * Updated showGrading to be based on published status * Update getAssessmentOverviews to compute submission progress * Fix tests * Scaffold function for comprehensive progress status (WIP) * Update RequestsSaga.ts * fix crash * Introduce soon-to-be comprehensive field into table * Shift conversion functions into utils * Update business logic using comprehensive state * Introduce progress status to assessment overviews * clean up display of progressStatus * remove derived submissionProgress field, add in status field from backend * remove direct gradingStatus use in grading page * remove gradingStatus from assessments * Remove more references to gradingStatus * Replace references to gradingStatus with progress * there is a lot of reference to gradingStatus. * Replace gradingStatus with progress in testing * Fully remove gradingStatus and replace with progress * Fix accidental import * Update to use new backend parameter names in backend * Remove isPublished field entirely from grading overviews to avoid confusion with publishing within assessment overviews * Update tests * Dummy publish all button in ground control * redux loop for publishall and unpublishall (part 1) * Remove re-autograde for published or non-submitted assessments * Add publishAll button * Replace deprecated ag-grid functions with current versions * Implement unpublish all button * Add unique key, avoid specialkey flag from react * Fix button layout * Fix button format * increase width for accessibility * autoPublish settings inserted into admin panel configs * cleanup of isAutoPublished field within assessment configs * update tests for assessmentConfiguration * remove un-needed import * remove debug-only submissionStatus in grading submissions table * Revert accidental removal of XP field * bp5-minimal tag to clean up bulk publishing buttons - thanks gabriel :) * Fix errors post-merge * Fix lint error * feat: Implement published and unpublished notifications and remove deprecated ones * chore: Remove commented code * Fix compile error * Remove unnecessary typecast * Remove unnecessary typecast * Remove unused import * update notification types to reflect backend * change notification types to reflect backend changes * remove git stash artifacts * remove git stash artefacts * add tooltips, update assessment fields * remove development artifacts * remove TODO comment as issue has been raised * Update GradingUtils.ts jsdocs * linting * readjust progress statuses and conversion functions * update colours and logos * expose backend isGradingPublished field and update tests * update assessment cards to show purely based on isGradingPublished status without further check for graded * remove hardcoded assessment status * linting * revert yarn lock change * Update yarn.lock * update mocks and tests * remove un-needed import * linting * Use enum values instead of strings for color keys * Use prop over BP CSS API * remove un-needed field calculation, fix typos * update student username to show nusnet id instead of duplicating student name (thanks gabriel :D) --------- Co-authored-by: GabrielCWT <77312579+GabrielCWT@users.noreply.github.com> Co-authored-by: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> commit 4556d3f Author: Liew Xin Yi <e0550381@u.nus.edu> Date: Sat Apr 13 19:43:51 2024 +0800 Implement and Integrate `java-slang` CSEC Visualizer (source-academy#2926) * Update ControlBarChapterSelect with Java * Implement Java CSEC Visualizer * Integrate CSEC Visualizer * Linting errors for java-slang-csec * Fix frontend test: rename Object to Obj to avoid potential name clash? * Update snapshot * Update imports from java-slang * Fix lint * Update snapshot * Fix linting * Fix typo Co-authored-by: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> * Add TODO for err source node location --------- Co-authored-by: joel chan <joelchanzhiyang@gmail.com> Co-authored-by: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> commit 612f68b Author: Lai Mei Tin <77192251+1001mei@users.noreply.github.com> Date: Sat Apr 13 18:02:16 2024 +0800 Integrate Java type checker and compiler into frontend (source-academy#2925) * Integrate Java compiler into frontend * Add typechecker from java-slang * Add program terminated succesfully output to Java * Bump java-slang to 1.0.7 * Remove program terminated output from java in frontend * Change ProgramTerminatedSuccessfully to anonymous class in java * Bump java-slang to 1.0.8 * Bump java-slang to 1.0.9 * Add process/browser to craco polyfill * Add java-parser to jest transform ignore patterns * Bump java-slang to 1.0.13 * Add mocks for java-slang functions * Fix wrong error label in java helper * Increase max file size to cache to 20 --------- Co-authored-by: Bryan Loh <bryanlohxz@gmail.com> Co-authored-by: Martin Henz <henz@comp.nus.edu.sg> commit d1c0a45 Author: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Sat Apr 13 14:53:02 2024 +0800 Migrate to Redux Toolkit part 5 (source-academy#2866) * Migrate remaining workspace reducers to RTK * Migrate remaining action creators to RTK * Remove `typesafe-actions` dependency Type safety is now achieved via Redux Toolkit. * Update testcase * Fix format * Fix compile error * Fix errors * Restore old NOTIFY_PROGRAM_EVALUATED reducer Done to optimize the diff and will be removed later. commit 0c45606 Author: Martin Henz <henz@comp.nus.edu.sg> Date: Fri Apr 12 12:34:11 2024 +0800 bumping js-slang (source-academy#2929) commit 02059bf Author: John Wong <johnwz123@gmail.com> Date: Fri Apr 12 01:59:37 2024 +0800 Modify mobile keyboard to be scrollable (source-academy#2915) * Modify mobile keyboard to be scrollable * Mobile Keyboard is now swipeable * Remove mobile-keyboard-row-toggle styles * Fix formatting * Remove console.log statements --------- Co-authored-by: Joven Soh <34702990+JovenSoh@users.noreply.github.com> commit 4cc0204 Author: John Wong <johnwz123@gmail.com> Date: Thu Apr 11 03:28:57 2024 +0800 Add full-screen button for Playground side content (source-academy#2911) * Added fullscreen button to playground side content * Refactor fullscreen button to use class as reference and Blueprint's Tooltip * updating snapshots * Remove unnecessary comments * Replace icon with button For more correct semantics. * Remove unnecessary styles Following the change from icon to button, `cursor: pointer` is no longer needed. Also lowered the z-index to a more reasonable value. * Fix format * Update test snapshots --------- Co-authored-by: henz <henz@comp.nus.edu.sg> Co-authored-by: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> commit e2abe18 Author: John Wong <johnwz123@gmail.com> Date: Thu Apr 11 02:16:49 2024 +0800 Add a fullscreen button for the game div container (source-academy#2855) * Add a fullscreen button for the game div container * Modify code to use the useFullscreen hook from the @mantine/hooks package * Bump dependencies * Use `IconNames` instead of magic strings --------- Co-authored-by: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Co-authored-by: Martin Henz <henz@comp.nus.edu.sg> Co-authored-by: Lee Hyung Woon / 이형운 <leehyungwoonsamuel@gmail.com> commit f4d6e78 Author: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed Apr 10 16:10:22 2024 +0800 Fix `xlsx` security vulnerability (source-academy#2914) * Bump and use recommended XLSX version from CDN * Deduplicate dependencies commit 571f8b7 Author: Martin Henz <henz@comp.nus.edu.sg> Date: Wed Apr 10 14:31:39 2024 +0800 bumping js-slang (source-academy#2922) commit c859f1b Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed Apr 10 14:14:57 2024 +0800 Bump tar from 6.1.15 to 6.2.1 (source-academy#2920) Bumps [tar](https://github.com/isaacs/node-tar) from 6.1.15 to 6.2.1. - [Release notes](https://github.com/isaacs/node-tar/releases) - [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md) - [Commits](isaacs/node-tar@v6.1.15...v6.2.1) --- updated-dependencies: - dependency-name: tar dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit bb790df Author: Martin Henz <henz@comp.nus.edu.sg> Date: Wed Apr 10 14:05:51 2024 +0800 bumping java-slang to 1.0.6 (source-academy#2924) commit 27e3181 Author: Martin Henz <henz@comp.nus.edu.sg> Date: Wed Apr 10 13:30:30 2024 +0800 bumping java-slang to 1.0.5 (source-academy#2923) commit 5dba6a5 Author: CZX <CZX123@users.noreply.github.com> Date: Wed Apr 10 07:58:53 2024 +0800 CSE Machine: Fixes for variadic function & global closures, added faded unreferenced objects (source-academy#2906) * Initial Commit * More fixes and added faded gc objects * Run format * Fix params text and added SourceObject to display runes correctly * bumping js-slang * Revamp unreferenced behavior and update snapshots * Run format * Update snapshot * Bump js-slang --------- Co-authored-by: henz <henz@comp.nus.edu.sg>
1 parent b3c6906 commit 83dd88c

File tree

225 files changed

+7837
-3298
lines changed

Some content is hidden

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

225 files changed

+7837
-3298
lines changed

.eslintrc.json

Lines changed: 9 additions & 1 deletion
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

Lines changed: 4 additions & 2 deletions
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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
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",
33+
"@mantine/hooks": "^7.7.0",
3434
"@octokit/rest": "^20.0.0",
3535
"@reduxjs/toolkit": "^1.9.7",
3636
"@sentry/browser": "^7.57.0",
@@ -50,8 +50,8 @@
5050
"flexboxgrid": "^6.3.1",
5151
"flexboxgrid-helpers": "^1.1.3",
5252
"hastscript": "^9.0.0",
53-
"java-slang": "^1.0.4",
54-
"js-slang": "^1.0.62",
53+
"js-slang": "^1.0.68",
54+
"java-slang": "^1.0.13",
5555
"js-yaml": "^4.1.0",
5656
"konva": "^9.2.0",
5757
"lodash": "^4.17.21",
@@ -91,10 +91,9 @@
9191
"rehype-react": "^8.0.0",
9292
"showdown": "^2.1.0",
9393
"sourceror": "^0.8.5",
94-
"typesafe-actions": "^5.1.0",
9594
"unified": "^11.0.0",
9695
"uuid": "^9.0.0",
97-
"xlsx": "0.18.5",
96+
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",
9897
"xml2js": "^0.6.0",
9998
"yareco": "^0.1.5"
10099
},
@@ -128,13 +127,16 @@
128127
"@types/showdown": "^2.0.1",
129128
"@types/uuid": "^9.0.0",
130129
"@types/xml2js": "^0.4.11",
130+
"@typescript-eslint/eslint-plugin": "^7.4.0",
131+
"@typescript-eslint/parser": "^7.4.0",
131132
"babel-core": "6",
132133
"babel-runtime": "^6.26.0",
133134
"buffer": "^6.0.3",
134135
"canvas": "^2.11.2",
135136
"constants-browserify": "^1.0.0",
136137
"coveralls": "^3.1.1",
137138
"cross-env": "^7.0.3",
139+
"eslint": "^8.57.0",
138140
"eslint-plugin-simple-import-sort": "^12.0.0",
139141
"https-browserify": "^1.0.0",
140142
"husky": "^9.0.0",
@@ -152,7 +154,7 @@
152154
"stream-browserify": "^3.0.0",
153155
"stream-http": "^3.2.0",
154156
"timers-browserify": "^2.0.12",
155-
"typescript": "~4.9.0",
157+
"typescript": "^5.4.3",
156158
"url": "^0.11.1",
157159
"webpack-bundle-analyzer": "^4.9.0"
158160
},

src/commons/SimpleDropdown.tsx

Lines changed: 4 additions & 5 deletions
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

Lines changed: 11 additions & 5 deletions
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

Lines changed: 3 additions & 4 deletions
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

Lines changed: 3 additions & 4 deletions
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

Lines changed: 3 additions & 4 deletions
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

Lines changed: 3 additions & 4 deletions
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

Lines changed: 3 additions & 4 deletions
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

Lines changed: 3 additions & 4 deletions
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

Lines changed: 5 additions & 6 deletions
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

Lines changed: 3 additions & 4 deletions
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}

0 commit comments

Comments
 (0)