Skip to content

Commit

Permalink
ui: Hide old errors on market page forms
Browse files Browse the repository at this point in the history
Some of the forms on the markets page would show an old error when
opening the form. This is now fixed.
  • Loading branch information
martonp authored and chappjc committed Jun 17, 2022
1 parent 43c933c commit 23150c8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 0 additions & 2 deletions client/webserver/site/src/js/dexsettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ export default class DexSettingsPage extends BasePage {

const closePopups = () => {
Doc.hide(page.forms)
page.exportSeedPW.value = ''
page.seedDiv.textContent = ''
}

Doc.bind(page.forms, 'mousedown', (e: MouseEvent) => {
Expand Down
4 changes: 3 additions & 1 deletion client/webserver/site/src/js/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -855,12 +855,14 @@ export class UnlockWalletForm {
bind(form, this.page.submitUnlock, () => this.submit())
}

setAsset (asset: SupportedAsset) {
refresh (asset: SupportedAsset) {
const page = this.page
this.currentAsset = asset
page.uwAssetLogo.src = Doc.logoPath(asset.symbol)
page.uwAssetName.textContent = asset.info.name
page.uwAppPass.value = ''
page.unlockErr.textContent = ''
Doc.hide(page.unlockErr)
const hidePWBox = State.passwordIsCached() || (this.pwCache && this.pwCache.pw)
if (hidePWBox) Doc.hide(page.uwAppPassBox)
else Doc.show(page.uwAppPassBox)
Expand Down
16 changes: 12 additions & 4 deletions client/webserver/site/src/js/markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export default class MarketsPage extends BasePage {
bindForm(page.cancelForm, page.cancelSubmit, async () => { this.submitCancel() })
// Order detail view
Doc.bind(page.vFeeDetails, 'click', () => this.showForm(page.vDetailPane))
Doc.bind(page.closeDetailPane, 'click', () => this.showForm(page.verifyForm))
Doc.bind(page.closeDetailPane, 'click', () => this.showVerifyForm())
// Bind active orders list's header sort events.
page.liveTable.querySelectorAll('[data-ordercol]')
.forEach((th: HTMLElement) => bind(th, 'click', () => setOrdersSortCol(th.dataset.ordercol || '')))
Expand Down Expand Up @@ -388,7 +388,7 @@ export default class MarketsPage extends BasePage {

// If the user clicks outside of a form, it should close the page overlay.
bind(page.forms, 'mousedown', (e: MouseEvent) => {
if (Doc.isDisplayed(page.vDetailPane) && !Doc.mouseInElement(e, page.vDetailPane)) return this.showForm(page.verifyForm)
if (Doc.isDisplayed(page.vDetailPane) && !Doc.mouseInElement(e, page.vDetailPane)) return this.showVerifyForm()
if (!Doc.mouseInElement(e, this.currentForm)) {
closePopups()
}
Expand Down Expand Up @@ -1354,7 +1354,7 @@ export default class MarketsPage extends BasePage {
const page = this.page
this.openAsset = asset
this.openFunc = f
this.unlockForm.setAsset(app().assets[asset.id])
this.unlockForm.refresh(app().assets[asset.id])
this.showForm(page.unlockWalletForm)
page.uwAppPass.focus()
}
Expand Down Expand Up @@ -1428,7 +1428,7 @@ export default class MarketsPage extends BasePage {
page.vSubmit.classList.add(buyBtnClass)
page.vSubmit.classList.remove(sellBtnClass)
}
this.showForm(page.verifyForm)
this.showVerifyForm()
page.vPass.focus()

if (baseAsset.wallet.open && quoteAsset.wallet.open) this.preOrder(order)
Expand All @@ -1439,6 +1439,13 @@ export default class MarketsPage extends BasePage {
}
}

/* showVerifyForm displays form to verify an order */
async showVerifyForm () {
const page = this.page
Doc.hide(page.vErr)
this.showForm(page.verifyForm)
}

/*
* submitEstimateUnlock reads the current vUnlockPass and unlocks any locked
* wallets.
Expand Down Expand Up @@ -1611,6 +1618,7 @@ export default class MarketsPage extends BasePage {
const asset = OrderUtil.isMarketBuy(order) ? this.market.quote : this.market.base
page.cancelRemain.textContent = Doc.formatCoinValue(remaining, asset.info.unitinfo)
page.cancelUnit.textContent = asset.symbol.toUpperCase()
Doc.hide(page.cancelErr)
this.showForm(page.cancelForm)
page.cancelPass.focus()
this.cancelData = {
Expand Down
2 changes: 1 addition & 1 deletion client/webserver/site/src/js/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export default class WalletsPage extends BasePage {
const page = this.page
this.openAsset = this.lastFormAsset = assetID
await this.hideBox()
this.unlockForm.setAsset(app().assets[assetID])
this.unlockForm.refresh(app().assets[assetID])
if (errorMsg) this.unlockForm.showErrorOnly(errorMsg)
this.animation = this.showBox(page.unlockWalletForm, page.walletPass)
}
Expand Down

0 comments on commit 23150c8

Please sign in to comment.