feat: automatically check and mark already solved questions#99
Open
Saarthak50 wants to merge 1 commit into
Open
feat: automatically check and mark already solved questions#99Saarthak50 wants to merge 1 commit into
Saarthak50 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a feature to dynamically identify and mark LeetCode questions that are already present in the user's linked GitHub repository. When visiting a problem page, the extension checks if the solution has already been pushed, and if so, styles the manual Push button as a green Pushed button.
How it works
README.md(taking user settings like language or difficulty folder structures into account)."two-sum", filename:two-sum, or filename:twosum). This allows the extension to find solutions even if they are named differently (likeTwoSum.java) or placed in custom paths.Key Changes
src/js/leetcode.jsLeetCodeV2.prototype.checkPushedStatus: Queries LeetCode GraphQL for question details, constructs the expected file path, checks if it exists in the GitHub repo, and falls back to a GitHub Code Search if it's not found in the default path.LeetCodeV2.prototype.getLanguage: Added fallback logic to retrieve the current language from the page's dropdown whensubmissionDatais null (on page load).LeetCodeV2.prototype.addManualSubmitButton: CallscheckPushedStatuson page load to style the button as green and labeled Pushed if the solution is found.LeetCodeV2.prototype.markUploaded: Transitions the manual push button state to Pushed and turns it green immediately upon a successful manual push.getGitIcon: Changed hardcoded SVG fill color from#100f0dtocurrentColorso the icon adapts to the button text color (turns green when pushed).src/js/welcome.jslinkRepo: Programmatically triggers theSync countsclick event upon linking an existing repository to automatically sync counts.Verification Done
npm run format).npx eslint src/js/leetcode.js src/js/welcome.js).TwoSum.java), verifying that both are recognized and styled as Pushed on page load.