Repository navigation
Implement key - #1262
Merged
Merged
Implement key#1262
Conversation
|
@assumptaamara 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an in-app celebration for newly earned key holder badges. When a connected
wallet earns a badge, an animated toast shows the badge, its name and the
criteria that were met, with a View Badges CTA that deep-links to the
wallet's badge showcase on the profile page.
What changed
src/services/badgeEvents.service.ts(new) — wallet-scoped realtime channel(
wallet:<address>topic) with backoff reconnects, plus a tolerantnormalizeBadgeMintedEventthat accepts flat payloads,{type,data}envelopes and field aliases. Unknown badge types are ignored.
src/utils/badgeAchievementToast.tsx(new) — the custom toast: animated badgeicon reveal, badge name, "Criteria met: …", a View Badges CTA and a manual
dismiss. Persists for 10 seconds.
src/hooks/useBadgeAchievements.ts(new) — detects achievements from therealtime event and from a polled snapshot, celebrates each badge exactly once,
and refreshes the badge showcase in place.
src/components/common/BadgeAchievementListener.tsx(new) — app-root listenerthat watches the connected wallet and wires the toast CTA to the router.
src/App.tsx— mounts the listener app-wide.src/hooks/useWallet.ts—useWalletBadgespolls every 30s, which is thefallback that keeps the feature working without the realtime feed.
src/components/common/WalletBadgeShowcase.tsx— gained thewallet-badgesanchor the CTA targets.
src/pages/ProfilePage.tsx— scrolls the badge showcase into view on arrival.src/utils/confetti.utils.ts,src/index.css— celebration burst and thebadge reveal animation (with a
prefers-reduced-motionguard).Behaviour
badges that were not already earned when the wallet was first seen.
showcase updates immediately without a page reload; the refetch confirms it.
/profile/<wallet>#wallet-badgesand scrolls theshowcase into view.
Tests
Added coverage:
badgeEvents.service.test.ts,badgeAchievementToast.test.tsx,useBadgeAchievements.test.tsxandBadgeAchievementListener.test.tsx.Note for review
The realtime path expects the backend to publish a
BadgeMintedframe on thewallet:<address>topic. When it does not — or whenVITE_WEBSOCKET_URLisunset — the 30s poll of
GET /wallets/:address/badgescarries the feature, atthe cost of up to 30s of latency.