Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit b1364c0

Browse files
authored
feat: Add token price and 24h change in treasury page (#327)
* Improve proposal page * Improve settings page * Add token price and 24h change in treasury * Fix conflicts * Align icon center
1 parent c9f6936 commit b1364c0

File tree

6 files changed

+160
-128
lines changed

6 files changed

+160
-128
lines changed

src/composables/useBalances.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ export function useBalances() {
2424
formatUnits(item.balance || 0, item.contract_decimals || 0)
2525
) > 0.001 && item.contract_address !== ETH_CONTRACT
2626
)
27-
].sort((a, b) => b.quote - a.quote);
27+
]
28+
.sort((a, b) => b.quote - a.quote)
29+
.map(asset => {
30+
if (asset.quote_rate && asset.quote_rate_24h)
31+
asset.percent =
32+
(100 / asset.quote_rate) *
33+
(asset.quote_rate - asset.quote_rate_24h);
34+
return asset;
35+
});
2836
loading.value = false;
2937
loaded.value = true;
3038
}

src/helpers/space.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"network": "1",
3-
"wallet": "0x10A19e7eE7d7F8a52822f6817de8ea18204F2e4f"
3+
"wallet": "0xaf28bcb48c40dbc86f52d459a6562f658fc94b1e"
44
}

src/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ h3 {
7878
}
7979

8080
h4 {
81-
@apply text-md;
81+
@apply text-[19px];
8282
}
8383

8484
h5 {

src/views/Proposal.vue

Lines changed: 106 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { sanitizeUrl } from '@braintree/sanitize-url';
55
import { useProposalsStore } from '@/stores/proposals';
66
import { _rt, _n, shortenAddress, getUrl } from '@/helpers/utils';
77
import { useActions } from '@/composables/useActions';
8-
import txs from '@/helpers/execution.json';
98
109
const route = useRoute();
1110
const proposalsStore = useProposalsStore();
@@ -33,118 +32,120 @@ onMounted(() => {
3332

3433
<template>
3534
<div>
36-
<Container v-if="!proposal" class="pt-5">
37-
<UiLoading />
38-
</Container>
39-
<div v-else>
40-
<Container class="pt-5">
41-
<h1 class="mb-3">
42-
{{ proposal.title || `Proposal #${proposal.proposal_id}` }}
43-
</h1>
44-
<div class="flex mb-4 items-center">
45-
<div class="flex-auto space-x-2">
46-
<router-link
47-
:to="{
48-
name: 'user',
49-
params: { id: proposal.author.id }
50-
}"
35+
<Container class="pt-5">
36+
<UiLoading v-if="!proposal" />
37+
<div v-else>
38+
<div>
39+
<h1 class="mb-3">
40+
{{ proposal.title || `Proposal #${proposal.proposal_id}` }}
41+
</h1>
42+
<div class="flex mb-4 items-center">
43+
<div class="flex-auto space-x-2">
44+
<router-link
45+
:to="{
46+
name: 'user',
47+
params: { id: proposal.author.id }
48+
}"
49+
>
50+
<Stamp :id="proposal.author.id" :size="24" class="mr-1" />
51+
{{ shortenAddress(proposal.author.id) }}
52+
</router-link>
53+
<span
54+
55+
<a
56+
class="text-skin-text"
57+
@click="modalOpenTimeline = true"
58+
v-text="_rt(proposal.created)"
59+
/>
60+
</span>
61+
</div>
62+
<a
63+
:href="sanitizeUrl(getUrl(proposal.metadata_uri))"
64+
target="_blank"
5165
>
52-
<Stamp :id="proposal.author.id" :size="24" class="mr-1" />
53-
{{ shortenAddress(proposal.author.id) }}
54-
</router-link>
55-
<span
56-
57-
<a
58-
class="text-skin-text"
59-
@click="modalOpenTimeline = true"
60-
v-text="_rt(proposal.created)"
61-
/>
62-
</span>
66+
<UiButton class="!w-[46px] !h-[46px] !px-[12px]">
67+
<IH-dots-horizontal />
68+
</UiButton>
69+
</a>
70+
</div>
71+
<div v-if="proposal.body" class="mb-4">
72+
<p v-text="proposal.body" />
6373
</div>
64-
<a :href="sanitizeUrl(getUrl(proposal.metadata_uri))" target="_blank">
65-
<UiButton class="!w-[46px] !h-[46px] !px-[12px]">
66-
<IH-dots-horizontal />
67-
</UiButton>
68-
</a>
69-
</div>
70-
<div v-if="proposal.body" class="mb-4">
71-
<p v-text="proposal.body" />
7274
</div>
73-
</Container>
74-
<Container class="space-y-4 mb-4" slim>
75-
<BlockExecution :txs="txs" />
76-
<a
77-
v-if="discussion"
78-
:href="discussion"
79-
target="_blank"
80-
class="x-block block mb-5"
81-
>
82-
<h4 class="px-4 py-3">
83-
<IH-chat-alt class="inline-block mr-2" /> Discussion
84-
<IH-external-link class="float-right mt-1" />
75+
76+
<div v-if="discussion">
77+
<h4 class="mb-3 eyebrow flex items-center">
78+
<IH-chat-alt class="inline-block mr-2" />
79+
<span>Discussion</span>
8580
</h4>
86-
<Preview
87-
:url="discussion"
88-
class="!border-0 !border-t !rounded-none"
89-
/>
90-
</a>
91-
</Container>
92-
<Container>
93-
<Vote :proposal="proposal">
94-
<template #voted="{ vote: userVote }">
95-
<h4 class="mb-2">Results</h4>
96-
<Results :proposal="proposal" width="full" />
97-
<div class="mt-2">
98-
<div v-if="userVote.choice === 1">
99-
You already voted <strong>for</strong> this proposal
100-
</div>
101-
<div v-else-if="userVote.choice === 2">
102-
You already voted <strong>against</strong> this proposal
103-
</div>
104-
<div v-else-if="userVote.choice === 3">
105-
You already <strong>abstained</strong> from voting on this
106-
proposal
81+
<a :href="discussion" target="_blank" class="block mb-5">
82+
<Preview :url="discussion" />
83+
</a>
84+
</div>
85+
86+
<div>
87+
<Vote :proposal="proposal">
88+
<template #voted="{ vote: userVote }">
89+
<h4 class="mb-3 eyebrow flex items-center">
90+
<IH-chart-bar class="inline-block mr-2" />
91+
<span>Results</span>
92+
</h4>
93+
<Results :proposal="proposal" width="full" />
94+
<div class="mt-2">
95+
<div v-if="userVote.choice === 1">
96+
You already voted <strong>for</strong> this proposal
97+
</div>
98+
<div v-else-if="userVote.choice === 2">
99+
You already voted <strong>against</strong> this proposal
100+
</div>
101+
<div v-else-if="userVote.choice === 3">
102+
You already <strong>abstained</strong> from voting on this
103+
proposal
104+
</div>
107105
</div>
106+
</template>
107+
<template #ended>
108+
<h4 class="mb-3 eyebrow flex items-center">
109+
<IH-chart-bar class="inline-block mr-2" />
110+
<span>Results</span>
111+
</h4>
112+
<Results :proposal="proposal" width="full" />
113+
</template>
114+
<div class="grid grid-cols-3 gap-2">
115+
<UiButton
116+
class="w-full !text-white !bg-green !border-green"
117+
@click="vote(proposal, 1)"
118+
>
119+
<IH-check class="inline-block" />
120+
</UiButton>
121+
<UiButton
122+
class="w-full !text-white !bg-red !border-red"
123+
@click="vote(proposal, 2)"
124+
>
125+
<IH-x class="inline-block" />
126+
</UiButton>
127+
<UiButton
128+
class="w-full !text-white !bg-gray-500 !border-gray-500"
129+
@click="vote(proposal, 3)"
130+
>
131+
<IH-arrow-right class="inline-block" />
132+
</UiButton>
108133
</div>
109-
</template>
110-
<template #ended>
111-
<h4 class="mb-2">Results</h4>
112-
<Results :proposal="proposal" width="full" />
113-
</template>
114-
<div class="grid grid-cols-3 gap-2">
115-
<UiButton
116-
class="w-full !text-white !bg-green !border-green"
117-
@click="vote(proposal, 1)"
118-
>
119-
<IH-check class="inline-block" />
120-
</UiButton>
121-
<UiButton
122-
class="w-full !text-white !bg-red !border-red"
123-
@click="vote(proposal, 2)"
124-
>
125-
<IH-x class="inline-block" />
126-
</UiButton>
127-
<UiButton
128-
class="w-full !text-white !bg-gray-500 !border-gray-500"
129-
@click="vote(proposal, 3)"
130-
>
131-
<IH-arrow-right class="inline-block" />
132-
</UiButton>
134+
</Vote>
135+
<div class="mt-3">
136+
<a class="text-skin-text" @click="modalOpenVotes = true">
137+
{{ _n(proposal.vote_count) }} votes
138+
</a>
139+
·
140+
<a
141+
class="text-skin-text"
142+
@click="modalOpenTimeline = true"
143+
v-text="_rt(proposal.max_end)"
144+
/>
133145
</div>
134-
</Vote>
135-
<div class="mt-3">
136-
<a class="text-skin-text" @click="modalOpenVotes = true">
137-
{{ _n(proposal.vote_count) }} votes
138-
</a>
139-
·
140-
<a
141-
class="text-skin-text"
142-
@click="modalOpenTimeline = true"
143-
v-text="_rt(proposal.max_end)"
144-
/>
145146
</div>
146-
</Container>
147-
</div>
147+
</div>
148+
</Container>
148149
<teleport to="#modal">
149150
<ModalVotes
150151
:open="modalOpenVotes"

src/views/Space/Settings.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ defineProps<{ space: Space }>();
1313
<div class="mx-4 pt-3">
1414
<div class="mb-3">
1515
<div class="s-label !mb-0">Name</div>
16-
<div class="text-skin-link text-md" v-text="space.name" />
16+
<h4 class="text-skin-link text-md" v-text="space.name" />
1717
</div>
1818
<div class="mb-3">
1919
<div class="s-label !mb-0">About</div>
20-
<div class="text-skin-link text-md" v-text="space.about || '...'" />
20+
<h4 class="text-skin-link text-md" v-text="space.about || '...'" />
2121
</div>
2222
<div class="mb-3">
2323
<div class="s-label !mb-0">Discussions</div>
24-
<div
24+
<h4
2525
class="text-skin-link text-md"
2626
v-text="space.discussions || '...'"
2727
/>
@@ -34,35 +34,35 @@ defineProps<{ space: Space }>();
3434
<div class="mx-4 pt-3">
3535
<div class="mb-3">
3636
<div class="s-label !mb-0">Voting delay</div>
37-
<div
37+
<h4
3838
class="text-skin-link text-md"
3939
v-text="_d(space.voting_delay) || 'No delay'"
4040
/>
4141
</div>
4242
<div class="mb-3">
4343
<div class="s-label !mb-0">Min. voting period</div>
44-
<div
44+
<h4
4545
class="text-skin-link text-md"
4646
v-text="_d(space.min_voting_period) || 'No min.'"
4747
/>
4848
</div>
4949
<div class="mb-3">
5050
<div class="s-label !mb-0">Max. voting period</div>
51-
<div
51+
<h4
5252
class="text-skin-link text-md"
5353
v-text="_d(space.max_voting_period)"
5454
/>
5555
</div>
5656
<div class="mb-3">
5757
<div class="s-label !mb-0" v-text="'Proposal threshold'" />
58-
<div
58+
<h4
5959
class="text-skin-link text-md"
6060
v-text="space.proposal_threshold"
6161
/>
6262
</div>
6363
<div class="mb-3">
6464
<div class="s-label !mb-0" v-text="'Quorum'" />
65-
<div class="text-skin-link text-md" v-text="space.quorum" />
65+
<h4 class="text-skin-link text-md" v-text="space.quorum" />
6666
</div>
6767
</div>
6868
</div>

0 commit comments

Comments
 (0)