-
Notifications
You must be signed in to change notification settings - Fork 1.2k
QoL Resource tab with shortcuts #8115
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
|
Any chance you could link resource names and resource paths? I recently needed to rename a folder for organization and as a result needed to go through and change the file paths and the names of the resources individually to match those file paths.... And I don't see much of a purpose for them having different names than their paths which they default to. Nonetheless these changes you have planned would already had a huge layer of convenience to that so great work! |
|
|
||
| const resourcesManager = project.getResourcesManager(); | ||
| const allNames = resourcesManager.getAllResourceNames().toJSArray(); | ||
| const currentIndex = allNames.indexOf(resource.getName()); |
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.
Use GetResourcePosition. No need for allNames
| const currentIndex = allNames.indexOf(resource.getName()); | ||
|
|
||
| let nextResourceName = null; | ||
| if (allNames.length > 1) { |
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.
Ideally we would expose Count in Bindings.idl for ResourcesContainer
| resourcesActionsMenuBuilder | ||
| } | ||
| /> | ||
| <div |
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.
Do we really need this container? Could we have a "onKeyDown" on the ResourcesList?
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.
Actually, do we really want to have a onKeyDown here? Could that be the ResourcesList that calls a props when up/down is called?
| } | ||
|
|
||
| const nextResource = resourcesManager.getResource(allNames[nextIndex]); | ||
| if (nextResource !== selectedResource) { |
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.
Is this comparison useful?
|
|
||
| let nextIndex = 0; | ||
| if (selectedResource) { | ||
| const currentIndex = allNames.indexOf(selectedResource.getName()); |
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.
Same as the other, I think it would be worth exposing Count and using GetResourcePosition rather than everytime getting getAllResourceNames + calling to JSArray which creates useless copies of the list of names in memory.
|
|
||
| const keyboardShortcutsRef = React.useRef<KeyboardShortcuts>( | ||
| new KeyboardShortcuts({ | ||
| shortcutCallbacks: {}, |
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.
Add a comment explaining why you don't set onDelete and onRename here.
| ); | ||
| } | ||
|
|
||
| _onKeyDown = (event: KeyboardEvent) => { |
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.
As written in another comment, it could be the ResourcesList that take care of this. A good LLM model could probably find the best way to do it.
Add to the the resource list:
2.mp4