Skip to content

Commit

Permalink
chore: sync develop and master
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-IS authored Jul 15, 2023
2 parents 25dfee7 + cfea660 commit 04d2f7e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 37 deletions.
4 changes: 2 additions & 2 deletions src/components/profiles/wallet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default {
computed: {
...mapGetters('accounts', ['account']),
...mapGetters('ballots', ['supply']),
...mapGetters('dao', ['daoSettings']),
isOwner () { return this.username === this.account }
Expand All @@ -45,7 +46,6 @@ export default {
},
methods: {
...mapActions('ballots', ['getSupply']),
...mapActions('payments', ['redeemAddress']),
...mapActions('profiles', ['getTokensAmounts']),
Expand All @@ -63,7 +63,7 @@ export default {
async fetchTokens () {
try {
this.wallet = []
this.supply = parseFloat(await this.getSupply())
if (this.username) {
const tokens = await this.getTokensAmounts(this.username)
this.pegToken = tokens.peg
Expand Down
13 changes: 2 additions & 11 deletions src/components/proposals/voter-list.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script>
import { mapActions } from 'vuex'
import gql from 'graphql-tag'
import paginate from '~/utils/paginate'
const PROPOSAL_VOTES_QUERY = `
getDocument(docId: $docId) {
Expand Down Expand Up @@ -89,17 +90,7 @@ export default {
pageCount () { return Math.ceil(this.voteCount / 5) },
votesPaginated () {
if (!this.votes || this.isLoading) return []
const startIndex = this.page * this.size
const lastIndex = startIndex + this.size
const voteCount = this.votes.length
if (voteCount >= lastIndex) {
return [...this.votes].splice(startIndex, this.size)
}
return [...this.votes].splice(startIndex / this.size, this.size)
return (!this.votes || this.isLoading) ? [] : paginate(this.votes, this.page, this.size)
}
},
Expand Down
1 change: 1 addition & 0 deletions src/layouts/DhoSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default {
this.$store.dispatch('accounts/checkMembership')
this.$store.commit('dao/switchDao', data)
this.$store.dispatch('dao/setTheme')
this.$store.dispatch('ballots/getSupply')
},
skip () { return !this.dhoname || !this.daoRegexp },
variables () { return { regexp: this.daoRegexp } },
Expand Down
25 changes: 9 additions & 16 deletions src/pages/proposals/ProposalHistory.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { mapActions, mapGetters } from 'vuex'
import { mapGetters } from 'vuex'
import { getProposalChipFilters } from '../../utils/proposal-filter'
import { PROPOSAL_STATE } from '~/const'
Expand Down Expand Up @@ -43,7 +43,7 @@ export default {
optionArray: [{ label: 'Sort by', disable: true }, 'Last added'],
circleArray: ['All circles', 'Circle One'],
pagination: {
first: 10,
first: 50,
offset: 0,
more: true
},
Expand Down Expand Up @@ -72,19 +72,19 @@ export default {
return filter.filter(proposal) &&
proposal.details_state_s !== PROPOSAL_STATE.DRAFTED &&
proposal.details_state_s !== PROPOSAL_STATE.PROPOSED &&
!proposal.details_autoApprove_i &&
proposal.creator !== 'dao.hypha' &&
(!this.textFilter || this.textFilter.length === 0 ||
(proposal.details_title_s?.toLocaleLowerCase() || '').includes(this.textFilter.toLocaleLowerCase()))
})
})
},
hasProposals () {
return this.archivedProposals?.length
}
hasProposals () { return this.archivedProposals?.length },
isLoading () { return this.$apollo.queries.archivedProposals.loading }
},
watch: {
selectedDao () {
this.getSupply()
this.$apollo.queries.archivedProposals.stop()
if (this.archivedProposals) {
this.resetPaginationValues()
Expand Down Expand Up @@ -129,18 +129,11 @@ export default {
window.scrollTo(0, 0)
},
created () {
if (!this.supply) {
this.getSupply()
}
},
activated () {
this.$apollo.queries.archivedProposals.refetch()
},
methods: {
...mapActions('ballots', ['getSupply']),
async onLoad (index, done) {
if (this.$apollo.queries.archivedProposals.loading) {
return
Expand Down Expand Up @@ -192,12 +185,12 @@ export default {
q-page.page-proposals
.row.q-py-md
.col-12.col-lg-9
base-placeholder.q-mr-sm(:compact="!$q.screen.gt.md" v-if="!hasProposals" :title="$t('pages.proposals.proposalhistory.noProposals')" subtitle="Your organization has not created any proposals yet. You can create a new proposal by clicking the button below." icon="fas fa-file-medical" :actionButtons="[{label: 'Create a new Proposal', color: 'primary', onClick: () => $router.push(`/${this.daoSettings.url}/proposals/create`), disable: !isMember, disableTooltip: 'You must be a member'}]")
base-placeholder.q-mr-sm(:compact="!$q.screen.gt.md" v-if="!filteredProposals.length && hasProposals" :title="$t('pages.proposals.proposalhistory.oopsNothingCould')" subtitle="Try a different filter or another keyword" icon="far fa-check-square" :actionButtons="[{label: 'Reset filter(s)', color: 'primary', onClick: () => this.$refs.filter.resetFilters() }]")
base-placeholder.q-mr-sm(:compact="!$q.screen.gt.md" v-if="!isLoading && !hasProposals" :title="$t('pages.proposals.proposalhistory.noProposals')" subtitle="Your organization has not created any proposals yet. You can create a new proposal by clicking the button below." icon="fas fa-file-medical" :actionButtons="[{label: 'Create a new Proposal', color: 'primary', onClick: () => $router.push(`/${this.daoSettings.url}/proposals/create`), disable: !isMember, disableTooltip: 'You must be a member'}]")
base-placeholder.q-mr-sm(:compact="!$q.screen.gt.md" v-if="!isLoading && !filteredProposals.length && hasProposals" :title="$t('pages.proposals.proposalhistory.oopsNothingCould')" subtitle="Try a different filter or another keyword" icon="far fa-check-square" :actionButtons="[{label: 'Reset filter(s)', color: 'primary', onClick: () => this.$refs.filter.resetFilters() }]")
proposal-list.q-mb-xxxl(:username="account" :proposals="filteredProposals" :supply="supply" :view="$q.screen.gt.md ? view: 'card'" :compact="!$q.screen.gt.md")
.row.justify-center.q-mb-xxxl(v-if="$apollo.loading")
loading-spinner(color="primary" size="72px")
q-infinite-scroll.scroll(@load="onLoad" :offset="750" ref="scroll" v-if="filteredProposals.length" :disable="!pagination.more" debounce="500" scroll-target=".hide-scrollbar")
q-infinite-scroll.scroll(@load="onLoad" :offset="1000" ref="scroll" v-if="filteredProposals.length" :disable="!pagination.more" debounce="30" scroll-target=".hide-scrollbar")
.col-3(v-if="$q.screen.gt.md")
filter-widget.sticky(ref="filter" :view.sync="view" :defaultOption="1" :sort.sync="sort" :textFilter.sync="textFilter" :circle.sync="circle" :showCircle="false" :optionArray.sync="optionArray" :circleArray.sync="circleArray" :viewSelectorLabel="'View'" :chipsFiltersLabel="'Proposal types'" :showViewSelector="false" :filters.sync="filters")
.row.full-width.q-my-md(v-if="!$q.screen.gt.md")
Expand Down
9 changes: 1 addition & 8 deletions src/pages/proposals/ProposalList.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { mapActions, mapGetters } from 'vuex'
import { mapGetters } from 'vuex'
import ipfsy from '~/utils/ipfsy'
import { getProposalChipFilters } from '../../utils/proposal-filter'
import gql from 'graphql-tag'
Expand Down Expand Up @@ -593,7 +593,6 @@ export default {
},
watch: {
selectedDao () {
this.getSupply()
this.$apollo.queries.dao.stop()
if (this.dao) {
this.resetPaginationValues()
Expand Down Expand Up @@ -631,11 +630,6 @@ export default {
}
},
created () {
if (!this.supply) {
this.getSupply()
}
},
activated () {
this.$apollo.queries.stagedProposals.refetch()
},
Expand All @@ -645,7 +639,6 @@ export default {
}
},
methods: {
...mapActions('ballots', ['getSupply']),
hideProposalBanner () {
localStorage.setItem('showProposalBanner', false)
Expand Down
3 changes: 3 additions & 0 deletions src/query/proposals/dao-proposals-history.gql
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ query historyProposals($docId: String!, $first: Int!, $offset: Int!) {
... on Circle {
details_dao_i
details_state_s

details_autoApprove_i

details_title_s
details_description_s
Expand Down Expand Up @@ -369,6 +371,7 @@ query historyProposals($docId: String!, $first: Int!, $offset: Int!) {
}

... on Role {
details_autoApprove_i
ballot_expiration_t
details_title_s
details_description_s
Expand Down
4 changes: 4 additions & 0 deletions src/utils/paginate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default function paginate(a, pageIndex, pageSize) {
const endIndex = Math.min((pageIndex + 1) * pageSize, a.length)
return a.slice(Math.max(endIndex - pageSize, 0), endIndex)
}

0 comments on commit 04d2f7e

Please sign in to comment.