Skip to content

Commit 247a376

Browse files
Merge branch 'folders-public-wip' of github.com:source-academy/frontend into folders-public-wip
2 parents 913a17f + f3423a3 commit 247a376

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/commons/controlBar/ControlBarGoogleDriveButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const ControlBarGoogleDriveButtons: React.FC<Props> = props => {
6565
label="Save As"
6666
icon={IconNames.SEND_TO}
6767
onClick={props.onClickSaveAs}
68-
isDisabled={props.accessToken ? false : true}
68+
isDisabled={props.accessToken ? props.isFolderModeEnabled : true}
6969
/>
7070
);
7171
const saveAllButton = (

src/commons/sagas/PersistenceSaga.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -555,13 +555,13 @@ export function* persistenceSaga(): SagaIterator {
555555
yield takeEvery(
556556
PERSISTENCE_SAVE_FILE,
557557
function* ({ payload: { id, name } }: ReturnType<typeof actions.persistenceSaveFile>) {
558+
yield call(store.dispatch, actions.disableFileSystemContextMenus());
558559
let toastKey: string | undefined;
559560

560561
const [currFolderObject] = yield select( // TODO resolve type here?
561562
(state: OverallState) => [
562563
state.playground.persistenceFile
563-
]
564-
);
564+
]);
565565

566566
yield call(ensureInitialisedAndAuthorised);
567567

@@ -576,11 +576,6 @@ export function* persistenceSaga(): SagaIterator {
576576
);
577577

578578
try {
579-
toastKey = yield call(showMessage, {
580-
message: `Saving as ${name}...`,
581-
timeout: 0,
582-
intent: Intent.PRIMARY
583-
});
584579

585580
if (activeEditorTabIndex === null) {
586581
throw new Error('No active editor tab found.');
@@ -599,13 +594,25 @@ export function* persistenceSaga(): SagaIterator {
599594
if (!currPersistenceFile) {
600595
throw new Error('Persistence file not found');
601596
}
597+
toastKey = yield call(showMessage, {
598+
message: `Saving as ${currPersistenceFile.name}...`,
599+
timeout: 0,
600+
intent: Intent.PRIMARY
601+
});
602602
yield call(updateFile, currPersistenceFile.id, currPersistenceFile.name, MIME_SOURCE, code, config);
603603
currPersistenceFile.lastSaved = new Date();
604604
yield put(actions.addPersistenceFile(currPersistenceFile));
605-
yield call(showSuccessMessage, `${name} successfully saved to Google Drive.`, 1000);
605+
yield call(store.dispatch, actions.updateRefreshFileViewKey());
606+
yield call(showSuccessMessage, `${currPersistenceFile.name} successfully saved to Google Drive.`, 1000);
606607
return;
607608
}
608609

610+
toastKey = yield call(showMessage, {
611+
message: `Saving as ${name}...`,
612+
timeout: 0,
613+
intent: Intent.PRIMARY
614+
});
615+
609616
yield call(updateFile, id, name, MIME_SOURCE, code, config);
610617
yield put(actions.playgroundUpdatePersistenceFile({ id, name, lastSaved: new Date() }));
611618
yield call(showSuccessMessage, `${name} successfully saved to Google Drive.`, 1000);
@@ -616,6 +623,7 @@ export function* persistenceSaga(): SagaIterator {
616623
if (toastKey) {
617624
dismiss(toastKey);
618625
}
626+
yield call(store.dispatch, actions.enableFileSystemContextMenus());
619627
}
620628
}
621629
);

0 commit comments

Comments
 (0)