123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { useDialog } from '../providers/dialogs'
- type OpenWarningDialogArgs = {
- onCancel?: () => void
- onConfirm?: () => void
- }
- export const useDisplayDataLostWarning = () => {
- const [openDialog, closeDialog] = useDialog()
- const cancelDialog = (onCancel?: () => void) => {
- onCancel?.()
- }
- const openWarningDialog = ({ onCancel, onConfirm }: OpenWarningDialogArgs) => {
- openDialog({
- title: "Drafts' video & image data will be lost",
- description:
- "Drafts' assets aren't stored permanently. If you proceed, you will need to reselect the files again.",
- primaryButton: {
- text: 'Proceed',
- onClick: () => {
- onConfirm?.()
- closeDialog()
- },
- },
- secondaryButton: {
- text: 'Cancel',
- onClick: () => {
- cancelDialog(onCancel)
- closeDialog()
- },
- },
- onExitClick: () => {
- cancelDialog(onCancel)
- closeDialog()
- },
- variant: 'warning',
- })
- }
- return {
- openWarningDialog,
- }
- }
|