From 6f911bfe3703560028af7bcf41230808d9db3539 Mon Sep 17 00:00:00 2001 From: Nikita-Polyakov Date: Mon, 4 Mar 2024 16:08:09 +0300 Subject: [PATCH] add links dropdown, improve paddings --- .../pages/Swap/TransactionsWidget.vue | 52 +++++++++------- .../Bridge => shared}/LinksDropdown.vue | 7 +-- src/consts/index.ts | 10 ++-- src/styles/_mixins.scss | 40 ++++++++----- src/utils/index.ts | 45 +++++++++++++- src/views/BridgeTransaction.vue | 59 ++++++------------- src/views/Explore/Books.vue | 1 - 7 files changed, 126 insertions(+), 88 deletions(-) rename src/components/{pages/Bridge => shared}/LinksDropdown.vue (88%) diff --git a/src/components/pages/Swap/TransactionsWidget.vue b/src/components/pages/Swap/TransactionsWidget.vue index 556371ea2..83bf33347 100644 --- a/src/components/pages/Swap/TransactionsWidget.vue +++ b/src/components/pages/Swap/TransactionsWidget.vue @@ -1,5 +1,5 @@ - - - - - + @@ -50,7 +42,7 @@ - + @@ -65,15 +57,15 @@ - + - + @@ -81,6 +73,11 @@ + + + ; inputAssetSymbol: string; @@ -124,6 +120,7 @@ type TableItem = { date: string; time: string; }; + links: WALLET_CONSTS.ExplorerLink[]; }; const UPDATE_INTERVAL = 15_000; @@ -131,6 +128,7 @@ const UPDATE_INTERVAL = 15_000; @Component({ components: { BaseWidget: lazyComponent(Components.BaseWidget), + LinksDropdown: lazyComponent(Components.LinksDropdown), TokenLogo: components.TokenLogo, FormattedAmount: components.FormattedAmount, FormattedAddress: components.FormattedAddress, @@ -138,6 +136,8 @@ const UPDATE_INTERVAL = 15_000; }, }) export default class SwapTransactionsWidget extends Mixins(ScrollableTableMixin) { + @state.wallet.settings.soraNetwork private soraNetwork!: Nullable; + @getter.swap.tokenFrom tokenFrom!: Nullable; @getter.swap.tokenTo tokenTo!: Nullable; @getter.wallet.account.assetsDataTable private assetsDataTable!: WALLET_TYPES.AssetsTable; @@ -170,18 +170,19 @@ export default class SwapTransactionsWidget extends Mixins(ScrollableTableMixin) // override ScrollableTableMixin get tableItems(): TableItem[] { return this.transactions.map((item) => { - const id = item.id ?? ''; + const txId = item.id ?? ''; + const blockId = item.blockId ?? ''; const address = item.from ?? ''; const inputAsset = item.assetAddress ? this.assetsDataTable[item.assetAddress] : null; const inputAssetSymbol = inputAsset?.symbol ?? '??'; const outputAsset = item.asset2Address ? this.assetsDataTable[item.asset2Address] : null; const outputAssetSymbol = outputAsset?.symbol ?? '??'; - const inputAmount = new FPNumber(item.amount ?? 0).toLocaleString(); - const outputAmount = new FPNumber(item.amount2 ?? 0).toLocaleString(); + const inputAmount = showMostFittingValue(new FPNumber(item.amount ?? 0)); + const outputAmount = showMostFittingValue(new FPNumber(item.amount2 ?? 0)); const date = dayjs(item.startTime); + const links = soraExplorerLinks(this.soraNetwork, txId, blockId); return { - id, address, inputAsset, inputAssetSymbol, @@ -190,6 +191,7 @@ export default class SwapTransactionsWidget extends Mixins(ScrollableTableMixin) inputAmount, outputAmount, datetime: { date: date.format('M/DD'), time: date.format('HH:mm:ss') }, + links, }; }); } @@ -309,3 +311,11 @@ export default class SwapTransactionsWidget extends Mixins(ScrollableTableMixin) + + diff --git a/src/components/pages/Bridge/LinksDropdown.vue b/src/components/shared/LinksDropdown.vue similarity index 88% rename from src/components/pages/Bridge/LinksDropdown.vue rename to src/components/shared/LinksDropdown.vue index e95a489a4..f47475cb6 100644 --- a/src/components/pages/Bridge/LinksDropdown.vue +++ b/src/components/shared/LinksDropdown.vue @@ -30,17 +30,13 @@ import { Component, Mixins, Prop } from 'vue-property-decorator'; import TranslationMixin from '@/components/mixins/TranslationMixin'; @Component -export default class BridgeLinksDropdown extends Mixins(TranslationMixin) { +export default class LinksDropdown extends Mixins(TranslationMixin) { @Prop({ default: () => [], type: Array }) readonly links!: Array; }