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

fix(bridge-ui): fix issue with claim notice modal #13507

Merged
merged 3 commits into from
Mar 30, 2023
Merged
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
19 changes: 17 additions & 2 deletions packages/bridge-ui/src/components/modals/NoticeModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
noShowAgainCheckbox = noShowAgainStorage;
});

function closeAndContinue() {
show = false;
onConfirm?.(noShowAgainCheckbox);
}

function onConfirmNotice() {
if (noShowAgainCheckbox) {
// If checkbox is checked, store it in localStorage so
Expand All @@ -29,9 +34,19 @@
noShowAgainStorage = true;
}

show = false;
closeAndContinue();
}

onConfirm?.(noShowAgainCheckbox);
// It could happen that the modal is being opened via prop, but the user
// already opted out of seeing the message (we have localStorage set).
// In that case, we still want to run the onConfirm callback, which contains
// the next steps in the flow, also setting the prop back to false
// (could be bound to the parent)
// TODO: use promises here. API to open the modal should return a promise
// which resolves when the user clicks on confirm. If noShowAgain is set
// to true, the promise should resolve immediately.
$: if (show && noShowAgainStorage) {
closeAndContinue();
}
</script>

Expand Down