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

Improve the functionality of your script.js #1165

Open
jaebee2 opened this issue May 14, 2024 · 0 comments
Open

Improve the functionality of your script.js #1165

jaebee2 opened this issue May 14, 2024 · 0 comments

Comments

@jaebee2
Copy link

jaebee2 commented May 14, 2024

Random '_newtab' Identifier: When opening a link in a new tab (_blank), you're appending _newtab with a random number to ensure uniqueness. However, _newtab is constant and not intended to be unique. If you want to open links in new tabs with a unique identifier, consider generating a random string instead of _newtab.

Toggle Mode Icon Display: In the toggle event listener, you're setting the display of the clicked icon to "none" and the next one to "inline-block". This can lead to issues if there are more than two icons or if the class doesn't match the icon's actual class name. It's safer to toggle a class on the parent container instead of directly manipulating the display property of individual icons.

### Dark Mode Class Addition: When toggling dark mode, you're adding the class header-dark-mode to elements like .header, .nav-link, etc. However, you're not removing this class if dark mode is toggled off. This could lead to unexpected behavior if the same elements are styled differently based on the presence of this class.

Search Functionality: The search functionality for filtering contributors seems straightforward, but it could be improved for better user experience. For instance, it currently filters based on exact matches of contributor usernames. You might want to consider implementing a more robust search feature that allows partial matches or includes fuzzy search.

Error Handling: While you have error handling for the GitHub API call (getContributorsList), you're only logging the error to the console. Consider providing user feedback in case of API call failures, such as displaying a message on the UI.

Variable Naming: Some variable names could be more descriptive for better code readability. For example, toggle could be toggleModeButton, para could be paragraphs, pcol could be paragraphColumn, etc.

Overall, these points are more about potential improvements rather than critical bugs. Your script seems well-structured and functional!

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

No branches or pull requests

1 participant