-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove modal from state, only use ModalOptions instead
- Loading branch information
Showing
17 changed files
with
55 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
import { stateAndDispatch } from "../state"; | ||
import { showModal } from "./showModal"; | ||
import { ConfirmationModalOptions } from "../types/modalOptions"; | ||
import * as Actions from "../state/actions"; | ||
|
||
export async function confirmAsync(title: string, message: string): Promise<boolean> { | ||
const { dispatch } = stateAndDispatch(); | ||
return new Promise<boolean>(resolve => { | ||
dispatch( | ||
Actions.setModalOptions({ | ||
modal: "confirmation", | ||
title, | ||
message, | ||
onCancel: () => resolve(false), | ||
onContinue: () => resolve(true), | ||
} as ConfirmationModalOptions) | ||
); | ||
showModal("confirmation"); | ||
showModal({ | ||
modal: "confirmation", | ||
title, | ||
message, | ||
onCancel: () => resolve(false), | ||
onContinue: () => resolve(true), | ||
} as ConfirmationModalOptions); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { stateAndDispatch } from "../state"; | ||
import * as Actions from "../state/actions"; | ||
import { ModalType } from "../types"; | ||
import { ModalOptions } from "../types/modalOptions"; | ||
|
||
export function showModal(modal: ModalType) { | ||
export function showModal(modal: ModalOptions) { | ||
const { dispatch } = stateAndDispatch(); | ||
dispatch(Actions.showModal(modal)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
import { ModalType } from "."; | ||
|
||
export interface ModalOptions { | ||
modal: ModalType; | ||
} | ||
|
||
export interface ConfirmationModalOptions extends ModalOptions { | ||
export type ConfirmationModalOptions = { | ||
modal: "confirmation"; | ||
title: string; | ||
message: string; | ||
onCancel: () => void; | ||
onContinue: () => void; | ||
} | ||
|
||
export interface BlockPickerOptions extends ModalOptions { | ||
export type BlockPickerOptions = { | ||
modal: "block-picker"; | ||
criteriaInstanceId: string; | ||
paramName: string; | ||
} | ||
|
||
export type CatalogDisplayOptions = { | ||
modal: "catalog-display"; | ||
} | ||
|
||
export type ImportRubricOptions = { | ||
modal: "import-rubric"; | ||
} | ||
|
||
export type ModalOptions = CatalogDisplayOptions | ImportRubricOptions | ConfirmationModalOptions | BlockPickerOptions; |