Skip to content

Commit 7940686

Browse files
authored
feat: reward cards, menu (#257)
* feat: reward cards, menu * chore: update
1 parent 0d13456 commit 7940686

File tree

11 files changed

+198
-52
lines changed

11 files changed

+198
-52
lines changed

apps/hub-telegram/app/components/ProspectiveBlock.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="grid grid-cols-2 gap-2">
3-
<NuxtLink to="/points">
3+
<NuxtLink to="/point">
44
<ActiveCard>
55
<ProspectivePoints :points="userStore.prospectivePoints" />
66
</ActiveCard>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<ActiveCard class="motion-preset-slide-left">
3+
<Section>
4+
<div class="flex flex-row justify-between">
5+
<div class="flex flex-col gap-1">
6+
<h3 class="text-xl/6 font-bold">
7+
{{ reward.name }}
8+
</h3>
9+
10+
<div
11+
v-if="reward.description"
12+
class="w-full text-base/5 font-normal whitespace-pre-wrap wrap-break-word line-clamp-8"
13+
>
14+
{{ reward.description }}
15+
</div>
16+
</div>
17+
18+
<UButton
19+
variant="solid"
20+
size="xl"
21+
class="text-xl/5 font-bold justify-center min-w-24"
22+
trailing-icon="i-lucide-coins"
23+
:label="reward.points.toString()"
24+
/>
25+
</div>
26+
</Section>
27+
</ActiveCard>
28+
</template>
29+
30+
<script setup lang="ts">
31+
import type { Reward } from '#shared/types'
32+
33+
defineProps<{ reward: Reward }>()
34+
</script>

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ function _useNavigation() {
1313
// badge: flowStore.nowViewedItemsCount > 10 ? '10+' : flowStore.nowViewedItemsCount.toString(),
1414
},
1515
{
16-
path: '/points',
17-
names: ['points'],
18-
title: 'Награды',
16+
path: '/point',
17+
names: ['point'],
18+
title: t('app.rewards'),
1919
icon: 'i-lucide-coins',
2020
},
2121
{
22-
path: '#',
23-
names: [],
24-
title: 'Позже',
25-
icon: 'i-lucide-lock',
22+
path: '/task',
23+
names: ['task'],
24+
title: t('app.tasks'),
25+
icon: 'i-lucide-check-check',
26+
},
27+
{
28+
path: '/navigation',
29+
names: ['navigation'],
30+
title: t('app.navigation'),
31+
icon: 'i-lucide-menu',
2632
},
27-
// {
28-
// path: '/navigation',
29-
// names: ['navigation'],
30-
// title: t('app.navigation'),
31-
// icon: 'i-lucide-menu',
32-
// },
3333
])
3434

3535
const isNavigationShown = ref(true)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<template>
2+
<PageContainer>
3+
<div class="flex flex-col gap-2.5 motion-preset-slide-left">
4+
<NuxtLink
5+
v-for="item in items"
6+
:key="item.label"
7+
:to="item.to"
8+
:target="item.target"
9+
@click="item.onClick"
10+
>
11+
<ActiveCard>
12+
<Section>
13+
<div class="flex flex-row gap-2.5 items-center">
14+
<UIcon :name="item.icon" class="size-5 shrink-0" />
15+
<h3 class="text-2xl/6 font-bold">
16+
{{ item.label }}
17+
</h3>
18+
</div>
19+
</Section>
20+
</ActiveCard>
21+
</NuxtLink>
22+
</div>
23+
</PageContainer>
24+
</template>
25+
26+
<script lang="ts" setup>
27+
const { vibrate } = useFeedback()
28+
29+
const items = ref([
30+
{
31+
label: 'Помощь в WhatsApp',
32+
to: 'https://wa.me/message/DRMTOEKLZU2FJ1',
33+
target: '_blank',
34+
icon: 'i-lucide-heart-handshake',
35+
onClick: () => vibrate(),
36+
},
37+
{
38+
label: 'Наш Telegram канал',
39+
to: 'https://t.me/franshizasushi',
40+
target: '_blank',
41+
icon: 'simple-icons:telegram',
42+
onClick: () => vibrate(),
43+
},
44+
{
45+
label: 'Наша VK группа',
46+
to: 'https://vk.com/franshizasushi',
47+
target: '_blank',
48+
icon: 'simple-icons:vk',
49+
onClick: () => vibrate(),
50+
},
51+
])
52+
</script>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<template>
2+
<PageContainer>
3+
<Section class="motion-preset-slide-left">
4+
<div class="flex flex-row gap-2 items-center">
5+
<UIcon
6+
name="i-lucide-coins"
7+
class="size-10 text-primary"
8+
/>
9+
</div>
10+
11+
<SectionTitle :title="`У вас ${userStore.prospectivePoints} ${pluralizationRu(userStore.prospectivePoints, ['Балл', 'Балла', 'Баллов'])}`" />
12+
13+
<p class="text-base/5">
14+
Выбирайте награду! Список регулярно обновляется.
15+
</p>
16+
17+
<UButton
18+
to="/task"
19+
variant="solid"
20+
size="xl"
21+
class="font-bold w-full justify-center"
22+
label="Хочу еще"
23+
/>
24+
</Section>
25+
26+
<div class="flex flex-col gap-3.5">
27+
<RewardCard
28+
v-for="reward of rewards"
29+
:key="reward.id"
30+
:reward="reward"
31+
/>
32+
</div>
33+
</PageContainer>
34+
</template>
35+
36+
<script setup lang="ts">
37+
import type { Reward } from '#shared/types'
38+
39+
const userStore = useUserStore()
40+
41+
const rewards = ref<Reward[]>([
42+
{
43+
id: '1',
44+
name: 'Первая награда',
45+
description: 'Описание награды',
46+
points: 5,
47+
},
48+
{
49+
id: '2',
50+
name: 'Вторая награда',
51+
description: 'Описание награды',
52+
points: 15,
53+
},
54+
{
55+
id: '3',
56+
name: 'Третья награда',
57+
description: 'Описание награды',
58+
points: 25,
59+
},
60+
])
61+
</script>

apps/hub-telegram/app/pages/points/index.vue

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template>
2+
<PageContainer>
3+
<SectionTitle title="Задания" />
4+
5+
<div class="flex flex-col gap-3.5">
6+
<p class="text-muted">
7+
Активных нет
8+
</p>
9+
</div>
10+
</PageContainer>
11+
</template>

apps/hub-telegram/i18n/locales/ru-RU.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
"show-more": "Показать еще"
2222
},
2323
"app": {
24-
"flow": "Поток"
24+
"flow": "Поток",
25+
"navigation": "Меню",
26+
"rewards": "Награды",
27+
"tasks": "Задания"
2528
},
2629
"error": {
2730
"common": "Неверное значение",

apps/hub-telegram/shared/types/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ export type FlowItemWithData = FlowItem & {
1717
comments: FlowItemCommentWithUser[]
1818
views: FlowItemView[]
1919
}
20+
21+
export type Reward = {
22+
id: string
23+
name: string
24+
description: string
25+
points: number
26+
}

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343
"vitest": "catalog:test",
4444
"vitest-browser-vue": "catalog:test"
4545
},
46-
"resolutions": {
47-
"unimport": "4.1.1"
48-
},
4946
"lint-staged": {
5047
"*.{js,ts,tsx,vue,md,json}": [
5148
"eslint --cache --fix"

0 commit comments

Comments
 (0)