Skip to content

Add goal templates, deposit QR, leaderboard and streaks - #471

Merged
nayt9 merged 2 commits into
stowp:mainfrom
fati-Onchain:handsoff/issues-356-357-358-359-552014
Oct 18, 2026
Merged

nayt9 merged 2 commits into
stowp:mainfrom
fati-Onchain:handsoff/issues-356-357-358-359-552014

Conversation

@fati-Onchain

Copy link
Copy Markdown
Contributor

Closes #356, closes #357, closes #358, closes #359

All four features are frontend-only and follow the existing component and hook patterns (Tailwind tokens, apiFetch hooks with a fetch-on-mount/refetch shape, dialogs with an Escape key handler and focus trap). New components are exported from components/savings/index.ts.

#356 Savings goal templates

  • lib/goalTemplates.ts: six pre-built templates (emergency fund, vacation, new laptop, education, car, home deposit). Each has a recommended target in XLM and a suggested timeline in months. A helper works out the monthly contribution.
  • GoalTemplatePicker: a grid of template cards shown at the top of GoalForm. Picking one fills in the goal name and target amount, and both stay editable before the goal is created. While a template is selected, the form shows the monthly amount needed to reach the current target in the template's timeline.
  • GoalForm also accepts an optional initialTemplateId prop, so a template can be pre-selected.

#357 QR code generator for deposit addresses

  • DepositQrModal: a modal that shows a QR code for the user's deposit address. It is opened from a new Deposit QR quick action on the dashboard.
  • Two payload formats (lib/depositQr.ts):
    • Address: the bare G… account, which any wallet understands.
    • Payment request: a SEP-7 web+stellar:pay URI with the destination plus optional asset and amount.
  • Two image formats: PNG and SVG downloads, both produced with the existing qrcode dependency.
  • A Copy button copies whatever value is currently encoded. The clipboard helper with its execCommand fallback was moved from AddressBadge into lib/clipboard.ts so both components share it. AddressBadge behaves the same as before.
  • XLM is always offered as an asset. USDC is offered only when NEXT_PUBLIC_USDC_ISSUER is set, because a SEP-7 request for a non-native asset needs its issuer.

#358 Group savings leaderboard

  • GroupLeaderboard: ranks a pool's members by how much they have contributed. The top three get medals and the viewer's own row is marked "You". Amounts are compared as BigInt stroops so no precision is lost.
  • Privacy options:
    • Members can be shown as anonymous ("Member #n"), as a masked address, or as the full address.
    • Contributions can be shown as a share of the pool (%), as an XLM amount, or hidden (rank only).
    • The default is the most private setting: anonymous members and percentage shares. Each viewer's choice is remembered in localStorage.
  • Real-time updates: useGroupDetail takes a new optional pollIntervalMs option. It refreshes the group in the background without switching the page back to its loading state, and it keeps the last good data if a refresh fails. The hook now also returns updatedAt. The group detail page polls every 15s and shows a "Live · updated hh:mm:ss" indicator.

#359 Savings streak tracker

  • lib/streaks.ts: counts the current and longest streak of consecutive deposit days or Monday-based weeks, using the viewer's local calendar and a day count that DST changes can't throw off. A streak stays active until a whole day or week passes with no deposit.
  • Achievement badges at 3, 7, 30 and 100 days, and at 4, 12, 26 and 52 weeks. A badge is earned once the longest streak reaches its threshold.
  • SavingsStreakTracker: a flame counter showing the current and longest streak, a Daily/Weekly toggle, a short prompt (for example "Deposit today to keep your streak alive"), and a grid showing which badges are earned and which are still locked.
  • useDepositHistory fetches GET /api/savings/deposits?address= and accepts either { deposits: [{ created_at }] } or a bare array. A 404 is treated as "no deposits yet". The tracker appears on the dashboard and is hidden if the history request fails.
  • Note: the backend has no deposit-history endpoint yet. Until one exists, the request returns 404, so the card shows a 0-day streak with a "make your first deposit" prompt.

Builds, tests and lint were not run for this change.

Closes #356
Closes #357
Closes #358
Closes #359

@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@fati-Onchain Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
stow Error Error Oct 18, 2026 11:40am UTC

@nayt9
nayt9 merged commit bd2b024 into stowp:main Oct 18, 2026
1 of 6 checks passed

This branch had an error being deployed

1 failed deployment
Preview — c71c1bbe Deployed Oct 18, 2026 by vercel[bot]
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.

Build savings streak tracker Create group savings leaderboard view Add QR code generator for deposit addresses Implement savings goal templates

2 participants