Skip to content

Commit

Permalink
added logic to manage showing of a rety txt btn when a collection fai…
Browse files Browse the repository at this point in the history
…ls to load.
  • Loading branch information
Nick Taras authored and Nick Taras committed Sep 22, 2023
1 parent 58fffe1 commit 2b7f150
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 13 additions & 1 deletion src/client/__tests__/selectIssuers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,19 @@ describe('select issuers spec', () => {
blockchain: 'evm',
},
],
options: {},
uiOptions: {
openingHeading:
"Open a new world of perks, benefits and opportunities with your attestation, collectible or token.",
issuerHeading: "Get discount with Ticket",
repeatAction: "Retry",
dismissAction: 'Dismiss',
loadAction: 'Load Collection',
noTokensFoundEvent: 'No Tokens Found',
balancesFoundEvent: 'Balance Found',
nftsFoundEvent: 'Token(s) Found',
openingAction: "Let's Go!",
position: "top-right",
},
})
}

Expand Down
6 changes: 3 additions & 3 deletions src/client/views/select-issuers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ export class SelectIssuers extends AbstractView {
issuerConnectMarkup(title: string, image: string | undefined, issuer: string, tokens: any[], data: Issuer) {
let buttonText = ''
const collectLoadAttempts = this.client.getTokenStore().getCollectionLoadAttempts(issuer);
let issuerButtonText = this.params.options.loadAction ?? "Load Collection";
if (collectLoadAttempts >= 1) issuerButtonText = this.params.options.repeatAction ?? 'Retry';
let issuerButtonText = this.params.options?.loadAction ?? "Load Collection";
if (collectLoadAttempts >= 1) issuerButtonText = this.params.options?.repeatAction ?? 'Retry';
// @ts-ignore
if (tokens?.length) buttonText = data?.fungible ? this.params.options.balanceFoundEvent ?? 'Balance found' : `${tokens.length} ${this.params.options?.nftsFoundEvent ?? 'Token(s) Available'}`
if (tokens?.length) buttonText = data?.fungible ? this.params.options?.balanceFoundEvent ?? 'Balance found' : `${tokens.length} ${this.params.options?.nftsFoundEvent ?? 'Token(s) Available'}`
return `
<li class="issuer-connect-banner-tn" data-issuer="${issuer}" role="menuitem">
<div tabindex="0" style="display: flex; align-items: center;">
Expand Down

0 comments on commit 2b7f150

Please sign in to comment.