Skip to content

Commit

Permalink
chore: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
clockworkgr committed Sep 18, 2024
1 parent 6d5964e commit 63c17d9
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 53 deletions.
51 changes: 37 additions & 14 deletions src/components/proposals/Breakdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ const getTxHash = (vote: AllVotesQuery["proposal_vote"][0]) => {
<span>{{ $t("components.Breakdown.weight") }}</span>
<span class="text-right">{{ $t("components.Breakdown.time") }}</span>
</div>
<div v-for="vote in filteredVotes" :key="vote.voter_address + vote.option"
class="grid grid-cols-5 py-4 w-full text-200 text-grey-50">
<div
v-for="vote in filteredVotes"
:key="vote.voter_address + vote.option"
class="grid grid-cols-5 py-4 w-full text-200 text-grey-50"
>
<span>{{ Utility.shorten(vote.voter_address) }}</span>
<span>{{ getTxHash(vote) }}</span>
<span>{{ vote.option.replace("VOTE_OPTION_", "") }}</span>
Expand All @@ -81,29 +84,49 @@ const getTxHash = (vote: AllVotesQuery["proposal_vote"][0]) => {
</div>

<div class="flex flex-row justify-end pt-12 gap-4">
<Icon icon="Arrowleftend" class="text-400 text-grey-100"
:class="{ 'text-light hover:opacity-75 cursor-pointer': offset > 0 }" @click="() => {
<Icon
icon="Arrowleftend"
class="text-400 text-grey-100"
:class="{ 'text-light hover:opacity-75 cursor-pointer': offset > 0 }"
@click="
() => {
offset = 0;
}
" />
<Icon icon="Arrowleft" class="text-400 text-grey-100"
:class="{ 'text-light hover:opacity-75 cursor-pointer': offset > 0 }" @click="() => {
"
/>
<Icon
icon="Arrowleft"
class="text-400 text-grey-100"
:class="{ 'text-light hover:opacity-75 cursor-pointer': offset > 0 }"
@click="
() => {
if (offset > 0) {
prev();
}
}
" />
"
/>
<!-- Page Numbers -->
<Icon icon="Arrowright" class="text-400 text-grey-100"
:class="{ 'text-light hover:opacity-75 cursor-pointer': hasMore }" @click="() => {
<Icon
icon="Arrowright"
class="text-400 text-grey-100"
:class="{ 'text-light hover:opacity-75 cursor-pointer': hasMore }"
@click="
() => {
next();
}
" />
<Icon icon="Arrowrightend" class="text-400 text-grey-100"
:class="{ 'text-light hover:opacity-75 cursor-pointer': hasMore }" @click="() => {
"
/>
<Icon
icon="Arrowrightend"
class="text-400 text-grey-100"
:class="{ 'text-light hover:opacity-75 cursor-pointer': hasMore }"
@click="
() => {
offset = Math.floor((votes?.proposal_vote_aggregate.aggregate?.count ?? 0) / limit) * limit;
}
" />
"
/>
</div>
</div>
</template>
115 changes: 78 additions & 37 deletions src/components/proposals/ProposalWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -415,33 +415,35 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${
<div class="flex flex-row justify-between items-center">
<div class="badges my-8 md:my-12">
<template v-if="inVoting">
<SimpleBadge :type="ContextTypes.INFO" icon="progress" class="mr-3">{{ $t("proposalpage.badges.votingPeriod")
}}
<SimpleBadge :type="ContextTypes.INFO" icon="progress" class="mr-3"
>{{ $t("proposalpage.badges.votingPeriod") }}
</SimpleBadge>
<SimpleBadge v-if="turnout < quorum" :type="ContextTypes.PLAIN" icon="warning">
{{ $t("proposalpage.badges.quorumPending") }}</SimpleBadge>
{{ $t("proposalpage.badges.quorumPending") }}</SimpleBadge
>
</template>
<template v-if="inDeposit">
<SimpleBadge :type="ContextTypes.INFO" icon="progress" class="mr-3">{{
$t("proposalpage.badges.depositPeriod")
}}</SimpleBadge>
}}</SimpleBadge>
<SimpleBadge :type="ContextTypes.PLAIN" icon="warning">{{
$t("proposalpage.badges.depositPending")
}}</SimpleBadge>
}}</SimpleBadge>
</template>
<SimpleBadge v-if="failed" :type="ContextTypes.FAIL" class="mr-3">{{
$t("proposalpage.badges.depositFailed")
}}</SimpleBadge>
<SimpleBadge v-if="rejected" icon="close" :type="ContextTypes.FAIL" class="mr-3">{{
$t("proposalpage.badges.rejected")
}}
}}</SimpleBadge>
<SimpleBadge v-if="rejected" icon="close" :type="ContextTypes.FAIL" class="mr-3"
>{{ $t("proposalpage.badges.rejected") }}
</SimpleBadge>
<SimpleBadge v-if="passed" :type="ContextTypes.SUCCESS" class="mr-3">{{
$t("proposalpage.badges.passed")
}}</SimpleBadge>
}}</SimpleBadge>
</div>
<div class="flex items-center text-300 text-grey-100 start-7 hover:opacity-50 hover:cursor-pointer"
@click="showJsonModal = true">
<div
class="flex items-center text-300 text-grey-100 start-7 hover:opacity-50 hover:cursor-pointer"
@click="showJsonModal = true"
>
<Icon icon="Curlybrackets" />&nbsp; JSON
</div>
</div>
Expand Down Expand Up @@ -500,12 +502,15 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${
<div class="link-gradient rounded h-2 w-2/12" />
</div>
<ProposalVote v-if="loggedIn" :proposal-id="proposal?.proposal[0].id" class="w-full" />
<div v-else
<div
v-else
class="justify-center px-6 py-4 rounded link-gradient text-dark text-300 text-center cursor-pointer w-full"
@click="() => {
@click="
() => {
bus.emit('open');
}
">
"
>
{{ $t("components.ProposalVote.cta") }}
</div>
</SimpleCard>
Expand All @@ -516,14 +521,22 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${
<div class="progress-bar w-full h-2 bg-grey-200 rounded my-6">
<div class="link-gradient rounded h-2 w-2/12" />
</div>
<ProposalDeposit v-if="loggedIn" :proposal-id="proposal?.proposal[0].id" :min-deposit="minDeposit"
:total-deposit="totalDeposit" :deposit-denom="depositDenom" />
<div v-else
<ProposalDeposit
v-if="loggedIn"
:proposal-id="proposal?.proposal[0].id"
:min-deposit="minDeposit"
:total-deposit="totalDeposit"
:deposit-denom="depositDenom"
/>
<div
v-else
class="justify-center px-6 py-4 rounded link-gradient text-dark text-300 text-center cursor-pointer w-full"
@click="() => {
@click="
() => {
bus.emit('open');
}
">
"
>
{{ $t("components.ProposalDeposit.cta") }}
</div>
</SimpleCard>
Expand Down Expand Up @@ -627,8 +640,10 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${
<div class="text-light text-300 md:text-500 text-left mb-8 font-medium">
{{ $t("proposalpage.labels.messages") }}
</div>
<div v-if="proposal?.proposal[0].proposal_type == '/govgen.gov.v1beta1.TextProposal'"
class="flex w-full flex-wrap">
<div
v-if="proposal?.proposal[0].proposal_type == '/govgen.gov.v1beta1.TextProposal'"
class="flex w-full flex-wrap"
>
<div class="grow w-full md:w-1/2 mb-10">
<div class="text-grey-100 text-200 mb-2">{{ $t("proposalpage.labels.proposalType") }}</div>
<div class="text-light text-200 md:text-300">{{ $t("proposalpage.types.text") }}</div>
Expand All @@ -646,8 +661,10 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${
</div>
</div>
</div>
<div v-if="proposal?.proposal[0].proposal_type == '/cosmos.params.v1beta1.ParameterChangeProposal'"
class="flex w-full flex-wrap flex-col md:flex-row">
<div
v-if="proposal?.proposal[0].proposal_type == '/cosmos.params.v1beta1.ParameterChangeProposal'"
class="flex w-full flex-wrap flex-col md:flex-row"
>
<div class="grow w-full md:w-1/2 mb-10 md:pr-3 pr-0">
<div class="text-grey-100 text-200 mb-2">{{ $t("proposalpage.labels.proposalType") }}</div>
<div class="text-light text-200 md:text-300">{{ $t("proposalpage.types.paramChange") }}</div>
Expand All @@ -667,13 +684,18 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${
<div class="grow w-full md:w-1/2 mb-10 md:pl-3 pr-0">
<div class="text-grey-100 text-200 mb-2">{{ $t("proposalpage.labels.changes") }}</div>
<div class="text-light text-100">
<VCodeBlock :code="JSON.stringify(proposal?.proposal[0].content.changes, null, '\t')" prismjs
:theme="false" />
<VCodeBlock
:code="JSON.stringify(proposal?.proposal[0].content.changes, null, '\t')"
prismjs
:theme="false"
/>
</div>
</div>
</div>
<div v-if="proposal?.proposal[0].proposal_type == '/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal'"
class="flex w-full flex-wrap">
<div
v-if="proposal?.proposal[0].proposal_type == '/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal'"
class="flex w-full flex-wrap"
>
<div class="grow w-1/2 mb-10">
<div class="text-grey-100 text-200 mb-2">{{ $t("proposalpage.labels.proposalType") }}</div>
<div class="text-light text-200 md:text-300">{{ $t("proposalpage.types.text") }}</div>
Expand All @@ -693,8 +715,11 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${
<div class="grow w-1/2 mb-10">
<div class="text-grey-100 text-200 mb-2">{{ $t("proposalpage.labels.upgradePlan") }}</div>
<div class="text-light text-100">
<VCodeBlock :code="JSON.stringify(proposal?.proposal[0].content.plan, null, '\t')" prismjs
:theme="false" />
<VCodeBlock
:code="JSON.stringify(proposal?.proposal[0].content.plan, null, '\t')"
prismjs
:theme="false"
/>
</div>
</div>
</div>
Expand All @@ -716,15 +741,27 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${
<!-- Voters Panel -->
<div v-if="proposal && proposal.proposal[0]" class="flex flex-col lg:flex-row w-full gap-6">
<!-- All Account Votes -->
<VotePanel :voters="distinctVoters" :denom="stakingDenomDisplay" :precision="stakingDenomDecimals"
:vote-tallies="allVoteCounts" :token-tallies="tokenTallies" @on-breakdown="showBreakdown('voters')">
<VotePanel
:voters="distinctVoters"
:denom="stakingDenomDisplay"
:precision="stakingDenomDecimals"
:vote-tallies="allVoteCounts"
:token-tallies="tokenTallies"
@on-breakdown="showBreakdown('voters')"
>
<template #header>{{ $t("proposalpage.labels.accountsAll") }}</template>
<template #type>{{ $t("proposalpage.labels.accountsVoted") }}</template>
</VotePanel>
<!-- All Validator Votes -->
<VotePanel :max="maxValidators" :voters="votedValidators" :denom="stakingDenomDisplay"
:precision="stakingDenomDecimals" :vote-tallies="validatorVoteCounts" :token-tallies="validatorTallies"
@on-breakdown="showBreakdown('validators')">
<VotePanel
:max="maxValidators"
:voters="votedValidators"
:denom="stakingDenomDisplay"
:precision="stakingDenomDecimals"
:vote-tallies="validatorVoteCounts"
:token-tallies="validatorTallies"
@on-breakdown="showBreakdown('validators')"
>
<template #header>{{ $t("proposalpage.labels.validators") }}</template>
<template #type>{{ $t("proposalpage.labels.validatorsVoted") }}</template>
</VotePanel>
Expand All @@ -737,8 +774,12 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${
</div>
<div class="flex flex-row object-contain">
<template v-if="validatorVoteSum >= 1">
<div v-for="voteType in voteTypes" :key="voteType" class="flex flex-row h-96 relative"
:style="[`width: ${calculateWidthForTree(voteType)}%`]">
<div
v-for="voteType in voteTypes"
:key="voteType"
class="flex flex-row h-96 relative"
:style="[`width: ${calculateWidthForTree(voteType)}%`]"
>
<Treemap :data="getValidatorVotes(voteType)" :type="voteType" />
</div>
</template>
Expand Down
7 changes: 5 additions & 2 deletions src/components/proposals/ValidatorBreakdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ const getValidatorInfo = (address: string) => {
</div>
<template v-for="validator in validatorData">
<template v-if="validator.votes.length > 0">
<div v-for="vote in validator.votes" :key="vote.voter_address + vote.option"
class="grid grid-cols-5 py-4 w-full text-200 text-grey-50">
<div
v-for="vote in validator.votes"
:key="vote.voter_address + vote.option"
class="grid grid-cols-5 py-4 w-full text-200 text-grey-50"
>
<span>{{ getValidatorInfo(vote.voter_address).moniker }}</span>
<span>{{ getTxHash(vote) }}</span>
<span>{{ vote.option.replace("VOTE_OPTION_", "") }}</span>
Expand Down

0 comments on commit 63c17d9

Please sign in to comment.