Skip to content

Commit 6f30ee7

Browse files
authored
feat: menu page (#136)
1 parent 3f38d52 commit 6f30ee7

6 files changed

Lines changed: 99 additions & 10 deletions

File tree

apps/storefront-telegram/app/components/CitySelector.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
size="xl"
2222
class="ring-muted font-medium"
2323
:label="city.name"
24-
@click="clientStore.updateCity(city.id)"
24+
@click="handleClick(city.id)"
2525
/>
2626
</div>
2727
</div>
@@ -30,5 +30,11 @@
3030
</template>
3131

3232
<script setup lang="ts">
33+
const { vibrate } = useFeedback()
3334
const clientStore = useClientStore()
35+
36+
function handleClick(id: string) {
37+
vibrate('success')
38+
clientStore.updateCity(id)
39+
}
3440
</script>

apps/storefront-telegram/app/components/Navigation.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ const mainRoutes = computed<NavigationRoute[]>(() => [
3232
icon: 'i-lucide-user',
3333
},
3434
{
35-
path: '/navigation',
36-
name: 'navigation',
35+
path: '/menu',
36+
name: 'menu',
3737
title: 'Меню',
3838
icon: 'i-lucide-menu',
3939
},

apps/storefront-telegram/app/pages/client/index.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,33 @@
2727
</template>
2828

2929
<script setup lang="ts">
30+
const { vibrate } = useFeedback()
3031
const clientStore = useClientStore()
3132
3233
const items = ref([
3334
{
3435
label: 'Мои заказы',
3536
icon: 'i-lucide-shopping-basket',
3637
to: '/client/orders',
38+
onClick: () => vibrate(),
3739
},
3840
{
3941
label: 'Мои адреса',
4042
icon: 'i-lucide-map-pin-house',
43+
onClick: () => vibrate(),
4144
},
4245
{
4346
label: 'Мои данные',
4447
icon: 'i-lucide-user',
48+
onClick: () => vibrate(),
4549
},
4650
{
4751
label: clientStore.selectedCity ? clientStore.selectedCity.name : 'Выбрать город',
4852
icon: 'i-lucide-locate-fixed',
49-
onClick: () => clientStore.updateCity(null),
53+
onClick: () => {
54+
vibrate('success')
55+
clientStore.updateCity(null)
56+
},
5057
},
5158
])
5259
</script>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<template>
2+
<PageContainer>
3+
<h1 class="text-2xl/5 font-bold tracking-tight">
4+
Меню
5+
</h1>
6+
7+
<div class="flex flex-col gap-1">
8+
<UButton
9+
v-for="item in items"
10+
:key="item.label"
11+
active
12+
size="xl"
13+
color="neutral"
14+
variant="ghost"
15+
class="px-0 text-xl/5 font-semibold"
16+
:label="item.label"
17+
:to="item.to"
18+
@click="item.onClick"
19+
/>
20+
</div>
21+
22+
<div class="flex flex-col gap-1">
23+
<p class="font-medium">
24+
{{ channelStore.selectedKitchen?.address }}
25+
</p>
26+
<p class="text-sm text-muted">
27+
Ежедневно с 11:00 до 22:00
28+
</p>
29+
</div>
30+
31+
<div class="flex flex-col gap-1">
32+
<UButton
33+
:to="formattedToCall"
34+
color="neutral"
35+
variant="ghost"
36+
class="px-0 text-lg font-medium"
37+
>
38+
{{ formatted }}
39+
</UButton>
40+
</div>
41+
42+
<div class="flex flex-row gap-2">
43+
<UIcon name="simple-icons:vk" class="size-8" />
44+
</div>
45+
</PageContainer>
46+
</template>
47+
48+
<script setup lang="ts">
49+
import { parsePhoneNumberWithError } from 'libphonenumber-js'
50+
51+
const { vibrate } = useFeedback()
52+
const channelStore = useChannelStore()
53+
54+
const tel = '79999999999'
55+
const formatted = parsePhoneNumberWithError(tel, 'RU').format('INTERNATIONAL')
56+
const formattedToCall = parsePhoneNumberWithError(tel, 'RU').format('RFC3966')
57+
58+
const items = ref([
59+
{
60+
label: 'Акции',
61+
to: '/menu',
62+
onClick: () => vibrate(),
63+
},
64+
{
65+
label: 'О нас',
66+
onClick: () => vibrate(),
67+
},
68+
{
69+
label: 'Франшиза',
70+
onClick: () => vibrate(),
71+
},
72+
{
73+
label: 'Бонусная программа',
74+
onClick: () => vibrate(),
75+
},
76+
{
77+
label: 'Частые вопросы',
78+
onClick: () => vibrate(),
79+
},
80+
])
81+
</script>

apps/storefront-telegram/app/pages/navigation.vue

Lines changed: 0 additions & 5 deletions
This file was deleted.

apps/storefront-telegram/app/stores/channel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const useChannelStore = defineStore('channel', () => {
1212
const currencySign = ref('₽')
1313
const kitchens = ref<KitchenWithData[]>([])
1414

15-
const selectedKitchenId = ref<string | undefined>()
15+
const selectedKitchenId = ref<string | undefined>('m68foq9qtpsxd69eayom7bjn') // Фрунзе
1616
const selectedKitchen = computed(() => kitchens.value.find((kitchen) => kitchen.id === selectedKitchenId.value))
1717

1818
const initDataRaw = useSignal(_initDataRaw)

0 commit comments

Comments
 (0)