From bb24df1011e9b754adf316bb221c4c729e9faaeb Mon Sep 17 00:00:00 2001 From: Tim Schmidt Date: Tue, 3 Oct 2023 12:09:57 -0700 Subject: [PATCH] fix: nftdetails page organization, fix filter, probably broke pause/play Signed-off-by: Tim Schmidt --- src/components/token/NftHolderTable.vue | 154 +++++---- .../transaction/NftTransactionTable.vue | 10 +- .../NftTransactionTableController.ts | 9 - .../transaction/TransactionFilterSelect.vue | 81 ++--- .../TransactionTableControllerXL.ts | 89 ++--- .../NftDetailsTransferGraph.vue | 2 - .../transfer_graphs/NftTransferGraph.vue | 96 +++--- src/pages/NftDetails.vue | 129 ++++---- src/schemas/HederaSchemas.ts | 308 ++++++++---------- src/utils/cache/NftBySerialCache.ts | 1 - src/utils/table/TableController.ts | 2 +- 11 files changed, 418 insertions(+), 463 deletions(-) diff --git a/src/components/token/NftHolderTable.vue b/src/components/token/NftHolderTable.vue index 5cb82799b..1c53dcc13 100644 --- a/src/components/token/NftHolderTable.vue +++ b/src/components/token/NftHolderTable.vue @@ -23,8 +23,9 @@ @@ -84,51 +84,61 @@ diff --git a/src/components/transaction/NftTransactionTable.vue b/src/components/transaction/NftTransactionTable.vue index a18395181..0adddfa64 100644 --- a/src/components/transaction/NftTransactionTable.vue +++ b/src/components/transaction/NftTransactionTable.vue @@ -147,12 +147,16 @@ export default defineComponent({ routeManager.routeToTransaction(t, event.ctrlKey || event.metaKey) } + const transactions = computed(() => { + return props.controller.rows.value.filter(el => + !props.controller.transactionType.value || el.type === props.controller.transactionType.value + ) + }) + return { isTouchDevice, isMediumScreen, - transactions: props.controller.rows as ComputedRef< - NftTransactionTransfer[] - >, + transactions: transactions, loading: props.controller.loading as ComputedRef, total: props.controller.totalRowCount as ComputedRef, currentPage: props.controller.currentPage as Ref, diff --git a/src/components/transaction/NftTransactionTableController.ts b/src/components/transaction/NftTransactionTableController.ts index 5ef100954..1c8c01d8a 100644 --- a/src/components/transaction/NftTransactionTableController.ts +++ b/src/components/transaction/NftTransactionTableController.ts @@ -89,19 +89,10 @@ export class NftTransactionTableController extends TableController< const params = {} as { limit: number order: string - transactiontype: string | undefined - timestamp: string | undefined } params.limit = limit params.order = order - if (this.transactionType.value != "") { - params.transactiontype = this.transactionType.value - } - if (consensusTimestamp !== null) { - params.timestamp = operator + ":" + consensusTimestamp - } - const r = await axios.get( `api/v1/tokens/${this.tokenId.value}/nfts/${this.serialNumber.value}/transactions`, {params: params}, diff --git a/src/components/transaction/TransactionFilterSelect.vue b/src/components/transaction/TransactionFilterSelect.vue index 21f569a82..c283141d8 100644 --- a/src/components/transaction/TransactionFilterSelect.vue +++ b/src/components/transaction/TransactionFilterSelect.vue @@ -40,48 +40,55 @@ diff --git a/src/components/transaction/TransactionTableControllerXL.ts b/src/components/transaction/TransactionTableControllerXL.ts index 869711320..e96f12a4f 100644 --- a/src/components/transaction/TransactionTableControllerXL.ts +++ b/src/components/transaction/TransactionTableControllerXL.ts @@ -18,21 +18,16 @@ * */ -import { - KeyOperator, - SortOrder, - TableController, -} from "@/utils/table/TableController" -import {Transaction, TransactionResponse} from "@/schemas/HederaSchemas" -import {ComputedRef, ref, Ref, watch, WatchStopHandle} from "vue" -import axios, {AxiosResponse} from "axios" -import {LocationQuery, Router} from "vue-router" -import {fetchStringQueryParam} from "@/utils/RouteManager" - -export class TransactionTableControllerXL extends TableController< - Transaction, - string -> { +import {KeyOperator, SortOrder, TableController} from "@/utils/table/TableController"; +import {Transaction, TransactionResponse} from "@/schemas/HederaSchemas"; +import {ComputedRef, ref, Ref, watch, WatchStopHandle} from "vue"; +import axios, {AxiosResponse} from "axios"; +import {LocationQuery, Router} from "vue-router"; +import {fetchStringQueryParam} from "@/utils/RouteManager"; + + +export class TransactionTableControllerXL extends TableController { + private readonly accountId: Ref private readonly accountIdMandatory: boolean @@ -40,24 +35,13 @@ export class TransactionTableControllerXL extends TableController< // Public // - public constructor( - router: Router, - accountId: Ref, - pageSize: ComputedRef, - accountIdMandatory: boolean, - pageParamName = "p", - keyParamName = "k", - ) { - super( - router, - pageSize, - 10 * pageSize.value, - 5000, - 10, - 100, - pageParamName, - keyParamName, - ) + public constructor(router: Router, + accountId: Ref, + pageSize: ComputedRef, + accountIdMandatory: boolean, + pageParamName = "p", keyParamName= "k") { + super(router, pageSize, 10 * pageSize.value, 5000, 10, 100, + pageParamName, keyParamName); this.accountId = accountId this.accountIdMandatory = accountIdMandatory this.watchAndReload([this.transactionType, this.accountId]) @@ -69,12 +53,8 @@ export class TransactionTableControllerXL extends TableController< // TableController // - public async load( - consensusTimestamp: string | null, - operator: KeyOperator, - order: SortOrder, - limit: number, - ): Promise { + public async load(consensusTimestamp: string | null, operator: KeyOperator, + order: SortOrder, limit: number): Promise { let result: Promise if (this.accountIdMandatory && this.accountId.value === null) { @@ -98,16 +78,10 @@ export class TransactionTableControllerXL extends TableController< if (consensusTimestamp !== null) { params.timestamp = operator + ":" + consensusTimestamp } - const cb = ( - r: AxiosResponse, - ): Promise => { + const cb = (r: AxiosResponse): Promise => { return Promise.resolve(r.data.transactions ?? []) } - result = axios - .get("api/v1/transactions", { - params: params, - }) - .then(cb) + result = axios.get("api/v1/transactions", {params: params}).then(cb) } return result @@ -128,26 +102,23 @@ export class TransactionTableControllerXL extends TableController< public mount(): void { this.transactionType.value = this.fetchTransactionTypeParam() // Must be done before calling mount() super.mount() - this.watchTransactionTypeHandle = watch( - this.transactionType, () => this.updateRouteQuery(), - ) + this.watchTransactionTypeHandle = watch(this.transactionType, () => this.updateRouteQuery()) } public unmount(): void { if (this.watchTransactionTypeHandle !== null) { this.watchTransactionTypeHandle() } - this.watchTransactionTypeHandle = null + this.watchTransactionTypeHandle = null; super.unmount() } protected makeRouteQuery(): LocationQuery { const result = super.makeRouteQuery() if (this.transactionType.value != "") { - result[this.typeParamName] = - this.transactionType.value.toLowerCase() + result[this.typeParamName] = this.transactionType.value.toLowerCase() } else { - delete (result[this.typeParamName]) + delete(result[this.typeParamName]) } return result } @@ -157,14 +128,10 @@ export class TransactionTableControllerXL extends TableController< // private readonly typeParamName = "type" - private watchTransactionTypeHandle: WatchStopHandle | null = null + private watchTransactionTypeHandle: WatchStopHandle|null = null public fetchTransactionTypeParam(): string { - return ( - fetchStringQueryParam( - this.typeParamName, - this.router.currentRoute.value, - )?.toUpperCase() ?? "" - ) + return fetchStringQueryParam(this.typeParamName, this.router.currentRoute.value)?.toUpperCase() ?? "" } + } diff --git a/src/components/transfer_graphs/NftDetailsTransferGraph.vue b/src/components/transfer_graphs/NftDetailsTransferGraph.vue index 87d1be066..e7e75b59f 100644 --- a/src/components/transfer_graphs/NftDetailsTransferGraph.vue +++ b/src/components/transfer_graphs/NftDetailsTransferGraph.vue @@ -143,8 +143,6 @@ export default defineComponent({ }), ); - console.log(nftTransferLayout); - watch( () => props.transaction, () => { diff --git a/src/components/transfer_graphs/NftTransferGraph.vue b/src/components/transfer_graphs/NftTransferGraph.vue index 48a632911..3671095e1 100644 --- a/src/components/transfer_graphs/NftTransferGraph.vue +++ b/src/components/transfer_graphs/NftTransferGraph.vue @@ -44,24 +44,24 @@
+ v-bind:account-id="nftTransferLayout[i-1].sender_account_id" + v-bind:no-anchor="compact" + null-label="MINT" + data-cy="sourceAccount"/>
-
+
+ v-bind:token-id="nftTransferLayout[i-1].token_id ?? undefined" + v-bind:show-extra="true" + v-bind:no-anchor="compact" + data-cy="nft"/>
@@ -103,38 +103,38 @@ @@ -146,13 +146,13 @@ export default defineComponent({ diff --git a/src/pages/NftDetails.vue b/src/pages/NftDetails.vue index 54ba17bcd..4f6c90680 100644 --- a/src/pages/NftDetails.vue +++ b/src/pages/NftDetails.vue @@ -28,90 +28,81 @@ class="section" > -