@@ -57,6 +57,8 @@ export class ViewerPopover {
57
57
private overflowCardButtons : JSX . Element [ ] ;
58
58
private overflowDialog : HTMLActionOverflowModalElement ;
59
59
60
+ @State ( )
61
+ private otherScripts : ScriptInfo [ ] ;
60
62
61
63
@Method ( )
62
64
async open ( tokenScript : TokenScript ) {
@@ -76,7 +78,7 @@ export class ViewerPopover {
76
78
try {
77
79
const enabled = await card . isEnabledOrReason ( ) ;
78
80
79
- console . log ( "Card enabled: " , enabled ) ;
81
+ // console.log("Card enabled: ", enabled);
80
82
81
83
if ( enabled === false )
82
84
continue ;
@@ -128,6 +130,21 @@ export class ViewerPopover {
128
130
location . search = params . toString ( ) ;
129
131
130
132
history . pushState ( undefined , undefined , location ) ;
133
+
134
+ await this . reloadOtherScripts ( ) ;
135
+ }
136
+
137
+ private async reloadOtherScripts ( ) {
138
+ this . otherScripts = null ;
139
+
140
+ if ( [ ScriptSourceType . SCRIPT_URI , ScriptSourceType . SCRIPT_REGISTRY ] . indexOf ( this . tokenScript . getSourceInfo ( ) . source ) === - 1 )
141
+ return ;
142
+
143
+ try {
144
+ this . otherScripts = await this . tokenScript . getEngine ( ) . resolveAllScripts ( this . tokenScript . getSourceInfo ( ) . tsId ) ;
145
+ } catch ( e ) {
146
+ console . warn ( e ) ;
147
+ }
131
148
}
132
149
133
150
private async showCard ( card : Card , token ?: TokenGridContext , cardIndex ?: number ) {
@@ -192,17 +209,9 @@ export class ViewerPopover {
192
209
< h3 > { this . tokenScript . getLabel ( 2 ) ?? this . tokenScript . getName ( ) } </ h3 >
193
210
</ div >
194
211
< div class = "view-toolbar-buttons" >
195
- < button class = "btn btn-secondary" style = { { marginRight : "15px" , minWidth : "35px" , fontSize : "16px" } } onClick = { async ( ) => {
196
- this . showLoader . emit ( ) ;
197
- try {
198
- const scripts = await this . tokenScript . getEngine ( ) . resolveAllScripts ( this . tokenScript . getSourceInfo ( ) . tsId ) ;
199
- this . showScriptSelector . emit ( scripts ) ;
200
- } catch ( e ) {
201
-
202
- }
203
- this . hideLoader . emit ( ) ;
204
-
205
- } } > Other TApps</ button >
212
+ { this . otherScripts ?. length > 1 ? < button class = "btn btn-secondary" style = { { marginRight : "15px" , minWidth : "35px" , fontSize : "16px" } } onClick = { async ( ) => {
213
+ this . showScriptSelector . emit ( this . otherScripts ) ;
214
+ } } > Other TApps</ button > : '' }
206
215
< share-to-tg-button > </ share-to-tg-button >
207
216
< security-status tokenScript = { this . tokenScript } />
208
217
< div >
0 commit comments