Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ianmaccallum
Copy link
Contributor

@ianmaccallum ianmaccallum commented Oct 1, 2025

Summary by CodeRabbit

  • Refactor

    • Consolidated rewards and discount retrieval into a single source, simplifying data flow.
    • Streamlined the partner landing preview to use a unified rewards display.
    • Aligned child components with a consistent rewards/discount data shape and adjusted layout accordingly.
  • Chores

    • Removed an obsolete rewards/discounts preview component no longer needed after consolidation.

@vercel
Copy link
Contributor

vercel bot commented Oct 1, 2025

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

Project Deployment Preview Updated (UTC)
dub Building Building Preview Oct 1, 2025 7:54pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

Walkthrough

Consolidated rewards and discount retrieval into getGroupRewardsAndDiscount within the lander preview, replaced RewardsDiscountsPreview with direct LanderRewards usage, adjusted props and layout to pass rewards and discount consistently, and removed the obsolete rewards-discounts-preview component.

Changes

Cohort / File(s) Summary
Lander preview consolidation
apps/web/ui/partners/groups/design/previews/lander-preview.tsx
Replaced separate hooks with getGroupRewardsAndDiscount(group); imported and rendered LanderRewards with { rewards, discount }; updated program rewards construction to use discount; removed RewardsDiscountsPreview import; adjusted layout/prop passing.
Deprecated preview removal
apps/web/ui/partners/groups/design/rewards-discounts-preview.tsx
Deleted RewardsDiscountsPreview component and all associated imports/logic that fetched group and computed rewards/discounts before rendering LanderRewards.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant LP as LanderPreview
  participant S as getGroupRewardsAndDiscount
  participant LR as LanderRewards

  U->>LP: Open lander preview
  LP->>S: Fetch {rewards, discount} for group
  S-->>LP: {rewards, discount}
  LP->>LR: Render with rewards, discount
  LR-->>U: Display rewards & discount
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • steven-tey

Poem

A hop, a bop, a unified call—
Rewards and discounts, one burrow for all.
Old preview gone, new carrots in sight,
LanderRewards twinkles, tidy and bright.
Thump-thump! Less code to sprawl—
More time for clover, after all. 🥕🐇

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 title clearly summarizes the main change—making the lander rewards group-scoped—and aligns with the code changes that replace separate hooks with a new group-scoped data-fetching call for rewards and discounts and update the UI accordingly.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-lander-rewards

📜 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 17f92ac and 510f7f6.

📒 Files selected for processing (2)
  • apps/web/ui/partners/groups/design/previews/lander-preview.tsx (4 hunks)
  • apps/web/ui/partners/groups/design/rewards-discounts-preview.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • apps/web/ui/partners/groups/design/rewards-discounts-preview.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
apps/web/ui/partners/groups/design/previews/lander-preview.tsx (2)
apps/web/lib/partners/get-group-rewards-and-discount.ts (1)
  • getGroupRewardsAndDiscount (7-22)
apps/web/ui/partners/lander/lander-rewards.tsx (1)
  • LanderRewards (4-27)
⏰ 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 (4)
apps/web/ui/partners/groups/design/previews/lander-preview.tsx (4)

3-3: LGTM! Improved data fetching architecture.

The consolidation of rewards and discount retrieval into a dedicated helper function, along with direct usage of LanderRewards, simplifies the component structure and aligns with the PR objective to make rewards group-scoped.

Also applies to: 9-9


52-52: LGTM! Cleaner data fetching approach.

The synchronous helper function getGroupRewardsAndDiscount ensures rewards and discount are consistently derived from the group scope, eliminating potential race conditions or stale data issues that could arise from separate hook calls.


243-246: LGTM! Clean component integration.

The direct usage of LanderRewards with explicit props simplifies the component hierarchy and ensures consistent data flow from the group-scoped rewards and discount.


333-333: Confirm discounts prop matches schema
The programLanderSchema defines discounts as an array of DiscountProps, but this preview passes a single discount object. Verify the block renderer’s program prop expects DiscountProps[] and either wrap discount in an array (discounts: [discount]) or update the schema/type to accept a singular object.


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.

@steven-tey steven-tey merged commit 13f520d into main Oct 1, 2025
5 of 8 checks passed
@steven-tey steven-tey deleted the fix-lander-rewards branch October 1, 2025 19:57
@coderabbitai coderabbitai bot mentioned this pull request Nov 21, 2025
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.

3 participants