Skip to content

Conversation

@kunal-595
Copy link
Contributor

fixes #944
Added a confirmation modal for locking the wallet to prevent accidental actions. Integrated the modal into the settings page and app navbar, with a toggle in settings to enable/disable it. .

Copilot AI review requested due to automatic review settings January 20, 2026 08:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a confirmation modal for the lock wallet action to prevent accidental wallet locking, along with a settings toggle to enable or disable this confirmation. The feature is integrated into both the settings page and the app navbar.

Changes:

  • Added showLockWalletConfirmation boolean setting to the jam settings store (defaults to true)
  • Created a new LockWalletConfirmDialog component that displays warnings when maker is running or coinjoin is in progress
  • Integrated the confirmation modal into both the SettingsPage and AppNavbar components with lock wallet flow modifications
  • Added translation key for the new settings toggle

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/store/jamSettingsStore.ts Added showLockWalletConfirmation boolean property with default value of true
src/i18n/locales/en/translation.json Added translation key show_lock_confirmation for the settings toggle label
src/components/settings/LockWalletConfirmDialog.tsx New dialog component displaying lock wallet confirmation with contextual warnings for active maker or coinjoin
src/components/settings/SettingsPage.tsx Integrated confirmation modal, added settings toggle, and modified lock wallet handler to check confirmation setting
src/components/layout/AppNavbar.tsx Integrated confirmation modal and modified lock wallet button to check confirmation setting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +174 to +178
const onClickLockWallet = () => {
if (showLockWalletConfirmation) {
setShowLockWalletDialog(true)
} else {
handleLockWallet()
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The onClickLockWallet function should be async and should await the call to handleLockWallet() on line 178 to ensure proper error handling. Currently, if handleLockWallet() fails when the confirmation is disabled, the error would be silently ignored. The SettingsPage implementation correctly uses await for this call.

Suggested change
const onClickLockWallet = () => {
if (showLockWalletConfirmation) {
setShowLockWalletDialog(true)
} else {
handleLockWallet()
const onClickLockWallet = async () => {
if (showLockWalletConfirmation) {
setShowLockWalletDialog(true)
} else {
await handleLockWallet()

Copilot uses AI. Check for mistakes.
Comment on lines +164 to +180
const handleLockWallet = async () => {
try {
setIsLockingWallet(true)
await onLockWallet(navigate, t)
} finally {
setIsLockingWallet(false)
setShowLockWalletDialog(false)
}
}

const onClickLockWallet = () => {
if (showLockWalletConfirmation) {
setShowLockWalletDialog(true)
} else {
handleLockWallet()
}
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is significant code duplication between this implementation and the identical logic in SettingsPage.tsx (lines 62-78). Consider extracting the handleLockWallet and onClickLockWallet functions into a shared custom hook (e.g., useWalletLocking) to reduce duplication and ensure consistent behavior across both components.

Copilot uses AI. Check for mistakes.
@theborakompanioni
Copy link
Collaborator

Looks nice!

I think the confirmation dialog should only be shown when a service is active (earn, send, sweep) and does not need a dedicated setting.
Also what about handling the dialog in App instead of AppNavbar and Settings?

I'd merge it nonetheless - these things can be done in follow-up PRs. What do you think?

@kunal-595
Copy link
Contributor Author

agreed, let's merge and iterate

you are right on both points:

Conditional dialog: The setting is unnecessary we should just check maker_running || coinjoin_in_process and show the dialog only when services are active simpler UX, less configuration.
centralize in App: Currently duplicated in AppNavbar and SettingsPage with identical logic moving to App.tsx elimnates that and makes it easier to trigger from anywhere

i will create follow-up issus for both:

remove the setting and make dialog conditional on service state
hoist dialog to App with a useLockWallet hook or context
Should be strightforward refactors without breaking existing behavior i can take these on unless you prefer to handle them

thanks for the review

@theborakompanioni theborakompanioni merged commit 5a79d2b into joinmarket-webui:v2 Jan 21, 2026
8 of 9 checks passed
@theborakompanioni
Copy link
Collaborator

theborakompanioni commented Jan 21, 2026

agreed, let's merge and iterate

Done. 🧡

remove the setting and make dialog conditional on service state hoist dialog to App with a useLockWallet hook or context Should be strightforward refactors without breaking existing behavior i can take these on unless you prefer to handle them

Yeah, I will handle it so you can focus on other stuff if you want 🙏
Still so much to do for v2!

Edit: See #1011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants