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

Add Scroll Progress Indicator to "Go To Top" Button and Remove react-top-loader #2134

Merged
merged 5 commits into from
Aug 5, 2024

Conversation

techy4shri
Copy link
Contributor

@techy4shri techy4shri commented Aug 4, 2024

Fixes Issue #1990

Closes #1990

Changes proposed

This PR introduces significant updates to the user interface, including a new "Go To Top" button with a circular scroll progress indicator and the removal of react-top-loader due to compatibility issues. The key changes are:

  1. Circular Progress Indicator: Added a circular progress bar outlining the "Go To Top" button, showing the user’s scroll progress from 0% to 100%.
  2. Button Visibility: The button is hidden when the scroll progress is below 2% and becomes visible as the user scrolls past this threshold.
  3. Styling and Positioning: Updated CSS to ensure the button is correctly positioned with an arrow icon and a background color filling the circle. Added smooth transitions for hover effects.
  4. Removal of react-top-loader: Due to conflicts with React versions, react-top-loader was removed. The previous implementation has been replaced with react-loader-spinner.

Screenshots

Screenshot 2024-08-04 230842
image

Note to reviewers

Note, react-top-loader is not compatible with reacct 16+ so this might show error while npm i, this issue can be resolved using --legacy-peer-deps while using npm i

Summary by CodeRabbit

  • New Features

    • Introduced a top loading bar for improved visual feedback during loading processes.
    • Added a "Go to Top" button that appears based on scroll progress, enhancing navigation.
  • Bug Fixes

    • Ensured the loading simulation restarts upon route changes for more accurate progress indication.
  • Style

    • Revamped styles for the "Go to Top" button, providing a visually appealing and responsive design.
    • Updated the loading spinner to a top loader bar for a cleaner interface.

- Installed react-top-loader package.
- Updated Loader component to use TopLoader from react-top-loader.
- Modified UserLayout component to control the loader's progress state.
- Ensured the loader appears during page transitions and completes at 100% when the page is fully loaded.
- Adjusted CSS for the loader container.

References:
- https://github.com/JovianHQ/react-top-loader#readme
Copy link

vercel bot commented Aug 4, 2024

@techy4shri is attempting to deploy a commit to the Vivek Prajapati's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Aug 4, 2024

Walkthrough

The update simplifies the project's loading mechanisms by removing specific dependencies and utilizing a new approach for indicating progress. The react-top-loader package has been eliminated along with other redundant loading components, paving the way for a more efficient and streamlined user experience. This change focuses on enhancing the loading feedback while improving overall performance.

Changes

Files Change Summary
package.json Removed react-loader-spinner and react-top-loading-bar dependencies, streamlining the project's dependency list, and potentially improving performance.

Assessment against linked issues

Objective Addressed Explanation
Implement react-top-loader: Integrate the react-top-loader package (#[1990]) The react-top-loader package was removed instead of integrated.
Ensure Seamless Integration: Ensure that the loader appears during page transitions (#[1990]) The change does not implement any loading indication during transitions.

🐰 In fields of code, where loaders once spun,
Now simpler paths, it's all just begun.
With fewer strings, we hop and we play,
A smoother journey for users today!
No more clutter, just elegant flow,
Performance shines, watch our project grow! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bce49b8 and f2c70ed.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (4)
  • package.json (1 hunks)
  • src/User/UserLayout.jsx (1 hunks)
  • src/User/components/progressbar/Loader.jsx (1 hunks)
  • src/User/components/progressbar/ScrollProgressBar.css (1 hunks)
Files skipped from review due to trivial changes (1)
  • package.json
Additional comments not posted (8)
src/User/components/progressbar/Loader.jsx (2)

1-2: Import statement looks good.

The import statement for TopLoader is correct and follows best practices.


4-12: Component logic looks good.

The Loader component correctly uses the TopLoader to display a loading bar based on the progress prop. The configuration parameters are appropriate.

src/User/components/progressbar/ScrollProgressBar.css (2)

1-10: Styles for loader overlay look good.

The loader-overlay class is correctly defined to cover the full width of the viewport with a fixed position and transparent background.


12-18: Visibility classes look good.

The visible and hidden classes are correctly defined to control the display properties of the loader.

src/User/UserLayout.jsx (4)

11-11: Initialization of progress state looks good.

The progress state is correctly initialized to 0.


19-29: Loading simulation logic looks good.

The simulateLoading function correctly increments the progress state until it reaches 100. The use of setInterval and clearInterval is appropriate.


32-33: Effect hook dependency looks good.

The useEffect hook correctly depends on the location object to restart the loading simulation on route changes.


38-38: Loader component usage looks good.

The Loader component is correctly used with the progress prop.

Copy link

vercel bot commented Aug 4, 2024

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

Name Status Preview Comments Updated (UTC)
vigybag ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 5, 2024 6:56am

Copy link
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f2c70ed and 78bc1a1.

Files selected for processing (1)
  • package.json (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package.json

…t-top-loader

- Implemented a circular progress indicator around the "Go To Top" button to show scroll progress.
- Updated CSS for button positioning, visibility, and hover effects.
- The button becomes visible when the user scrolls past 2% of the page height and is positioned fixed at the bottom-right corner.
- Removed `react-top-loader` due to compatibility issues with React versions. The previous loader implementation was replaced with a new approach using `react-loader-spinner`.
Copy link
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 78bc1a1 and d7a594a.

Files selected for processing (3)
  • src/User/UserLayout.jsx (1 hunks)
  • src/User/components/GoToTop/gototop.jsx (2 hunks)
  • src/User/components/GoToTop/top.css (1 hunks)
Additional comments not posted (7)
src/User/UserLayout.jsx (2)

9-9: Ensure loading feedback is handled elsewhere.

The Loader component and associated loading logic have been removed. Ensure that loading feedback is handled appropriately in the overall application context to maintain a good user experience.


19-19: LGTM!

The changes simplify the component by removing the loading state management.

src/User/components/GoToTop/top.css (1)

1-61: LGTM!

The CSS styles are well-defined and provide a good user experience for the GoToTop component.

src/User/components/GoToTop/gototop.jsx (4)

3-3: Ensure CSS file is correctly imported.

The top.css file is imported for styling. Verify that the CSS file is correctly imported and applied.


6-16: LGTM!

The scroll progress tracking logic is well-implemented and enhances the user experience.


30-33: LGTM!

The circular progress indicator provides a good visual representation of the scroll progress.


35-55: LGTM!

The component's return structure is well-organized and the SVG elements are correctly implemented.

@techy4shri techy4shri changed the title Implement react-top-loader for page loading indication Add Scroll Progress Indicator to "Go To Top" Button and Remove react-top-loader Aug 4, 2024
Copy link
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d7a594a and 7f70ecb.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (1)
  • package.json (1 hunks)
Additional comments not posted (2)
package.json (2)

Line range hint 1-62:
Verify removal of react-top-loading-bar.

Ensure that all references to react-top-loading-bar have been removed or replaced in the codebase.

Verification successful

Verify removal of react-top-loading-bar.

The react-top-loading-bar dependency has been successfully removed from the codebase. There are no remaining references to it.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `react-top-loading-bar` is no longer used in the codebase.

# Test: Search for any remaining references to `react-top-loading-bar`. Expect: No matches.
rg 'react-top-loading-bar'

Length of output: 26


Line range hint 1-62:
Verify removal of react-loader-spinner.

Ensure that all references to react-loader-spinner have been removed or replaced in the codebase.

Verification successful

Verification successful: react-loader-spinner has been removed.

No references to react-loader-spinner were found in the codebase, confirming that the dependency has been fully removed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `react-loader-spinner` is no longer used in the codebase.

# Test: Search for any remaining references to `react-loader-spinner`. Expect: No matches.
rg 'react-loader-spinner'

Length of output: 25


Script:

#!/bin/bash
# Description: Verify that `react-loader-spinner` is no longer imported or required in the codebase.

# Test: Search for any import or require statements for `react-loader-spinner`. Expect: No matches.
rg "import .* from 'react-loader-spinner'" -A 2
rg "require('react-loader-spinner')" -A 2

Length of output: 105

@codervivek5 codervivek5 merged commit 6f47811 into codervivek5:main Aug 5, 2024
2 checks passed
Copy link

github-actions bot commented Aug 5, 2024

Congratulations, Your pull request has been successfully merged 🥳🎉 Thank you for your contribution to the project 🚀 Keep Contributing!! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement GoToTop arrow and progressbar in one
2 participants