Skip to content

Strk#507

Merged
Ebube111 merged 2 commits intostagingfrom
strk
Dec 21, 2025
Merged

Strk#507
Ebube111 merged 2 commits intostagingfrom
strk

Conversation

@Ebube111
Copy link
Copy Markdown
Collaborator

@Ebube111 Ebube111 commented Dec 21, 2025

Summary by CodeRabbit

  • New Features

    • Added Starknet blockchain support for cross-chain donations.
  • Bug Fixes

    • Improved responsive layout on campaigns page for small screens.
    • Added progress indicator to featured campaigns carousel.
  • Chores

    • Updated past funding rounds configuration.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 21, 2025

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

Project Deployment Review Updated (UTC)
potlock-next-app Ready Ready Preview, Comment Dec 21, 2025 5:03am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 21, 2025

Walkthrough

This 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

Cohort / File(s) Summary
Cross-chain donation components with Starknet support
src/features/donation/components/cross-chain-amount-entry.tsx, src/features/donation/components/cross-chain-token-avatar.tsx
Added "starknet" to evmChains and tokenAvatars mappings, treating Starknet as an EVM-compatible chain for address initialization and avatar resolution.
Token selector initialization refactor
src/features/donation/components/cross-chain-token-selector.tsx
Introduced useRef hooks (onTokenChangeRef, initializedDefaultValueRef) to stabilize callback references and prevent repeated default value initialization. Updated effect dependencies to include tokenOptions and added guards to ensure initialization only triggers for cross-chain tokens when options are available.
Campaigns page responsive layout
src/pages/campaigns.tsx
Changed featured campaigns header from horizontal flex-row to vertical layout on small screens with responsive adjustments on medium screens. Added current carousel index display (current + 1) in header and applied shrink-0 to VIEW ALL button to prevent flex shrinking.
Past funding rounds configuration
src/pages/index.tsx
Updated PAST_FUNDING_ROUNDS_POT_IDS constant, replacing "mpdao.v1.potfactory.potlock.near" with "build.v1.potfactory.potlock.near" to change filtered pot IDs for past funding rounds display.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Token selector ref refactoring (cross-chain-token-selector.tsx): Verify that useRef-based callback and initialization tracking prevent unintended re-initialization and that effect dependencies correctly trigger initialization only when needed.
  • Cross-chain Starknet additions: Ensure consistent treatment of Starknet across evmChains, token avatars, and token options generation.
  • Campaigns layout changes: Validate responsive behavior across breakpoints and confirm shrink-0 application on button prevents layout breaking.

Possibly related PRs

  • Cross chain donation #475: Directly modifies the same cross-chain donation components (cross-chain-token-selector, cross-chain-token-avatar, cross-chain-amount-entry) for Starknet support.
  • Past Funding Round #505: Edits the same PAST_FUNDING_ROUNDS_POT_IDS constant in src/pages/index.tsx with overlapping pot ID changes.
  • Featured c #502: Modifies src/pages/campaigns.tsx's featured campaigns header and VIEW ALL button layout handling.

Suggested reviewers

  • carina-akaia
  • Prometheo
  • Jikugodwill

Poem

🐰 A rabbit hops through chains so bright,
Adding Starknet to the donation site,
With refs that guard initialization's way,
And campaigns that flex in smart display,
Potlock grows stronger, day by day! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
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.
Title check ❓ Inconclusive The title 'Strk' is an acronym or abbreviation that does not clearly convey the scope or purpose of the changes made to the codebase. Replace the title with a descriptive summary of the main changes, such as 'Add Starknet support to donation components and update past funding rounds pot ID' to clearly communicate the pull request intent.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch strk

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 featuredData in 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7c5b8ab and bd58e8a.

📒 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.tsx
  • 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 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-0 prevents 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:

  1. initializedDefaultValueRef prevents processing the same defaultValue multiple times
  2. onTokenChangeRef provides a stable reference to the latest callback
  3. The effect only processes cross-chain tokens (those containing ":")
  4. NEAR native tokens are excluded from initialization

The dependency array change from [loading, tokens.length, onTokenChange] to [loading, tokens.length, tokenOptions] is correct since onTokenChange is now referenced via the ref and tokenOptions is 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.

@Ebube111 Ebube111 merged commit 741684a into staging Dec 21, 2025
3 of 5 checks passed
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.

1 participant