-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add modal to confirm workflow draft version overriding #7758
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR introduces a confirmation modal for overriding existing workflow draft versions, enhancing user experience and preventing accidental data loss.
- Added
AdditionalButtons
prop toConfirmationModal
inpackages/twenty-front/src/modules/ui/layout/modal/components/ConfirmationModal.tsx
for flexible button configurations - Created new
OverrideWorkflowDraftConfirmationModal
component inpackages/twenty-front/src/modules/workflow/components/OverrideWorkflowDraftConfirmationModal.tsx
to handle draft override confirmations - Implemented Recoil state management for modal visibility in
packages/twenty-front/src/modules/workflow/states/openOverrideWorkflowDraftConfirmationModalState.ts
- Updated
RecordShowPageWorkflowVersionHeader
inpackages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsx
to integrate the new confirmation modal
4 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -138,6 +141,9 @@ export const ConfirmationModal = ({ | |||
title="Cancel" | |||
fullWidth | |||
/> | |||
|
|||
{AdditionalButtons} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider wrapping AdditionalButtons in a conditional to avoid rendering empty space when not provided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it can cause problems. If AdditionalButtons
equals undefined
, React will render nothing.
isOpen={openOverrideWorkflowDraftConfirmationModal} | ||
setIsOpen={setOpenOverrideWorkflowDraftConfirmationModal} | ||
title="A draft already exists" | ||
subtitle="A draft already exists for this workflow. Are you sure to erase it?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The subtitle grammar could be improved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed
subtitle="A draft already exists for this workflow. Are you sure to erase it?" | |
subtitle="A draft already exists for this workflow. Are you sure you want to erase it?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
...ages/twenty-front/src/modules/workflow/components/OverrideWorkflowDraftConfirmationModal.tsx
Show resolved
Hide resolved
@@ -46,6 +48,7 @@ export const RecordShowPageWorkflowVersionHeader = ({ | |||
skip: !isDefined(workflowVersion), | |||
limit: 1, | |||
}); | |||
const draftWorkflowVersion = draftWorkflowVersions[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Ensure draftWorkflowVersion is properly typed as WorkflowVersion | undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
await updateOneWorkflowVersion({ | ||
idToUpdate: draftWorkflowVersionId, | ||
updateOneRecordInput: workflowVersionUpdateInput, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you check with @Bonapara if we expect a redirection afterwards?
… the draft workflow version
67f6c9b
to
813526e
Compare
Thanks @Devessier for your contribution! |
In this PR:
<ConfirmationModal />
to take additional buttons to display between the cancel and the confirm buttons.A demo:
CleanShot.2024-10-16.at.17.01.13.mp4
Closes twentyhq/private-issues#114