#777 feat(campaign): Backer leaderboard show top supporters on campaign page FIXED - #830
Open
veloura-dev wants to merge 1 commit into
Conversation
…porters on campaign page FIXED
|
@veloura-dev 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! 🚀 |
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 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. Comment |
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.
CLOSE #777
Code-level facts below were re-verified against the files on disk this turn (line numbers cited). Test/lint/typecheck numbers come from the runs I executed earlier in this session —
node_moduleswas dropped from the workspace snapshot between turns, so I have not re-run them just now.. Findings
1. The feature did not exist in any form. Searching
backer,top,leaderboard,privacy,anonymousacrossapps/web/srcfound no per-campaign backer ranking, no creator featuring, and no backer privacy model. The two nearest things were both unusable for this issue:types/sponsor.ts→INITIAL_MOCK_SPONSORS: a flat sponsor-wall list, no ranking, no privacy field.services/leaderboard.service.ts(#643): a global monthly sponsor/planter points board, not campaign-scoped, no privacy.2. The host page did not compile. Baseline
tsc --noEmitreported 11 errors inapps/web/src/app/(overview)/campaigns/[id]/page.tsx: duplicateEdit/ShieldCheckimports, three<TabsList>opening tags for one close, unclosedTabsTrigger/TabsContenton the Q&A and Success tabs, and the insurance-claim modal duplicated. There was nowhere to mount the feature until that was repaired.3. Seven files repo-wide had parse-level merge corruption (campaign detail page, campaigns directory, success-stories route + component, wallet modal,
co2-impact.ts,certificate.service.ts). These parse failures masked the real type state — once fixed, 52 pre-existing type errors surfaced.4.
pnpm installwas broken.@stellar/freghter-api@^6.0.1returns 404 (typo forfreighter, which the committed lockfile already pins),@types/html2canvas@^1.2.6has no such release (max 1.0.0), andhtml2canvaswas unused and absent from the lockfile — so--frozen-lockfilecould never succeed.5. Pre-existing debt I did not take on: 52 type errors across 29 unrelated files, 4 ESLint errors, 16 failing test files, and route handlers still using the pre-Next-15 sync
paramssignature (flagged by Next's generated.next/typesvalidators).6. One bug in my own first implementation, caught by rendering the page: the hook located the viewer's row by address, so an anonymous backer — whose address is redacted — silently lost their own privacy controls. Fixed to key off the service's
isSelf, with a regression test.. Fix features
Ranking — contributions aggregated per backer and summed in exact fixed-point bigint (7-decimal stroops,
parseTokenAmount/sumTokenAmounts), so0.1 + 0.2 === 0.3and ranking never drifts on floats. Ties break by earliest contribution, then address. Capped atTOP_BACKERS_LIMIT = 10(line 146), limit overridable per call.Creator featuring —
MAX_FEATURED_BACKERS = 3(line 149). Featured rows pin to the top while keeping the rank they earned by amount (a featured #6 still reads "6"). Supports an optional creator note, is idempotent on re-feature, and toggles off.Privacy enforcement matrix (the core of "respect privacy preferences"):
PUBLICANONYMOUSshowAmountPRIVATEremovedFromFeatured: true(lines 160–165).Only the campaign creator can feature backers(lines 197, 258); an unregistered creator is rejected too.API surface —
GET(privacy-aware board,?limit/viewer/creator),POST(record contribution),PATCH(set privacy) at/api/campaigns/:id/backers;POST/DELETEfeaturing at/api/campaigns/:id/backers/featured(403 on non-creator, body-or-query for DELETE).UI — top-10 list with gold/silver/bronze medals, featured star + amber pin, privacy badges, "Amount hidden", totals chips (
14 backers,38,700.5 raised,0/3 featured), inline error banner, empty state, and the private-backer disclosure line.Repo repairs — the 7 corrupted files fixed, the dependency typo fixed, and
pnpm install --frozen-lockfilenow succeeds against the committed lockfile.Verification (from runs executed earlier this session)
co2-impact,certificate.service,wallet-modal,CampaignImpactCalculator)tsc --noEmitnext buildReached heap limit); selective build OOM-killed (137). Compensated with tsc + Vite/jsdom render of the real page + direct route-handler execution.