Skip to content

Commit

Permalink
feat: Added dialog suggesting auto correction on start of correction
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkoelle committed Jun 30, 2021
1 parent 9219e3b commit 4be4de2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 77 deletions.
75 changes: 0 additions & 75 deletions app/components/ConfirmDialog.tsx

This file was deleted.

5 changes: 4 additions & 1 deletion app/dialogs/OverwriteSchemaDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export function onInitializeSheet(
dispatch(save());
}

showModal(ConfirmationDialog, StartCorrectionDialog(selectedSheet));
showModal(
ConfirmationDialog,
StartCorrectionDialog(showModal, selectedSheet)
);
}

const OverwriteSchemaDialog = (
Expand Down
8 changes: 7 additions & 1 deletion app/dialogs/StartCorrectionDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { correctionPageSetSheetId } from '../model/CorrectionPageSlice';
import { setTabIndex } from '../model/HomeSlice';
import SheetEntity from '../model/SheetEntity';
import ConfirmationDialog from './ConfirmationDialog';
import SuggestAutoCorrectionDialog from './SuggestAutoCorrectionDialog';

const StartCorrectionDialog = (selectedSheet: SheetEntity | undefined) => {
const StartCorrectionDialog = (showModal, selectedSheet: SheetEntity) => {
const onStartCorrection = (dispatch) => {
if (selectedSheet?.id !== undefined) {
dispatch(correctionPageSetSheetId(selectedSheet?.id));
dispatch(setTabIndex(3));
showModal(
ConfirmationDialog,
SuggestAutoCorrectionDialog(showModal, selectedSheet)
);
}
};

Expand Down
14 changes: 14 additions & 0 deletions app/dialogs/SuggestAutoCorrectionDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import AutoCorrectionModal from '../modals/AutoCorrectionModal';
import SheetEntity from '../model/SheetEntity';

const SuggestAutoCorrectionDialog = (showModal, sheet: SheetEntity) => {
return {
title: 'Try auto correct single choice tasks?',
text: `Do you want to try to auto correct the single choice tasks?`,
onConfirm: () => {
showModal(AutoCorrectionModal, { sheetId: sheet.id });
},
};
};

export default SuggestAutoCorrectionDialog;

0 comments on commit 4be4de2

Please sign in to comment.