-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FormNavigationBlocker -> FormChangesTracker
useFormNavigationBlocking -> useDiscardFormChangesConfirmation Update exports from default to module
- Loading branch information
Showing
15 changed files
with
71 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
import ConfirmationModal from "./ConfirmationModal"; | ||
|
||
export default ConfirmationModal; | ||
export { ConfirmationModal }; | ||
export { ConfirmationModal } from "./ConfirmationModal"; |
25 changes: 25 additions & 0 deletions
25
airbyte-webapp/src/components/FormChangesTracker/index.tsx
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useLayoutEffect, useMemo } from "react"; | ||
import { uniqueId } from "lodash"; | ||
import { useLocation } from "react-router-dom"; | ||
|
||
import { useChangedFormsById } from "hooks/useDiscardFormChangesConfirmation"; | ||
|
||
interface Props { | ||
changed: boolean; | ||
} | ||
|
||
const FormChangesTracker: React.FC<Props> = ({ changed }) => { | ||
const location = useLocation(); | ||
const [changedFormsById, setChangedFormsById] = useChangedFormsById(); | ||
const id = useMemo(() => `${location.pathname}__${uniqueId("form_")}`, [location.pathname]); | ||
|
||
useLayoutEffect(() => { | ||
if (!!changedFormsById?.[id] !== changed) { | ||
setChangedFormsById({ ...changedFormsById, [id]: changed }); | ||
} | ||
}, [id, changed, setChangedFormsById, changedFormsById]); | ||
|
||
return null; | ||
}; | ||
|
||
export default FormChangesTracker; |
25 changes: 0 additions & 25 deletions
25
airbyte-webapp/src/components/FormNavigationBlocker/index.tsx
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
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,4 +1 @@ | ||
import ConfirmationModalService from "./ConfirmationModalService"; | ||
|
||
export default ConfirmationModalService; | ||
export { ConfirmationModalService }; | ||
export * from "./ConfirmationModalService"; |
4 changes: 2 additions & 2 deletions
4
airbyte-webapp/src/hooks/services/ConfirmationModal/reducer.ts
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,18 +1,18 @@ | ||
import React from "react"; | ||
|
||
export interface ConfirmationModal { | ||
export interface ConfirmationModalOptions { | ||
submitButtonText: React.ReactNode; | ||
title: React.ReactNode; | ||
text: React.ReactNode; | ||
onSubmit: () => Promise<void>; | ||
} | ||
|
||
export interface ConfirmationModalServiceApi { | ||
openConfirmationModal: (confirmationModal: ConfirmationModal) => void; | ||
openConfirmationModal: (confirmationModal: ConfirmationModalOptions) => void; | ||
closeConfirmationModal: () => void; | ||
} | ||
|
||
export interface ConfirmationModalState { | ||
isOpen: boolean; | ||
confirmationModal: ConfirmationModal | null; | ||
confirmationModal: ConfirmationModalOptions | null; | ||
} |
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