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

merge dev #70

Merged
merged 4 commits into from
Jul 26, 2024
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
12 changes: 11 additions & 1 deletion src/common/modals/compositions/ChangeLockModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
color="secondary"
:text="$t('change-lock-modal.cancel-btn')"
:disabled="isSubmitting"
@click="modal.close()"
@click="cancel"
/>
<app-button
class="change-lock-modal__btn"
Expand Down Expand Up @@ -147,6 +147,7 @@ const submit = async () => {
)

emit('update:is-shown', false)
form.lockPeriod = ''

await tx.wait()

Expand All @@ -172,6 +173,15 @@ watch(
() => fetchExpectedMultiplier(form.lockPeriod),
{ immediate: true },
)

const cancel = () => {
clearFields()
emit('update:is-shown', false)
}

const clearFields = () => {
form.lockPeriod = ''
}
</script>

<style lang="scss" scoped>
Expand Down
15 changes: 9 additions & 6 deletions src/common/modals/compositions/ClaimModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
</i18n-t>
</template>
<template #default="{ modal }">
<claim-form
class="claim-modal__form"
:pool-id="poolId"
@cancel="modal.close"
@tx-sent="modal.close"
/>
<transition name="fade">
<claim-form
v-if="isShown"
class="claim-modal__form"
:pool-id="poolId"
@cancel="modal.close"
@tx-sent="modal.close"
/>
</transition>
</template>
</basic-modal>
</template>
Expand Down
17 changes: 10 additions & 7 deletions src/common/modals/compositions/DepositModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
@update:is-shown="emit('update:is-shown', $event)"
>
<template #default="{ modal }">
<deposit-form
class="deposit-modal__form"
:pool-id="poolId"
:min-stake="minStake"
@cancel="modal.close"
@stake-tx-sent="modal.close"
/>
<transition name="fade">
<deposit-form
v-if="isShown"
class="deposit-modal__form"
:pool-id="poolId"
:min-stake="minStake"
@cancel="modal.close"
@stake-tx-sent="modal.close"
/>
</transition>
</template>
</basic-modal>
</template>
Expand Down
17 changes: 10 additions & 7 deletions src/common/modals/compositions/WithdrawModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@
</p>
</div>
</div>
<withdraw-form
class="withdraw-modal__form"
:pool-id="poolId"
:available-amount="availableAmount"
@cancel="modal.close"
@tx-sent="modal.close"
/>
<transition name="fade">
<withdraw-form
v-if="isShown"
class="withdraw-modal__form"
:pool-id="poolId"
:available-amount="availableAmount"
@cancel="modal.close"
@tx-sent="modal.close"
/>
</transition>
</template>
</basic-modal>
</template>
Expand Down
15 changes: 13 additions & 2 deletions src/forms/ClaimForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class="claim-form__btn"
color="secondary"
:text="$t('claim-form.cancel-btn')"
@click="emit('cancel')"
@click="cancel"
/>
<app-button
class="claim-form__btn"
Expand All @@ -33,7 +33,7 @@ import { getEthExplorerTxUrl, bus, BUS_EVENTS, ErrorHandler } from '@/helpers'
import { storeToRefs, useWeb3ProvidersStore } from '@/store'
import { address, required } from '@/validators'
import { config } from '@config'
import { reactive, ref } from 'vue'
import {reactive, ref, watch} from 'vue'

const emit = defineEmits<{
(e: 'cancel', v: void): void
Expand Down Expand Up @@ -95,6 +95,8 @@ const submit = async (): Promise<void> => {

emit('tx-sent')

clearFields()

await tx.wait()

bus.emit(
Expand All @@ -109,6 +111,15 @@ const submit = async (): Promise<void> => {

isSubmitting.value = false
}

const cancel = (): void => {
clearFields()
emit('cancel')
}

const clearFields = () => {
form.address = ''
}
</script>

<style lang="scss" scoped>
Expand Down
12 changes: 11 additions & 1 deletion src/forms/WithdrawForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class="withdraw-form__btn"
color="secondary"
:text="$t('withdraw-form.cancel-btn')"
@click="emit('cancel')"
@click="cancel"
/>
<app-button
class="withdraw-form__btn"
Expand Down Expand Up @@ -98,6 +98,7 @@ const submit = async (): Promise<void> => {
)

emit('tx-sent')
clearFields()

await tx.wait()

Expand All @@ -113,6 +114,15 @@ const submit = async (): Promise<void> => {

isSubmitting.value = false
}

const cancel = () => {
clearFields()
emit('cancel')
}

const clearFields = () => {
form.amount = ''
}
</script>

<style lang="scss" scoped>
Expand Down
25 changes: 16 additions & 9 deletions src/pages/HomePage/views/PublicPoolView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@
<p class="public-pool-view__dashboard-description">
{{ $t(`home-page.public-pool-view.dashboard-description--${poolId}`) }}
</p>
<p v-if="poolData" class="public-pool-view__dashboard-note">
<p
v-if="poolData?.withdrawLockPeriod"
class="public-pool-view__dashboard-note"
>
{{
$t(`home-page.public-pool-view.dashboard-note--${poolId}`, {
daysCount: poolData.withdrawLockPeriod.div(24 * 60 * 60),
Expand Down Expand Up @@ -161,9 +164,10 @@ const web3ProvidersStore = useWeb3ProvidersStore()

const claimLockTime = computed(() => {
if (userPoolData.value?.claimLockEnd) {
return new Time(userPoolData.value?.claimLockEnd.toNumber()).format(
DEFAULT_TIME_FORMAT,
)
const lockEnd = new Time(userPoolData.value?.claimLockEnd.toNumber())
return new Time().isAfter(lockEnd)
? '-'
: lockEnd.format(DEFAULT_TIME_FORMAT)
}
if (poolData.value) {
const lockTime = new Time(
Expand All @@ -174,9 +178,10 @@ const claimLockTime = computed(() => {
: poolData.value.payoutStart
.add(poolData.value.withdrawLockPeriod)
.toNumber(),
).format(DEFAULT_TIME_FORMAT)

return new Time().isAfter(lockTime) ? '-' : lockTime
)
return new Time().isAfter(lockTime)
? '-'
: lockTime.format(DEFAULT_TIME_FORMAT)
}
return ''
})
Expand All @@ -191,8 +196,10 @@ const withdrawAtTime = computed(() => {
: poolData.value.payoutStart
.add(poolData.value.withdrawLockPeriod)
.toNumber(),
).format(DEFAULT_TIME_FORMAT)
return new Time().isAfter(withdrawTime) ? '-' : withdrawTime
)
return new Time().isAfter(withdrawTime)
? '-'
: withdrawTime.format(DEFAULT_TIME_FORMAT)
}
return '-'
})
Expand Down
Loading