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

Animated Preloader added #405

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AbhijitMotekar99
Copy link

@AbhijitMotekar99 AbhijitMotekar99 commented Oct 26, 2024

Issues Identification

Closes: #347

Description

Summary

Animeted text preloader added

Waste.Manaegment.preloader.mp4

Types of Changes

Please check the boxes that apply

  • Bugfix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (Documentation content changed)
  • Other (please describe):

Checklist

Please check the boxes that apply

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • My changes do not break the current system and pass all existing test cases
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features

    • Introduced a preloader feature to enhance user experience during page loading.
    • Added animated text and styling for the preloader.
    • Implemented a structure to hide main content until the preloader animation completes.
  • Bug Fixes

    • Corrected a typo in the class name for main content.

Copy link
Contributor

coderabbitai bot commented Oct 26, 2024

Walkthrough

The changes in the index.html file introduce a preloader feature that enhances the user experience during page loading. A new style block defines the preloader's appearance and animation, which includes a fixed overlay and animated text. The main content is encapsulated in a newly added <div> that is initially hidden, with JavaScript managing the preloader's visibility by displaying it for 5 seconds before revealing the main content. A minor typo in the class name was also corrected.

Changes

Files Change Summary
index.html Added a preloader feature with styling and animation. Introduced <div class="preloader"> and <div class="main-content">. Updated JavaScript for preloader visibility and corrected a typo in class name.

Assessment against linked issues

Objective Addressed Explanation
Implement animated preloader as described (#347)

🐇 In the garden, where bunnies play,
A preloader spins, brightening the day.
With a wave of its hand, it hides the wait,
Revealing the content, oh, isn't it great?
So hop along, friends, with joy and delight,
Our site now loads smoothly, a beautiful sight! 🌼✨


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

Copy link

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. 😊

1 similar comment
Copy link

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. 😊

Copy link

netlify bot commented Oct 26, 2024

Deploy Preview for manageyourwaste failed. Why did it fail? →

Name Link
🔨 Latest commit 8246157
🔍 Latest deploy log https://app.netlify.com/sites/manageyourwaste/deploys/671cdbbab7794e0008674f03

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thank you, AbhijitMotekar99, for creating this pull request and contributing to WasteManagement! 💗

The maintainers will review this Pull Request and provide feedback as soon as possible! 😇
We appreciate your patience and contribution, Keep up the great work! 😀

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

🧹 Outside diff range and nitpick comments (2)
index.html (2)

30-30: Simplify the gradient background.

The gradient uses the same color three times which is unnecessary.

-      background: linear-gradient(to right, #26a69a, #26a69a, #26a69a); /* Yellow gradient */
+      background: #26a69a;

90-103: Enhance preloader accessibility.

The preloader SVG lacks proper accessibility attributes for screen readers.

-    <div class="preloader">
+    <div class="preloader" role="status" aria-label="Loading">
         <svg viewBox="0 0 1320 300">
+            <title>Loading Animation</title>
+            <desc>Animated text showing 'Waste Management' while content loads</desc>
           <text
             x="50%"
             y="50%"
             dy=".35em"
             text-anchor="middle"
             class="animate-stroke"
             style="font-weight: bold;"
+            aria-hidden="true"
           >
             Waste Management
           </text>
         </svg>
     </div>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d5e4053 and 8246157.

📒 Files selected for processing (1)
  • index.html (3 hunks)

Comment on lines +846 to +852
window.addEventListener('load', function() {
// Show the preloader for 5 seconds
setTimeout(function() {
document.querySelector('.preloader').style.display = 'none'; // Hide preloader
document.querySelector('.main-content').classList.remove('hidden'); // Show main content
}, 5000); // 5 seconds delay
});
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve preloader timing and reliability.

The current implementation has several limitations:

  1. The 5-second fixed delay might be too long for fast connections or too short for slow ones
  2. No fallback if JavaScript is disabled
  3. Doesn't consider the actual content load state

Consider this improved implementation:

     window.addEventListener('load', function() {
-      // Show the preloader for 5 seconds
+      // Track actual content load state
+      const contentLoaded = new Promise((resolve) => {
+        if (document.readyState === 'complete') {
+          resolve();
+        } else {
+          window.addEventListener('load', resolve);
+        }
+      });
+
+      // Ensure minimum animation time of 2 seconds
+      const minimumDelay = new Promise(resolve => setTimeout(resolve, 2000));
+
+      // Hide preloader only when content is ready and minimum time has passed
+      Promise.all([contentLoaded, minimumDelay]).then(() => {
         setTimeout(function() {
           document.querySelector('.preloader').style.display = 'none';
           document.querySelector('.main-content').classList.remove('hidden');
-        }, 5000); // 5 seconds delay
+        }, 0);
+      });
     });

Also add this fallback in the <head>:

<noscript>
  <style>
    .preloader { display: none !important; }
    .main-content { display: block !important; }
  </style>
</noscript>

<div id="progress-container">
<div id="progress-bar"></div>
</div>
<div class="main-contetnt">
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix critical typo in main content class name.

There's a typo in the class name that will break the preloader functionality. The JavaScript looks for .main-content but the HTML uses .main-contetnt.

-    <div class="main-contetnt">
+    <div class="main-content">
📝 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 class="main-contetnt">
<div class="main-content">

Comment on lines +81 to +86
display: block;
padding: 20px;
width: 100vw;
min-height: 100vh; /* Ensure it covers at least the full height */
padding: 0; /* Reset any padding */
margin: 0; /* Remove margin */
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove duplicate padding declaration.

The .main-content class has duplicate padding properties.

   .main-content {
     display: block;
-    padding: 20px;
     width: 100vw;
     min-height: 100vh;
     padding: 0;
     margin: 0;
   }
📝 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
display: block;
padding: 20px;
width: 100vw;
min-height: 100vh; /* Ensure it covers at least the full height */
padding: 0; /* Reset any padding */
margin: 0; /* Remove margin */
display: block;
width: 100vw;
min-height: 100vh; /* Ensure it covers at least the full height */
padding: 0; /* Reset any padding */
margin: 0; /* Remove margin */

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.

[Feature] : Adding animeted Pre Loader
1 participant