Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis PR adds Starknet blockchain support to cross-chain donation components, refactors token selector initialization logic using refs to prevent re-initialization, adjusts responsive layout in the campaigns page header, and updates the past funding rounds pot ID from "mpdao.v1.potfactory.potlock.near" to "build.v1.potfactory.potlock.near". Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/pages/campaigns.tsx (1)
45-51: Consider making the carousel position indicator dynamic.The responsive layout changes look good. However, the position indicator uses a hardcoded "/3" value which assumes exactly 3 filtered campaigns (from line 80's filter). If the filtered campaign list changes in the future, this will display incorrect information.
🔎 Proposed fix to make the position dynamic
- <p className="text-[18px]">{current + 1}/3</p> + <p className="text-[18px]">{current + 1}/{data?.filter((d) => [106, 101, 91].includes(d?.on_chain_id))?.length || 0}</p>Or better yet, calculate the filtered data once:
+ const featuredData = useMemo(() => + data?.filter((d) => [106, 101, 91].includes(d?.on_chain_id)) ?? [], + [data] + ); + return ( <div className="mt-8 w-full p-0 "> <div className="mb-4 flex w-full flex-col gap-4 p-2 md:flex-row md:items-center md:justify-between md:gap-0 md:p-0"> <div className="flex items-center gap-4"> <h1 className="text-sm font-medium uppercase leading-6 tracking-[1.12px] text-[#292929]"> Featured Campaigns </h1> - <p className="text-[18px]">{current + 1}/3</p> + <p className="text-[18px]">{current + 1}/{featuredData.length}</p> </div>Then use
featuredDatain the carousel:<CarouselContent> - {data?.length && - data - ?.filter((data) => [106, 101, 91].includes(data?.on_chain_id)) - ?.map((data) => <CampaignCarouselItem key={data.on_chain_id} data={data} />)} + {featuredData.map((data) => <CampaignCarouselItem key={data.on_chain_id} data={data} />)} </CarouselContent>
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/features/donation/components/cross-chain-amount-entry.tsx(1 hunks)src/features/donation/components/cross-chain-token-avatar.tsx(1 hunks)src/features/donation/components/cross-chain-token-selector.tsx(4 hunks)src/pages/campaigns.tsx(2 hunks)src/pages/index.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-04-17T14:16:13.402Z
Learnt from: carina-akaia
Repo: PotLock/potlock-nextjs-app PR: 365
File: src/features/donation/models/effects/index.ts:155-174
Timestamp: 2025-04-17T14:16:13.402Z
Learning: The transaction outcome handling in src/features/donation/models/effects/index.ts is temporary and will be replaced with `nearRps.txStatus` in the future, so extensive refinements to the current implementation aren't necessary.
Applied to files:
src/features/donation/components/cross-chain-amount-entry.tsxsrc/features/donation/components/cross-chain-token-selector.tsx
📚 Learning: 2025-06-25T12:26:52.941Z
Learnt from: akaia-shadowfox
Repo: PotLock/potlock-nextjs-app PR: 418
File: src/layout/profile/components/team.tsx:21-37
Timestamp: 2025-06-25T12:26:52.941Z
Learning: The `useAccountSocialProfile` hook in `src/entities/_shared/account/hooks/social-profile.ts` returns `avatar` and `cover` objects where the `.url` property is guaranteed to be defined. The hook uses `useAccountSocialImageSrc` with fallback URLs (placeholder constants) to ensure these properties are never undefined through the fallback chain: `nftMediaSrc ?? rawImageSrc ?? fallbackUrl`.
Applied to files:
src/features/donation/components/cross-chain-token-selector.tsx
📚 Learning: 2025-06-25T12:26:52.941Z
Learnt from: akaia-shadowfox
Repo: PotLock/potlock-nextjs-app PR: 418
File: src/layout/profile/components/team.tsx:21-37
Timestamp: 2025-06-25T12:26:52.941Z
Learning: The `useAccountSocialProfile` hook in `src/entities/_shared/account/hooks/social-profile.ts` returns `avatar` and `cover` objects where the `.url` property is guaranteed to be defined. The hook uses `useAccountSocialImageSrc` with fallback URLs (placeholder constants) to ensure these properties are never undefined.
Applied to files:
src/features/donation/components/cross-chain-token-selector.tsx
📚 Learning: 2025-05-13T03:39:29.454Z
Learnt from: akaia-shadowfox
Repo: PotLock/potlock-nextjs-app PR: 370
File: src/features/donation/models/effects/index.ts:60-63
Timestamp: 2025-05-13T03:39:29.454Z
Learning: In the PotLock project, `ByPotId` type ensures that `potId` is a required property of type `AccountId`. The codebase has TypeScript type checking in precommit hooks that prevents pushing code with type mismatches.
Applied to files:
src/pages/index.tsx
📚 Learning: 2025-06-02T18:44:53.590Z
Learnt from: akaia-shadowfox
Repo: PotLock/potlock-nextjs-app PR: 400
File: src/features/donation/components/modal-confirmation-screen.tsx:83-88
Timestamp: 2025-06-02T18:44:53.590Z
Learning: In src/features/donation/components/modal-confirmation-screen.tsx, the isFeeBypassAllowed flag is temporarily hardcoded to true for urgent shipping, with a TODO comment indicating it should be replaced with campaign permission-based logic using campaign?.allow_fee_avoidance ?? false for campaign donations.
Applied to files:
src/pages/campaigns.tsx
🧬 Code graph analysis (2)
src/features/donation/components/cross-chain-token-selector.tsx (1)
src/common/constants.ts (1)
NATIVE_TOKEN_ID(125-125)
src/pages/campaigns.tsx (1)
src/common/ui/layout/components/atoms/button.tsx (1)
Button(111-111)
⏰ 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 (20.x)
🔇 Additional comments (7)
src/features/donation/components/cross-chain-token-avatar.tsx (1)
35-35: LGTM! Starknet avatar entry added correctly.The Starknet token avatar entry follows the established pattern and integrates seamlessly with the existing avatar mapping.
src/pages/campaigns.tsx (1)
68-68: LGTM! Button styling improved.The addition of
shrink-0prevents the button from shrinking in flex layouts, ensuring consistent sizing across different screen sizes.src/features/donation/components/cross-chain-token-selector.tsx (3)
54-54: LGTM! Starknet avatar entry added.The Starknet token avatar follows the existing pattern and complements the addition in cross-chain-token-avatar.tsx.
114-114: LGTM! Starknet added to supported blockchains.Adding "starknet" to the evmChains list appropriately extends cross-chain donation support.
223-256: Excellent refactor to prevent re-initialization!The use of refs to track initialization state and maintain a stable callback reference effectively prevents infinite loops and duplicate initialization calls. The guards ensure that:
initializedDefaultValueRefprevents processing the same defaultValue multiple timesonTokenChangeRefprovides a stable reference to the latest callback- The effect only processes cross-chain tokens (those containing ":")
- NEAR native tokens are excluded from initialization
The dependency array change from
[loading, tokens.length, onTokenChange]to[loading, tokens.length, tokenOptions]is correct sinceonTokenChangeis now referenced via the ref andtokenOptionsis what the effect actually uses.src/features/donation/components/cross-chain-amount-entry.tsx (1)
115-115: LGTM! Starknet added to EVM chains.Adding "starknet" to the evmChains list ensures that Starknet addresses are correctly initialized using the EVM_ADDRESS format, consistent with the changes in cross-chain-token-selector.tsx.
src/pages/index.tsx (1)
41-45: The three pot IDs in this constant (ai, build, and oss) are all legitimate and active PotLock funding rounds. No verification action is required—these are intentional entries for tracking past funding rounds.Likely an incorrect or invalid review comment.
Summary by CodeRabbit
New Features
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.