Skip to content

Commit 2dffa74

Browse files
authored
feat: categories now clickable (#124)
1 parent 2588435 commit 2dffa74

11 files changed

Lines changed: 62 additions & 42 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
should-scale-background
77
:set-background-color-on-scale="false"
88
:ui="{
9-
content: 'max-h-10/12 !mt-150',
10-
overlay: 'tg-content-safe-area-top',
9+
content: 'max-h-10/12',
1110
}"
1211
>
1312
<template #content>
14-
<div class="p-4 flex flex-col gap-3 overflow-y-auto">
13+
<div class="p-4 pb-20 flex flex-col gap-3 overflow-y-auto">
1514
<h3 class="text-lg font-semibold">
1615
Выберите город
1716
</h3>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const isThisRoute = computed(() => route.exact ? router.currentRoute.value.path
4343
4444
const { y } = useWindowScroll()
4545
const isCatalogButton = computed(() => route.path === '/')
46-
const canScrollToTop = computed(() => isCatalogButton.value && y.value > 500)
46+
const canScrollToTop = computed(() => isCatalogButton.value && y.value > 650)
4747
4848
function handleScrollToTop() {
4949
vibrate()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="z-30 overflow-hidden h-full min-h-dvh w-full tg-content-safe-area">
2+
<div class="z-30 relative h-full min-h-dvh w-full tg-content-safe-area">
33
<div class="px-4 py-2 max-w-[28rem] mx-auto mb-20 flex flex-col gap-y-6">
44
<slot />
55
</div>
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
<template>
2-
<div class="z-40 sticky top-0 h-18 bg-primary">
2+
<div class="z-40 sticky top-0 h-fit tg-bg-secondary">
33
<div class="max-w-full overflow-x-scroll snap-x">
44
<div class="w-max flex flex-row flex-wrap gap-5">
55
<div
66
v-for="category in menuStore.menu?.categories"
77
:key="category.id"
88
class="scroll-ml-6 snap-start"
99
>
10-
<div class="p-0">
10+
<button class="py-2" @click="scrollToCategory(category.slug)">
1111
{{ category.name }}
12-
</div>
12+
</button>
1313
</div>
1414
</div>
1515
</div>
1616
</div>
1717
</template>
1818

1919
<script setup lang="ts">
20+
const { vibrate } = useFeedback()
21+
2022
const menuStore = useMenuStore()
23+
24+
function scrollToCategory(id: string) {
25+
vibrate()
26+
27+
const category = window.document.getElementById(id)
28+
category?.scrollIntoView({ behavior: 'smooth' })
29+
}
2130
</script>

apps/storefront-telegram/app/components/catalog/CategoryBlock.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="flex flex-col gap-3 mb-10">
3-
<h2 class="text-2xl/5 font-semibold tracking-tight">
3+
<h2 :id="category?.slug" class="scroll-mt-14 text-2xl/5 font-semibold tracking-tight">
44
{{ category?.name }}
55
</h2>
66

apps/storefront-telegram/app/components/catalog/RecommendedSlider.vue

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,56 @@
66

77
<div class="max-w-full overflow-x-scroll snap-x">
88
<div class="w-max flex flex-row flex-wrap gap-2">
9-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
10-
<div class="p-2 max-w-24">
9+
<div class="min-w-28 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
10+
<div class="p-2 max-w-28">
1111
1 товар
1212
</div>
1313
</div>
1414

15-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
16-
<div class="p-2 max-w-24">
15+
<div class="min-w-28 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
16+
<div class="p-2 max-w-28">
1717
2 товар
1818
</div>
1919
</div>
2020

21-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
22-
<div class="p-2 max-w-24">
21+
<div class="min-w-28 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
22+
<div class="p-2 max-w-28">
2323
3 товар
2424
</div>
2525
</div>
2626

27-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
28-
<div class="p-2 max-w-24">
27+
<div class="min-w-28 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
28+
<div class="p-2 max-w-28">
2929
4 товар
3030
</div>
3131
</div>
3232

33-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
34-
<div class="p-2 max-w-24">
33+
<div class="min-w-28 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
34+
<div class="p-2 max-w-28">
3535
5 товар
3636
</div>
3737
</div>
3838

39-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
40-
<div class="p-2 max-w-24">
39+
<div class="min-w-28 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
40+
<div class="p-2 max-w-28">
4141
6 товар
4242
</div>
4343
</div>
4444

45-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
46-
<div class="p-2 max-w-24">
45+
<div class="min-w-28 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
46+
<div class="p-2 max-w-28">
4747
7 товар
4848
</div>
4949
</div>
5050

51-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
52-
<div class="p-2 max-w-24">
51+
<div class="min-w-28 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
52+
<div class="p-2 max-w-28">
5353
8 товар
5454
</div>
5555
</div>
5656

57-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
58-
<div class="p-2 max-w-24">
57+
<div class="min-w-28 scroll-ml-6 snap-start border border-primary aspect-3/4 rounded-lg">
58+
<div class="p-2 max-w-28">
5959
9 товар
6060
</div>
6161
</div>

apps/storefront-telegram/app/components/catalog/StoriesSlider.vue

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,40 @@
11
<template>
22
<div class="max-w-full overflow-x-scroll snap-x">
33
<div class="w-max flex flex-row flex-wrap gap-2">
4-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
5-
<div class="p-2 max-w-24">
4+
<div class="min-w-36 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
5+
<div class="p-2 max-w-36">
66
1 карточка
77
</div>
88
</div>
99

10-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
11-
2 карточка
10+
<div class="min-w-36 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
11+
<div class="p-2 max-w-36">
12+
2 карточка
13+
</div>
1214
</div>
1315

14-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
15-
3 карточка
16+
<div class="min-w-36 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
17+
<div class="p-2 max-w-36">
18+
3 карточка
19+
</div>
1620
</div>
1721

18-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
19-
4 карточка
22+
<div class="min-w-36 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
23+
<div class="p-2 max-w-36">
24+
4 карточка
25+
</div>
2026
</div>
2127

22-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
23-
5 карточка
28+
<div class="min-w-36 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
29+
<div class="p-2 max-w-36">
30+
5 карточка
31+
</div>
2432
</div>
2533

26-
<div class="min-w-24 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
27-
6 карточка
34+
<div class="min-w-36 scroll-ml-6 snap-start border border-primary aspect-2/3 rounded-lg">
35+
<div class="p-2 max-w-36">
36+
6 карточка
37+
</div>
2838
</div>
2939
</div>
3040
</div>

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
<CatalogStoriesSlider />
1111
<CatalogRecommendedSlider />
12-
1312
<CatalogCategoriesSliderMenu />
1413

1514
<CatalogCategoryBlock

apps/web-app/shared/services/partner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const createPartnerAgreementSchema = type({
3535
})
3636
export type CreatePartnerAgreement = typeof createPartnerAgreementSchema.infer
3737

38-
const patentStatus = type('"in_work" | "on_registration" | "registered"')
38+
const patentStatus = type('"in_work" | "not_paid" | "on_registration" | "registered"')
3939

4040
export const updatePartnerAgreementSchema = type({
4141
concludedAt: type('string | undefined').describe('error.length.invalid').optional(),

apps/web-app/shared/utils/helpers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export function getPatentStatus(status: AgreementPatentStatus) {
3535
switch (status) {
3636
case 'in_work':
3737
return 'В работе'
38+
case 'not_paid':
39+
return 'Не оплачен'
3840
case 'on_registration':
3941
return 'На регистрации'
4042
case 'registered':
@@ -45,6 +47,7 @@ export function getPatentStatus(status: AgreementPatentStatus) {
4547
export function getPatentStatusForSelect(): { value: AgreementPatentStatus, label: string }[] {
4648
return [
4749
{ value: 'in_work', label: 'В работе' },
50+
{ value: 'not_paid', label: 'Не оплачен' },
4851
{ value: 'on_registration', label: 'На регистрации' },
4952
{ value: 'registered', label: 'Зарегистрирован' },
5053
]

0 commit comments

Comments
 (0)