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

Adds ability to create a project above currently selected one via shift+p #240

Merged
merged 5 commits into from
Feb 20, 2023

Conversation

kory-smith
Copy link
Contributor

Been a while! I'm finally ready to start actually contributing to this extension. Been a long time coming. I have a lot of plans, but first, I'll just implement something I've wanted to a while: the ability to create a new project with a shortcut.

@kory-smith kory-smith marked this pull request as draft February 18, 2023 20:11
@kory-smith kory-smith marked this pull request as ready for review February 18, 2023 20:52
@mgsloan mgsloan merged commit ae8435d into mgsloan:master Feb 20, 2023
@mgsloan
Copy link
Owner

mgsloan commented Feb 20, 2023

Awesome, thank you!!

mgsloan added a commit that referenced this pull request Feb 20, 2023
The goal is to always avoid incorrect clicks while also adapting to
many DOM changes.

* Uses project ID from the current browser url instead of matching by
name (handles case where projects have the same name).

* No use of 'first' matching element

* Asserts that number of buttons is 1 or 2

* Uses SVG path matching instead of assuming order of menu items
@mgsloan
Copy link
Owner

mgsloan commented Feb 20, 2023

I've made some changes for robustness. I know it looks like a rewrite, but your addition was very helpful

@mgsloan
Copy link
Owner

mgsloan commented Feb 20, 2023

I've also changed the binding to alt+p, and added alt+shift+p for adding project above. I'd have preferred to make this ctrl+p, but unfortunately there is no way to disable the browser print action.

The reason for this change is in analogy to o (add task below) vs shift-o (add task above)

@kory-smith
Copy link
Contributor Author

Thank you for the enhancements! I probably should have said this earlier, but my master plan was to suggest changing the current sort behavior to free up some keybindings.

I'd love it if s opened the sort menu and made hints just like the g does. Here's a mockup of how it would look:
image

Then, p and shift+p would be free for project above and project below. That's actually why I went with shift+p to add a project above in the first place.

I'd also like to add a few more keybindings for working with projects (like one to delete a project, one to archive a project, etc). And I'm probably also going to try my hand at a more robust options page.

@mgsloan
Copy link
Owner

mgsloan commented Feb 26, 2023

That makes sense! I released version 175 with this, but then upon checking it looks like my approach already broke when it comes to selecting the menu item, not sure what is up with that.

However! I noticed that the menu item is focused with a box around it. Turns out that pressing enter with the menu open will also open the 'add project above', and tab changes which item is selected. So, I think it's more versatile to just support opening the menu. I also added w for opening the top right "more actions" menu. Those changes were released in version 176

I do really like your idea for the changes to sorting.

mgsloan added a commit that referenced this pull request Feb 26, 2023
@kory-smith
Copy link
Contributor Author

kory-smith commented Mar 2, 2023

That makes sense! I released version 175 with this, but then upon checking it looks like my approach already broke when it comes to selecting the menu item, not sure what is up with that.

I just looked into this, and I think it's happening because in this line, selectUnique throws an error because it can't find an a tag (which I know you expect).

However! I noticed that the menu item is focused with a box around it. Turns out that pressing enter with the menu open will also open the 'add project above', and tab changes which item is selected. So, I think it's more versatile to just support opening the menu. I also added w for opening the top right "more actions" menu. Those changes were released in version 176

I do really like your idea for the changes to sorting.

It sounds like you aren't interested in actually clicking the button with p or alt+p, but I also found that your ADD_ABOVE_SVG_PATH is different from mine. Mine is M9 6.74L6.35 9.4a.5.5 0 01-.7-.7l3.53-3.54a.5.5 0 01.7 0l3.55 3.53a.5.5 0 01-.71.7L10 6.69V18.5a.5.5 0 11-1 0V6.74zM17 15h2.5a.5.5 0 110 1H17v2.5a.5.5 0 11-1 0V16h-2.5a.5.5 0 110-1H16v-2.5a.5.5 0 111 0V15z. No clue what accounts for the difference, but I wanted to let you know. I personally would really like the button to be clicked, but that might just have to be a setting or something I hard-code into my own instance of the extension.

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.

None yet

2 participants