Add filetable context menu#301
Merged
Merged
Conversation
Still needs to do: - disable menus on some conditions - run actions - would be nice to have: highlight menu target (like in the finder) Note that we use the depreciated Menu from blueprint since Menu2 only has a declarative version. Also, we have to pass the appState to the component but that's not a good idea.
Added detection of ability to copy/paste: we had to add a new state to FileTable: rightClickFile which keeps track of the file that's under the mouse when a right click happens. The FileContextMenu now has access to MobX stores and is only rendered when the context menu is opened. Still need to do: - check when delete should be enabled - implement copy/paste/delete Streched goal: - add a new outline that indicates which elements the action will act on - update copy paste menu+context menu to include the number of elements (ie: "Paste 4 elements")
Also made appState.setClipboard to accept a list of files: will be used when hovering a non selected file & clicking on the copy menu.
Todo: also move alerts displayed after copying data to the clipboard into the clipboard state.
Tests was referencing un-used appState.caches property which was removed.
Also: moved copied to clipboard toast to Clipboard.setClipboard
The paste function was moved to the appState object because most file/batch related functions are stored in this object. Maybe we should move this elsewhere ? There is also a Batch state (which is defined in its own transfers dir ?!)... We should do some cleanup here!
Still need to do: - fix showDeleteConfirmDialog: Trans doesn't use the selected language, it sticks to English :/ - cleanup Toolbar.tsx: call appState.delete and remove unused code
Also added a check in appState.delete to return if there are no elements to delete: we wouldn't want to show a useless dialog in this case.
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.
This PR adds a new context menu on FileTable:
The menu is always displayed but each item is disabled if not possible (for example
pasteis disabled if there are no items in the clipboard).Rules:
Copy
Enabled if
files to be copied
Paste
Enabled if clipboard not empty and:
or
Delete
Enabled if
Files to be deleted:
Lots of refactoring was done:
appState.clipboardappStateand can be accessed by callingappState.deleteFixes #235