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

Improve files table UX (fixes #121): #125

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

jpovixwm
Copy link
Contributor

  • Add visual indication to deselected directories with selected subrows
  • Automatically deselect directories whenever their children are deselected
  • Automatically select directories as soon as all of their children are selected
  • Change Ctrl-A behavior so that it only selects entries that match the entered search terms
  • Deselect entries that become hidden while using the search bar

Fair warning: this makes the issue with not being able to perform the context menu actions "Open" and "Open folder", when multiple entries are selected, just a tiny bit worse for single-file directories, because when you right click the file, the directory gets automatically selected.
When it comes to my opinion on how to fix that, I think it'd be OK to make these context menu entries apply only to the row that was actually right-clicked.

@jpovixwm
Copy link
Contributor Author

Uh oh, looks like the "Open" and "Open folder" actions are broken for single-file torrents too. I'll investigate tomorrow.

- Add visual indication to deselected directories with selected subrows
- Automatically deselect directories whenever their children are
  deselected
- Automatically select directories as soon as all of their children are
  selected
- Change Ctrl-A behavior so that it only selects entries that match the
  entered search terms
- Deselect entries that become hidden while using the search bar
Copy link
Member

@qu1ck qu1ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality looks good to me, just have one question inline.

I'm not happy with the css but a few things I tried didn't work well either. Let's merge for functionality and I'll experiment with the colors and shadows later.

@@ -183,26 +188,49 @@ function useSelected(props: FileTreeTableProps) {
return next;
}, []);

const deriveNewSelection = useRef((_: boolean) => [] as string[]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this have to be a ref and not a simple callback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I make it a callback, there's this small quirk:
TrguiNG_GtX8lSe7qx
I.e. after performing an action on a directory while some of its children are filtered out, the directory becomes deselected. (because the callback is changing in this case, and eslint requires us to include the callback in useEffect's dependency array).
If it's a ref, like in the PR, this issue doesn't occur:
TrguiNG_ihIvTn8U7F

@qu1ck qu1ck merged commit 666f7ef into openscopeproject:master Dec 19, 2023
3 checks passed
@qu1ck
Copy link
Member

qu1ck commented Dec 19, 2023

Thanks for the fix.

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.

2 participants