Skip to content

Conversation

@sweep-ai-deprecated
Copy link
Contributor

@sweep-ai-deprecated sweep-ai-deprecated bot commented Feb 2, 2024

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

  • Added useEffect hook to listen for the 'o' key press in the PlasmoOverlay component in src/contents/modal/index.tsx
  • Added handleKeyPress function to open the modal when the 'o' key is pressed
  • Added useEffect hook to listen for the 'a' and 'c' key presses in the IndexPopup component in src/popup/index.tsx
  • Added handleKeyPress function to add the current repository to the list when the 'a' key is pressed, and to clear the list when the 'c' key is pressed
  • Imported GetOwnerRepoName function from src/service/index.ts in src/popup/index.tsx
  • Added check to ensure that the current repository is not already in the list before adding it
  • Cleaned up unused imports and variables in both components

Fixes #27.


πŸŽ‰ Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

πŸ’‘ To get Sweep to edit this pull request, you can:

  • Comment below, and Sweep can edit the entire PR
  • Comment on a file, Sweep will only modify the commented file
  • Edit the original issue to get Sweep to recreate the PR from scratch

@sweep-ai-deprecated
Copy link
Contributor Author

Rollback Files For Sweep

  • Rollback changes to src/contents/modal/index.tsx
  • Rollback changes to src/popup/index.tsx

This is an automated message generated by Sweep AI.

@sweep-ai-deprecated
Copy link
Contributor Author

Apply Sweep Rules to your PR?

  • Apply: Refactor large functions to be more modular.
  • Apply: Add docstrings to all functions and file headers.

This is an automated message generated by Sweep AI.

Comment on lines +91 to +110
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])

Copy link
Owner

@wxharry wxharry Feb 2, 2024

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!

@wxharry
Copy link
Owner

wxharry commented Feb 2, 2024

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

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sweep: Add keyboard binding to add current repo, open modal, and clear all data

2 participants