Skip to content

Staging to main#397

Merged
Ebube111 merged 2 commits intomainfrom
staging
May 27, 2025
Merged

Staging to main#397
Ebube111 merged 2 commits intomainfrom
staging

Conversation

@Ebube111
Copy link
Copy Markdown
Collaborator

@Ebube111 Ebube111 commented May 27, 2025

Summary by CodeRabbit

  • New Features

    • Replaced the static featured projects grid on the homepage with an interactive carousel that supports looping, drag-free scrolling, and automatic slide advancement.
    • Added navigation arrows to manually scroll through featured projects in the carousel.
  • Improvements

    • Updated campaign carousel to display 8 featured campaigns with a new selection of campaign IDs.
    • Changed the external "Learn More" link for campaigns to direct to updated documentation.
    • Enhanced responsive and fixed-width styling for account and campaign cards for better layout consistency.
  • Bug Fixes

    • Campaigns list now excludes the campaign with ID 14 from display.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
potlock-next-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 8:11am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2025

Walkthrough

This update modifies the width and responsive styling of several card components across the application, including AccountCard, AccountCardSkeleton, and CampaignCard. It also updates campaign filtering logic, featured campaign selection, and carousel display on the campaigns and home pages. No changes to component signatures or exported interfaces were made.

Changes

Files/Paths Change Summary
src/entities/_shared/account/components/card-skeleton.tsx Changed root div width class from w-full to w-100 in AccountCardSkeleton.
src/entities/_shared/account/components/card.tsx Updated container div classes for responsive width: removed w-full, added md:w-full, w-80, min-w-105.
src/entities/campaign/components/CampaignCard.tsx Modified root div class to add max-w-105 w-full md:max-w-full for responsive width constraints.
src/entities/campaign/components/CampaignsList.tsx Filtered out campaign with id 14 from displayed campaigns.
src/pages/campaigns.tsx Changed featured campaign count from 3 to 8, filtered campaigns by specific IDs, updated "Learn More" URL.
src/pages/index.tsx Replaced static grid with looping carousel for featured projects; added navigation and auto-advance logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HomePage
    participant Carousel
    participant AccountCard

    User->>HomePage: Loads /
    HomePage->>Carousel: Initialize carousel with featured projects
    loop Every 4 seconds
        Carousel->>Carousel: Auto-advance to next slide
    end
    User->>Carousel: Clicks navigation arrow
    Carousel->>Carousel: Scrolls to previous/next slide
    Carousel->>AccountCard: Render project card for visible slide
    AccountCard-->>User: Display project info
Loading
sequenceDiagram
    participant User
    participant CampaignsList
    participant CampaignCard

    User->>CampaignsList: Loads campaign list
    CampaignsList->>CampaignsList: Filter out campaign with id 14
    CampaignsList->>CampaignCard: Render card for each remaining campaign
    CampaignCard-->>User: Display campaign info
Loading

Possibly related PRs

  • Campaign UI fixes #350: Also modifies CampaignCard.tsx, focusing on campaign data display and progress bar logic, while this PR addresses width styling and layout.

Suggested reviewers

  • carina-akaia

Poem

In a field of cards both wide and slim,
We tweaked their widths on a stylish whim.
Campaigns now filtered, the carousel spins,
Eight featured projects—let the showcase begin!
With every scroll and every view,
This bunny hops to celebrate you! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 5

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1c044e and a1afbee.

📒 Files selected for processing (6)
  • src/entities/_shared/account/components/card-skeleton.tsx (1 hunks)
  • src/entities/_shared/account/components/card.tsx (1 hunks)
  • src/entities/campaign/components/CampaignCard.tsx (1 hunks)
  • src/entities/campaign/components/CampaignsList.tsx (1 hunks)
  • src/pages/campaigns.tsx (3 hunks)
  • src/pages/index.tsx (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/entities/campaign/components/CampaignsList.tsx (1)
src/entities/campaign/components/CampaignCard.tsx (1)
  • CampaignCard (15-88)
src/pages/index.tsx (2)
src/entities/_shared/account/components/card.tsx (1)
  • AccountCard (30-153)
src/features/donation/components/user-entrypoints.tsx (1)
  • DonateToAccountButton (43-51)
🔇 Additional comments (7)
src/pages/campaigns.tsx (1)

104-104:

Details

✅ Verification successful

Verify the new documentation URL is accessible.

The external link URL has been updated to the new domain. Please ensure this URL is accessible and contains the expected content.


🏁 Script executed:

#!/bin/bash
# Description: Verify the new documentation URL is accessible
# Expected: HTTP 200 response from the new URL

curl -I "https://docs.potlock.io/user-guides/campaigns" 2>/dev/null | head -1

Length of output: 77


Documentation link verified
The URL https://docs.potlock.io/user-guides/campaigns returns HTTP 200. No further action required.

src/entities/campaign/components/CampaignCard.tsx (1)

25-25: Good responsive width implementation.

The added responsive width classes max-w-105 w-full md:max-w-full provide appropriate constraints for different screen sizes, ensuring cards don't become too wide on smaller screens while allowing full width utilization on larger displays.

src/entities/_shared/account/components/card.tsx (1)

54-55: LGTM! Good responsive width implementation.

The responsive width classes provide excellent mobile-first design:

  • w-80 ensures readable card width on small screens
  • md:w-full md:min-w-105 allows flexible expansion on larger screens
  • max-w-105 mx-auto maintains consistency and centering across all breakpoints

This change aligns well with the carousel implementation where consistent card sizing is important.

src/pages/index.tsx (4)

1-2: LGTM! Clean import additions for carousel functionality.

The new imports are well-organized and include all necessary components for the carousel implementation.

Also applies to: 9-15


122-139: LGTM! Solid carousel state management with auto-advance.

The carousel state management is well-implemented:

  • Proper cleanup of interval in useEffect
  • Correct dependency array with [api]
  • Event listener setup for slide selection tracking

The 4-second auto-advance interval provides a good balance between user engagement and readability.


167-185: LGTM! Well-configured carousel implementation.

The carousel setup is excellent:

  • Proper loop behavior with loop: true
  • Smooth interactions with dragFree: true and reasonable duration: 20
  • Clean integration with the existing AccountCard component
  • Consistent DonateToAccountButton actions for each project

The transition from static grid to carousel enhances user experience while maintaining the same functionality.


142-142: LGTM! Clean layout wrapper update.

The transition from <main> to PageWithBanner component provides better layout structure and consistency with the overall application design.

Also applies to: 206-206

export const AccountCardSkeleton = () => {
return (
<div className="bg-background mx-auto flex h-full w-full max-w-[420px] flex-col overflow-hidden rounded-xl border border-solid border-[#dbdbdb] shadow-[0px_-2px_0px_#dbdbdb_inset] transition-all duration-300 hover:translate-y-[-1rem]">
<div className="bg-background w-100 mx-auto flex h-full max-w-[420px] flex-col overflow-hidden rounded-xl border border-solid border-[#dbdbdb] shadow-[0px_-2px_0px_#dbdbdb_inset] transition-all duration-300 hover:translate-y-[-1rem]">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify consistency with AccountCard component.

The change from w-full to w-100 modifies the skeleton from full-width to a fixed 100-unit width. Ensure this change aligns with the corresponding AccountCard component styling to maintain visual consistency between loading and loaded states.


🏁 Script executed:

#!/bin/bash
# Description: Check if AccountCard component has similar width styling changes
# Expected: AccountCard should have corresponding width changes for consistency

rg -A 3 -B 3 "AccountCard.*className" --type tsx

Length of output: 78


🏁 Script executed:

#!/bin/bash
# Locate the AccountCard component
rg -n "AccountCard" --glob "*.tsx"

# Inspect its root container styling
rg -A 5 -B 5 "className=" --glob "*AccountCard*.tsx"

Length of output: 13022


🏁 Script executed:

#!/bin/bash
# Locate the shared AccountCard component and inspect its root styling
rg -n "export const AccountCard" -A 10 --glob "src/entities/_shared/account/components/card.tsx"
rg -n "className=" --glob "src/entities/_shared/account/components/card.tsx"

Length of output: 3214


🏁 Script executed:

#!/bin/bash
# Show the return statement and surrounding JSX for AccountCard
rg -n "return \(" -A5 -B5 --glob "src/entities/_shared/account/components/card.tsx"

# Display the first 80 lines of the AccountCard file to inspect the root wrapper
sed -n '1,80p' src/entities/_shared/account/components/card.tsx

Length of output: 3739


Align AccountCardSkeleton width with AccountCard styling

The skeleton’s fixed w-100 diverges from the responsive widths used in AccountCard. Update the root wrapper to match:

• Replace

- className="bg-background w-100 mx-auto flex h-full max-w-[420px] flex-col …"
+ className="bg-background md:w-full w-80 mx-auto flex h-full max-w-[420px] flex-col …"

This ensures the skeleton uses the same w-80 (20rem) default and md:w-full at breakpoints, with the existing max-w-[420px] and mx-auto intact.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="bg-background w-100 mx-auto flex h-full max-w-[420px] flex-col overflow-hidden rounded-xl border border-solid border-[#dbdbdb] shadow-[0px_-2px_0px_#dbdbdb_inset] transition-all duration-300 hover:translate-y-[-1rem]">
<div
className="bg-background md:w-full w-80 mx-auto flex h-full max-w-[420px] flex-col overflow-hidden rounded-xl border border-solid border-[#dbdbdb] shadow-[0px_-2px_0px_#dbdbdb_inset] transition-all duration-300 hover:translate-y-[-1rem]"
>
🤖 Prompt for AI Agents
In src/entities/_shared/account/components/card-skeleton.tsx at line 5, the
width class is set to w-100, which is a fixed width and inconsistent with the
responsive width styling used in the AccountCard component. To fix this, replace
w-100 with w-80 md:w-full to ensure the skeleton matches the AccountCard's
default width of 20rem and becomes full width at medium breakpoints, while
keeping max-w-[420px] and mx-auto for max width and centering.

Comment on lines +78 to +80
{filteredCampaigns
?.filter((campaign) => campaign?.id !== 14)
.map((campaign) => <CampaignCard key={campaign.id} data={campaign} />)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider making campaign exclusion configurable.

Hardcoding the exclusion of campaign ID 14 directly in the component couples business logic with presentation logic. This approach is not scalable and lacks context for why this specific campaign is excluded.

Consider these alternatives:

  1. Move the exclusion logic to a configuration file or environment variable
  2. Add a hidden or featured flag to the campaign data model
  3. Handle this filtering at the API/data layer
-            {filteredCampaigns
-              ?.filter((campaign) => campaign?.id !== 14)
-              .map((campaign) => <CampaignCard key={campaign.id} data={campaign} />)}
+            {filteredCampaigns
+              ?.filter((campaign) => !campaign?.isHidden)
+              .map((campaign) => <CampaignCard key={campaign.id} data={campaign} />)}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/entities/campaign/components/CampaignsList.tsx around lines 78 to 80, the
exclusion of campaign ID 14 is hardcoded in the component, mixing business logic
with presentation. To fix this, remove the hardcoded filter and instead
implement a configurable approach such as reading excluded campaign IDs from a
configuration file or environment variable, or use a flag in the campaign data
model to mark campaigns as hidden. Alternatively, move this filtering logic to
the API or data fetching layer so the component only receives campaigns meant to
be displayed.

Comment thread src/pages/campaigns.tsx
<div className=" flex items-center gap-4 ">
<h1 className=" text-[18px] font-semibold ">Featured Campaigns</h1>
<p className="text-[18px]">{current + 1}/3</p>
<p className="text-[18px]">{current + 1}/8</p>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Count hardcoded to 8 may not match actual filtered campaigns.

The count displays "/8" but depends on the filtered campaign IDs existing in the data. If any of the hardcoded campaign IDs [13, 12, 11, 10, 9, 7, 6, 3] don't exist, the actual count will be less than 8, creating a misleading UI.

Calculate the count dynamically:

-          <p className="text-[18px]">{current + 1}/8</p>
+          <p className="text-[18px]">{current + 1}/{data?.filter((data) => [13, 12, 11, 10, 9, 7, 6, 3].includes(data?.id))?.length || 0}</p>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<p className="text-[18px]">{current + 1}/8</p>
<p className="text-[18px]">
{current + 1}/
{data?.filter((item) =>
[13, 12, 11, 10, 9, 7, 6, 3].includes(item?.id)
)?.length || 0}
</p>
🤖 Prompt for AI Agents
In src/pages/campaigns.tsx at line 42, the total count of campaigns is hardcoded
as 8, which may not reflect the actual number of filtered campaigns. Replace the
hardcoded "8" with a dynamic calculation that counts the length of the filtered
campaign IDs array to ensure the displayed total matches the actual filtered
campaigns.

Comment thread src/pages/campaigns.tsx
Comment on lines +62 to +64
data
?.filter((data) => [13, 12, 11, 10, 9, 7, 6, 3].includes(data?.id))
?.map((data) => <CampaignCarouselItem key={data.id} data={data} />)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Replace hardcoded campaign ID filtering with a more maintainable solution.

Similar to the CampaignsList component, hardcoding specific campaign IDs makes the code brittle and difficult to maintain. Consider using campaign metadata or configuration-driven filtering.

Consider these approaches:

  1. Add a isFeatured property to campaign data
  2. Use a configuration file for featured campaign management
  3. Create a dedicated API endpoint for featured campaigns
-            data
-              ?.filter((data) => [13, 12, 11, 10, 9, 7, 6, 3].includes(data?.id))
-              ?.map((data) => <CampaignCarouselItem key={data.id} data={data} />)}
+            data
+              ?.filter((data) => data?.isFeatured)
+              ?.map((data) => <CampaignCarouselItem key={data.id} data={data} />)}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
data
?.filter((data) => [13, 12, 11, 10, 9, 7, 6, 3].includes(data?.id))
?.map((data) => <CampaignCarouselItem key={data.id} data={data} />)}
data
?.filter((data) => data?.isFeatured)
?.map((data) => <CampaignCarouselItem key={data.id} data={data} />)}
🤖 Prompt for AI Agents
In src/pages/campaigns.tsx around lines 62 to 64, the filtering of campaign data
uses hardcoded campaign IDs, which is not maintainable. Replace this by
implementing a more flexible approach such as adding an `isFeatured` property to
the campaign data objects and filtering based on that property, or
alternatively, use a configuration file or a dedicated API endpoint to manage
featured campaigns. Update the filter logic to use this new method instead of
hardcoded IDs.

Comment thread src/pages/index.tsx
Comment on lines +150 to +163
<div className="flex gap-6">
<img
src="/assets/icons/left-arrow.svg"
alt=""
onClick={() => api?.scrollTo(current - 1)}
className="h-6 w-6 cursor-pointer rounded-full border border-gray-400 text-[14px] text-gray-500"
/>
<img
src="/assets/icons/right-arrow.svg"
alt=""
onClick={() => api?.scrollTo(current + 1)}
className="h-6 w-6 cursor-pointer rounded-full border border-gray-400 text-[14px] text-gray-500"
/>
</div>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve accessibility for navigation arrows.

The navigation arrows have accessibility issues that should be addressed:

  1. Using img elements with onClick handlers excludes keyboard users
  2. Empty alt attributes provide no context for screen readers
  3. Missing focus indicators and keyboard navigation

Replace the img elements with proper button elements:

-            <div className="flex gap-6">
-              <img
-                src="/assets/icons/left-arrow.svg"
-                alt=""
-                onClick={() => api?.scrollTo(current - 1)}
-                className="h-6 w-6 cursor-pointer rounded-full border border-gray-400 text-[14px] text-gray-500"
-              />
-              <img
-                src="/assets/icons/right-arrow.svg"
-                alt=""
-                onClick={() => api?.scrollTo(current + 1)}
-                className="h-6 w-6 cursor-pointer rounded-full border border-gray-400 text-[14px] text-gray-500"
-              />
-            </div>
+            <div className="flex gap-6">
+              <button
+                onClick={() => api?.scrollTo(current - 1)}
+                className="flex h-6 w-6 items-center justify-center rounded-full border border-gray-400 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"
+                aria-label="Previous featured project"
+              >
+                <img
+                  src="/assets/icons/left-arrow.svg"
+                  alt=""
+                  className="h-4 w-4"
+                />
+              </button>
+              <button
+                onClick={() => api?.scrollTo(current + 1)}
+                className="flex h-6 w-6 items-center justify-center rounded-full border border-gray-400 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"
+                aria-label="Next featured project"
+              >
+                <img
+                  src="/assets/icons/right-arrow.svg"
+                  alt=""
+                  className="h-4 w-4"
+                />
+              </button>
+            </div>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="flex gap-6">
<img
src="/assets/icons/left-arrow.svg"
alt=""
onClick={() => api?.scrollTo(current - 1)}
className="h-6 w-6 cursor-pointer rounded-full border border-gray-400 text-[14px] text-gray-500"
/>
<img
src="/assets/icons/right-arrow.svg"
alt=""
onClick={() => api?.scrollTo(current + 1)}
className="h-6 w-6 cursor-pointer rounded-full border border-gray-400 text-[14px] text-gray-500"
/>
</div>
<div className="flex gap-6">
<button
onClick={() => api?.scrollTo(current - 1)}
className="flex h-6 w-6 items-center justify-center rounded-full border border-gray-400 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"
aria-label="Previous featured project"
>
<img
src="/assets/icons/left-arrow.svg"
alt=""
className="h-4 w-4"
/>
</button>
<button
onClick={() => api?.scrollTo(current + 1)}
className="flex h-6 w-6 items-center justify-center rounded-full border border-gray-400 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"
aria-label="Next featured project"
>
<img
src="/assets/icons/right-arrow.svg"
alt=""
className="h-4 w-4"
/>
</button>
</div>
🤖 Prompt for AI Agents
In src/pages/index.tsx around lines 150 to 163, the navigation arrows use img
elements with onClick handlers, which are not accessible for keyboard users and
lack proper alt text and focus indicators. Replace these img elements with
button elements that include accessible labels (e.g., aria-label), ensure they
are keyboard focusable, and maintain the visual styling. This will improve
accessibility by enabling keyboard navigation and providing context for screen
readers.

@Ebube111 Ebube111 merged commit 40ca624 into main May 27, 2025
3 of 6 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Dec 2, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Dec 15, 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.

1 participant