Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(web): jurors-page-scroll #1885

Merged
merged 3 commits into from
Feb 5, 2025
Merged

refactor(web): jurors-page-scroll #1885

merged 3 commits into from
Feb 5, 2025

Conversation

Harman-singh-waraich
Copy link
Contributor

@Harman-singh-waraich Harman-singh-waraich commented Feb 4, 2025

PR-Codex overview

This PR focuses on enhancing the scrollTop functionality in the useScrollTop hook to support smooth scrolling and integrating this feature into the DisplayJurors component for improved user experience during page navigation.

Detailed summary

  • Modified scrollTop function in useScrollTop to accept a smooth parameter for smooth scrolling.
  • Integrated useScrollTop into DisplayJurors component.
  • Updated handlePageChange to call scrollTop(true) for smooth scrolling when changing pages.
  • Removed unused useIsDesktop import and variable.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features
    • Added an option for smooth scrolling when returning to the top, offering a more fluid user experience.
    • Enhanced navigation by automatically resetting the view to the top during page transitions.
    • Simplified pagination logic in the Display Jurors component to a fixed value of 10.

@Harman-singh-waraich Harman-singh-waraich requested a review from a team as a code owner February 4, 2025 15:38
Copy link
Contributor

coderabbitai bot commented Feb 4, 2025

Walkthrough

This pull request updates the scroll behavior by modifying the useScrollTop hook to accept an optional smooth parameter (defaulting to false). The hook now allows a conditional smooth scrolling effect. Additionally, the DisplayJurors component is updated to use this hook so that when the page changes, the view scrolls to the top with a smooth animation if specified. No other functionality has been altered.

Changes

File(s) Change Summary
web/src/hooks/useScrollTop.ts, web/src/pages/Jurors/DisplayJurors.tsx Updated the useScrollTop hook to accept an optional smooth parameter. The DisplayJurors component now calls scrollTop(true) on page change to scroll to the top with smooth behavior.

Sequence Diagram(s)

sequenceDiagram
    participant D as DisplayJurors
    participant H as useScrollTop Hook
    participant B as Browser

    D->>H: Call scrollTop(true)
    H->>B: Execute scroll({ top: 0, behavior: "smooth" })
    B-->>D: Top of page reached
Loading

Possibly related PRs

  • feat: UX improvements #1760: The changes in the main PR, which modify the scrollTop function in the useScrollTop hook, are directly related to the introduction of the ScrollTop component in the retrieved PR, as the new component utilizes the useScrollTop hook to manage scroll behavior.

Suggested labels

Type: Enhancement :sparkles:, Package: Web, Type: UX

Suggested reviewers

  • kemuru
  • alcercu

Poem

I'm a little rabbit, hopping through code bright,
With smooth scrolls now, everything feels light.
A tweak here and a hop there, top pages in sight,
The view resets so nicely, shining like moonlight.
Cheers from my burrow, where changes play just right! 🐇
Happy coding, with bunny joy taking flight!

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

📜 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 1be7200 and 642d2a2.

📒 Files selected for processing (1)
  • web/src/pages/Jurors/DisplayJurors.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/pages/Jurors/DisplayJurors.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: contracts-testing
  • GitHub Check: SonarCloud
  • GitHub Check: Analyze (javascript)

🪧 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. (Beta)
  • @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 or @coderabbitai title 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.

Copy link

netlify bot commented Feb 4, 2025

Deploy Preview for kleros-v2-testnet ready!

Name Link
🔨 Latest commit b5da6d7
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2-testnet/deploys/67a389cf5f87f70008a63d01
😎 Deploy Preview https://deploy-preview-1885--kleros-v2-testnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 4, 2025

Deploy Preview for kleros-v2-neo ready!

Name Link
🔨 Latest commit b5da6d7
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2-neo/deploys/67a389cf0d76fb0008541600
😎 Deploy Preview https://deploy-preview-1885--kleros-v2-neo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 4, 2025

Deploy Preview for kleros-v2-university ready!

Name Link
🔨 Latest commit b5da6d7
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2-university/deploys/67a389cf254ea30007529541
😎 Deploy Preview https://deploy-preview-1885--kleros-v2-university.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 4, 2025
Copy link

netlify bot commented Feb 4, 2025

Deploy Preview for kleros-v2-testnet-devtools ready!

Name Link
🔨 Latest commit b5da6d7
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2-testnet-devtools/deploys/67a389cfc2c4ec00082e3684
😎 Deploy Preview https://deploy-preview-1885--kleros-v2-testnet-devtools.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kemuru kemuru self-requested a review February 4, 2025 15:59
Copy link
Contributor

@kemuru kemuru left a comment

Choose a reason for hiding this comment

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

I don't see the flashing now, but is the scrolling working as expected?

Screen.Recording.2025-02-04.at.16.58.10.mp4

@kemuru
Copy link
Contributor

kemuru commented Feb 4, 2025

also have to change the 20 jurors per page to 10 jurors per page

Copy link
Contributor

@alcercu alcercu left a comment

Choose a reason for hiding this comment

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

lgtm

@alcercu alcercu enabled auto-merge February 5, 2025 15:55
Copy link

codeclimate bot commented Feb 5, 2025

Code Climate has analyzed commit b5da6d7 and detected 0 issues on this pull request.

View more on Code Climate.

Copy link

sonarqubecloud bot commented Feb 5, 2025

@alcercu alcercu merged commit 8a545b9 into dev Feb 5, 2025
25 of 26 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Feb 12, 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