From 0bacb99ac10eb73d1a0d0241fd3f83f974670826 Mon Sep 17 00:00:00 2001 From: Donovan Solms <4567303+donovansolms@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:04:21 +0200 Subject: [PATCH 1/3] Fix sorting for price and minted on tokens page --- .../src/app/list-tokens/list-tokens.page.html | 6 +-- .../src/app/list-tokens/list-tokens.page.ts | 38 ++++++++++++++++++- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/list-tokens/list-tokens.page.html b/frontend/src/app/list-tokens/list-tokens.page.html index 362749da..f0f2310b 100644 --- a/frontend/src/app/list-tokens/list-tokens.page.html +++ b/frontend/src/app/list-tokens/list-tokens.page.html @@ -23,8 +23,8 @@ - @@ -42,7 +42,7 @@ # Name Ticker - Token Price + Token Price Minted diff --git a/frontend/src/app/list-tokens/list-tokens.page.ts b/frontend/src/app/list-tokens/list-tokens.page.ts index eb5122e2..93247666 100644 --- a/frontend/src/app/list-tokens/list-tokens.page.ts +++ b/frontend/src/app/list-tokens/list-tokens.page.ts @@ -11,6 +11,7 @@ import { TokenDecimalsPipe } from '../core/pipe/token-with-decimals.pipe'; import { ActivatedRoute, RouterLink } from '@angular/router'; import { TableModule } from 'primeng/table'; import { PriceService } from '../core/service/price.service'; +import { SortEvent } from 'primeng/api'; @Component({ selector: 'app-list-tokens', @@ -26,7 +27,7 @@ export class ListTokensPage implements OnInit { tokens: any = null; holdings: any = null; offset = 0; - limit = 500; + limit = 2000; lastFetchCount = 0; baseTokenPrice: number = 0; @@ -111,4 +112,39 @@ export class ListTokensPage implements OnInit { }); } + customSort(event: SortEvent) { + if (event.field == 'minted') { + event.data?.sort((data1, data2) => { + + let value1 = parseInt(data1["circulating_supply"]) / parseInt(data1["max_supply"]); + let value2 = parseInt(data2["circulating_supply"]) / parseInt(data2["max_supply"]); + let result = null; + + if (value1 == null && value2 != null) result = -1; + else if (value1 != null && value2 == null) result = 1; + else if (value1 == null && value2 == null) result = 0; + else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0; + + return event.order as number * result; + }); + + } + + event.data?.sort((data1, data2) => { + let value1 = data1[event.field as string]; + let value2 = data2[event.field as string]; + let result = null; + + if (value1 == null && value2 != null) result = -1; + else if (value1 != null && value2 == null) result = 1; + else if (value1 == null && value2 == null) result = 0; + else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2); + else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0; + + return event.order as number * result; + }); + } + + + } From 2a5ae21971b98173a0c0d1d5859a8dfc32648dbb Mon Sep 17 00:00:00 2001 From: Donovan Solms <4567303+donovansolms@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:16:35 +0200 Subject: [PATCH 2/3] Fix transfer over 1000 to be no longer be invalid --- frontend/src/app/transfer-modal/transfer-modal.page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/transfer-modal/transfer-modal.page.ts b/frontend/src/app/transfer-modal/transfer-modal.page.ts index a8ac0509..ec54ab6c 100644 --- a/frontend/src/app/transfer-modal/transfer-modal.page.ts +++ b/frontend/src/app/transfer-modal/transfer-modal.page.ts @@ -118,7 +118,7 @@ export class TransferModalPage implements OnInit { // Construct metaprotocol memo message const params = new Map([ ["tic", this.ticker], - ["amt", this.transferForm.value.basic.amount], + ["amt", this.transferForm.value.basic.amount.replace(/\s/g, '')], ["dst", this.transferForm.value.basic.destination], ]); const urn = this.protocolService.buildURN(environment.chain.chainId, 'transfer', params); From c3d90744efc028c4aa0e5583150f54bc2b57bd42 Mon Sep 17 00:00:00 2001 From: Donovan Solms <4567303+donovansolms@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:58:51 +0200 Subject: [PATCH 3/3] Minor display updates --- .../generic-viewer/generic-viewer.page.html | 3 +- .../list-inscriptions.page.html | 44 +++++++++++-------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/frontend/src/app/generic-viewer/generic-viewer.page.html b/frontend/src/app/generic-viewer/generic-viewer.page.html index 99e9e365..566fe510 100644 --- a/frontend/src/app/generic-viewer/generic-viewer.page.html +++ b/frontend/src/app/generic-viewer/generic-viewer.page.html @@ -45,7 +45,8 @@ Audio not supported by browser - +
diff --git a/frontend/src/app/list-inscriptions/list-inscriptions.page.html b/frontend/src/app/list-inscriptions/list-inscriptions.page.html index ec2e4d34..35c4f610 100644 --- a/frontend/src/app/list-inscriptions/list-inscriptions.page.html +++ b/frontend/src/app/list-inscriptions/list-inscriptions.page.html @@ -12,23 +12,29 @@ - - - - - Latest - Oldest - - - - - - - - - - - + + + + + + + + + + + + + + + + Latest + Oldest + + + + + @@ -40,7 +46,7 @@
+ *ngFor="let item of inscriptions; let index">
@@ -71,4 +77,4 @@

{{ item.name }}

- + \ No newline at end of file