Skip to content

Commit 79afb15

Browse files
Merge branch 'folders-public-wip' of github.com:source-academy/frontend into folders-public-wip
2 parents e18cfe9 + fb238b0 commit 79afb15

33 files changed

+1390
-954
lines changed

src/commons/application/ApplicationTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ export const defaultEditorValue = '// Type your program in here!';
362362
*
363363
* @param workspaceLocation the location of the workspace, used for context
364364
*/
365-
export const createDefaultWorkspace = (workspaceLocation: WorkspaceLocation): WorkspaceState => ({ // TODO remove default js
365+
export const createDefaultWorkspace = (workspaceLocation: WorkspaceLocation): WorkspaceState => ({
366366
autogradingResults: [],
367367
context: createContext<WorkspaceLocation>(
368368
Constants.defaultSourceChapter,

src/commons/application/actions/SessionActions.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,10 @@ export const setAdminPanelCourseRegistrations = createAction(
208208

209209
export const setGoogleUser = createAction(SET_GOOGLE_USER, (user?: string) => ({ payload: user }));
210210

211-
export const setGoogleAccessToken =
212-
createAction(SET_GOOGLE_ACCESS_TOKEN, (accessToken?: string) => ({ payload: accessToken}));
211+
export const setGoogleAccessToken = createAction(
212+
SET_GOOGLE_ACCESS_TOKEN,
213+
(accessToken?: string) => ({ payload: accessToken })
214+
);
213215

214216
export const setGitHubOctokitObject = createAction(
215217
SET_GITHUB_OCTOKIT_OBJECT,
@@ -226,7 +228,8 @@ export const removeGitHubOctokitObjectAndAccessToken = createAction(
226228
);
227229

228230
export const removeGoogleUserAndAccessToken = createAction(
229-
REMOVE_GOOGLE_USER_AND_ACCESS_TOKEN, () => ({ payload: {} })
231+
REMOVE_GOOGLE_USER_AND_ACCESS_TOKEN,
232+
() => ({ payload: {} })
230233
);
231234

232235
export const submitAnswer = createAction(

src/commons/assessmentWorkspace/AssessmentWorkspace.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,14 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
423423
const resetWorkspaceOptions = assertType<WorkspaceState>()({
424424
autogradingResults: options.autogradingResults ?? [],
425425
// TODO: Hardcoded to make use of the first editor tab. Rewrite after editor tabs are added.
426-
editorTabs: [{ value: options.editorValue ?? '', highlightedLines: [], breakpoints: [], githubSaveInfo: {repoName: '', filePath: ''} }],
426+
editorTabs: [
427+
{
428+
value: options.editorValue ?? '',
429+
highlightedLines: [],
430+
breakpoints: [],
431+
githubSaveInfo: { repoName: '', filePath: '' }
432+
}
433+
],
427434
programPrependValue: options.programPrependValue ?? '',
428435
programPostpendValue: options.programPostpendValue ?? '',
429436
editorTestcases: options.editorTestcases ?? []

src/commons/controlBar/ControlBarToggleFolderModeButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const ControlBarToggleFolderModeButton: React.FC<Props> = ({
3232
iconColor: isFolderModeEnabled ? Colors.BLUE4 : undefined
3333
}}
3434
onClick={toggleFolderMode}
35-
isDisabled ={false}
35+
isDisabled={false}
3636
//isDisabled={isSessionActive || isPersistenceActive}
3737
/>
3838
</Tooltip2>

src/commons/controlBar/github/ControlBarGitHubButtons.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { Popover2, Tooltip2 } from '@blueprintjs/popover2';
44
import { Octokit } from '@octokit/rest';
55
import React from 'react';
66
import { useResponsive } from 'src/commons/utils/Hooks';
7+
import { PersistenceFile } from 'src/features/persistence/PersistenceTypes';
78

89
import { GitHubSaveInfo } from '../../../features/github/GitHubTypes';
910
import ControlButton from '../../ControlButton';
10-
import { PersistenceFile } from 'src/features/persistence/PersistenceTypes';
1111

1212
type Props = {
1313
isFolderModeEnabled: boolean;
@@ -39,7 +39,8 @@ export const ControlBarGitHubButtons: React.FC<Props> = props => {
3939
const hasFilePath = filePath !== '';
4040
const hasOpenFile = isLoggedIn && hasFilePath;
4141

42-
const mainButtonDisplayText = (props.currPersistenceFile && props.currPersistenceFile.name) || 'GitHub';
42+
const mainButtonDisplayText =
43+
(props.currPersistenceFile && hasOpenFile && props.currPersistenceFile.name) || 'GitHub';
4344
let mainButtonIntent: Intent = Intent.NONE;
4445
if (hasOpenFile) {
4546
mainButtonIntent = props.isDirty ? Intent.WARNING : Intent.PRIMARY;

src/commons/fileSystem/FileSystemActions.ts

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ import { createAction } from '@reduxjs/toolkit';
22
import { FSModule } from 'browserfs/dist/node/core/FS';
33
import { PersistenceFile } from 'src/features/persistence/PersistenceTypes';
44

5-
import {
5+
import {
66
ADD_GITHUB_SAVE_INFO,
77
ADD_PERSISTENCE_FILE,
88
DELETE_ALL_GITHUB_SAVE_INFO,
9-
DELETE_ALL_PERSISTENCE_FILES, DELETE_GITHUB_SAVE_INFO,
10-
DELETE_PERSISTENCE_FILE,
9+
DELETE_ALL_PERSISTENCE_FILES,
10+
DELETE_GITHUB_SAVE_INFO,
11+
DELETE_PERSISTENCE_FILE,
1112
SET_IN_BROWSER_FILE_SYSTEM,
12-
SET_PERSISTENCE_FILE_LAST_EDIT_BY_PATH,
13-
UPDATE_PERSISTENCE_FILE_PATH_AND_NAME_BY_PATH,
13+
SET_PERSISTENCE_FILE_LAST_EDIT_BY_PATH,
1414
UPDATE_LAST_EDITED_FILE_PATH,
15-
UPDATE_REFRESH_FILE_VIEW_KEY,
16-
UPDATE_PERSISTENCE_FOLDER_PATH_AND_NAME_BY_PATH} from './FileSystemTypes';
15+
UPDATE_PERSISTENCE_FILE_PATH_AND_NAME_BY_PATH,
16+
UPDATE_PERSISTENCE_FOLDER_PATH_AND_NAME_BY_PATH,
17+
UPDATE_REFRESH_FILE_VIEW_KEY
18+
} from './FileSystemTypes';
1719

1820
export const setInBrowserFileSystem = createAction(
1921
SET_IN_BROWSER_FILE_SYSTEM,
@@ -22,55 +24,56 @@ export const setInBrowserFileSystem = createAction(
2224

2325
export const addGithubSaveInfo = createAction(
2426
ADD_GITHUB_SAVE_INFO,
25-
(persistenceFile: PersistenceFile) => ({ payload: { persistenceFile }})
27+
(persistenceFile: PersistenceFile) => ({ payload: { persistenceFile } })
2628
);
2729

2830
export const deleteGithubSaveInfo = createAction(
2931
DELETE_GITHUB_SAVE_INFO,
30-
(persistenceFile : PersistenceFile) => ({ payload: persistenceFile })
32+
(persistenceFile: PersistenceFile) => ({ payload: persistenceFile })
3133
);
3234

33-
export const deleteAllGithubSaveInfo = createAction(
34-
DELETE_ALL_GITHUB_SAVE_INFO,
35-
() => ({ payload: {} })
36-
);
35+
export const deleteAllGithubSaveInfo = createAction(DELETE_ALL_GITHUB_SAVE_INFO, () => ({
36+
payload: {}
37+
}));
3738

3839
export const addPersistenceFile = createAction(
3940
ADD_PERSISTENCE_FILE,
40-
( persistenceFile: PersistenceFile ) => ({ payload: persistenceFile })
41+
(persistenceFile: PersistenceFile) => ({ payload: persistenceFile })
4142
);
4243

4344
export const deletePersistenceFile = createAction(
4445
DELETE_PERSISTENCE_FILE,
45-
( persistenceFile: PersistenceFile ) => ({ payload: persistenceFile })
46+
(persistenceFile: PersistenceFile) => ({ payload: persistenceFile })
4647
);
4748

4849
export const updatePersistenceFilePathAndNameByPath = createAction(
4950
UPDATE_PERSISTENCE_FILE_PATH_AND_NAME_BY_PATH,
50-
(oldPath: string, newPath: string, newFileName: string) => ({ payload: {oldPath, newPath, newFileName}})
51+
(oldPath: string, newPath: string, newFileName: string) => ({
52+
payload: { oldPath, newPath, newFileName }
53+
})
5154
);
5255

5356
export const updatePersistenceFolderPathAndNameByPath = createAction(
5457
UPDATE_PERSISTENCE_FOLDER_PATH_AND_NAME_BY_PATH,
55-
(oldPath: string, newPath: string, oldFolderName: string, newFolderName: string) => ({ payload: {oldPath, newPath, oldFolderName, newFolderName}})
58+
(oldPath: string, newPath: string, oldFolderName: string, newFolderName: string) => ({
59+
payload: { oldPath, newPath, oldFolderName, newFolderName }
60+
})
5661
);
5762

58-
export const deleteAllPersistenceFiles = createAction(
59-
DELETE_ALL_PERSISTENCE_FILES,
60-
() => ({ payload: {} })
61-
);
63+
export const deleteAllPersistenceFiles = createAction(DELETE_ALL_PERSISTENCE_FILES, () => ({
64+
payload: {}
65+
}));
6266

6367
export const setPersistenceFileLastEditByPath = createAction(
6468
SET_PERSISTENCE_FILE_LAST_EDIT_BY_PATH,
65-
(path: string, date: Date) => ({ payload: {path, date} })
69+
(path: string, date: Date) => ({ payload: { path, date } })
6670
);
6771

6872
export const updateLastEditedFilePath = createAction(
6973
UPDATE_LAST_EDITED_FILE_PATH,
70-
( lastEditedFilePath: string) => ({ payload: {lastEditedFilePath} })
74+
(lastEditedFilePath: string) => ({ payload: { lastEditedFilePath } })
7175
);
7276

73-
export const updateRefreshFileViewKey = createAction(
74-
UPDATE_REFRESH_FILE_VIEW_KEY,
75-
() => ({ payload: {} })
76-
);
77+
export const updateRefreshFileViewKey = createAction(UPDATE_REFRESH_FILE_VIEW_KEY, () => ({
78+
payload: {}
79+
}));

0 commit comments

Comments
 (0)