Skip to content

Commit

Permalink
Rename Multiple Files mode to Folder mode & shift Folder mode toggle …
Browse files Browse the repository at this point in the history
…button (source-academy#2380)

* Rename multiple files mode to Folder mode

* Place Folder mode toggle button after the Session button

* Update test snapshots
  • Loading branch information
ianyong authored and RichDom2185 committed Jul 15, 2023
1 parent 1503968 commit 2dd60dd
Show file tree
Hide file tree
Showing 24 changed files with 126 additions and 127 deletions.
2 changes: 1 addition & 1 deletion src/commons/application/ApplicationTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export const createDefaultWorkspace = (workspaceLocation: WorkspaceLocation): Wo
workspaceLocation,
Constants.defaultSourceVariant
),
isMultipleFilesEnabled: false,
isFolderModeEnabled: false,
activeEditorTabIndex: 0,
editorTabs: [
{
Expand Down
18 changes: 9 additions & 9 deletions src/commons/assessmentWorkspace/AssessmentWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {

const dispatch = useDispatch();

const { isMultipleFilesEnabled, activeEditorTabIndex, editorTabs } = useTypedSelector(
const { isFolderModeEnabled, activeEditorTabIndex, editorTabs } = useTypedSelector(
store => store.workspaces[workspaceLocation]
);

React.useEffect(() => {
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable multiple files.
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable Folder mode.
props.handleEditorValueChange(0, '');
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand Down Expand Up @@ -182,7 +182,7 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
}
}

// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable multiple files.
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable Folder mode.
props.handleEditorValueChange(0, answer);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand Down Expand Up @@ -220,7 +220,7 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
props.handleUpdateHasUnsavedChanges(true);
}

// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable multiple files.
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable Folder mode.
props.handleEditorValueChange(0, newCode);

const input: Input = {
Expand Down Expand Up @@ -350,7 +350,7 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
programPostpendValue = questionData.postpend;
}

// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable multiple files.
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable Folder mode.
props.handleEditorUpdateBreakpoints(0, []);
dispatch(updateCurrentAssessmentId(assessmentId, questionId));
dispatch(
Expand Down Expand Up @@ -378,7 +378,7 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
dispatch(beginClearContext(workspaceLocation, question.library, true));
props.handleUpdateHasUnsavedChanges(false);
if (editorValue) {
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable multiple files.
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable Folder mode.
props.handleEditorValueChange(0, editorValue);
}
};
Expand All @@ -394,7 +394,7 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
const isGraded = props.assessment!.questions[questionId].grader !== undefined;
const isContestVoting = props.assessment!.questions[questionId]?.type === 'voting';
const handleContestEntryClick = (_submissionId: number, answer: string) => {
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable multiple files.
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable Folder mode.
props.handleEditorValueChange(0, answer);
};

Expand Down Expand Up @@ -771,7 +771,7 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
label="Confirm"
onClick={() => {
closeOverlay();
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable multiple files.
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable Folder mode.
props.handleEditorValueChange(
0,
(props.assessment!.questions[questionId] as IProgrammingQuestion).solutionTemplate
Expand All @@ -795,7 +795,7 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
question.type === QuestionTypes.programming || question.type === QuestionTypes.voting
? {
editorVariant: 'normal',
isMultipleFilesEnabled,
isFolderModeEnabled,
activeEditorTabIndex,
setActiveEditorTabIndex,
removeEditorTabByIndex,
Expand Down
Loading

0 comments on commit 2dd60dd

Please sign in to comment.