From 62f5a837f090ae779300bd1530eb80913e23c34d Mon Sep 17 00:00:00 2001 From: En Rong <53928333+chownces@users.noreply.github.com> Date: Fri, 3 May 2024 12:49:52 +0800 Subject: [PATCH] Migrate out of react-hotkeys to @mantine/hooks (#2968) * Migrate playground hulk hotkey bindings to alt+shift+h * Migrate SubstVisualizer hotkey bindings * Migrate Data Viz hotkey bindings * Migrate CSE machine hotkey bindings * Remove react-hotkeys from package.json * Fix PR comments * Fix snapshots * Use Blueprint Card component instead of div * Move documentation from props to component * Fix format and snapshots --------- Co-authored-by: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> --- package.json | 1 - .../AssessmentWorkspace.tsx.snap | 9 - src/commons/editor/Editor.tsx | 16 +- src/commons/hotkeys/HotKeys.tsx | 39 ++ src/commons/repl/Repl.tsx | 15 +- .../__tests__/__snapshots__/Repl.tsx.snap | 13 +- .../SideContentCseMachine.tsx.snap | 6 +- .../content/SideContentCseMachine.tsx | 39 +- .../content/SideContentDataVisualizer.tsx | 39 +- .../content/SideContentSubstVisualizer.tsx | 517 +++++++-------- .../sourceRecorder/SourceRecorderEditor.tsx | 16 +- src/pages/playground/Playground.tsx | 28 +- .../__snapshots__/Playground.tsx.snap | 589 +++++++++--------- yarn.lock | 7 - 14 files changed, 602 insertions(+), 732 deletions(-) create mode 100644 src/commons/hotkeys/HotKeys.tsx diff --git a/package.json b/package.json index 1d6b04cc62..edef0c8f50 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,6 @@ "react-drag-drop-files": "^2.3.10", "react-draggable": "^4.4.5", "react-dropzone": "^14.2.3", - "react-hotkeys": "^2.0.0", "react-i18next": "^14.1.0", "react-konva": "^18.2.10", "react-latex-next": "^3.0.0", diff --git a/src/commons/assessmentWorkspace/__tests__/__snapshots__/AssessmentWorkspace.tsx.snap b/src/commons/assessmentWorkspace/__tests__/__snapshots__/AssessmentWorkspace.tsx.snap index 2525ef6a9b..e0ea3c38bc 100644 --- a/src/commons/assessmentWorkspace/__tests__/__snapshots__/AssessmentWorkspace.tsx.snap +++ b/src/commons/assessmentWorkspace/__tests__/__snapshots__/AssessmentWorkspace.tsx.snap @@ -220,7 +220,6 @@ exports[`AssessmentWorkspace AssessmentWorkspace page with ContestVoting questio >
- The data visualizer helps you to visualize data structures.
-
-
- It is activated by calling the function
-
-
- draw_data(x
-
- 1
-
- , x
-
- 2
-
- , ... x
-
- n
-
- )
-
- , where
-
-
- x
-
- k
-
-
-
- would be the
-
-
- k
-
- th
-
-
-
- data structure that you want to visualize and
-
- n
-
- is the number of structures.
-
-
- The data visualizer uses box-and-pointer diagrams, as introduced in
-
-
-
- Structure and Interpretation of Computer Programs, JavaScript Edition, Chapter 2, Section 2
-
-
- .
-
+ draw_data(x
+
+ 1
+
+ , x
+
+ 2
+
+ , ... x
+
+ n
+
+ )
+
+ , where
+
+
+ x
+
+ k
+
+
+
+ would be the
+
+
+ k
+
+ th
+
+
+
+ data structure that you want to visualize and
+
+ n
+
+ is the number of structures.
+
- The data visualizer helps you to visualize data structures.
-
-
- It is activated by calling the function
-
-
- draw_data(x
-
- 1
-
- , x
-
- 2
-
- , ... x
-
- n
-
- )
-
- , where
-
-
- x
-
- k
-
-
-
- would be the
-
-
- k
-
- th
-
-
-
- data structure that you want to visualize and
-
- n
-
- is the number of structures.
-
-
- The data visualizer uses box-and-pointer diagrams, as introduced in
-
-
-
- Structure and Interpretation of Computer Programs, JavaScript Edition, Chapter 2, Section 2
-
-
- .
-
+ draw_data(x
+
+ 1
+
+ , x
+
+ 2
+
+ , ... x
+
+ n
+
+ )
+
+ , where
+
+
+ x
+
+ k
+
+
+
+ would be the
+
+
+ k
+
+ th
+
+
+
+ data structure that you want to visualize and
+
+ n
+
+ is the number of structures.
+