-
Notifications
You must be signed in to change notification settings - Fork 172
Add exam mode #3106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kah-seng
wants to merge
67
commits into
source-academy:master
Choose a base branch
from
iZUMi-kyouka:exam_mode
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add exam mode #3106
Changes from 11 commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
1ec4ff9
Added exam mode switches for admin panel and create course dropdown
kah-seng 1aba138
Fixed exam mode switch not updating on launch
kah-seng 5111ee5
Hide Google Drive, GitHub, share and sessions button when exam mode e…
kah-seng c8d8f18
added auto url navigation to course under exam mode; fixed UI logic c…
iZUMi-kyouka 804fdad
fixed some formatting with yarn run format
iZUMi-kyouka 7f09b05
added enableExamMode field in backend tests; eslint fix and formatting
iZUMi-kyouka 38b208c
Hide remote execution when exam mode enabled, shifted exam mode check…
kah-seng f17ff59
yarn run format and rename for standardisation
kah-seng bad7d50
Formatting
kah-seng 3f4921b
Merge branch 'master' into exam_mode
RichDom2185 2d837c1
Remove .tool-versions
RichDom2185 0c7526b
Disable create course when under exam mode, hide exam mode toggle whe…
kah-seng fc1a803
Added isOfficialCourse field in backend tests
kah-seng 6a20fc7
Change useTypedSelector to useSession
kah-seng 736e624
added resume code function in admin panel
iZUMi-kyouka 1f42ded
Added validate resume code saga
kah-seng 6cd6727
Added basic dev tools detection, pausing of source academy and resume…
kah-seng b72a22b
Added resume code input validation for admin panel
kah-seng 9f5e3a2
Restore pause overlay
kah-seng feacd38
Fixed resume code input validation
kah-seng cc13931
Added backend saga tests
kah-seng 7d61c43
Merge branch 'master' into exam_mode
RichDom2185 23415c9
added disable-devtool library; configured PauseAcademyOverlay to work…
iZUMi-kyouka 0c68331
fixed repeated request to pause user by using useRef
iZUMi-kyouka ad49ef5
Added documentation tab and merge block_dev_tools_library branch
kah-seng c52f215
Fixed tests
kah-seng d8e3d6f
used native sicp component instead of loading another SA web app in a…
iZUMi-kyouka a9cfd33
fixed styling issues; added home button to control iframe
iZUMi-kyouka 15a9e62
fixed text and index search failure on assessment SICP tab
iZUMi-kyouka 666f50a
Formatting and added caching of documentation pages
kah-seng 1bdac8e
fixed home button for sicp native component with callback functions
iZUMi-kyouka bedcc4d
commented unusued console.log
iZUMi-kyouka 0b28757
added maxheight to the SICP component
iZUMi-kyouka aa1e266
Fix format
RichDom2185 d91e7af
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 685184d
Use `useSession`
RichDom2185 5caf874
Remove unused code
RichDom2185 0e3101f
Simplify code
RichDom2185 d6c2ca3
Added pausing when browser tab change detected, and simplified code
kah-seng 3f3b75d
Fixed bug where sometimes refreshing bypasses overlay, modified valid…
kah-seng a525978
Formatting
kah-seng ec9c372
fixed styling to allow resizing of documentation iframe; added sagas …
iZUMi-kyouka 2777ebf
fix formatting
iZUMi-kyouka bab2a81
fixed sicp js sidebar docs styling; improved button styling
iZUMi-kyouka 669a347
formatting
iZUMi-kyouka bb4c32d
Changed overlay to show when focus regained instead
kah-seng 3e660d9
Changed pause overlay to notification when focus lost
kah-seng 50eb143
Change alert to notifications
kah-seng 87feefe
Alert to notification
kah-seng 80d57bf
Removed useless button
kah-seng ef6f91c
added applyEnableExamMode to exclude staffs and admins from exam mode…
iZUMi-kyouka 1447ed5
added applyEnableExamMode to exclude staffs and admins from exam mode…
iZUMi-kyouka 39ec7f8
Added local preview of exam mode for admins
kah-seng 37c947e
auto resized docs sidebar to reasonable size; fixed sicp sidebar bott…
iZUMi-kyouka 95469a5
fixed bug where clicking home on other docs tab also navigates sicp d…
iZUMi-kyouka a8b1b4b
Report focus gain on launch
kah-seng 8a7671b
hide preview exam mode button on non official course
iZUMi-kyouka a244844
Resume code input always visible, can no longer be empty no matter ex…
kah-seng 5289a9d
Trim resume code input
kah-seng 3cb1957
Formatting
kah-seng 52635e8
Fixed bug where resume code does not update when switching courses
kah-seng bcb9833
Merge branch 'master' into exam_mode
RichDom2185 a0e854d
Simplify props name
RichDom2185 75a9fbb
Remove commented code and unnecessary bool prop
RichDom2185 715aeff
Remove unnecessary underscore variable
RichDom2185 407052d
merge from master and resolve conflicts
iZUMi-kyouka 1b21039
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -5,7 +5,7 @@ import { useDispatch } from 'react-redux'; | |||||||||||||||||
import { Navigate, Outlet, useNavigate, useParams } from 'react-router'; | ||||||||||||||||||
import ResearchAgreementPrompt from 'src/commons/researchAgreementPrompt/ResearchAgreementPrompt'; | ||||||||||||||||||
import Constants from 'src/commons/utils/Constants'; | ||||||||||||||||||
import { useSession } from 'src/commons/utils/Hooks'; | ||||||||||||||||||
import { useSession, useTypedSelector } from 'src/commons/utils/Hooks'; | ||||||||||||||||||
import classes from 'src/styles/Academy.module.scss'; | ||||||||||||||||||
|
||||||||||||||||||
import SessionActions from '../../commons/application/actions/SessionActions'; | ||||||||||||||||||
|
@@ -37,6 +37,7 @@ const CourseSelectingAcademy: React.FC = () => { | |||||||||||||||||
const { courseId } = useSession(); | ||||||||||||||||||
const { courseId: routeCourseIdStr } = useParams<{ courseId?: string }>(); | ||||||||||||||||||
const routeCourseId = routeCourseIdStr != null ? parseInt(routeCourseIdStr, 10) : undefined; | ||||||||||||||||||
const enableExamMode = useTypedSelector(state => state.session.enableExamMode); | ||||||||||||||||||
|
||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
React.useEffect(() => { | ||||||||||||||||||
// Regex to handle case where routeCourseIdStr is not a number | ||||||||||||||||||
|
@@ -47,7 +48,11 @@ const CourseSelectingAcademy: React.FC = () => { | |||||||||||||||||
if (routeCourseId !== undefined && !Number.isNaN(routeCourseId) && courseId !== routeCourseId) { | ||||||||||||||||||
dispatch(SessionActions.updateLatestViewedCourse(routeCourseId)); | ||||||||||||||||||
} | ||||||||||||||||||
}, [courseId, dispatch, routeCourseId, navigate, routeCourseIdStr]); | ||||||||||||||||||
|
||||||||||||||||||
if (enableExamMode) { | ||||||||||||||||||
navigate(`/courses/${courseId}`); | ||||||||||||||||||
} | ||||||||||||||||||
}, [courseId, dispatch, routeCourseId, navigate, routeCourseIdStr, enableExamMode]); | ||||||||||||||||||
|
||||||||||||||||||
return Number.isNaN(routeCourseId) ? ( | ||||||||||||||||||
<Navigate to="/" /> | ||||||||||||||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use
useSession
for simplicity: