Skip to content

GITC-622: move under button errors to top #9724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/assets/v2/js/cart-ethereum-polygon.js
Original file line number Diff line number Diff line change
@@ -182,13 +182,15 @@ Vue.component('grantsCartEthereumPolygon', {
this.cart.unsupportedTokens = this.cart.tokenList.filter(
(token) => !this.supportedTokens.includes(token)
);
if (this.cart.unsupportedTokens.length > 0) {
_alert(`Polygon checkout not supported due to the use of the token ${this.cart.unsupportedTokens[0]}`, 'danger');
}

// Update the fee estimate and gas cost based on changes
this.polygon.estimatedGasCost = await this.estimateGasCost();

// Emit event so cart.js can update state accordingly to display info to user
this.$emit('polygon-data-updated', {
polygonUnsupportedTokens: this.cart.unsupportedTokens,
polygonEstimatedGasCost: this.polygon.estimatedGasCost
});
},
5 changes: 4 additions & 1 deletion app/assets/v2/js/cart-ethereum-zksync.js
Original file line number Diff line number Diff line change
@@ -138,6 +138,10 @@ Vue.component('grantsCartEthereumZksync', {
(token) => !this.supportedTokens.includes(token)
);

if (this.cart.unsupportedTokens.length > 0) {
_alert(`zkSync checkout not supported due to the use of the token ${this.cart.unsupportedTokens[0]}`, 'danger');
}

// If currently selected fee token is still in the cart, don't change it. Otherwise, set
// fee token to the token used for the first item in the cart
if (!this.cart.tokenList.includes(this.zksync.feeTokenSymbol)) {
@@ -170,7 +174,6 @@ Vue.component('grantsCartEthereumZksync', {

// Emit event so cart.js can update state accordingly to display info to user
this.$emit('zksync-data-updated', {
zkSyncUnsupportedTokens: this.cart.unsupportedTokens,
zkSyncEstimatedGasCost: estimatedGasCost
});
},
18 changes: 3 additions & 15 deletions app/grants/templates/grants/cart/eth.html
Original file line number Diff line number Diff line change
@@ -502,7 +502,7 @@ <h1 class="font-weight-bold mt-2">Pay with zkSync</h1>

<b-tooltip target="zksync-tooltip" triggers="hover">
<p v-if="grantsByTenant.length > maxCartItems">
Zksync checkout supports checkout for [[maxCartItems]] items.
zkSync checkout supports checkout for [[maxCartItems]] items.
Please remove [[ grantsByTenant.length - maxCartItems ]] grant
<span v-if="grantsByTenant.length - maxCartItems > 1">s</span>
from your cart to use zkSync checkout.
@@ -511,21 +511,9 @@ <h1 class="font-weight-bold mt-2">Pay with zkSync</h1>
</div>

<!-- Checkout recommendation -->
<div class="text-center mt-2" v-if="
(zkSyncUnsupportedTokens.length > 0 || polygonUnsupportedTokens.length > 0) ||
polygonUnsupportedTokens.length > 0 ||
!isNaN(checkoutRecommendation.savingsInPercent)
">
<div class="text-center mt-2" v-if="!isNaN(checkoutRecommendation.savingsInPercent)">
<div class="font-smaller-3 bg-lightpurple p-3 rounded w-100">
<template v-if="zkSyncUnsupportedTokens.length > 0 || polygonUnsupportedTokens.length > 0">
<template v-if="zkSyncUnsupportedTokens.length > 0">
zkSync checkout not supported due to [[ zkSyncUnsupportedTokens.join(', ') ]]
</template>
<template v-if="polygonUnsupportedTokens.length > 0">
Polygon checkout not supported due to [[ polygonUnsupportedTokens.join(', ') ]]
</template>
</template>
<template v-else-if="!isNaN(checkoutRecommendation.savingsInPercent)">
<template v-if="!isNaN(checkoutRecommendation.savingsInPercent)">
💡 Save <span class="text-primary">~[[ checkoutRecommendation.savingsInPercent ]]%</span>
on gas fees with [[ checkoutRecommendation.name ]]!
</template>