-
Notifications
You must be signed in to change notification settings - Fork 30
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
Sort and Filter indicators for the Experiments Table #1760
Conversation
@wolmir great job! Just a few comments:
Please let me know if you need an example. Thank you ! |
8ea80ba
to
a8e2eb3
Compare
I have built a quick spec . Please see here and let me know if you have any comments. |
@wolmir no animation when toggling. Thank you ! |
a8e2eb3
to
d0f37af
Compare
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.
Agreed with @maxagin's comments, but even as it is this is a good improvement!
@wolmir good stuff, thanks! 🙏 |
Hey @wolmir, just wanted to share with you my arguments in relation to the initial comments, sorry I was in rush to share feedback before you push :) , so will do it now:
The main reason is that, when the symbol is on the right side (for right align content) it will push the text, which will create unwanted movement and the focus will be also on the text instead of just indicator, when the label is actually not changing.
The symbol ↑ is more compact and better describes the direction. Same time the caret icon arrow is typically meant to indicate that an accordion will open.
It is natural to have animation for the caret icon arrow and this is exactly what you have created! However for the direction arrow, spin animation won’t really work. The direction arrow can use linear animation instead. |
Thanks @maxagin ! |
bffb6b1
to
94f1411
Compare
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.
Thanks for doing this. I have left some feedback on the code. Definitely need to fix the on resize issue before we merge. Also need some. design feedback re: the icon not being visible.
webview/package.json
Outdated
@@ -24,6 +24,7 @@ | |||
"dependencies": { | |||
"@tippyjs/react": "^4.2.6", | |||
"@vscode/webview-ui-toolkit": "^1.0.0", | |||
"@vscode/codicons": "^0.0.30", |
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.
[C] We now have this as a dependency here and as a dev dependency in the root package.
const DEFAULT_COLUMN_WIDTH = 75 | ||
const MINIMUM_COLUMN_WIDTH = 50 | ||
const DEFAULT_COLUMN_WIDTH = 100 | ||
const MINIMUM_COLUMN_WIDTH = 90 |
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.
[I] There are a couple of issues here.
- The icon can still be hidden (not sure what to do about this cc @maxagin).
Screen.Recording.2022-05-31.at.8.54.34.am.mov
- On resize is causing the sort direction to change.
Screen.Recording.2022-05-31.at.8.52.01.am.mov
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.
For 1. That is one of the reasons that the old style was so effective.
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.
[Q] Can we revert to the previous style so that we can get this in?
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.
@mattseddon By previous style do you mean the top and bottom borders?
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.
Yes. More of a question for @maxagin & @shcheklein.
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.
Something like this @mattseddon @shcheklein
Screen.Recording.2022-06-02.at.18.46.07.mov
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.
@wolmir got it, I like it! :)
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.
the whole column header should clickable though, right, I don't have to click the ...
symbol?
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.
Yes, that's just for show
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.
className={cx( | ||
styles.sortIcon, | ||
`codicon codicon-${ | ||
sortOrder === SortOrder.ASCENDING ? 'arrow-up' : 'arrow-down' |
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.
[C] There is some history here. The first time we came to add icons, @rogermparent, @sroy3 and myself all added them at roughly the same time. We came up with three different implementations. Which we then standardised to the current SVGR model. From talking to @sroy3 I think we did this because we had custom SVGs that we wanted to add to the webview(s). As this may no longer be the case we may want to change the approach but we will need to reflect that single method throughout the webview code. Please raise an issue to discuss and we can talk about it in the retro at the end of the week.
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.
I created one here: #1802
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.
It could be a good thing to change it to classes later, it would be simpler to add new ones. Right now though, of all the "custom" icons, there is still the clock one that does not have its equivalent in codicons. Since the up and down arrows are already in the current implementation, changing this to use <Icon icon={sortOrder === SortOrder.ASCENDING ? AllIcons.UP_ARROW : AllIcons.DOWN_ARROW} />
should not be too complicated. We can review using the whole library later and use #1802 to decide what to do with the missing icon.
959c2f7
to
def7186
Compare
I see there was recently some code added for filter indicators. It's great that you're tackling this, but I think it would be best to keep it in a separate, even if chained, PR considering this one is big and active enough as is. |
e0fc931
to
c018383
Compare
export enum SortOrderLabel { | ||
ASCENDING = 'Sort Ascending', | ||
DESCENDING = 'Sort Descending', | ||
NONE = 'Remove Sort' |
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.
I think these could just go inside SortOrder
instead and that would be one less enum.
content={menuContent} | ||
disabled={menuDisabled || menuSuppressed} | ||
onShow={() => { | ||
return !column.isResizing |
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.
Does this really need to be in a function?
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.
No, It was left over from when I was trying to make the left-click sort work. I believe it's not needed anymore
{ | ||
hidden: !hasFilter, | ||
icon: AllIcons.LINES, | ||
onClick: () => {}, |
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.
Maybe we should set a property to have simple icons without actions. Currently there is a pointer cursor on the filter icon and it makes it seem as if clicking on it was going to do something and nothing happens.
type: MessageFromWebviewType.REMOVE_COLUMN_SORT | ||
} | ||
} | ||
]} |
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.
Should we always show all options? If there is currently no sort, do we need to show "Remove Sort"? Same for when sorted ascending or descending. It does look fine now, I'm just genuinely curious about whether or not it'd be better to remove or keep options.
I might be missing something, but nothing happens when I left-click a table header. left-click-sort-not-working-demo.mp4 |
Yes, that was scrapped for the moment. I'll update the PR title in a moment |
Code Climate has analyzed commit abeb4b8 and detected 3 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 93.1% (85% is the threshold). This pull request will bring the total coverage in the repository to 96.6% (0.0% change). View more on Code Climate. |
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.
Sorry for the confusion! As far as adding indicators, I think this PR definitely fits the bill. Anything I could point out has already been pointed out before, but with the refactor of unnecessary onClick handlers I think we've crossed the threshold of mergeable.
* Add arrow sort indicators and filter indicators to columns * Fix filters prop dependencies * fix tests * add filters to deeply nested storybook * refactor table head for complexity * fix dev server chaos * Fix PR change requests * Remove unnecessary click handlers * Fix test imports Co-authored-by: Matt Seddon <mattseddon@hotmail.com>
Solves (#1708)
This PR adds sorting and filtering indicators in the form of icons to the experiments table headers.
It also changes the direction of the ellipsis truncation to left-side only and reduces the font-size of the leaf headers.
Specs
Figma
Resulting
Screen.Recording.2022-05-24.at.11.20.51.mov