Skip to content

Commit

Permalink
fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
thepiwo committed May 5, 2021
1 parent ec084db commit 3f78227
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/components/TipInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<div class="input-group">
<!-- TODO: Remove this wrapper after removing bootstrap -->
<input
v-if="!tip"
v-if="!isRetippable"
v-model="message"
maxlength="280"
class="message form-control"
Expand All @@ -63,7 +63,7 @@
:select-token-f="token => (inputToken = token)"
/>
<AeButton :disabled="!isValid || v1TipWarning">
{{ tip ? $t('retip') : $t('tip') }}
{{ isRetippable ? $t('retip') : $t('tip') }}
</AeButton>
</div>
</form>
Expand Down Expand Up @@ -116,12 +116,12 @@ export default {
const urlStats = stats && this.tipUrl
&& stats.urlStats.find(({ url }) => url === this.tipUrl);
const tipTokenAmount = this.tip.token
const tipTokenAmount = this.tip?.token
? [{ token: this.tip.token, amount: this.tip.tokenAmount }] : [];
return {
isTipped: urlStats ? urlStats.senders.includes(this.address) : false,
totalAmount: urlStats ? urlStats.totalAmount : this.tip.amount || '0',
totalAmount: urlStats ? urlStats.totalAmount : this.tip?.amount || '0',
tokenTotalAmount: urlStats ? urlStats.totalTokenAmount : tipTokenAmount,
};
},
Expand All @@ -140,7 +140,7 @@ export default {
: null;
},
tipAmount() {
return +this.tipUrlStats.totalAmount !== 0
return +this.tipUrlStats.totalAmount !== '0'
? {
value: this.tipUrlStats.totalAmount,
token: null,
Expand All @@ -157,6 +157,9 @@ export default {
&& this.inputToken !== null
);
},
isRetippable() {
return this.tip && this.tip.type !== 'POST_WITHOUT_TIP';
},
tipUrl() {
if (this.comment) {
return `https://superhero.com/tip/${this.comment.tipId}/comment/${this.comment.id}`;
Expand Down Expand Up @@ -203,7 +206,7 @@ export default {
: 18,
).toFixed();
if (!this.tip) {
if (!this.isRetippable) {
await this.$store.dispatch('aeternity/tip', {
url: this.tipUrl,
title: this.message,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default class Backend {
if (ordering) queryParams.set('ordering', ordering);
if (direction) queryParams.set('direction', direction);
if (search) queryParams.set('search', search);
return backendFetch(`tokenCache/wordRegistry?${queryParams.toString()}`);
return process.env.VUE_APP_CONTRACT_V2_ADDRESS ? backendFetch(`tokenCache/wordRegistry?${queryParams.toString()}`) : Promise.resolve({});
}

static getWordSaleVotesDetails = async (address) => backendFetch(`tokenCache/wordSaleVotesDetails/${address}`);
Expand Down

0 comments on commit 3f78227

Please sign in to comment.