Skip to content

Commit

Permalink
fix(settings-token): hide token fields if they not configured
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenibir committed Sep 12, 2023
1 parent 2086989 commit 16b3003
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
13 changes: 12 additions & 1 deletion src/components/common/payout-amounts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
})
</script>
Expand All @@ -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")
</template>
8 changes: 4 additions & 4 deletions src/pages/proposals/create/StepPayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -426,15 +426,15 @@ 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
.col
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
Expand Down

0 comments on commit 16b3003

Please sign in to comment.