Skip to content

Comments

fix/PRO-3014/leaderboard-improvements#264

Merged
RanaBug merged 3 commits intostagingfrom
fix/PRO-3014/leaderboard-improvements
Mar 24, 2025
Merged

fix/PRO-3014/leaderboard-improvements#264
RanaBug merged 3 commits intostagingfrom
fix/PRO-3014/leaderboard-improvements

Conversation

@RanaBug
Copy link
Collaborator

@RanaBug RanaBug commented Mar 21, 2025

Description

  • Auto-scroll for when scrolling down the leaderboards
  • Display last updated leaderboard lists
  • 'My rank' on top of the leaderboard lists
  • Wallet address truncate fix
  • Remove 0d or 0h when it is equal to 0 on the Points Tile

How Has This Been Tested?

  • Unit Tests and Manual Testing

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Summary by CodeRabbit

  • New Features

    • Introduced lazy loading for leaderboard entries, enabling continuous data display as you scroll.
    • Added personalized leaderboard sections that display your rank and points when your wallet is connected.
    • Implemented dynamic display of the leaderboard's last updated time.
    • Enhanced wallet address visualization for optimal readability across various screen sizes.
  • Bug Fixes/Improvements

    • Refined timestamp formatting to conditionally hide zero values for a cleaner, clearer display.
    • Corrected test identifiers to ensure accurate element referencing in tests.

@RanaBug RanaBug requested a review from IAmKio March 21, 2025 17:22
@RanaBug RanaBug self-assigned this Mar 21, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2025

Walkthrough

The changes enhance several leaderboard and points components by introducing wallet address integration and lazy loading in the LeaderboardTab, refining responsive wallet display in UserInfo, and adding dynamic last-fetched timestamp updates in the leaderboard index. Additionally, the PointsFormattedTimestamp component now conditionally renders time values and corrects a typo in its test identifier. Corresponding test updates have been made to support these new functionalities and ensure accurate targeting of elements.

Changes

File(s) Change Summary
src/apps/leaderboard/components/LeaderboardTab/LeaderboardTab.tsx
src/apps/leaderboard/components/LeaderboardTab/test/LeaderboardTab.test.tsx
Integrated wallet address using useWalletAddress, implemented lazy loading of entries via an IntersectionObserver, switched from button to div trigger, and updated tests to mock the observer and validate the display of the "My rank" section.
src/apps/leaderboard/components/UserInfo/UserInfo.tsx Modified useEffect logic for wallet address display based on window width with new truncation conditions for different screen sizes.
src/apps/leaderboard/index.tsx Added new state variables and effects to manage and display last fetched timestamps using date-fns with periodic updates via a minute-based timer.
src/apps/pillarx-app/components/PointsFormattedTimestamp/PointsFormattedTimestamp.tsx
src/apps/pillarx-app/components/PointsTile/test/PointsTile.test.tsx
Corrected a typographical error in data-testid and introduced conditional rendering for time components, with tests updated to reference the corrected timestamp identifier.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant LT as LeaderboardTab
    participant WA as useWalletAddress
    participant IO as IntersectionObserver

    U->>LT: Load LeaderboardTab component
    LT->>WA: Retrieve wallet address
    WA-->>LT: Return walletAddress
    LT->>IO: Set up IntersectionObserver on loadMoreRef
    IO-->>LT: Element visible in viewport
    LT->>LT: Invoke handleLoadMore (increment visibleCount)
Loading
sequenceDiagram
    participant LI as LeaderboardIndex
    participant DF as DataFetch
    participant TF as formatDistanceToNowStrict
    participant Timer as Timer Effect

    DF->>LI: Data fetch successful (all-time, weekly)
    LI->>LI: Set lastFetched timestamps
    Timer->>TF: Trigger periodic update every minute
    TF-->>LI: Return formatted timeAgo strings
    LI->>LI: Update leaderboard display with new timeAgo values
Loading

Suggested reviewers

  • IAmKio

Poem

Hop, hop, tap, tap—my code garden’s in bloom,
Wallets and lazy loads banish the gloom.
Timestamps tick like carrots fresh and bright,
With tests on point, everything feels just right.
A little bunny from CodeRabbit sends a cheerful cheer—
May coding adventures bring delight all year!
🐰


📜 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 65977c3 and dd5e7ea.

⛔ Files ignored due to path filters (3)
  • src/apps/leaderboard/components/LeaderboardTab/test/__snapshots__/LeaderboardTab.test.tsx.snap is excluded by !**/*.snap
  • src/apps/pillarx-app/components/MediaGridCollection/tests/__snapshots__/DisplayCollectionImage.test.tsx.snap is excluded by !**/*.snap
  • src/apps/pillarx-app/components/PointsTile/test/__snapshots__/PointsTile.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • src/apps/leaderboard/components/LeaderboardTab/test/LeaderboardTab.test.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/apps/leaderboard/components/LeaderboardTab/test/LeaderboardTab.test.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: unit-tests
  • GitHub Check: build
  • GitHub Check: Cloudflare Pages

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 21, 2025

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: dd5e7ea
Status: ✅  Deploy successful!
Preview URL: https://7e6a1c3a.x-e62.pages.dev
Branch Preview URL: https://fix-pro-3014-leaderboard-imp.x-e62.pages.dev

View logs

Copy link
Collaborator

@IAmKio IAmKio left a comment

Choose a reason for hiding this comment

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

Looks good, if you could just check that one comment please 🙏

@github-actions github-actions bot temporarily deployed to Preview (fix/PRO-3014/leaderboard-improvements) March 24, 2025 09:11 Inactive
Copy link
Collaborator

@IAmKio IAmKio left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-actions github-actions bot temporarily deployed to Preview (fix/PRO-3014/leaderboard-improvements) March 24, 2025 09:28 Inactive
@RanaBug RanaBug merged commit 0133289 into staging Mar 24, 2025
7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Mar 24, 2025
3 tasks
@coderabbitai coderabbitai bot mentioned this pull request Aug 20, 2025
3 tasks
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.

2 participants