From 11183a34753f1f608952740f62b24b6397eabeac Mon Sep 17 00:00:00 2001 From: Michael Wallace Date: Thu, 26 Oct 2023 22:51:41 +1100 Subject: [PATCH] feat: add card button hiding & various fixes --- javascript/engine-js/src/TokenScript.ts | 2 +- javascript/engine-js/src/tokenScript/Card.ts | 4 ++++ .../src/components/common/card-view/card-popover.tsx | 2 +- .../tokenscript-viewer/src/integration/discoveryAdapter.ts | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/javascript/engine-js/src/TokenScript.ts b/javascript/engine-js/src/TokenScript.ts index 0891f8fc..180c6e07 100644 --- a/javascript/engine-js/src/TokenScript.ts +++ b/javascript/engine-js/src/TokenScript.ts @@ -271,7 +271,7 @@ export class TokenScript { public getCards(tokenOrigin?: string): Card[] { if (!tokenOrigin) - tokenOrigin = this.getCurrentTokenContext().originId; + tokenOrigin = this.getCurrentTokenContext()?.originId; if (!this.cards) { diff --git a/javascript/engine-js/src/tokenScript/Card.ts b/javascript/engine-js/src/tokenScript/Card.ts index 2718287d..a3ad6f7f 100644 --- a/javascript/engine-js/src/tokenScript/Card.ts +++ b/javascript/engine-js/src/tokenScript/Card.ts @@ -77,6 +77,10 @@ export class Card { return this.view.getAttribute("urlFragment") } + get uiButton() { + return this.view.hasAttribute("uiButton") ? (this.view.getAttribute("uiButton") === 'true') : true; + } + /** * Determines whether the view is to be loaded from a URL or from embedded content in ts:view */ diff --git a/javascript/tokenscript-viewer/src/components/common/card-view/card-popover.tsx b/javascript/tokenscript-viewer/src/components/common/card-view/card-popover.tsx index d0e71d2b..6882cd13 100644 --- a/javascript/tokenscript-viewer/src/components/common/card-view/card-popover.tsx +++ b/javascript/tokenscript-viewer/src/components/common/card-view/card-popover.tsx @@ -193,7 +193,7 @@ export class CardPopover implements IViewBinding { sandbox="allow-scripts allow-modals allow-forms allow-popups"> -
+
diff --git a/javascript/tokenscript-viewer/src/integration/discoveryAdapter.ts b/javascript/tokenscript-viewer/src/integration/discoveryAdapter.ts index 160b1850..51da0e03 100644 --- a/javascript/tokenscript-viewer/src/integration/discoveryAdapter.ts +++ b/javascript/tokenscript-viewer/src/integration/discoveryAdapter.ts @@ -9,8 +9,8 @@ import {Contract, ethers} from "ethers"; const COLLECTION_CACHE_TTL = 86400; const TOKEN_CACHE_TTL = 3600; -export const BASE_TOKEN_DISCOVERY_URL = //'https://api.token-discovery.tokenscript.org' - 'http://localhost:3000' +export const BASE_TOKEN_DISCOVERY_URL = 'https://api.token-discovery.tokenscript.org'; + //'http://localhost:3000'; export class DiscoveryAdapter implements ITokenDiscoveryAdapter {