-
Notifications
You must be signed in to change notification settings - Fork 0
Sweep: Add keyboard binding to add current repo, open modal, and clear all data (β Sandbox Passed) #28
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
base: master
Are you sure you want to change the base?
Conversation
Rollback Files For Sweep
This is an automated message generated by Sweep AI. |
Apply Sweep Rules to your PR?
This is an automated message generated by Sweep AI. |
| useEffect(() => { | ||
| const handleKeyPress = async (event) => { | ||
| if (event.key === 'a') { | ||
| const { owner, repo } = await GetOwnerRepoName() | ||
| if (owner && repo) { | ||
| const isItemInList = repoList.some( | ||
| (item) => item.owner === owner && item.repo === repo | ||
| ) | ||
| if (!isItemInList) { | ||
| setRepoList(prevRepoList => [...prevRepoList, {owner, repo}]) | ||
| } | ||
| } | ||
| } else if (event.key === 'c') { | ||
| setRepoList([]) | ||
| } | ||
| } | ||
| window.addEventListener('keydown', handleKeyPress) | ||
| return () => window.removeEventListener('keydown', handleKeyPress) | ||
| }, [repoList]) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweep: Move this logic to src/contents/modal/index.tsx, where we handle the keydown event 'o'. They should be similar. Thanks!
|
Sweep: Please Move the logic handling the keyboard event 'a' and 'c' in src/popup/index.tsx to src/contents/modal/index.tsx where we handle the keydown event 'o'. They should be similar. Thanks |
PR Feedback: π
Description
This pull request adds keyboard bindings to the modal and popup components in order to perform certain actions. It also includes some code cleanup and organization.
Summary
useEffecthook to listen for the 'o' key press in thePlasmoOverlaycomponent insrc/contents/modal/index.tsxhandleKeyPressfunction to open the modal when the 'o' key is presseduseEffecthook to listen for the 'a' and 'c' key presses in theIndexPopupcomponent insrc/popup/index.tsxhandleKeyPressfunction to add the current repository to the list when the 'a' key is pressed, and to clear the list when the 'c' key is pressedGetOwnerRepoNamefunction fromsrc/service/index.tsinsrc/popup/index.tsxFixes #27.
π Latest improvements to Sweep:
π‘ To get Sweep to edit this pull request, you can: