Skip to content
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

Alert pop up changes #512

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading