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

Updating equation which defines when to fetch while scrolling #99

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

HASH-0021
Copy link

Reason: Fetching is not working when the scrollbar has reached the end. I can't pinpoint the exact issue but this is caused by window.pageYOffset being little less than the actual length.

Detailed explanation: I found the issue in "Archives" tab and was using Opera desktop browser when I found this issue. When I scrolled to the end of the document, the document isn't fetching more solutions which is supposed to be the intended behavior by the looks of useInfiniteScroll implementation. Even though the same issue isn't replicated in Chrome, this isn't browser issue as I found out "Solutions" tab also has the same issue in both browsers. Maybe the issue is related to device dimensions.

Solution: Math.ceil fixes this issue at the cost of fetching solutions 1px earlier which shouldn't be an issue. Maybe there is a better way to fix this issue. Math.round doesn't work for "Solutions" tab as the window.pageYOffset value is less than actual_length-0.5px and this implementation rounds to a lower value.

Sidenote: This is regarding repository. There are quite a few dependency conflicts while I was installing the dependencies. I tried with npm and yarn separately, both got few conflicts, so I don't think that is the issue. I have to make few changes to dependency versions and the actual code to make the webapp running. I am not pushing those changes here as they might not be the correct way to make this app running and might even break the app. Please let me know if I am doing something wrong or update app to the latest versions.

@HASH-0021
Copy link
Author

Added new subpage "My Submissions", which as the name suggests displays all of the user's submissions. If the user is not logged in, then the login screen is displayed instead.

Idea: Users can only view archived solutions and current year's solutions. They have very little overview of their submissions.

Details:

  • Created new MySubmissions component which serves the "My Submissions" subpage.
  • Updated routes in "App.js" and "siteConfig.js" files.
  • Added LoginCard, ProfileCard and MiniCard child components to support the MySubmissions component.
  • Updated "sorts.js" file with a new function sortByDay to support the MySubmissions component.

Notes:

  • Need to add "/my-submissions" endpoint in the backend.
  • Need to test functionality of login. I couldn't check this because after login the webpage is redirected to actual website rather than the development endpoint. Instead I tested this subpage using hardcoded userInfo. Maybe there is a way to get this functionality working which I am unaware of. Please let me know if there is.
  • Need to update APIs to have consistency of datatypes. Even though most of it is handled in the code, webpage can break because of any unhandled datatype, even for existing code.
  • Most likely, userid in the API's objects are wrong. As the user ids are above 15 digits, JavaScript is not accurate in storing the numbers. BigInt should be used instead. This difference can be observed from userid in the object and "user id" from avatarUrl in the object.
  • Also, Discord has new policy, the new feature requires users to have a unique usernames. Though the old username with discriminator exists, but "ZTM AoC" web application takes the new username and keeps discriminator to 0. This can be left as it is now, but updating to new standard will remove any mismatch regarding a user and maybe not break the application.

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.

1 participant