From 16b30037295fec99a35b30587cd8bd3d4016e882 Mon Sep 17 00:00:00 2001 From: Evgeni B Date: Tue, 12 Sep 2023 17:31:17 +0300 Subject: [PATCH] fix(settings-token): hide token fields if they not configured --- src/components/common/payout-amounts.vue | 13 ++++++++++++- src/pages/proposals/create/StepPayout.vue | 8 ++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/components/common/payout-amounts.vue b/src/components/common/payout-amounts.vue index 005fdcdbf..05afe2ee7 100644 --- a/src/components/common/payout-amounts.vue +++ b/src/components/common/payout-amounts.vue @@ -31,6 +31,17 @@ export default defineComponent({ type: String, default: undefined } + }, + + methods: { + settingsHasToken(token) { + if (token !== 'Voice Token') { + const cleanTokenName = token.split(' ')?.[2]?.replace('(', '').replace(')', '') + return cleanTokenName === this.$store.state.dao.settings.pegToken || cleanTokenName === this.$store.state.dao.settings.rewardToken + } else { + return true + } + } } }) @@ -39,5 +50,5 @@ export default defineComponent({ .full-width(:class="{row: $q.platform.is.desktop}") template(v-for="token in tokens") .col(v-if="token.value" :class="{'col-12': stacked, 'q-mb-md': $q.platform.is.mobile}") - token-value(:daoLogo="daoLogo" :multiplier="multiplier" v-bind="token") + token-value(v-if="settingsHasToken(token.label)" :daoLogo="daoLogo" :multiplier="multiplier" v-bind="token") diff --git a/src/pages/proposals/create/StepPayout.vue b/src/pages/proposals/create/StepPayout.vue index 0fb5385f1..f0d1beff7 100644 --- a/src/pages/proposals/create/StepPayout.vue +++ b/src/pages/proposals/create/StepPayout.vue @@ -389,14 +389,14 @@ widget(:class="{ 'disable-step': currentStepName !== 'step-payout' && $q.screen. .row(v-if="isAssignment") label.text-bold {{ toggle ? $t('pages.proposals.create.steppayout.compensationForOnePeriod') : $t('pages.proposals.create.steppayout.compensationForOneCycle') }} .q-col-gutter-xs.q-mt-sm(:class="{ 'q-mt-xxl':$q.screen.lt.md || $q.screen.md, 'row':$q.screen.gt.md }") - .col-4(:class="{ 'q-mt-md':$q.screen.lt.md || $q.screen.md }" v-if="fields.reward && selectedDao.hasCustomToken") + .col-4(:class="{ 'q-mt-md':$q.screen.lt.md || $q.screen.md }" v-if="fields.reward && selectedDao.hasCustomToken && $store.state.dao.settings.rewardToken") label.h-label(v-if="$store.state.dao.settings.rewardToken !== 'HYPHA'") {{ `${fields.reward.label} (${$store.state.dao.settings.rewardToken})` }} label.h-label(v-else) {{ `${fields.reward.label}` }} .row.full-width.items-center.q-mt-xs token-logo.q-mr-xs(size="40px" type="utility" :daoLogo="daoSettings.logo") q-input.rounded-border.col(dense :readonly="!custom" outlined v-model="utilityToken" rounded v-if="isAssignment && !isFounderRole") q-input.rounded-border.col(dense :readonly="!custom" outlined v-model="reward" rounded v-else) - .col-4(:class="{ 'q-mt-md':$q.screen.lt.md || $q.screen.md }" v-if="fields.peg") + .col-4(:class="{ 'q-mt-md':$q.screen.lt.md || $q.screen.md }" v-if="fields.peg && $store.state.dao.settings.pegToken") label.h-label(v-if="$store.state.dao.settings.pegToken !== 'HUSD'") {{ `${fields.peg.label} ${$store.state.dao.settings.pegToken ? `(${$store.state.dao.settings.pegToken})`:''}`}} label.h-label(v-else) {{ `${fields.peg.label}` }} .row.full-width.items-center.q-mt-xs @@ -426,7 +426,7 @@ widget(:class="{ 'disable-step': currentStepName !== 'step-payout' && $q.screen. // Multiplier .full-width(v-if="fields.rewardCoefficient || fields.voiceCoefficient || fields.pegCoefficient") .row - .col(v-if="fields.rewardCoefficient") + .col(v-if="fields.rewardCoefficient && $store.state.dao.settings.rewardToken") label.h-label(v-if="$store.state.dao.settings.rewardToken !== 'HYPHA'") {{ `${fields.rewardCoefficient.label} (${$store.state.dao.settings.rewardToken})` }} label.h-label(v-else) {{ `${fields.rewardCoefficient.label}` }} .row.items-center @@ -434,7 +434,7 @@ widget(:class="{ 'disable-step': currentStepName !== 'step-payout' && $q.screen. q-input.q-my-sm.rounded-border(v-model="rewardCoefficientLabel" outlined suffix="%" :prefix="fields.rewardCoefficient.disabled ? 'x' : rewardCoefficientLabel > 9 ? 'x1.' : 'x1.0'" :readonly="fields.rewardCoefficient.disabled" :rules="[rules.lessOrEqualThan(20), rules.greaterThanOrEqual(-20)]") template(v-slot:prepend) token-logo.logo-border(size="md" type="utility" :daoLogo="daoSettings.logo") - .col(v-if="fields.pegCoefficient") + .col(v-if="fields.pegCoefficient && $store.state.dao.settings.pegToken") label.h-label(v-if="$store.state.dao.settings.pegToken !== 'HUSD'") {{ `${fields.pegCoefficient.label} (${$store.state.dao.settings.pegToken})` }} label.h-label(v-else) {{ `${fields.pegCoefficient.label}` }} .row.items-center