From 3153a42233b429424df8713959966cd2011164cf Mon Sep 17 00:00:00 2001 From: Nick Taras Date: Fri, 29 Sep 2023 11:44:03 +1000 Subject: [PATCH] added small ux to stop loading animation when user cancels auto load --- src/client/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client/index.ts b/src/client/index.ts index 9f03149e..c4d9e6c5 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -327,6 +327,7 @@ export class Client { this.tokenStore.clearCachedTokens() this.eventSender('connected-wallet', null) this.eventSender('disconnected-wallet', null) + localStorage.removeItem('tn-autoload-tokens') this.triggerUiUpdateCallback(UIUpdateEventType.WALLET_DISCONNECTED) } catch (e) { logger(2, 'Failed to disconnect wallet', e) @@ -518,7 +519,7 @@ export class Client { this.eventSender('tokens-loaded', { loadedCollections: Object.keys(this.tokenStore.getCurrentIssuers()).length }) } - cancelTokenAutoload() { + public cancelTokenAutoload() { this.cancelAutoload = true localStorage.setItem('tn-autoload-tokens', 'false') } @@ -1011,6 +1012,11 @@ export class Client { this.userCancelTokenAutoload = true this.cancelTokenAutoload() this.ui.dismissLoader() + // TODO implement communication (pub/sub events) + // to de-couple this logic for default and custom views to utilise. + document.querySelectorAll('.connect-btn-tn .lds-ellipsis').forEach((el) => { + el.parentElement.innerHTML = this.config.uiOptions?.loadAction ?? 'Load Collection' + }) } }) .catch((err) => {