Skip to content

Commit 612b235

Browse files
authored
chore: navigation rework (#152)
* chore: navigation rework * chore: badge
1 parent 52d9090 commit 612b235

14 files changed

Lines changed: 66 additions & 39 deletions

File tree

apps/atrium-telegram/app/components/NavigationButton.vue

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div
77
class="relative py-1 w-full rounded-2xl flex flex-row items-center justify-center"
88
:class="[
9-
isThisRoute && 'tg-bg-button tg-text-button motion-translate-y-in',
9+
(isThisRoute || isThisName) && 'tg-bg-button tg-text-button motion-translate-y-in',
1010
]"
1111
>
1212
<UIcon
@@ -15,20 +15,29 @@
1515
class="size-6 motion-preset-shake"
1616
/>
1717
<UIcon
18-
v-else-if="isFlowInnerPage && canReturnToMain && route.name === 'flow'"
18+
v-else-if="router.currentRoute.value.meta.canReturn && isThisName"
1919
name="i-lucide-undo-2"
2020
class="size-6 motion-preset-shake"
2121
/>
22-
<UIcon
22+
<UChip
2323
v-else
24-
:name="route.icon"
25-
class="size-6 motion-preset-shake"
26-
/>
24+
size="3xl"
25+
:show="!!route.badge"
26+
:text="route.badge"
27+
:ui="{
28+
base: '-right-1 px-1.5 py-2 ring-2 tg-text-button font-bold motion-translate-y-loop-25 motion-duration-3500',
29+
}"
30+
>
31+
<UIcon
32+
:name="route.icon"
33+
class="size-6 motion-preset-shake"
34+
/>
35+
</UChip>
2736
</div>
2837
<p
2938
class="text-xs font-medium"
3039
:class="[
31-
isThisRoute && 'tg-text',
40+
(isThisRoute || isThisName) && 'tg-text',
3241
]"
3342
>
3443
{{ route.title }}
@@ -40,10 +49,11 @@
4049
const { route } = defineProps<{ route: NavigationRoute }>()
4150
4251
const { vibrate } = useFeedback()
43-
const { canScrollToTop, isMainPage, isFlowInnerPage, canReturnToMain } = useNavigation()
52+
const { canScrollToTop, isMainPage } = useNavigation()
4453
const router = useRouter()
4554
4655
const isThisRoute = computed(() => route.exact ? router.currentRoute.value.path === route.path : router.currentRoute.value.path.startsWith(route.path))
56+
const isThisName = computed(() => route.names.includes(router.currentRoute.value.name))
4757
4858
function handleScrollToTop() {
4959
vibrate()

apps/atrium-telegram/app/components/flow/FeedbackAverage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<Section>
2+
<Section class="motion-preset-slide-down motion-delay-600">
33
<div class="flex flex-col gap-2">
44
<div class="flex flex-row gap-2 items-center">
55
<UIcon name="i-lucide-users-round" class="size-8 text-primary" />

apps/atrium-telegram/app/components/flow/ItemCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<ActiveCard>
33
<UIcon name="i-lucide-clipboard-check" class="size-8 text-primary" />
44

5-
<h3 class="text-lg/5 font-bold">
5+
<h3 class="text-2xl/5 font-bold">
66
{{ item.title }}
77
</h3>
88

9-
<div class="w-full text-sm/4 font-normal whitespace-pre-wrap break-words line-clamp-16">
9+
<div class="w-full text-base/5 font-normal whitespace-pre-wrap break-words line-clamp-12">
1010
{{ item.description }}
1111
</div>
1212

apps/atrium-telegram/app/components/flow/KitchensOnline.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<Section v-if="kitchensOnline">
2+
<Section v-if="kitchensOnline" class="motion-preset-slide-down motion-delay-100">
33
<div class="flex flex-col gap-2">
44
<div class="flex flex-row gap-2 items-center">
55
<UChip
@@ -20,7 +20,7 @@
2020
</div>
2121
</Section>
2222

23-
<Section v-else>
23+
<Section v-else class="motion-preset-slide-down motion-delay-100">
2424
<div class="flex flex-col gap-2">
2525
<div class="flex flex-row gap-2 items-center">
2626
<UIcon name="i-lucide-store" class="size-8 text-primary" />

apps/atrium-telegram/app/components/flow/OrderAmountAverage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<Section>
2+
<Section class="motion-preset-slide-down motion-delay-400">
33
<div class="flex flex-col gap-2">
44
<div class="flex flex-row gap-2 items-center">
55
<UIcon name="i-lucide-receipt-text" class="size-8 text-primary" />

apps/atrium-telegram/app/components/flow/OrdersOnline.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<Section>
2+
<Section class="motion-preset-slide-down motion-delay-200">
33
<div class="flex flex-col gap-2">
44
<div class="flex flex-row gap-2 items-center">
55
<UIcon name="i-lucide-shopping-bag" class="size-8 text-primary" />

apps/atrium-telegram/app/composables/useNavigation.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,28 @@ function _useNavigation() {
33
const { t } = useI18n()
44
const { y } = useWindowScroll()
55

6+
const taskStore = useTaskStore()
7+
68
const mainRoutes = computed<NavigationRoute[]>(() => [
79
{
810
path: '/',
9-
name: 'flow',
11+
names: ['index', 'flow-itemId'],
1012
title: t('app.flow'),
1113
icon: 'i-lucide-waves',
1214
exact: true,
1315
},
1416
{
1517
path: '/epic',
16-
name: 'epic',
18+
names: ['epic', 'epic-epicId'],
1719
title: t('app.epics'),
1820
icon: 'i-lucide-crown',
1921
},
2022
{
2123
path: '/tasks',
22-
name: 'tasks',
24+
names: ['tasks'],
2325
title: t('app.my-tasks'),
2426
icon: 'i-lucide-layout-dashboard',
27+
badge: taskStore.myTodayTasks.length.toString(),
2528
},
2629
])
2730

@@ -30,15 +33,9 @@ function _useNavigation() {
3033
const isMainPage = computed(() => router.currentRoute.value.path === '/')
3134
const canScrollToTop = computed(() => y.value > 650)
3235

33-
const isFlowInnerPage = computed(() => router.currentRoute.value.path.startsWith('/flow'))
34-
const canReturnToMain = computed(() => isFlowInnerPage.value && router.currentRoute.value.path !== '/')
35-
3636
return {
3737
isNavigationShown,
3838

39-
isFlowInnerPage,
40-
canReturnToMain,
41-
4239
isMainPage,
4340
canScrollToTop,
4441

apps/atrium-telegram/app/pages/epic/[epicId]/index.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@
5959
<script setup lang="ts">
6060
import { ModalUpdateEpic } from '#components'
6161
62+
definePageMeta({
63+
name: 'epic-epicId',
64+
canReturn: true,
65+
})
66+
6267
const { params } = useRoute('epic-epicId')
6368
6469
const { vibrate } = useFeedback()

apps/atrium-telegram/app/pages/flow/[itemId]/index.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<UIcon name="i-lucide-clipboard-check" class="size-10 text-primary" />
66
</div>
77

8-
<h2 class="text-xl font-bold">
8+
<h2 class="text-2xl/6 font-bold">
99
{{ item?.title }}
1010
</h2>
1111

@@ -17,6 +17,11 @@
1717
</template>
1818

1919
<script setup lang="ts">
20+
definePageMeta({
21+
name: 'flow-itemId',
22+
canReturn: true,
23+
})
24+
2025
const { params } = useRoute('flow-itemId')
2126
2227
const flowStore = useFlowStore()

apps/atrium-telegram/app/pages/index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<FlowFeedbackAverage />
1111
</div>
1212

13-
<div class="flex flex-col gap-2">
13+
<div class="flex flex-col gap-4">
1414
<NuxtLink
1515
v-for="item in flowStore.items"
1616
:key="item.id"
@@ -24,6 +24,10 @@
2424
</template>
2525

2626
<script setup lang="ts">
27+
definePageMeta({
28+
name: 'index',
29+
})
30+
2731
const flowStore = useFlowStore()
2832
2933
useHead({

0 commit comments

Comments
 (0)