Skip to content

Commit

Permalink
Merge branch 'develop' into refactor/proposal-detail-query
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenijesavic committed Sep 20, 2023
2 parents 6961e5d + 50eae70 commit 4c20ee6
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 54 deletions.
41 changes: 10 additions & 31 deletions src/components/common/payout-amounts.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
<script lang="ts">
<script>
import { defineComponent } from 'vue'
import { PropType } from 'vue/types/v3-component-props'
import TokenValue from './token-value.vue'
import { TOKEN_TYPES } from '~/const'
type TokenProps = Omit<
InstanceType<typeof TokenValue>['$props'],
'daoLogo' | 'multiplier'
>
/**
* Displays the amounts of tokens earned for a contribution.
*/
export default defineComponent({
name: 'payout-amounts',
components: {
TokenValue
TokenValue: () => import('./token-value.vue')
},
props: {
tokens: {
type: Array as PropType<TokenProps[]>,
type: Array,
default: () => []
},
multiplier: {
Expand All @@ -35,35 +25,24 @@ export default defineComponent({
},
methods: {
settingsHasToken(token) {
if (token !== 'VOICE') {
if (this.$store.state.dao.settings.pegToken && this.$store.state.dao.settings.rewardToken) {
return token === this.$store.state.dao.settings.pegToken || token === this.$store.state.dao.settings.rewardToken
} else {
return false
}
} else {
return true
}
},
settingsMultiplier(label) {
switch (label) {
case TOKEN_TYPES.UTILITY_TOKEN:
return this.$store.state.dao.settings.utilityTokenMultiplier
case TOKEN_TYPES.CASH_TOKEN:
return this.$store.state.dao.settings.settings_treasuryTokenMultiplier_i
return this.$store.state.dao.settings.treasuryTokenMultiplier
case TOKEN_TYPES.VOICE_TOKEN:
return this.$store.state.dao.settings.settings_voiceTokenMultiplier_i
case TOKEN_TYPES.UTILITY_TOKEN:
return this.$store.state.dao.settings.settings_utilityTokenMultiplier_i
return this.$store.state.dao.settings.voiceTokenMultiplier
}
}
}
})
</script>

<template lang="pug">
.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(v-if="settingsHasToken(token.symbol)" :daoLogo="daoLogo" :multiplier="settingsMultiplier(token.label)" v-bind="token")
.col(v-if="token?.value" :class="{'col-12': stacked, 'q-mb-md': $q.platform.is.mobile}")
token-value(:daoLogo="daoLogo" :multiplier="settingsMultiplier(token?.label)" v-bind="token")
</template>
11 changes: 6 additions & 5 deletions src/components/login/register-user-with-captcha-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,11 @@ export default {
.p-onboarding {{ $t('login.register-user-with-captcha-view.itContainsThe') }}
.p-onboarding.bold {{ $t('login.register-user-with-captcha-view.onceTheAccount') }}
.p-onboarding {{ $t('login.register-user-with-captcha-view.youAreSet') }}
.row.justify-center.items-center(:style="{ 'margin-bottom': '60px' }")
.row.justify-center.items-center(v-if="$q.screen.gt.md" :style="{ 'margin-bottom': '60px' }")
.qr-code-wrapper
qrcode-vue(:value="inviteLink" size="125")
qrcode-vue(:value="inviteLink" size="150")
img.q-ml-xl(:style="{ 'width': '150px', 'height': '150px' }" src="~/assets/images/onboarding-hypha-logo.png")
.row(v-else :style="{ 'margin-bottom': '200px' }")
#form3.flex.column.justify-center(v-show="step === this.steps.finish.name")
template
div.full-height.column.justify-center
Expand Down Expand Up @@ -317,13 +318,13 @@ export default {
loading-spinner(color="primary" size="72px")
#bottom-indicator.row.items-center(v-if="![this.steps.create.name, this.steps.loading.name].includes(step)")
.col
.col(v-if="$q.screen.gt.md")
.row.q-gutter-sm(v-if="$q.screen.gt.md")
.ellipse-border(:class="'ellipse-filled'")
.ellipse-border(:class="(step === this.steps.inviteLink.name || step === this.steps.finish.name ) && 'ellipse-filled'")
.ellipse-border(:class="step === this.steps.finish.name && 'ellipse-filled'")
.col-10.no-wrap.flex.justify-end.items-center
q-btn(v-if="step === this.steps.inviteLink.name && !$q.screen.gt.md" :label="$t('login.register-user-with-captcha-view.downloadWallet')" color="primary" outline unelevated @click="downloadWallet()" rounded no-caps)
.no-wrap.flex.justify-end.items-center(:class="{ 'col-10': $q.screen.gt.md, 'col': !$q.screen.gt.md, 'full-width': !$q.screen.gt.md}")
q-btn.full-width(v-if="step === this.steps.inviteLink.name && !$q.screen.gt.md" :label="$t('login.register-user-with-captcha-view.downloadWallet')" color="primary" outline unelevated @click="downloadWallet()" rounded no-caps)
q-btn(v-if="step === this.steps.inviteLink.name && $q.screen.gt.md" :label="$t('login.register-user-with-captcha-view.copyInviteLink')" color="primary" outline unelevated @click="copyText()" rounded no-caps)
q-btn(v-if="step !== this.steps.finish.name").q-mx-md.q-px-md(:style="{ 'height': 'fit-content' }" :label="step === 'finish' ? 'Need Help?' : 'Next'" color="primary" unelevated @click="next" :disable="!this.inviteLink" :loading="submitting" :outline="step === this.steps.finish.name" rounded no-caps)
q-list(v-if="step === steps.finish.name")
Expand Down
4 changes: 2 additions & 2 deletions src/components/proposals/proposal-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ widget.proposal-view.q-mb-sm
.column
.text-h5.text-bold {{ title }}
.text-italic.text-body {{ subtitle }}
version-history(v-if="type === PROPOSAL_TYPE.POLICY && !hidePolicyHistory" :proposalId="proposal?.docId ? proposal.docId : docId")
quest-progression(v-if="type === PROPOSAL_TYPE.QUEST_START" :proposalId="proposal?.docId ? proposal.docId : docId")
version-history(v-if="type === PROPOSAL_TYPE.POLICY && !hidePolicyHistory" :proposalId="proposal?.docId ? proposal?.docId : docId")
quest-progression(v-if="type === PROPOSAL_TYPE.QUEST_START && status === PROPOSAL_STATE.APPROVED" :proposalId="proposal?.docId ? proposal?.docId : docId")
.q-my-sm(:class="{ 'row':$q.screen.gt.md }" v-if="type === PROPOSAL_TYPE.ROLE || type === PROPOSAL_TYPE.EDIT || type === PROPOSAL_TYPE.PAYOUT || type === PROPOSAL_TYPE.ABILITY || type === PROPOSAL_TYPE.BADGE")
.col.bg-internal-bg.rounded-border(:class="{ 'q-mr-xs':$q.screen.gt.md, 'q-mb-sm':$q.screen.lt.md || $q.screen.md }" v-if="icon")
.row.full-width.q-pt-md.q-px-md.q-ml-xs(:class="{ 'q-pb-md':$q.screen.lt.md || $q.screen.md }" v-if="iconDetails")
Expand Down
16 changes: 8 additions & 8 deletions src/components/proposals/quest-progression.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,22 @@ export default {
return status
},
completionCardTitle () {
return this.currentQuest.status === PROPOSAL_STATE.PROPOSED ? 'Not available yet' : 'Create now!'
return this.currentQuest?.status === PROPOSAL_STATE.PROPOSED ? 'Not available yet' : 'Create now!'
}
}
}
</script>
<template lang="pug">
.quest-progression(v-if="currentQuest.status !== PROPOSAL_STATE.DRAFTED")
.quest-progression(v-if="currentQuest?.status !== PROPOSAL_STATE.DRAFTED")
.text-grey.text-italic.q-mb-sm(:style="{ 'font-size': '12px' }") {{ $t('proposals.quest-progression.questProgression') }}
.row
.q-mr-md.q-mb-md.rounded-border.q-pa-md(:style="{ 'min-width': '160px', 'max-width': '160px' }" :class="cardColor(currentQuest.status)")
.icon-container(:class="{ 'bg-primary': currentQuest.status === PROPOSAL_STATE.PENDING }")
q-icon(name="fa fa-map-marker" :color="iconColor(currentQuest.status)")
.h-h5.text-white(:style="{ 'white-space': 'nowrap', 'text-overflow': 'ellipsis', 'overflow': 'hidden' }") {{ currentQuest.title }}
.q-mr-md.q-mb-md.rounded-border.q-pa-md(:style="{ 'min-width': '160px', 'max-width': '160px' }" :class="cardColor(currentQuest?.status)")
.icon-container(:class="{ 'bg-primary': currentQuest?.status === PROPOSAL_STATE.PENDING }")
q-icon(name="fa fa-map-marker" :color="iconColor(currentQuest?.status)")
.h-h5.text-white(:style="{ 'white-space': 'nowrap', 'text-overflow': 'ellipsis', 'overflow': 'hidden' }") {{ currentQuest?.title }}
q-tooltip {{ currentQuest.title }}
.h-h7.text-white.q-mt-md(:class="{ 'text-grey': currentQuest.status === PROPOSAL_STATE.PENDING}") {{ cardStatus(currentQuest) }}
q-tooltip {{ currentQuest?.title }}
.h-h7.text-white.q-mt-md(:class="{ 'text-grey': currentQuest?.status === PROPOSAL_STATE.PENDING}") {{ cardStatus(currentQuest) }}
template(v-if="claimPayments?.length" v-for="card in claimPayments")
.q-mr-md.q-mb-md.rounded-border.q-pa-md(:style="{ 'min-width': '160px', 'max-width': '160px' }" :class="cardColor(card.status)")
.icon-container(:class="{ 'bg-primary': card.status === PROPOSAL_STATE.PENDING }")
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/DhoSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export default {
result (res) {
const data = res.data?.queryDao
if (!(data.length)) {
if (!(data?.length)) {
this.daoQueryNumberOfRetires++
if (this.daoQueryNumberOfRetires > MAX_NUM_OF_RETIRES) {
this.$router.push({ path: '/not-found' })
Expand Down
4 changes: 2 additions & 2 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,8 @@
"pleaseVerifyYou":"Please verify you are not a BOT",
"proceedWith":"Proceed with Hypha Wallet\n ",
"setupHyphaWallet":"Set-up Hypha Wallet",
"scanTheQr":"Scan the QR code on this page,",
"itContainsThe":" it contains the invite to create the Hypha Account on your wallet.",
"scanTheQr":"Click the 'Download Wallet' button on this page,",
"itContainsThe":" this will redirect you to the Hypha Wallet download page.",
"onceTheAccount":" Once the account is ready,",
"youAreSet":" you are set for the last next step.",
"copyInviteLink":"Copy invite link",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/onboarding/NLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export default {
padding 50px 80px
.bottom-card
position: absolute
top: 220px
top: 120px
left: 0
right: 0
bottom: 0
Expand Down
27 changes: 25 additions & 2 deletions src/pages/proposals/ProposalDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ const PROPOSAL_QUERY = `
}
}

start {
details_startTime_t
}

details_periodCount_i

lockedby {
docId
}
Expand Down Expand Up @@ -265,6 +271,11 @@ const PROPOSAL_QUERY = `
details_pegAmount_a
details_rewardAmount_a
details_voiceAmount_a
start {
details_startTime_t
}

details_periodCount_i
}

dao {
Expand Down Expand Up @@ -1399,9 +1410,10 @@ export default {
Circle: { key: 'circle', title: 'Circle' },
Policy: { key: 'policy', title: 'Policy' },
Quest: { key: 'quest', title: 'Quest' },
Queststart: { key: 'quest', title: 'Quest' },
Questcomplet: { key: 'quest', title: 'Quest' },
Budget: { key: 'circlebudget', title: 'Budget' }
}[this.proposal?.__typename]
}[this.proposal.__typename]
this.$store.commit('proposals/setStepIndex', 1)
this.$store.commit('proposals/setCategory', category)
this.$store.commit('proposals/setType', this.proposal?.__typename)
Expand Down Expand Up @@ -1475,6 +1487,17 @@ export default {
this.$store.commit('proposals/setPegCoefficient', this?.proposal?.details_pegCoefficientX10000_i)
}

if (this.proposal.__typename === PROPOSAL_TYPE.QUEST_START || this.proposal.__typename === PROPOSAL_TYPE.QUEST_PAYOUT) {
this.$store.commit('proposals/setUrl', this.proposal?.details_url_s)
this.$store.commit('proposals/setStartPeriod', this.proposal?.start?.[0])
this.$store.commit('proposals/setPeriodCount', this.proposal?.details_periodCount_i)
this.$store.commit('proposals/setPeg', this.proposal?.details_pegAmount_a.split(' ')[0])
this.$store.commit('proposals/setReward', this.proposal?.details_rewardAmount_a.split(' ')[0])
this.$store.commit('proposals/setVoice', this.proposal?.details_voiceAmount_a.split(' ')[0])
this.$store.commit('proposals/setStartPeriod', this.proposal?.start[0])
this.$store.commit('proposals/setPeriodCount', this.proposal?.details_periodCount_i)
}

const draftId = Date.now()
this.$store.commit('proposals/setDraftId', draftId)
this.saveDraft()
Expand Down
2 changes: 1 addition & 1 deletion src/pages/proposals/create/StepDuration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default {
<template lang="pug">
widget
label.h-h4 {{ fields.stepDurationTitle.label }}
label.h-h4 {{ fields.stepDurationTitle?.label }}
div
.q-mt-md
.q-gutter-sm(:class="{ 'row': $q.screen.gt.md }")
Expand Down
64 changes: 63 additions & 1 deletion src/store/proposals/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ export default {
let content
let proposalType
let publishToStaging

if (draft.edit) {
proposalType = 'edit'
publishToStaging = false
Expand Down Expand Up @@ -842,6 +841,69 @@ export default {
...(draft.masterPolicy ? [{ label: 'master_policy', value: ['int64', draft.masterPolicy.value] }] : [])
]
break

case PROPOSAL_TYPE.QUEST_PAYOUT:
content = [
{ label: 'content_group_label', value: ['string', 'details'] },
{ label: 'title', value: ['string', draft.title] },
{ label: 'description', value: ['string', draft.description] },
{ label: 'url', value: ['string', draft.url] },
{ label: 'annual_usd_salary', value: ['asset', `${parseFloat(draft.annualUsdSalary).toFixed(2)} USD`] },
{ label: 'fulltime_capacity_x100', value: ['int64', Math.round(parseFloat(draft.roleCapacity) * 100)] },
{ label: 'min_deferred_x100', value: ['int64', Math.round(parseFloat(draft.minDeferred))] },

{ label: 'voice_amount', value: ['asset', `${parseFloat(draft.voice).toFixed(rootState.dao.settings.voiceTokenDecimals)} ${rootState.dao.settings.voiceToken}`] },
{ label: 'reward_amount', value: ['asset', `${parseFloat(draft.reward).toFixed(rootState.dao.settings.rewardTokenDecimals)} ${rootState.dao.settings.rewardToken}`] },
{ label: 'peg_amount', value: ['asset', `${parseFloat(draft.peg).toFixed(rootState.dao.settings.pegTokenDecimals)} ${rootState.dao.settings.pegToken}`] },

{ label: 'start_period', value: ['int64', draft.startPeriod.docId] },
{ label: 'period_count', value: ['int64', draft.periodCount] },
{ label: 'recipient', value: ['name', rootState.accounts.account] },
...(draft.parentId ? [{ label: 'quest_start', value: ['int64', draft.parentId] }] : [])
]
break

case PROPOSAL_TYPE.QUEST_START:
content = [
{ label: 'content_group_label', value: ['string', 'details'] },
{ label: 'title', value: ['string', draft.title] },
{ label: 'description', value: ['string', draft.description] },
{ label: 'url', value: ['string', draft.url] },
{ label: 'annual_usd_salary', value: ['asset', `${parseFloat(draft.annualUsdSalary).toFixed(2)} USD`] },
{ label: 'fulltime_capacity_x100', value: ['int64', Math.round(parseFloat(draft.roleCapacity) * 100)] },
{ label: 'min_deferred_x100', value: ['int64', Math.round(parseFloat(draft.minDeferred))] },

{ label: 'voice_amount', value: ['asset', `${parseFloat(draft.voice).toFixed(rootState.dao.settings.voiceTokenDecimals)} ${rootState.dao.settings.voiceToken}`] },
{ label: 'reward_amount', value: ['asset', `${parseFloat(draft.reward).toFixed(rootState.dao.settings.rewardTokenDecimals)} ${rootState.dao.settings.rewardToken}`] },
{ label: 'peg_amount', value: ['asset', `${parseFloat(draft.peg).toFixed(rootState.dao.settings.pegTokenDecimals)} ${rootState.dao.settings.pegToken}`] },

{ label: 'start_period', value: ['int64', draft.startPeriod.docId] },
{ label: 'period_count', value: ['int64', draft.periodCount] },
{ label: 'recipient', value: ['name', rootState.accounts.account] },
...(draft.parentId ? [{ label: 'quest_start', value: ['int64', draft.parentId] }] : [])
]
break

case PROPOSAL_TYPE.QUEST :
content = [
{ label: 'content_group_label', value: ['string', 'details'] },
{ label: 'title', value: ['string', draft.title] },
{ label: 'description', value: ['string', draft.description] },
{ label: 'url', value: ['string', draft.url] },
{ label: 'annual_usd_salary', value: ['asset', `${parseFloat(draft.annualUsdSalary).toFixed(2)} USD`] },
{ label: 'fulltime_capacity_x100', value: ['int64', Math.round(parseFloat(draft.roleCapacity) * 100)] },
{ label: 'min_deferred_x100', value: ['int64', Math.round(parseFloat(draft.minDeferred))] },

{ label: 'voice_amount', value: ['asset', `${parseFloat(draft.voice).toFixed(rootState.dao.settings.voiceTokenDecimals)} ${rootState.dao.settings.voiceToken}`] },
{ label: 'reward_amount', value: ['asset', `${parseFloat(draft.reward).toFixed(rootState.dao.settings.rewardTokenDecimals)} ${rootState.dao.settings.rewardToken}`] },
{ label: 'peg_amount', value: ['asset', `${parseFloat(draft.peg).toFixed(rootState.dao.settings.pegTokenDecimals)} ${rootState.dao.settings.pegToken}`] },

{ label: 'start_period', value: ['int64', draft.startPeriod.docId] },
{ label: 'period_count', value: ['int64', draft.periodCount] },
{ label: 'recipient', value: ['name', rootState.accounts.account] },
...(draft.parentId ? [{ label: 'quest_start', value: ['int64', draft.parentId] }] : [])
]
break
}
if (content) {
const actions = [{
Expand Down

0 comments on commit 4c20ee6

Please sign in to comment.