Skip to content

Commit d64d158

Browse files
Add visible selection, update text and tidy assets
1 parent 66a09ac commit d64d158

File tree

8 files changed

+20
-10
lines changed

8 files changed

+20
-10
lines changed

javascript/engine-js/src/repo/sources/RegistryScriptURI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {ResolvedScriptData, ScriptInfo, SourceInterface} from "./SourceInterface";
22
import {TokenScriptEngine, ScriptSourceType} from "../../Engine";
33

4-
const HOLESKY_DEV_7738 = "0x29a27A5D74Fe8ff01E2dA8b9fC64061A3DFBEe14";
4+
const HOLESKY_DEV_7738 = "0x0077380bCDb2717C9640e892B9d5Ee02Bb5e0682";
55
const HOLESKY_ID = 17000; // TODO: Source this from engine
66
const cacheTimeout = 60 * 1000; // 1 minute cache validity
77

-3.28 KB
Binary file not shown.
-5.87 KB
Binary file not shown.

javascript/tokenscript-viewer/src/components.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ export namespace Components {
198198
"imageUrl": string;
199199
"name": string;
200200
"onRemove"?: (tsId: string) => Promise<void>;
201+
"selected": boolean;
201202
"tokenScript"?: TokenScript1;
202203
"tsId": string;
203204
}
@@ -947,6 +948,7 @@ declare namespace LocalJSX {
947948
"imageUrl"?: string;
948949
"name"?: string;
949950
"onRemove"?: (tsId: string) => Promise<void>;
951+
"selected"?: boolean;
950952
"tokenScript"?: TokenScript1;
951953
"tsId"?: string;
952954
}

javascript/tokenscript-viewer/src/components/common/tokenscript-grid/tokenscript-button.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
opacity: 0.6;
2929
}
3030

31+
.ts-button.selected {
32+
border: 2px solid blue; /* Add fine blue line */
33+
}
34+
3135
.ts-details {
3236
padding: 10px;
3337
flex-grow: 1;

javascript/tokenscript-viewer/src/components/common/tokenscript-grid/tokenscript-button.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export class TokenscriptButton {
2323
@State()
2424
subText: string;
2525

26+
@Prop({mutable: true})
27+
selected: boolean = false;
28+
2629
@Prop()
2730
imageUrl: string;
2831

@@ -61,7 +64,7 @@ export class TokenscriptButton {
6164

6265
render(){
6366
return (
64-
<Host class={"ts-button" + (this.enabled && (!this.onRemove || this.tokenScript) ? '' : ' disabled')}
67+
<Host class={"ts-button" + (this.selected ? ' selected' : '') + (this.enabled && (!this.onRemove || this.tokenScript) ? '' : ' disabled')}
6568
title={this.name}
6669
style={{cursor: this.enabled && (!this.onRemove || this.tokenScript) ? 'pointer' : 'not-allowed'}}>
6770
<token-icon src={this.imageUrl} imageTitle={this.name}/>

javascript/tokenscript-viewer/src/components/viewers/new/add/script-select-dialog.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,32 @@ export class ScriptSelectDialog {
2424

2525
let scriptData = this.scripts;
2626
let buttons = [];
27-
28-
// TODO: Add this same component on viewer-popover too
29-
// Which is currently selected?
30-
//let currentSelection = this.tokenScript.getSourceInfo().scriptInfo?.scriptId;
3127
let currentSelection;
3228

29+
const query = new URLSearchParams(document.location.search.substring(1));
30+
if (query.has("scriptId")) {
31+
currentSelection = query.get("scriptId");
32+
}
3333
//populate with script data
3434
for (let i = 0; i < scriptData?.length; i++) {
3535
let script = scriptData[i];
3636
buttons.push({
3737
icon: script.icon?.length > 0 ? script.icon : "assets/icon/blueTS.svg",
3838
name: script.name,
39-
selected: scriptData[i].scriptId == currentSelection ? "assets/icon/circlecr.png" : "assets/icon/uncel2s.png"
39+
selected: scriptData[i].scriptId == currentSelection
4040
});
4141
}
4242

4343
return (
4444
<Host>
4545
<popover-dialog ref={(el) => this.dialog = el as HTMLPopoverDialogElement} dialogStyles={{ background: "#fff !important", color: "#000 !important" }}>
46-
<p>Select from the available TApps for this contract below</p>
46+
<p>Select from the available tapps for this contract below</p>
4747
<div class="select-list">
48-
{this.scripts.map((script, index) => {
48+
{buttons.map((script, index) => {
4949
return <tokenscript-button
5050
name={script.name}
5151
imageUrl={script.icon}
52+
selected={script.selected}
5253
onClick={() => {
5354
this.onScriptSelect(this.scripts[index]);
5455
this.dialog.closeDialog();

javascript/tokenscript-viewer/src/components/viewers/new/viewer-popover/viewer-popover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export class ViewerPopover {
211211
<div class="view-toolbar-buttons">
212212
{this.otherScripts?.length > 1 ? <button class="btn btn-secondary" style={{marginRight: "15px", minWidth: "35px", fontSize: "16px"}} onClick={async () =>{
213213
this.showScriptSelector.emit(this.otherScripts);
214-
}}>Other TApps</button> : ''}
214+
}}>Other tapps</button> : ''}
215215
<share-to-tg-button></share-to-tg-button>
216216
<security-status tokenScript={this.tokenScript}/>
217217
<div>

0 commit comments

Comments
 (0)