Skip to content
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

Fix confirm buttons loading state #881

Merged
merged 6 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion env.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"charts": true,
"soraCard": false
},
"SUBQUERY_ENDPOINT": "https://subquery2.q1.sora2.soramitsu.co.jp",
"SUBQUERY_ENDPOINT": "https://api.subquery.network/sq/sora-xor/sora-prod-sub4",
"DEFAULT_NETWORKS": [
{
"chain": "SORA",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"dependencies": {
"@metamask/detect-provider": "^2.0.0",
"@soramitsu/soraneo-wallet-web": "1.11.6",
"@soramitsu/soraneo-wallet-web": "1.11.7",
"@walletconnect/web3-provider": "^1.8.0",
"base-64": "^1.0.0",
"core-js": "^3.26.0",
Expand Down
6 changes: 3 additions & 3 deletions src/components/SelectAsset/SelectToken.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<dialog-base :visible.sync="isVisible" :title="t('selectToken.title')" custom-class="asset-select">
<s-tabs v-model="tabValue" class="s-tabs--exchange" type="rounded" @click="handleTabClick">
<s-tabs :value="tabValue" class="s-tabs--exchange" type="rounded" @input="handleTabChange">
<search-input
ref="search"
v-model="query"
Expand Down Expand Up @@ -106,7 +106,7 @@ export default class SelectToken extends Mixins(TranslationMixin, SelectAssetMix
@action.wallet.account.addAsset private addAsset!: (address?: string) => Promise<void>;

@Watch('visible')
async handleTabChange(value: boolean): Promise<void> {
async handleTabReset(value: boolean): Promise<void> {
if (!value) return;

this.tabValue = first(this.tokenTabs);
Expand Down Expand Up @@ -179,7 +179,7 @@ export default class SelectToken extends Mixins(TranslationMixin, SelectAssetMix
api.assets.removeAccountAsset(asset.address);
}

handleTabClick({ name }): void {
handleTabChange(name: Tabs): void {
this.tabValue = name;
this.handleClearSearch();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Settings/MarketAlgorithm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span>{{ t('dexSettings.marketAlgorithmTooltip.main') }}</span>
</div>
</settings-header>
<settings-tabs :value="currentMarketAlgorithm" :tabs="marketAlgorithmTabs" @click="selectTab" />
<settings-tabs :value="currentMarketAlgorithm" :tabs="marketAlgorithmTabs" @input="selectTab" />
</div>
</template>

Expand Down Expand Up @@ -53,7 +53,7 @@ export default class MarketAlgorithm extends Mixins(TranslationMixin) {
return `<span class="algorithm">${type}</span>`;
}

selectTab({ name }): void {
selectTab(name: MarketAlgorithms): void {
this.setMarketAlgorithm(name);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Settings/SlippageTolerance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</template>
<div :class="slippageToleranceClasses">
<div class="slippage-tolerance-default">
<settings-tabs :value="slippageTolerance" :tabs="SlippageToleranceTabs" @click="selectTab" />
<settings-tabs :value="slippageTolerance" :tabs="SlippageToleranceTabs" @input="selectTab" />
</div>
<div class="slippage-tolerance-custom">
<s-float-input
Expand Down Expand Up @@ -126,7 +126,7 @@ export default class SlippageTolerance extends Mixins(mixins.NumberFormatterMixi
return '';
}

selectTab({ name }): void {
selectTab(name: string): void {
this.setSlippageTolerance(name);
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/Swap/Chart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
</div>
<div class="chart-filters">
<s-tabs type="rounded" :value="selectedFilter.name" @click="selectFilter">
<s-tabs type="rounded" :value="selectedFilter.name" @input="selectFilter">
<s-tab
v-for="filter in filters"
:key="filter.name"
Expand Down Expand Up @@ -877,7 +877,7 @@ export default class SwapChart extends Mixins(
this.subscribeToPriceUpdates();
}

selectFilter({ name }): void {
selectFilter(name: string): void {
const filter = this.filters.find((item) => item.name === name);

if (!filter) return;
Expand Down
4 changes: 2 additions & 2 deletions src/modules/demeterFarming/components/CalculatorDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<div class="duration">
<info-line label="Duration" class="duration-title" />
<s-tabs type="rounded" :value="selectedPeriod" @click="selectPeriod" class="duration-tabs">
<s-tabs type="rounded" :value="selectedPeriod" @input="selectPeriod" class="duration-tabs">
<s-tab v-for="period in intervals" :key="period" :name="String(period)" :label="`${period}D`" />
</s-tabs>
</div>
Expand Down Expand Up @@ -174,7 +174,7 @@ export default class CalculatorDialog extends Mixins(StakeDialogMixin) {
return new FPNumber(this.calculatedRoiPercent.toFixed(2)).toLocaleString() + '%';
}

selectPeriod({ name }): void {
selectPeriod(name: string): void {
this.interval = Number(name);
}

Expand Down
8 changes: 7 additions & 1 deletion src/modules/demeterFarming/components/ClaimDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<s-button
type="primary"
class="s-typography-button--large action-button"
:loading="parentLoading"
:disabled="isInsufficientXorForFee"
@click="confirm"
>
Expand Down Expand Up @@ -64,7 +65,12 @@ import TranslationMixin from '@/components/mixins/TranslationMixin';
FormattedAmount: components.FormattedAmount,
},
})
export default class ClaimDialog extends Mixins(AccountPoolMixin, TranslationMixin, mixins.DialogMixin) {
export default class ClaimDialog extends Mixins(
AccountPoolMixin,
TranslationMixin,
mixins.DialogMixin,
mixins.LoadingMixin
) {
readonly FontSizeRate = WALLET_CONSTS.FontSizeRate;

confirm(): void {
Expand Down
1 change: 1 addition & 0 deletions src/modules/demeterFarming/components/StakeDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<s-button
type="primary"
class="s-typography-button--large action-button"
:loading="parentLoading"
:disabled="isInsufficientXorForFee || valueFundsEmpty || isInsufficientBalance"
@click="handleConfirm"
>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/demeterFarming/mixins/StakeDialogMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import PoolMixin from './PoolMixin';
import type { CodecString } from '@sora-substrate/util';

@Component
export default class StakeDialogMixin extends Mixins(PoolMixin, mixins.DialogMixin) {
export default class StakeDialogMixin extends Mixins(PoolMixin, mixins.DialogMixin, mixins.LoadingMixin) {
@Prop({ default: () => true, type: Boolean }) readonly isAdding!: boolean;

get networkFee(): CodecString {
Expand Down
2 changes: 2 additions & 0 deletions src/modules/demeterFarming/views/Pool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@
:pool="selectedPool"
:account-pool="selectedAccountPool"
:is-adding="isAddingStake"
:parent-loading="parentLoading || loading"
@add="handleStakeAction($event, deposit)"
@remove="handleStakeAction($event, withdraw)"
/>
<claim-dialog
:visible.sync="showClaimDialog"
:pool="selectedPool"
:account-pool="selectedAccountPool"
:parent-loading="parentLoading || loading"
@confirm="handleClaimRewards"
/>

Expand Down
2 changes: 2 additions & 0 deletions src/modules/demeterFarming/views/Staking.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@
:pool="selectedPool"
:account-pool="selectedAccountPool"
:is-adding="isAddingStake"
:parent-loading="parentLoading || loading"
@add="handleStakeAction($event, deposit)"
@remove="handleStakeAction($event, withdraw)"
/>
<claim-dialog
:visible.sync="showClaimDialog"
:pool="selectedPool"
:account-pool="selectedAccountPool"
:parent-loading="parentLoading || loading"
@confirm="handleClaimRewards"
/>
<calculator-dialog :visible.sync="showCalculatorDialog" :pool="selectedPool" :account-pool="selectedAccountPool" />
Expand Down
2 changes: 1 addition & 1 deletion src/views/AddLiquidity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

<confirm-token-pair-dialog
:visible.sync="showConfirmDialog"
:parent-loading="parentLoading"
:parent-loading="parentLoading || loading"
:share-of-pool="shareOfPool"
:first-token="firstToken"
:second-token="secondToken"
Expand Down
8 changes: 5 additions & 3 deletions src/views/ReferralProgram.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
<p class="referrer-description" v-html="t('referralProgram.referrer.description')" />
</template>
<s-card v-if="referrer" shadow="always" size="small" border-radius="medium">
<div class="referrer-link-details">
<div class="referrer-link-details with-referrer">
<div class="referral-link-label">{{ t('referralProgram.referrer.referredLablel') }}</div>
<div class="referral-link" v-html="referrerLink.label" />
</div>
Expand Down Expand Up @@ -709,9 +709,11 @@ export default class ReferralProgram extends Mixins(
&-details {
display: flex;
flex-direction: column;
margin-right: $inner-spacing-mini;
overflow: hidden;
color: var(--s-color-theme-accent);
&.with-referrer {
margin-right: $inner-spacing-mini;
overflow: hidden;
}
}
&,
&-label {
Expand Down
2 changes: 1 addition & 1 deletion src/views/RemoveLiquidity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

<confirm-remove-liquidity
:visible.sync="showConfirmDialog"
:parent-loading="parentLoading"
:parent-loading="parentLoading || loading"
@confirm="handleConfirmRemoveLiquidity"
/>

Expand Down
2 changes: 1 addition & 1 deletion src/views/RewardsTabs.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="container rewards-tabs">
<s-tabs :value="currentTab" type="card" @change="handleChangeTab">
<s-tabs :value="currentTab" type="card" @input="handleChangeTab">
<s-tab
v-for="rewardsTab in RewardsTabsItems"
:key="rewardsTab"
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2395,10 +2395,10 @@
crypto-js "^4.0.0"
lodash "^4.17.15"

"@soramitsu/soramitsu-js-ui@^1.0.41":
version "1.0.41"
resolved "https://nexus.iroha.tech/repository/npm-group/@soramitsu/soramitsu-js-ui/-/soramitsu-js-ui-1.0.41.tgz#77b480c6ac8b06e7d0575d73e4275a98339090df"
integrity sha512-qL/2UKYMEtp7DFdyRIsohAHBawmq5akjIeqAruMeOX5ZPMaKRIsP6mmRCNZieGgKMUQMdWEfHDtcgpkD0HQXCA==
"@soramitsu/soramitsu-js-ui@^1.0.42":
version "1.0.42"
resolved "https://nexus.iroha.tech/repository/npm-group/@soramitsu/soramitsu-js-ui/-/soramitsu-js-ui-1.0.42.tgz#adbafccb428d0351e95640d3f3ce011805e3461b"
integrity sha512-F8JFQb8hixDgKWSWLXdg7EkU5Y4YiisONJLEL/+D7Q8s1//3L+FLyRCsWu4l9Q/BZ6jbWUjAGDTcwZ8Rxsd0Nw==
dependencies:
core-js "^3.26.1"
element-resize-detector "^1.2.4"
Expand All @@ -2412,14 +2412,14 @@
vue-property-decorator "^9.1.2"
vuex "^3.6.2"

"@soramitsu/soraneo-wallet-web@1.11.6":
version "1.11.6"
resolved "https://nexus.iroha.tech/repository/npm-group/@soramitsu/soraneo-wallet-web/-/soraneo-wallet-web-1.11.6.tgz#c30f0553e808e6c6fbcf3ff64a9011c86b4df73d"
integrity sha512-FRuDh3evltsd+NG2PujrbUH5eUpxb5uLbwTrfAXrI5aI+tcZitF4Cwf6Y8RzAg7jPOSMuAcrQ1iD5F3WVrHOsg==
"@soramitsu/soraneo-wallet-web@1.11.7":
version "1.11.7"
resolved "https://nexus.iroha.tech/repository/npm-group/@soramitsu/soraneo-wallet-web/-/soraneo-wallet-web-1.11.7.tgz#c82e8a168e483d5e43782ac3325cde0902e6f68b"
integrity sha512-W4qIQ2o6yZM7Kk9EWG4UdvsKFggGQoVh1DjeDgT1+jXeLY8hZyPh17oPyIxnZ/2Mlot9SAUdFJFzBs6R3mhhgw==
dependencies:
"@polkadot/vue-identicon" "2.6.1"
"@sora-substrate/util" "1.11.17"
"@soramitsu/soramitsu-js-ui" "^1.0.41"
"@soramitsu/soramitsu-js-ui" "^1.0.42"
"@subwallet/wallet-connect" "^0.2.3"
"@urql/core" "^3.0.5"
"@zxing/browser" "^0.1.1"
Expand Down