Skip to content

feat: reward cards, menu#257

Merged
hmbanan666 merged 2 commits into
mainfrom
reward-cards
Oct 31, 2025
Merged

feat: reward cards, menu#257
hmbanan666 merged 2 commits into
mainfrom
reward-cards

Conversation

@hmbanan666

@hmbanan666 hmbanan666 commented Oct 31, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added rewards page, tasks page, and navigation menu with external links.
    • Added reward card component to show reward name, optional description, and points.
  • Improvements

    • Expanded clickable area for prospective item links so the whole card is tappable.
  • Chores

    • Updated navigation routes and labels.
    • Added Russian localization strings for menu, rewards, and tasks.

@hmbanan666 hmbanan666 self-assigned this Oct 31, 2025
@coderabbitai

coderabbitai Bot commented Oct 31, 2025

Copy link
Copy Markdown

Walkthrough

Add a rewards feature and navigation/menu updates: new RewardCard, /point and /task pages, a /navigation page with external links and feedback, route renames from /points → /point, Reward type and Russian i18n keys, and minor ProspectiveBlock NuxtLink change.

Changes

Cohort / File(s) Summary
Navigation routing & ProspectiveBlock
apps/hub-telegram/app/components/ProspectiveBlock.vue, apps/hub-telegram/app/composables/useNavigation.ts
Route updated from /points to /point; ActiveCard wrapped by NuxtLink; mainRoutes entries updated (added /navigation, replaced placeholder with /task, names arrays and i18n titles adjusted).
Reward UI & page
apps/hub-telegram/app/components/RewardCard.vue, apps/hub-telegram/app/pages/point/index.vue
New RewardCard SFC displaying reward name/optional description and points button; new /point page renders a rewards list and header using user prospective points.
New pages
apps/hub-telegram/app/pages/navigation.vue, apps/hub-telegram/app/pages/task/index.vue
New navigation page listing external links (NuxtLink target="_blank") with useFeedback().vibrate() on click; new task page stub showing "Активных нет".
Removed content
apps/hub-telegram/app/pages/points/index.vue
Removed previous "Награды за Баллы" template block.
Types & i18n
apps/hub-telegram/shared/types/index.ts, apps/hub-telegram/i18n/locales/ru-RU.json
Added Reward type (id, name, description, points); added app.navigation, app.rewards, app.tasks keys in Russian locale.
Package manifest
package.json
Removed resolutions field (unimport pin removed).

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant PB as ProspectiveBlock
    participant Nuxt as Router/NuxtLink
    participant Point as /point page
    participant RC as RewardCard

    U->>PB: click card
    PB->>Nuxt: navigate to /point
    Nuxt->>Point: render /point
    Point->>RC: render RewardCard(s)
    Note right of RC#color(##f0f4ff): displays name, optional description,\nand points button
Loading
sequenceDiagram
    participant U as User
    participant Nav as navigation.vue
    participant Ext as External Link
    participant FB as useFeedback

    U->>Nav: click external item
    Nav->>FB: vibrate()
    Nav->>Ext: open link (target="_blank")
    Note right of Nav#color(##fff7f0): external resources list with icons
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to route name vs. path consistency across useNavigation.ts, ProspectiveBlock, and new page links.
  • Verify the new Reward type shape matches all usages and imports (#shared/types path).
  • Check i18n key usage (t('app.rewards'), t('app.navigation'), t('app.tasks')) for missing translations or fallbacks.
  • Confirm useFeedback().vibrate() signature and behavior in navigation.vue.
  • Review package.json removal of resolutions for any CI/tooling impacts.

Possibly related PRs

Poem

🐰 I hopped from /points to /point with cheer,
Cards now clickable, rewards drawing near,
A menu opens links that twinkle bright,
Tasks rest quietly — no active fight,
I thump my paw and celebrate the sight! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: reward cards, menu" directly corresponds to the primary changes in the changeset. The PR introduces a new RewardCard component and a complete rewards page displaying these cards, matching the "reward cards" portion of the title. It also adds a new navigation page for external resource links, aligning with the "menu" reference. The title is concise, specific, and uses conventional commit format. Both mentioned features represent the main UI additions across multiple new files and components. The title effectively communicates the core changes without unnecessary noise or vagueness.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch reward-cards

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f67249 and 6818bef.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • package.json (0 hunks)
💤 Files with no reviewable changes (1)
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
apps/hub-telegram/app/pages/task/index.vue (1)

1-11: Use i18n for hardcoded text.

The component uses hardcoded Russian strings instead of the i18n system. For consistency with the rest of the codebase, consider using translation keys.

Apply this diff to use i18n:

 <template>
   <PageContainer>
-    <SectionTitle title="Задания" />
+    <SectionTitle :title="$t('app.tasks')" />
 
     <div class="flex flex-col gap-3.5">
       <p class="text-muted">
-        Активных нет
+        {{ $t('app.tasks-empty') }}
       </p>
     </div>
   </PageContainer>
 </template>

Also add the missing key to apps/hub-telegram/i18n/locales/ru-RU.json:

   "app": {
     "flow": "Поток",
     "navigation": "Меню",
     "rewards": "Награды",
-    "tasks": "Задания"
+    "tasks": "Задания",
+    "tasks-empty": "Активных нет"
   },
apps/hub-telegram/app/pages/navigation.vue (1)

29-51: Consider using i18n for hardcoded labels.

The navigation items use hardcoded Russian text. For consistency with the rest of the codebase and to support potential future internationalization, consider using the i18n system.

Example refactor:

 const items = ref([
   {
-    label: 'Помощь в WhatsApp',
+    label: t('app.navigation-whatsapp'),
     to: 'https://wa.me/message/DRMTOEKLZU2FJ1',
     target: '_blank',
     icon: 'i-lucide-heart-handshake',
     onClick: () => vibrate(),
   },
   {
-    label: 'Наш Telegram канал',
+    label: t('app.navigation-telegram'),
     to: 'https://t.me/franshizasushi',
     target: '_blank',
     icon: 'simple-icons:telegram',
     onClick: () => vibrate(),
   },
   {
-    label: 'Наша VK группа',
+    label: t('app.navigation-vk'),
     to: 'https://vk.com/franshizasushi',
     target: '_blank',
     icon: 'simple-icons:vk',
     onClick: () => vibrate(),
   },
 ])

And add corresponding keys to ru-RU.json.

apps/hub-telegram/app/components/RewardCard.vue (1)

18-24: Consider removing unnecessary toString() conversion.

The UButton label prop can accept a number directly, making the explicit conversion unnecessary.

Apply this diff:

       <UButton
         variant="solid"
         size="xl"
         class="text-xl/5 font-bold justify-center min-w-24"
         trailing-icon="i-lucide-coins"
-        :label="reward.points.toString()"
+        :label="String(reward.points)"
       />
apps/hub-telegram/app/pages/point/index.vue (1)

11-23: Use i18n for hardcoded text.

The component contains several hardcoded Russian strings that should use the i18n system for consistency with the rest of the codebase.

Apply this diff to use i18n:

-      <SectionTitle :title="`У вас ${userStore.prospectivePoints} ${pluralizationRu(userStore.prospectivePoints, ['Балл', 'Балла', 'Баллов'])}`" />
+      <SectionTitle :title="$t('app.rewards-balance', { points: userStore.prospectivePoints, unit: pluralizationRu(userStore.prospectivePoints, ['Балл', 'Балла', 'Баллов']) })" />
 
       <p class="text-base/5">
-        Выбирайте награду! Список регулярно обновляется.
+        {{ $t('app.rewards-description') }}
       </p>
 
       <UButton
         to="/task"
         variant="solid"
         size="xl"
         class="font-bold w-full justify-center"
-        label="Хочу еще"
+        :label="$t('app.rewards-more-button')"
       />

And add the corresponding keys to ru-RU.json:

   "app": {
     "flow": "Поток",
     "navigation": "Меню",
     "rewards": "Награды",
-    "tasks": "Задания"
+    "tasks": "Задания",
+    "rewards-balance": "У вас {points} {unit}",
+    "rewards-description": "Выбирайте награду! Список регулярно обновляется.",
+    "rewards-more-button": "Хочу еще"
   },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d13456 and 3f67249.

📒 Files selected for processing (9)
  • apps/hub-telegram/app/components/ProspectiveBlock.vue (1 hunks)
  • apps/hub-telegram/app/components/RewardCard.vue (1 hunks)
  • apps/hub-telegram/app/composables/useNavigation.ts (1 hunks)
  • apps/hub-telegram/app/pages/navigation.vue (1 hunks)
  • apps/hub-telegram/app/pages/point/index.vue (1 hunks)
  • apps/hub-telegram/app/pages/points/index.vue (0 hunks)
  • apps/hub-telegram/app/pages/task/index.vue (1 hunks)
  • apps/hub-telegram/i18n/locales/ru-RU.json (1 hunks)
  • apps/hub-telegram/shared/types/index.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/hub-telegram/app/pages/points/index.vue
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (5)
apps/hub-telegram/app/components/ProspectiveBlock.vue (1)

3-7: LGTM! Route update and improved link structure.

The route change from /points to /point aligns with the navigation refactoring, and wrapping the ActiveCard inside NuxtLink properly makes the entire card clickable.

apps/hub-telegram/shared/types/index.ts (1)

21-26: LGTM! Clean type definition.

The Reward type is well-defined with appropriate fields for the rewards feature.

apps/hub-telegram/i18n/locales/ru-RU.json (1)

23-28: LGTM! Localization keys added correctly.

The new i18n keys for navigation, rewards, and tasks are properly structured and support the new features.

apps/hub-telegram/app/pages/point/index.vue (1)

41-60: Hardcoded mock data is acceptable for initial implementation.

The hardcoded rewards array is fine for the initial feature implementation. When ready to integrate with backend data, this can be replaced with API calls.

apps/hub-telegram/app/composables/useNavigation.ts (1)

16-32: LGTM! Navigation routes updated correctly.

The navigation routes have been properly updated to reflect the new page structure with correct i18n usage throughout. The changes align well with the new /point, /task, and /navigation pages.

Comment on lines +10 to +15
<div
v-if="reward.description"
class="w-full text-base/5 font-normal whitespace-pre-wrap wrap-break-word line-clamp-8"
>
{{ reward.description }}
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Invalid Tailwind CSS class name.

Line 12 uses wrap-break-word which is not a valid Tailwind utility class. This should be break-words.

Apply this diff:

         <div
           v-if="reward.description"
-          class="w-full text-base/5 font-normal whitespace-pre-wrap wrap-break-word line-clamp-8"
+          class="w-full text-base/5 font-normal whitespace-pre-wrap break-words line-clamp-8"
         >
           {{ reward.description }}
         </div>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div
v-if="reward.description"
class="w-full text-base/5 font-normal whitespace-pre-wrap wrap-break-word line-clamp-8"
>
{{ reward.description }}
</div>
<div
v-if="reward.description"
class="w-full text-base/5 font-normal whitespace-pre-wrap break-words line-clamp-8"
>
{{ reward.description }}
</div>
🤖 Prompt for AI Agents
In apps/hub-telegram/app/components/RewardCard.vue around lines 10 to 15, the
Tailwind class "wrap-break-word" on the description div is invalid; replace
"wrap-break-word" with the correct Tailwind utility "break-words" so the class
list becomes valid and word-wrapping behaves as intended.

@sonarqubecloud

Copy link
Copy Markdown

@hmbanan666 hmbanan666 merged commit 7940686 into main Oct 31, 2025
8 checks passed
@hmbanan666 hmbanan666 deleted the reward-cards branch October 31, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant