From 3de5b72ad35dc76a7b1a4a8a44fc69d02e84bf37 Mon Sep 17 00:00:00 2001 From: Arsenije Savic Date: Mon, 25 Sep 2023 16:49:48 -0600 Subject: [PATCH] refactor: clean up --- src/App.vue | 2 +- src/components/dao/settings-plans-billing.vue | 40 +- src/layouts/Layout.vue | 218 +++++- src/layouts/MainLayout.vue | 97 --- src/layouts/MultiDhoLayout.vue | 672 +++++++++--------- src/layouts/ProposalLayout.vue | 92 --- src/router/routes.js | 3 +- src/store/accounts/state.js | 2 +- src/store/dao/mutations.js | 71 +- 9 files changed, 592 insertions(+), 605 deletions(-) delete mode 100644 src/layouts/MainLayout.vue delete mode 100644 src/layouts/ProposalLayout.vue diff --git a/src/App.vue b/src/App.vue index f326be441..f968b08d6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -23,7 +23,7 @@ export default { account: { async handler (value) { if (value) { - await this.getPublicProfile(this.account) + await this.getPublicProfile(value) } }, immediate: true diff --git a/src/components/dao/settings-plans-billing.vue b/src/components/dao/settings-plans-billing.vue index bba8c9c12..90ef8fc41 100644 --- a/src/components/dao/settings-plans-billing.vue +++ b/src/components/dao/settings-plans-billing.vue @@ -2,7 +2,7 @@ import { mapGetters } from 'vuex' import gql from 'graphql-tag' import { ORIGIN, PLAN_TYPE, PAYMENT_INTERVAL } from '~/const' -import formatPlan from '~/utils/format-plan' +// import formatPlan from '~/utils/format-plan' const STATES = Object.freeze({ WAITING: 'WAITING', @@ -23,22 +23,6 @@ const PLANS_QUERY = ` } ` -const ACTIVE_PLAN_QUERY = ` - activePlan(daoUrl: $daoUrl) { - subscriptionId - subscriptionItemId - subscriptionStatus - currency - currentPeriodEnd - currentPeriodStart - coreMembersCount - communityMembersCount - price - id: planId - name: planName - } - ` - export default { name: 'settings-plans-billing', components: { @@ -63,12 +47,6 @@ export default { query: gql`query PLANS{ ${PLANS_QUERY} }`, update: data => data.getStripePrices, fetchPolicy: 'no-cache' - }, - activePlan: { - variables() { return { daoUrl: this.$route.params.dhoname } }, - query: gql`query activePlan($daoUrl: String!) { ${ACTIVE_PLAN_QUERY} }`, - update: data => formatPlan(data.activePlan), - fetchPolicy: 'no-cache' } }, @@ -191,10 +169,6 @@ export default { isFreePlan() { return !this.selectedDaoPlan?.id }, isPlanModalOpen() { return [STATES.UPDATING_PLAIN, STATES.CREATING_SESSION].includes(this.state) }, - currentPlan() { - return this.activePlan?.id ? this.activePlan : this.selectedDaoPlan - }, - plans() { return this._plans .map(_ => ({ @@ -264,7 +238,7 @@ export default { div .text-xl.text-weight-600.text-primary {{ $t(`plans.${plan.name}`) }} p.q-pa-none.q-ma-none.text-3xl.text-primary.text-bold ${{ formatMoney(plan.amountUSD) }} - div(v-if="currentPlan?.id === plan.id") + div(v-if="selectedDaoPlan?.id === plan.id") q-chip(dense color="positive" text-color="white") span.text-uppercase.text-xxs.text-bold.q-px-xxs {{ $t(`statuses.active`) }} .hr.q-mt-md.q-mb-xs @@ -282,7 +256,7 @@ export default { nav.q-mt-xl.full-width.row.justify-end q-btn.q-px-xl.rounded-border.text-bold.q-ml-xs( - :disable="currentPlan?.id === plan.id" + :disable="selectedDaoPlan?.id === plan.id" :label="$t('configuration.settings-plans-billing.plan.modal.cta')" @click="isFreePlan ? _createCheckoutSession(plan.id) : _updateSubscription(plan.id)" color="secondary" @@ -300,20 +274,20 @@ export default { widget.q-mt-xl(bar shadow) header.row.justify-between div - .text-xl.text-weight-600.text-primary {{ $t(`plans.${currentPlan.name}`) }} - p.q-pa-none.q-ma-none.text-3xl.text-primary.text-bold ${{ formatMoney(currentPlan.amountUSD) }} + .text-xl.text-weight-600.text-primary {{ $t(`plans.${selectedDaoPlan.name}`) }} + p.q-pa-none.q-ma-none.text-3xl.text-primary.text-bold ${{ formatMoney(selectedDaoPlan.amountUSD) }} //- TODO: Return after beta //- span.q-ml-xxs.text-sm.text-weight-500 / {{ $('periods.month') }} div q-chip(dense color="positive" text-color="white") - span.text-uppercase.text-xxs.text-bold.q-px-xxs {{ $t(`statuses.${currentPlan.status}`) }} + span.text-uppercase.text-xxs.text-bold.q-px-xxs {{ $t(`statuses.${selectedDaoPlan.status}`) }} .hr.q-mt-md.q-mb-xs footer div.row.justify-between p.q-pa-none.q-ma-none.text-sm.text-h-gray.leading-loose Core Members - p.q-pa-none.q-ma-none.text-sm.text-h-gray.leading-loose {{ selectedDaoPlan.currentCoreMembersCount }} / {{ currentPlan.coreMembersCount }} + p.q-pa-none.q-ma-none.text-sm.text-h-gray.leading-loose {{ selectedDaoPlan.currentCoreMembersCount }} / {{ selectedDaoPlan.coreMembersCount }} //- TODO: Return after beta //- div.row.justify-between.q-mt-xs //- p.q-pa-none.q-ma-none.text-sm.text-h-gray.leading-loose Community Members diff --git a/src/layouts/Layout.vue b/src/layouts/Layout.vue index cf156482d..1540ee7a9 100644 --- a/src/layouts/Layout.vue +++ b/src/layouts/Layout.vue @@ -1,4 +1,150 @@ diff --git a/src/layouts/MultiDhoLayout.vue b/src/layouts/MultiDhoLayout.vue index b3f13f7f8..723e53269 100644 --- a/src/layouts/MultiDhoLayout.vue +++ b/src/layouts/MultiDhoLayout.vue @@ -6,307 +6,307 @@ import { timeago } from '~/utils/TimeUtils' import { parsedNotification } from '~/utils/notifications-utils' import { ROUTE_NAMES } from '~/const' -const MAX_NUM_OF_RETIRES = 10 - -const DAO_ACTIVE_QUERY = ` - activePlan(daoUrl: $daoUrl) { - subscriptionId - subscriptionItemId - subscriptionStatus - currency - currentPeriodEnd - currentPeriodStart - coreMembersCount - communityMembersCount - price - id: planId - name: planName - } - - queryDao @cascade(fields: ["settings"]) { - docId - details_daoName_n +// const MAX_NUM_OF_RETIRES = 10 + +// const DAO_ACTIVE_QUERY = ` +// activePlan(daoUrl: $daoUrl) { +// subscriptionId +// subscriptionItemId +// subscriptionStatus +// currency +// currentPeriodEnd +// currentPeriodStart +// coreMembersCount +// communityMembersCount +// price +// id: planId +// name: planName +// } - details_daoType_s - # details_isWaitingEcosystem_i - createdDate +// queryDao @cascade(fields: ["settings"]) { +// docId +// details_daoName_n - upcomingelct { - docId - } +// details_daoType_s +// # details_isWaitingEcosystem_i +// createdDate - admin(filter: { details_member_n: { eq: $username } }) { - docId - } - enroller(filter: { details_member_n: { eq: $username } }) { - docId - } - applicant(filter: { details_member_n: { eq: $username } }) { - docId - } - member(filter: { details_member_n: { eq: $username } }) { - docId - } +// upcomingelct { +// docId +// } - announcements: alert { - id: docId - title: details_level_s - message: details_content_s - enabled: details_enabled_i - } +// admin(filter: { details_member_n: { eq: $username } }) { +// docId +// } +// enroller(filter: { details_member_n: { eq: $username } }) { +// docId +// } +// applicant(filter: { details_member_n: { eq: $username } }) { +// docId +// } +// member(filter: { details_member_n: { eq: $username } }) { +// docId +// } - planmanager { - bill { - id: docId - startDate: details_startDate_t - endDate: details_endDate_t - expirationDate: details_expirationDate_t - periodCount: details_periodCount_i - name: details_planName_s - price: details_planPrice_a - isInfinite: details_isInfinite_i - discountPercX10000: details_discountPercX10000_i - - pricingplan { - maxMemberCount: details_maxMemberCount_i - } - } - currentbill { - id: docId - startDate: details_startDate_t - endDate: details_endDate_t - expirationDate: details_expirationDate_t - periodCount: details_periodCount_i - name: details_planName_s - price: details_planPrice_a - isInfinite: details_isInfinite_i - discountPercX10000: details_discountPercX10000_i - - pricingplan { - maxMemberCount: details_maxMemberCount_i - } - } - lastbill { - id: docId - startDate: details_startDate_t - endDate: details_endDate_t - expirationDate: details_expirationDate_t - periodCount: details_periodCount_i - name: details_planName_s - price: details_planPrice_a - isInfinite: details_isInfinite_i - discountPercX10000: details_discountPercX10000_i - - pricingplan { - maxMemberCount: details_maxMemberCount_i - } - } - } +// announcements: alert { +// id: docId +// title: details_level_s +// message: details_content_s +// enabled: details_enabled_i +// } - multisigs: openmultisig { - approvedby { - docId - details_member_n - } +// planmanager { +// bill { +// id: docId +// startDate: details_startDate_t +// endDate: details_endDate_t +// expirationDate: details_expirationDate_t +// periodCount: details_periodCount_i +// name: details_planName_s +// price: details_planPrice_a +// isInfinite: details_isInfinite_i +// discountPercX10000: details_discountPercX10000_i + +// pricingplan { +// maxMemberCount: details_maxMemberCount_i +// } +// } +// currentbill { +// id: docId +// startDate: details_startDate_t +// endDate: details_endDate_t +// expirationDate: details_expirationDate_t +// periodCount: details_periodCount_i +// name: details_planName_s +// price: details_planPrice_a +// isInfinite: details_isInfinite_i +// discountPercX10000: details_discountPercX10000_i + +// pricingplan { +// maxMemberCount: details_maxMemberCount_i +// } +// } +// lastbill { +// id: docId +// startDate: details_startDate_t +// endDate: details_endDate_t +// expirationDate: details_expirationDate_t +// periodCount: details_periodCount_i +// name: details_planName_s +// price: details_planPrice_a +// isInfinite: details_isInfinite_i +// discountPercX10000: details_discountPercX10000_i + +// pricingplan { +// maxMemberCount: details_maxMemberCount_i +// } +// } +// } - id: docId - - # ecosystem_name_s - # ecosystem_logo_s - # ecosystem_domain_s - # ecosystem_purpose_s - - # settings_onboarderAccount_n - - # settings_claimEnabled_i - settings_daoUrl_s - # settings_daoName_n - settings_daoTitle_s - # settings_daoDescription_s - # settings_governanceTokenContract_n - # settings_pegToken_a - # settings_pegTokenContract_n - # settings_rewardToken_a - # settings_rewardTokenContract_n - # settings_rewardToPegRatio_a - # settings_treasuryContract_n - # settings_voiceToken_a - - settings_socialChat_s - settings_documentationButtonText_s - - settings_proposalsCreationEnabled_i - settings_membersApplicationEnabled_i - settings_removableBannersEnabled_i - settings_multisigEnabled_i - - settings_votingDurationSec_i - # settings_periodDurationSec_i - settings_votingAlignmentX100_i - settings_votingQuorumX100_i - # settings_voiceTokenDecayPeriod_i - - settings_communityVotingEnabled_i - settings_communityVotingMethod_s - settings_upvoteStartDateTime_s - settings_upvoteDuration_i - settings_upvoteRounds_s - settings_upvoteCheifDelegateCount_i - settings_upvoteCheifDelegateDuration_i - settings_upvoteHeadDelegateRound_i - settings_upvoteHeadDelegateDuration_i - settings_communityVotingDurationSec_i - settings_communityVotingAlignmentPercent_i - settings_communityVotingQuorumPercent_i - - # settings_usesSeeds_i - # settings_isHypha_i - - settings_logo_s - settings_extendedLogo_s - settings_primaryColor_s - settings_secondaryColor_s - settings_textColor_s - settings_pattern_s - settings_patternColor_s - settings_patternOpacity_i - settings_patternBase64_s - - settings_splashBackgroundImage_s - - settings_dashboardBackgroundImage_s - settings_dashboardTitle_s - settings_dashboardParagraph_s - - settings_proposalsBackgroundImage_s - settings_proposalsTitle_s - settings_proposalsParagraph_s - - settings_membersBackgroundImage_s - settings_membersTitle_s - settings_membersParagraph_s - - settings_organisationBackgroundImage_s - settings_organisationTitle_s - settings_organisationParagraph_s - - settings_exploreBackgroundImage_s - settings_exploreTitle_s - settings_exploreParagraph_s - - settings_documentationURL_s - } +// multisigs: openmultisig { +// approvedby { +// docId +// details_member_n +// } + +// id: docId + +// # ecosystem_name_s +// # ecosystem_logo_s +// # ecosystem_domain_s +// # ecosystem_purpose_s + +// # settings_onboarderAccount_n + +// # settings_claimEnabled_i +// settings_daoUrl_s +// # settings_daoName_n +// settings_daoTitle_s +// # settings_daoDescription_s +// # settings_governanceTokenContract_n +// # settings_pegToken_a +// # settings_pegTokenContract_n +// # settings_rewardToken_a +// # settings_rewardTokenContract_n +// # settings_rewardToPegRatio_a +// # settings_treasuryContract_n +// # settings_voiceToken_a + +// settings_socialChat_s +// settings_documentationButtonText_s + +// settings_proposalsCreationEnabled_i +// settings_membersApplicationEnabled_i +// settings_removableBannersEnabled_i +// settings_multisigEnabled_i + +// settings_votingDurationSec_i +// # settings_periodDurationSec_i +// settings_votingAlignmentX100_i +// settings_votingQuorumX100_i +// # settings_voiceTokenDecayPeriod_i + +// settings_communityVotingEnabled_i +// settings_communityVotingMethod_s +// settings_upvoteStartDateTime_s +// settings_upvoteDuration_i +// settings_upvoteRounds_s +// settings_upvoteCheifDelegateCount_i +// settings_upvoteCheifDelegateDuration_i +// settings_upvoteHeadDelegateRound_i +// settings_upvoteHeadDelegateDuration_i +// settings_communityVotingDurationSec_i +// settings_communityVotingAlignmentPercent_i +// settings_communityVotingQuorumPercent_i + +// # settings_usesSeeds_i +// # settings_isHypha_i + +// settings_logo_s +// settings_extendedLogo_s +// settings_primaryColor_s +// settings_secondaryColor_s +// settings_textColor_s +// settings_pattern_s +// settings_patternColor_s +// settings_patternOpacity_i +// settings_patternBase64_s + +// settings_splashBackgroundImage_s + +// settings_dashboardBackgroundImage_s +// settings_dashboardTitle_s +// settings_dashboardParagraph_s + +// settings_proposalsBackgroundImage_s +// settings_proposalsTitle_s +// settings_proposalsParagraph_s + +// settings_membersBackgroundImage_s +// settings_membersTitle_s +// settings_membersParagraph_s + +// settings_organisationBackgroundImage_s +// settings_organisationTitle_s +// settings_organisationParagraph_s + +// settings_exploreBackgroundImage_s +// settings_exploreTitle_s +// settings_exploreParagraph_s + +// settings_documentationURL_s +// } - settings(filter: { settings_daoUrl_s: { regexp: $regexp } }) { - ecosystem_name_s - ecosystem_logo_s - ecosystem_domain_s - ecosystem_purpose_s - - settings_onboarderAccount_n - - settings_claimEnabled_i - settings_daoUrl_s - settings_daoName_n - settings_daoTitle_s - settings_daoDescription_s - settings_governanceTokenContract_n - - settings_pegTokenName_s - settings_pegToken_a - settings_pegTokenContract_n - settings_treasuryTokenMultiplier_i - settings_treasuryContract_n - - settings_rewardTokenName_s - settings_rewardToken_a - settings_rewardTokenContract_n - settings_rewardToPegRatio_a - settings_rewardTokenMaxSupply_a - settings_utilityTokenMultiplier_i - - settings_voiceToken_a - settings_voiceTokenDecayPeriod_i - settings_voiceTokenDecayPerPeriodX10M_i - settings_voiceTokenMultiplier_i - - settings_socialChat_s - settings_documentationButtonText_s - - settings_proposalsCreationEnabled_i - settings_membersApplicationEnabled_i - settings_removableBannersEnabled_i - settings_multisigEnabled_i - - settings_votingDurationSec_i - settings_periodDurationSec_i - settings_votingAlignmentX100_i - settings_votingQuorumX100_i - settings_voiceTokenDecayPeriod_i - - settings_communityVotingEnabled_i - settings_communityVotingMethod_s - settings_upvoteStartDateTime_s - settings_upvoteDuration_i - settings_upvoteRounds_s - settings_upvoteCheifDelegateCount_i - settings_upvoteCheifDelegateDuration_i - settings_upvoteHeadDelegateRound_i - settings_upvoteHeadDelegateDuration_i - settings_communityVotingDurationSec_i - settings_communityVotingAlignmentPercent_i - settings_communityVotingQuorumPercent_i - - settings_usesSeeds_i - settings_isHypha_i - - settings_logo_s - settings_extendedLogo_s - settings_primaryColor_s - settings_secondaryColor_s - settings_textColor_s - settings_pattern_s - settings_patternColor_s - settings_patternOpacity_i - settings_patternBase64_s - - settings_splashBackgroundImage_s - - settings_dashboardBackgroundImage_s - settings_dashboardTitle_s - settings_dashboardParagraph_s - - settings_proposalsBackgroundImage_s - settings_proposalsTitle_s - settings_proposalsParagraph_s - - settings_membersBackgroundImage_s - settings_membersTitle_s - settings_membersParagraph_s - - settings_organisationBackgroundImage_s - settings_organisationTitle_s - settings_organisationParagraph_s - - settings_exploreBackgroundImage_s - settings_exploreTitle_s - settings_exploreParagraph_s - - settings_documentationURL_s - } +// settings(filter: { settings_daoUrl_s: { regexp: $regexp } }) { +// ecosystem_name_s +// ecosystem_logo_s +// ecosystem_domain_s +// ecosystem_purpose_s + +// settings_onboarderAccount_n + +// settings_claimEnabled_i +// settings_daoUrl_s +// settings_daoName_n +// settings_daoTitle_s +// settings_daoDescription_s +// settings_governanceTokenContract_n + +// settings_pegTokenName_s +// settings_pegToken_a +// settings_pegTokenContract_n +// settings_treasuryTokenMultiplier_i +// settings_treasuryContract_n + +// settings_rewardTokenName_s +// settings_rewardToken_a +// settings_rewardTokenContract_n +// settings_rewardToPegRatio_a +// settings_rewardTokenMaxSupply_a +// settings_utilityTokenMultiplier_i + +// settings_voiceToken_a +// settings_voiceTokenDecayPeriod_i +// settings_voiceTokenDecayPerPeriodX10M_i +// settings_voiceTokenMultiplier_i + +// settings_socialChat_s +// settings_documentationButtonText_s + +// settings_proposalsCreationEnabled_i +// settings_membersApplicationEnabled_i +// settings_removableBannersEnabled_i +// settings_multisigEnabled_i + +// settings_votingDurationSec_i +// settings_periodDurationSec_i +// settings_votingAlignmentX100_i +// settings_votingQuorumX100_i +// settings_voiceTokenDecayPeriod_i + +// settings_communityVotingEnabled_i +// settings_communityVotingMethod_s +// settings_upvoteStartDateTime_s +// settings_upvoteDuration_i +// settings_upvoteRounds_s +// settings_upvoteCheifDelegateCount_i +// settings_upvoteCheifDelegateDuration_i +// settings_upvoteHeadDelegateRound_i +// settings_upvoteHeadDelegateDuration_i +// settings_communityVotingDurationSec_i +// settings_communityVotingAlignmentPercent_i +// settings_communityVotingQuorumPercent_i + +// settings_usesSeeds_i +// settings_isHypha_i + +// settings_logo_s +// settings_extendedLogo_s +// settings_primaryColor_s +// settings_secondaryColor_s +// settings_textColor_s +// settings_pattern_s +// settings_patternColor_s +// settings_patternOpacity_i +// settings_patternBase64_s + +// settings_splashBackgroundImage_s + +// settings_dashboardBackgroundImage_s +// settings_dashboardTitle_s +// settings_dashboardParagraph_s + +// settings_proposalsBackgroundImage_s +// settings_proposalsTitle_s +// settings_proposalsParagraph_s + +// settings_membersBackgroundImage_s +// settings_membersTitle_s +// settings_membersParagraph_s + +// settings_organisationBackgroundImage_s +// settings_organisationTitle_s +// settings_organisationParagraph_s + +// settings_exploreBackgroundImage_s +// settings_exploreTitle_s +// settings_exploreParagraph_s + +// settings_documentationURL_s +// } - levels: salaryband { - id: docId - name: details_name_s - annualAmount: details_annualUsdSalary_a - minDeferred: details_minDeferredX100_i - } +// levels: salaryband { +// id: docId +// name: details_name_s +// annualAmount: details_annualUsdSalary_a +// minDeferred: details_minDeferredX100_i +// } - memberAggregate { - count - } - } -` +// memberAggregate { +// count +// } +// } +// ` // const NOTIFICATIONS_QUERY = ` // queryNotification(order: { desc: time }) { @@ -356,50 +356,50 @@ export default { }, apollo: { - dao: { - query: gql`query activeDao($daoUrl: String!, $regexp: String!, $username: String) { ${DAO_ACTIVE_QUERY} }`, - update: data => { - const dao = data.queryDao[0] - return { - ...dao, - name: dao?.details_daoName_n || '', - title: dao?.settings[0]?.settings_daoTitle_s || '', - icon: dao?.settings[0]?.settings_logo_s || '', - isHypha: dao?.settings[0]?.settings_isHypha_i || '' - } - }, - skip () { return !this.dhoname || this.isLogged ? !this.account : '' }, - variables () { - return { - regexp: '/^' + this.dhoname + '$/i', - daoUrl: this.dhoname, - username: this.account - } - }, - - async result (res) { - const data = res?.data - - if (!data?.queryDao?.length) { - this.daoQueryNumberOfRetires++ - if (this.daoQueryNumberOfRetires > MAX_NUM_OF_RETIRES) { - this.$router.push({ path: '/not-found' }) - } else { - this.$apollo.queries.dao.refetch() - } - return - } - - this.$store.commit('accounts/setMember', data?.queryDao[0]) - this.$store.dispatch('ballots/getSupply') - this.$store.commit('dao/switchDao', data) - this.$store.dispatch('dao/setTheme') - this.state = STATE.READY - }, - loadingKey: 'loading', - fetchPolicy: 'no-cache' - // pollInterval: 300 // TODO: Swap with subscribe once dgraph is ready - }, + // dao: { + // query: gql`query activeDao($daoUrl: String!, $regexp: String!, $username: String) { ${DAO_ACTIVE_QUERY} }`, + // update: data => { + // const dao = data.queryDao[0] + // return { + // ...dao, + // name: dao?.details_daoName_n || '', + // title: dao?.settings[0]?.settings_daoTitle_s || '', + // icon: dao?.settings[0]?.settings_logo_s || '', + // isHypha: dao?.settings[0]?.settings_isHypha_i || '' + // } + // }, + // skip () { return !this.dhoname || this.isLogged ? !this.account : '' }, + // variables () { + // return { + // regexp: '/^' + this.dhoname + '$/i', + // daoUrl: this.dhoname, + // username: this.account + // } + // }, + + // async result (res) { + // const data = res?.data + + // if (!data?.queryDao?.length) { + // this.daoQueryNumberOfRetires++ + // if (this.daoQueryNumberOfRetires > MAX_NUM_OF_RETIRES) { + // this.$router.push({ path: '/not-found' }) + // } else { + // this.$apollo.queries.dao.refetch() + // } + // return + // } + + // this.$store.commit('accounts/setMember', data?.queryDao[0]) + // this.$store.dispatch('ballots/getSupply') + // this.$store.commit('dao/switchDao', data) + // this.$store.dispatch('dao/setTheme') + // this.state = STATE.READY + // }, + // loadingKey: 'loading', + // fetchPolicy: 'no-cache' + // // pollInterval: 300 // TODO: Swap with subscribe once dgraph is ready + // }, dhos: { query: require('../query/profile/profile-dhos.gql'), @@ -443,7 +443,7 @@ export default { return { daoQueryNumberOfRetires: 0, STATE, - state: STATE.LOADING, + state: STATE.READY, ROUTE_NAMES, timeago, diff --git a/src/layouts/ProposalLayout.vue b/src/layouts/ProposalLayout.vue deleted file mode 100644 index 52b33d754..000000000 --- a/src/layouts/ProposalLayout.vue +++ /dev/null @@ -1,92 +0,0 @@ - - - - - diff --git a/src/router/routes.js b/src/router/routes.js index 3161e90dd..c02659bea 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -34,7 +34,8 @@ const routes = [ name: 'create-your-dao', meta: { title: I18n.t('routes.createYourDao'), - hideForAuth: false + hideForAuth: false, + layout: () => import('layouts/LoginLayout.vue') }, component: () => import('pages/onboarding/NLogin.vue') }, diff --git a/src/store/accounts/state.js b/src/store/accounts/state.js index edd99039f..1b714de18 100644 --- a/src/store/accounts/state.js +++ b/src/store/accounts/state.js @@ -1,6 +1,6 @@ export default () => ({ account: null, - membership: false, + membership: true, applicant: false, enroller: false, admin: false, diff --git a/src/store/dao/mutations.js b/src/store/dao/mutations.js index 206aa4cb5..51d3ba801 100644 --- a/src/store/dao/mutations.js +++ b/src/store/dao/mutations.js @@ -1,11 +1,4 @@ import { PLAN, PLAN_STATUS } from '~/const' -export const setDho = (state, dho) => { - if (dho && dho.length === 1) { - state.dho = { - ...dho[0].settings[0] - } - } -} const settingsMapper = (settings) => { return { @@ -105,58 +98,50 @@ const settingsMapper = (settings) => { } } -// Called by DhoSelector.vue after the apollo query -export const switchDao = (state, data) => { - const dao = data?.queryDao[0] || {} - const plan = data?.activePlan || {} +export const setAlerts = (state, data) => { + state.alerts = [...data] +} +export const setConfigs = (state, data) => { + state.configs = { + ...state.configs, + ...data + } +} + +export const setDAO = (state, dao) => { state.name = dao.details_daoName_n state.hash = dao.hash state.docId = dao.docId - state.announcements = [...dao.announcements].map(_ => ({ ..._, enabled: Boolean(_.enabled) })) - state.meta = { memberCount: dao.memberAggregate.count } - state.plan = { - ...plan, - name: (plan?.name || PLAN.FOUNDER).toLowerCase(), - status: plan?.status || PLAN_STATUS.ACTIVE, - amountUSD: (plan?.price / 100), - coreMembersCount: plan?.coreMembersCount || 5, - communityMembersCount: plan?.communityMembersCount || 0, - currentCoreMembersCount: dao?.memberAggregate?.count || 0 - - } - - const multisigs = dao.multisigs - state.multisigs = multisigs && multisigs.length > 0 ? multisigs.map(settingsMapper) : [] - const settings = dao.settings[0] - state.ecosystem = { - name: settings?.ecosystem_name_s, - logo: settings?.ecosystem_logo_s, - domain: settings?.ecosystem_domain_s, - purpose: settings?.ecosystem_purpose_s - } - state.settings = { - ...settingsMapper(settings), - levels: [...dao?.levels], - upvoteElectionId: dao?.upcomingelct?.[0]?.docId + ...settingsMapper(settings) } } -export const setAlerts = (state, data) => { - state.alerts = [...data] +export const setDho = (state, dho) => { + if (dho && dho.length === 1) { + state.dho = { + ...dho[0].settings[0] + } + } } -export const setConfigs = (state, data) => { - state.configs = { - ...state.configs, - ...data +export const setPlan = (state, plan) => { + state.plan = { + ...plan, + name: (plan?.name || PLAN.FOUNDER).toLowerCase(), + status: plan?.status || PLAN_STATUS.ACTIVE, + amountUSD: (plan?.price / 100) / 12, + coreMembersCount: plan?.coreMembersCount || 5, + communityMembersCount: plan?.communityMembersCount || 0, + currentCoreMembersCount: state?.meta?.memberCount || 0 + } }