Skip to content

Commit edaeb01

Browse files
Merge branch 'folders-public-wip' of github.com:source-academy/frontend into folders-public-wip
2 parents 327fdb3 + afbab53 commit edaeb01

File tree

6 files changed

+496
-359
lines changed

6 files changed

+496
-359
lines changed

src/commons/application/ApplicationTypes.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,11 @@ export const createDefaultWorkspace = (workspaceLocation: WorkspaceLocation): Wo
401401
});
402402

403403
const defaultFileName = 'program.js';
404+
const defaultTopLevelFolderName = 'proj';
404405
export const getDefaultFilePath = (workspaceLocation: WorkspaceLocation) =>
405-
`${WORKSPACE_BASE_PATHS[workspaceLocation]}/${defaultFileName}`;
406+
`${WORKSPACE_BASE_PATHS[workspaceLocation]}/${defaultTopLevelFolderName}/${defaultFileName}`;
406407

407-
export const defaultWorkspaceManager: WorkspaceManagerState = { // TODO default
408+
export const defaultWorkspaceManager: WorkspaceManagerState = {
408409
assessment: {
409410
...createDefaultWorkspace('assessment'),
410411
currentAssessment: undefined,

src/commons/controlBar/ControlBarGoogleDriveButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const ControlBarGoogleDriveButtons: React.FC<Props> = props => {
7474
icon={IconNames.DOUBLE_CHEVRON_UP}
7575
onClick={props.onClickSaveAll}
7676
// disable if persistenceObject is not a folder
77-
isDisabled={props.currentObject ? props.currentObject.isFolder ? false : true : true}
77+
isDisabled={props.accessToken ? false : true}
7878
/>
7979
);
8080

src/commons/fileSystem/FileSystemReducer.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,6 @@ export const FileSystemReducer: Reducer<FileSystemState, SourceActionType> = cre
104104
})
105105
.addCase(updatePersistenceFolderPathAndNameByPath, (state, action) => {
106106
const filesState = state['persistenceFileArray'];
107-
//const persistenceFileFindIndex = filesState.findIndex(e => e.path === action.payload.oldPath);
108-
console.log(action.payload);
109-
filesState.forEach(e => console.log(e.path));
110-
// if (persistenceFileFindIndex === -1) {
111-
// return;
112-
// }
113107
// get current level of folder
114108
const regexResult = /^(.*[\\\/])?(\.*.*?)(\.[^.]+?|)$/.exec(action.payload.newPath)!;
115109

src/commons/sagas/GitHubPersistenceSaga.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ function* githubSaveAll(): any {
293293
}
294294

295295
function* githubCreateFile({ payload }: ReturnType<typeof actions.githubCreateFile>): any {
296-
yield call(store.dispatch, actions.disableFileSystemContextMenus());
296+
//yield call(store.dispatch, actions.disableFileSystemContextMenus());
297297

298298
const filePath = payload;
299299

@@ -338,7 +338,7 @@ function* githubCreateFile({ payload }: ReturnType<typeof actions.githubCreateFi
338338
}
339339

340340
function* githubDeleteFile({ payload }: ReturnType<typeof actions.githubDeleteFile>): any {
341-
yield call(store.dispatch, actions.disableFileSystemContextMenus());
341+
//yield call(store.dispatch, actions.disableFileSystemContextMenus());
342342

343343
const filePath = payload;
344344

@@ -377,7 +377,7 @@ function* githubDeleteFile({ payload }: ReturnType<typeof actions.githubDeleteFi
377377
}
378378

379379
function* githubDeleteFolder({ payload }: ReturnType<typeof actions.githubDeleteFolder>): any {
380-
yield call(store.dispatch, actions.disableFileSystemContextMenus());
380+
//yield call(store.dispatch, actions.disableFileSystemContextMenus());
381381

382382
const filePath = payload;
383383

@@ -415,7 +415,7 @@ function* githubDeleteFolder({ payload }: ReturnType<typeof actions.githubDelete
415415
}
416416

417417
function* githubRenameFile({ payload }: ReturnType<typeof actions.githubRenameFile>): any {
418-
yield call(store.dispatch, actions.disableFileSystemContextMenus());
418+
//yield call(store.dispatch, actions.disableFileSystemContextMenus());
419419

420420
const newFilePath = payload.newFilePath;
421421
const oldFilePath = payload.oldFilePath;
@@ -456,7 +456,7 @@ function* githubRenameFile({ payload }: ReturnType<typeof actions.githubRenameFi
456456
}
457457

458458
function* githubRenameFolder({ payload }: ReturnType<typeof actions.githubRenameFile>): any {
459-
yield call(store.dispatch, actions.disableFileSystemContextMenus());
459+
//yield call(store.dispatch, actions.disableFileSystemContextMenus());
460460

461461
const newFilePath = payload.newFilePath;
462462
const oldFilePath = payload.oldFilePath;

0 commit comments

Comments
 (0)