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

implemented skeletons loading page, for all navigation #570

Open
wants to merge 39 commits into
base: main
Choose a base branch
from

Conversation

Saurabhsing21
Copy link

@Saurabhsing21 Saurabhsing21 commented Jan 15, 2025

/claim #533
Fixes #533

Implementing Skeleton Loading for Navigation and Images

Skeleton loading is a technique used to display a placeholder while content is being loaded, improving user experience by reducing perceived load times. Below is how to implement skeleton loading for Navigation and Images.

Before I:

image alt

After:

image alt

@Saurabhsing21
Copy link
Author

/claim #533

Copy link

algora-pbc bot commented Jan 15, 2025

💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe.

Copy link
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

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

Not the right fix, the loading will still appear.

The reason is the loading appears is because index.html loads before other assets

@Saurabhsing21
Copy link
Author

Not the right fix, the loading will still appear.

The reason is the loading appears is because index.html loads before other assets

Thanks, I'm just done with changes you require. i will submit it soon

- Added a simple and lightweight skeleton loading page for all navigation.
- Ensured no JavaScript is loaded via <script> tags for security and performance.
- Custom lightweight inline script is used for minimal interactivity.
- Fixes issue tscircuit#533.
- Implemented skeleton in `index.html` to show loading state until content is fully loaded.

Signed-off-by: Saurabhsing21 <[email protected]>
- Added a simple and lightweight skeleton loading page for all navigation.
- Ensured no JavaScript is loaded via <script> tags for security and performance.
- Custom lightweight inline script is used for minimal interactivity.
- Fixes issue tscircuit#533.
- Implemented skeleton in `index.html` to show loading state until content is fully loaded.

Signed-off-by: Saurabhsing21 <[email protected]>
@Saurabhsing21
Copy link
Author

Saurabhsing21 commented Jan 16, 2025

@seveibar @imrishabh18 , I have completed the skeleton loading page implementation in index.html. Please review it and let me know if any further changes are required.

index.html Outdated
Comment on lines 204 to 214
<script>
document.addEventListener("DOMContentLoaded", () => {
const skeletonLoader = document.getElementById("skeleton-loader");
if (skeletonLoader) {
console.log("Skeleton Loader is displayed.");
setTimeout(() => {
skeletonLoader.style.display = "none";
}, 300); // Hide skeleton after React initializes
}
});
</script>
Copy link
Member

Choose a reason for hiding this comment

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

@Saurabhsing21 I don't we need the cleanup and hiding of the skeleton at both the places, I see you have added this in the useEffect() hook as well.

Copy link
Author

Choose a reason for hiding this comment

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

@imrishabh18 just to clarify, do you mean that I should remove the script tag and keep the skeleton hiding logic only in the useEffect() hook?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, give it a try. I think that should work

@imrishabh18
Copy link
Member

Other than that, this LGTM! Make sure you are fixing the format issues

@Saurabhsing21
Copy link
Author

Other than that, this LGTM! Make sure you are fixing the format issues

ok i will fix this

removed  cleanup and hiding of the skeleton   from script tag inside index.html
using  cleanup and hiding of the skeleton  with useEffect() in app.tsx
Signed-off-by: Saurabhsing21 <[email protected]>
Signed-off-by: Saurabhsing21 <[email protected]>
@Saurabhsing21
Copy link
Author

@imrishabh18 please review this,

@imrishabh18
Copy link
Member

LGTM!

cc: @seveibar

Copy link
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

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

LGTM, let's see @ShiboSoftwareDev weigh in!!!!

@ShiboSoftwareDev
Copy link
Contributor

@seveibar if you test the preview, it feels off

@ShiboSoftwareDev
Copy link
Contributor

@Saurabhsing21 it still doesn't work so don't worry about playwright atm

@Saurabhsing21
Copy link
Author

@Saurabhsing21 it still doesn't work so don't worry about playwright atm

Then how to solve this development vs production problem
@seveibar ?

@ShiboSoftwareDev
Copy link
Contributor

@Saurabhsing21 only test on production
click this to view production preview deployment:
image

…t experience

- Ensured loader stays visible for a minimum time to handle fast networks.
- Added logic to detect React rendering using MutationObserver.
- Enhanced loader hiding with smooth progress bar shrinking effect.
- Fixed issues with animation bounds for the loading bar.
- Addressed inconsistencies between development and deployment environments.

This update ensures a seamless loading experience across all network conditions.

Signed-off-by: Saurabhsing21 <[email protected]>
…t experience

- Ensured loader stays visible for a minimum time to handle fast networks.
- Added logic to detect React rendering using MutationObserver.
- Enhanced loader hiding with smooth progress bar shrinking effect.
- Fixed issues with animation bounds for the loading bar.
- Addressed inconsistencies between development and deployment environments.

This update ensures a seamless loading experience across all network conditions.

Signed-off-by: Saurabhsing21 <[email protected]>
@Saurabhsing21
Copy link
Author

@ShiboSoftwareDev review this i have fixed deployment problem

@ShiboSoftwareDev
Copy link
Contributor

@Saurabhsing21 when I go to the ai page it appears for a little and then disappears

@Saurabhsing21
Copy link
Author

Saurabhsing21 commented Jan 24, 2025

@Saurabhsing21 when I go to the ai page it appears for a little and then disappears
@ShiboSoftwareDev
Sorry, but I did not understand at which appearance you are talking about. Can you give any image or video, specific what is happening and what I need to change?

@ShiboSoftwareDev
Copy link
Contributor

@Saurabhsing21 when I click the AI tab I see the loading screen and then it disappears leaving an empty page before the AI page is loaded

@Saurabhsing21
Copy link
Author

@ShiboSoftwareDev i have removed blank page problem, please check once another thing i want you to chack loading animation for same page navigation, just like LinkedIn and other webpages the use skeleton loading animation for same page navigation so that also implemented same loading animation for same page navigation chec. let me know if there any changes are needed

@ShiboSoftwareDev
Copy link
Contributor

@Saurabhsing21

Screen.Recording.2025-01-25.123221.mp4

Copy link

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Jan 28, 2025
@Saurabhsing21
Copy link
Author

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

i am working on it

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

Successfully merging this pull request may close these issues.

implement a simple fancy loading page, for all navigation
4 participants