Skip to content

Commit abe2cc2

Browse files
committed
Improve forum breadcrumbs & navigation on mobile
1 parent d26d041 commit abe2cc2

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

app/pages/forum/index.vue

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import ForumModalAddDiscussion from '@/components/Forum/ForumModalAddDiscussion.
1111
import ForumModalAddTopic from '@/components/Forum/ForumModalAddTopic.vue'
1212
import BadgeCircle from '@/components/Shared/BadgeCircle.vue'
1313
import UserDisplay from '@/components/Shared/UserDisplay.vue'
14+
import { useBreakpoint } from '@/lib/mediaQuery'
1415
import { composedPathToString, composePathToTopic } from '@/lib/topics'
1516
import { slugify } from '@/lib/utils/formatting'
1617
@@ -39,6 +40,7 @@ interface ActivityItem {
3940
}
4041
4142
const userId = useUserId()
43+
const isMobile = useBreakpoint('<s')
4244
4345
const { user } = useCacheUserData(userId, { includeRole: true })
4446
@@ -303,20 +305,33 @@ const postSinceYesterday = computed(() => {
303305
</div>
304306
</section>
305307

306-
<Flex x-between y-center class="mb-m">
307-
<Breadcrumbs>
308+
<Flex x-start y-center class="mb-m">
309+
<Button :disabled="!activeTopicId" size="s" :square="!isMobile" outline @click="activeTopicId = activeTopicPath.at(-2)?.parent_id ?? null">
310+
<template v-if="isMobile" #start>
311+
<Icon :name="!activeTopicId ? 'ph:house' : 'ph:arrow-left'" />
312+
</template>
313+
<Icon v-if="!isMobile" :name="!activeTopicId ? 'ph:house' : 'ph:arrow-left'" />
314+
<template v-if="isMobile">
315+
{{ !activeTopicId ? 'Fontpage' : "Back" }}
316+
</template>
317+
</Button>
318+
<Breadcrumbs v-if="!isMobile">
308319
<BreadcrumbItem @click="activeTopicId = null">
309320
Frontpage
310321
</BreadcrumbItem>
311322
<BreadcrumbItem
312323
v-for="(item, index) in activeTopicPath"
313324
:key="item.parent_id"
314-
v-bind="index !== activeTopicPath.length - 1 || activeTopicPath.length > 1 ? { onClick: () => activeTopicId = item.parent_id } : {}"
325+
v-bind="index !== activeTopicPath.length - 1 ? {
326+
onClick: () => activeTopicId = item.parent_id,
327+
} : {}"
315328
>
316329
{{ item.title }}
317330
</BreadcrumbItem>
318331
</Breadcrumbs>
319332

333+
<div class="flex-1" />
334+
320335
<!-- Only allow creating things for signed in users -->
321336
<Flex v-if="user" gap="s">
322337
<Dropdown v-if="user.role === 'admin' || user.role === 'moderator'">
@@ -547,6 +562,8 @@ const postSinceYesterday = computed(() => {
547562
}
548563
549564
&.pinned {
565+
background-color: color-mix(in srgb, var(--color-accent) 15%, transparent) !important;
566+
550567
.forum__category-post--icon {
551568
background-color: var(--color-accent);
552569
border-color: var(--color-accent);

0 commit comments

Comments
 (0)