Skip to content

Commit 6c8aa0c

Browse files
authored
fix(design): Add breadcrumbs to proposal page and fix proposal heading (#4477)
* Cleanup state styling * Fix height * Truncate proposal title in breadcrumb * Reduce badge height to fix border * Don't show core if its the connected user * Reduce max length for proposal breadcrumb * Add breadcrumb to proposal page and fix header * Fix breadcrumbs on custom domain * Refactor styling * Fix indicator style * Fix color and border * Refactor * Make both outlined * Use truncate instead of fixes char length * Change id name * Revert state colors * Increase max length of bread crumb * Remove handleBackClick * Cleanup
1 parent 6a87e6c commit 6c8aa0c

File tree

8 files changed

+53
-74
lines changed

8 files changed

+53
-74
lines changed

src/components/BaseBadge.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const isCore = computed(() => {
1111
<template>
1212
<div
1313
v-if="isCore"
14-
class="ml-1 rounded-full border px-[7px] text-xs text-skin-text"
14+
class="ml-1 rounded-full border px-[7px] text-xs text-skin-text leading-[22px]"
1515
>
1616
{{ $t('isCore') }}
1717
</div>

src/components/BaseBreadcrumbs.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
<script setup lang="ts">
22
defineProps<{
3-
pages: { name: string; to: string; current: boolean }[];
3+
pages: { id?: string; name: string; to: string; current: boolean }[];
44
}>();
55
</script>
66

77
<template>
88
<div class="flex items-center">
99
<div v-for="(page, i) in pages" :key="i" class="flex items-center">
1010
<router-link v-if="!page.current" :to="page.to" class="flex items-center">
11-
<span class="text-skin-link">{{ page.name }}</span>
11+
<span class="text-skin-link whitespace-nowrap">{{ page.name }}</span>
1212
</router-link>
1313
<div v-else class="flex cursor-default items-center">
14-
<span class="text-skin-link opacity-40">{{ page.name }}</span>
14+
<span
15+
class="text-skin-link opacity-40"
16+
:class="{
17+
'line-clamp-1 max-w-[380px]': page.id === 'proposal-title'
18+
}"
19+
>{{ page.name }}</span
20+
>
1521
</div>
1622
<div class="mx-1 flex h-[20px] w-[20px] items-center justify-center">
1723
<i-ho-chevron-right

src/components/BaseUser.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ const spaceMembers = computed(() => {
5050
>
5151
{{ getUsername(address, profile) }}
5252
</span>
53-
<BaseBadge :address="address" :members="spaceMembers" />
53+
<BaseBadge
54+
v-if="getUsername(address, profile) !== 'You'"
55+
:address="address"
56+
:members="spaceMembers"
57+
/>
5458
</div>
5559
</BaseLink>
5660
</PopoverHoverProfile>

src/components/LabelProposalState.vue

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
<script setup lang="ts">
2-
const props = withDefaults(
3-
defineProps<{
4-
state: string;
5-
slim?: boolean;
6-
}>(),
7-
{
8-
slim: false
9-
}
10-
);
2+
const props = defineProps<{
3+
state: string;
4+
}>();
115
126
const stateClass = computed(() => {
137
if (props.state === 'closed') return 'bg-[#BB6BD9]';
@@ -17,30 +11,10 @@ const stateClass = computed(() => {
1711
</script>
1812

1913
<template>
20-
<span v-if="slim" :class="stateClass" class="State slim text-white" />
21-
<span
22-
v-else
14+
<div
15+
class="text-white rounded-full px-[12px] text-sm h-[24px] w-fit leading-[23px]"
2316
:class="stateClass"
24-
class="State text-white"
25-
v-text="$t(`proposals.states.${state}`)"
26-
/>
17+
>
18+
{{ $t(`proposals.states.${state}`) }}
19+
</div>
2720
</template>
28-
29-
<style scoped>
30-
.State {
31-
font-size: 16px;
32-
height: 26px;
33-
vertical-align: middle;
34-
padding: 0 12px;
35-
border-radius: 14px;
36-
line-height: 24px;
37-
}
38-
39-
.State.slim {
40-
padding: 0;
41-
height: 12px;
42-
width: 13px;
43-
border-radius: 50%;
44-
display: inline-block;
45-
}
46-
</style>

src/components/SpaceBreadcrumbs.vue

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
<script setup lang="ts">
2-
import { ExtendedSpace } from '@/helpers/interfaces';
2+
import { ExtendedSpace, Proposal } from '@/helpers/interfaces';
33
import { shorten } from '@/helpers/utils';
44
5-
const props = defineProps<{ space: ExtendedSpace }>();
5+
const props = defineProps<{ space: ExtendedSpace; proposal?: Proposal }>();
66
77
const route = useRoute();
8+
const { domain } = useApp();
89
910
const pages = computed(() => {
1011
let pages: any = [];
1112
const spaceRoute = `/${props.space.id}`;
1213
const basePages = [
13-
{ name: props.space.name, to: spaceRoute, current: false }
14+
{ name: domain ? 'Home' : props.space.name, to: spaceRoute, current: false }
1415
];
1516
1617
if (route.name === 'spaceProposal') {
1718
const id = route.params.id as string;
1819
pages = [
1920
...basePages,
20-
{ name: id, to: `${spaceRoute}/proposal/${id}`, current: true }
21+
{
22+
id: 'proposal-title',
23+
name: props.proposal?.title,
24+
to: `${spaceRoute}/proposal/${id}`,
25+
current: true
26+
}
2127
];
2228
}
2329
2430
if (route.name === 'spaceDelegate') {
2531
const delegate = route.params.address as string;
2632
pages = [
33+
...basePages,
2734
{
28-
name: props.space.name,
35+
name: 'Delegates',
2936
to: `${spaceRoute}/delegates`,
3037
current: false
3138
},
@@ -44,5 +51,8 @@ const pages = computed(() => {
4451
</script>
4552

4653
<template>
47-
<BaseBreadcrumbs :pages="pages" />
54+
<BaseBreadcrumbs
55+
:pages="pages"
56+
class="px-3 md:px-4 -mt-1 pb-[16px] lg:pb-[20px]"
57+
/>
4858
</template>

src/components/SpaceProposalHeader.vue

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,19 @@ watch(
106106

107107
<template>
108108
<h1
109-
class="mb-3 break-words text-xl leading-8 sm:text-2xl"
109+
class="break-words text-xl leading-8 sm:leading-[44px] sm:text-2xl"
110110
data-testid="proposal-page-title"
111111
v-text="proposal.title"
112112
/>
113113

114-
<div class="mb-4 flex flex-col sm:flex-row sm:space-x-1">
115-
<div class="mb-1 flex items-center sm:mb-0">
116-
<LabelProposalState :state="proposal.state" class="mr-2" />
114+
<div class="mb-4 flex">
115+
<div class="flex items-center space-x-1">
117116
<LinkSpace :space-id="space.id" class="group text-skin-text">
118117
<div class="flex items-center">
119-
<AvatarSpace :space="space" size="28" />
120-
<span class="ml-2 group-hover:text-skin-link" v-text="space.name" />
118+
<AvatarSpace :space="space" size="20" />
119+
<span class="ml-1 group-hover:text-skin-link" v-text="space.name" />
121120
</div>
122121
</LinkSpace>
123-
</div>
124-
<div class="flex grow items-center space-x-1">
125122
<span v-text="$t('proposalBy')" />
126123
<BaseUser
127124
:address="proposal.author"
@@ -130,7 +127,8 @@ watch(
130127
:proposal="proposal"
131128
hide-avatar
132129
/>
133-
130+
</div>
131+
<div class="flex grow items-center space-x-3">
134132
<BaseMenu
135133
class="!ml-auto pl-3"
136134
:items="sharingItems"
@@ -148,10 +146,10 @@ watch(
148146
</div>
149147
</template>
150148
</BaseMenu>
151-
<BaseMenu class="md:ml-2" :items="threeDotItems" @select="handleSelect">
149+
<BaseMenu :items="threeDotItems" @select="handleSelect">
152150
<template #button>
153151
<div>
154-
<BaseButtonIcon :loading="isSending">
152+
<BaseButtonIcon :loading="isSending" class="!p-0">
155153
<i-ho-dots-horizontal />
156154
</BaseButtonIcon>
157155
</div>

src/components/SpaceProposalPage.vue

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ useMeta({
2222
});
2323
2424
const route = useRoute();
25-
const router = useRouter();
2625
const { web3, web3Account } = useWeb3();
2726
const { isMessageVisible, setMessageVisibility } = useFlaggedMessageStatus(
2827
route.params.id as string
@@ -54,8 +53,6 @@ const strategies = computed(
5453
() => props.proposal?.strategies ?? props.space.strategies
5554
);
5655
57-
const browserHasHistory = computed(() => window.history.state.back);
58-
5956
const { modalAccountOpen, isModalPostVoteOpen } = useModal();
6057
const { modalTermsOpen, termsAccepted, acceptTerms } = useTerms(props.space.id);
6158
@@ -98,12 +95,6 @@ async function loadResults() {
9895
loadedResults.value = true;
9996
}
10097
101-
function handleBackClick() {
102-
if (!browserHasHistory.value || browserHasHistory.value.includes('create'))
103-
return router.push({ name: 'spaceProposals' });
104-
return router.go(-1);
105-
}
106-
10798
function handleChoiceQuery() {
10899
const choice = route.query.choice as string;
109100
if (web3Account.value && choice && props.proposal.state === 'active') {
@@ -128,12 +119,9 @@ onMounted(() => setMessageVisibility(props.proposal.flagged));
128119
</script>
129120

130121
<template>
131-
<TheLayout v-bind="$attrs">
122+
<SpaceBreadcrumbs :space="space" :proposal="proposal" />
123+
<TheLayout v-bind="$attrs" class="mt-[20px]">
132124
<template #content-left>
133-
<div class="mb-3 px-3 md:px-0">
134-
<ButtonBack @click="handleBackClick" />
135-
</div>
136-
137125
<MessageWarningFlagged
138126
v-if="isMessageVisible"
139127
type="proposal"
@@ -143,6 +131,8 @@ onMounted(() => setMessageVisibility(props.proposal.flagged));
143131

144132
<template v-else>
145133
<div class="px-3 md:px-0">
134+
<LabelProposalState :state="proposal.state" class="mb-[12px]" />
135+
146136
<SpaceProposalHeader
147137
:space="space"
148138
:proposal="proposal"

src/views/SpaceDelegate.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,7 @@ onBeforeRouteLeave(async () => {
155155

156156
<template>
157157
<div class="mb-[80px] md:mb-0">
158-
<SpaceBreadcrumbs
159-
:space="space"
160-
class="mx-4 -mt-1 pb-[16px] lg:pb-[20px]"
161-
/>
158+
<SpaceBreadcrumbs :space="space" />
162159

163160
<BaseContainer v-if="isLoggedUser" class="pb-2 pt-3 lg:py-[20px]">
164161
<ButtonSwitch

0 commit comments

Comments
 (0)