Skip to content

Commit

Permalink
Alert pop up changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RichGriff committed Jun 25, 2024
1 parent 91d61da commit 6d7aa63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions next_frontend/components/common/NodeEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,19 @@ const NodeEdit = ({ node, isOpen, setEditOpen }: NodeEditProps) => {
onClose={() => setDeleteOpen(false)}
onConfirm={handleDelete}
loading={loading}
confirmButtonText={'Delete'}
message={'Deleting this element will also remove all of the connected child elements. This cannot be undone.'}
confirmButtonText={'Yes, delete this element!'}
cancelButtonText={'No, keep the element'}
/>

<AlertModal
isOpen={alertOpen}
onClose={() => setAlertOpen(false)}
onConfirm={handleClose}
loading={loading}
message={'There are unresolved changes, continue to discard these changes.'}
confirmButtonText={'Discard Changes'}
message={'You have changes that have not been updated, would you like to discard these changes?'}
confirmButtonText={'Yes, discard changes!'}
cancelButtonText={'No, keep editing'}
/>
</>
)}
Expand Down
6 changes: 4 additions & 2 deletions next_frontend/components/modals/alertModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface AlertModalProps {
loading: boolean;
message?: string
confirmButtonText: string
cancelButtonText?: string | null
}

export const AlertModal: React.FC<AlertModalProps> = ({
Expand All @@ -20,7 +21,8 @@ export const AlertModal: React.FC<AlertModalProps> = ({
onConfirm,
loading,
message,
confirmButtonText
confirmButtonText,
cancelButtonText
}) => {
const [isMounted, setIsMounted] = useState(false);

Expand All @@ -41,7 +43,7 @@ export const AlertModal: React.FC<AlertModalProps> = ({
>
<div className="pt-6 space-x-2 flex items-center justify-end w-full">
<Button disabled={loading} variant="outline" onClick={onClose}>
Cancel
{cancelButtonText ? cancelButtonText : 'Cancel'}
</Button>
<Button disabled={loading} variant="destructive" onClick={onConfirm}>
{loading ? 'Deleting' : confirmButtonText}
Expand Down

0 comments on commit 6d7aa63

Please sign in to comment.