From fbb2671cea41c5ea93059f8e3152b104958be30f Mon Sep 17 00:00:00 2001 From: Philipp Piwo Date: Thu, 22 Apr 2021 10:28:20 +0200 Subject: [PATCH] fixed url stats usage --- src/components/TipInput.vue | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/components/TipInput.vue b/src/components/TipInput.vue index a788e6429..fe77e4125 100644 --- a/src/components/TipInput.vue +++ b/src/components/TipInput.vue @@ -4,7 +4,7 @@ :is="useSdkWallet ? 'button' : 'a'" :href="useSdkWallet ? undefined : deepLink" class="button" - :class="{ tipped: isTipped }" + :class="{ tipped: tipUrlStats.isTipped }" :title="title" @click="useSdkWallet && (showModal = true)" > @@ -16,9 +16,9 @@ /> url === this.tipUrl); + return { + isTipped: urlStats ? urlStats.senders.includes(this.address) : false, + totalAmount: urlStats ? urlStats.totalamount : '0', + tokenTotalAmount: urlStats ? urlStats.totaltokenamount : [], + }; + }, + }), largestFtTipAmount() { - return this.tip && this.tip.UrlStats.totaltokenamount.length - ? this.tip.UrlStats.totaltokenamount.reduce( + return this.tipUrlStats.tokenTotalAmount.length + ? this.tipUrlStats.tokenTotalAmount.reduce( (a, b) => (a.amount > b.amount ? a : b), - this.tip.UrlStats.totaltokenamount[0], + this.tipUrlStats.tokenTotalAmount[0], ) : null; }, tipAmount() { - return this.tip && this.tip.UrlStats?.totalamount !== '0' + return +this.tipUrlStats.totalAmount !== 0 ? { - value: this.tip.UrlStats?.totalamount, + value: this.tipUrlStats.totalAmount, token: null, } : { @@ -168,7 +175,7 @@ export default { title() { if (this.userAddress) return this.$t('components.TipInput.tipUser'); if (this.comment) return this.$t('components.TipInput.tipComment'); - return this.isTipped + return this.tipUrlStats.isTipped ? this.$t('components.TipInput.totalTipsWithYou') : this.$t('components.TipInput.totalTips'); },