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 styles of filtering options for Clippy's lint list #8070

Merged
merged 10 commits into from
Mar 10, 2022

Conversation

CrazyRoka
Copy link
Contributor

@CrazyRoka CrazyRoka commented Dec 3, 2021

Partially solves #7958

Updated styles for filtering options. It now uses dropdown menus.

image

changelog: none

@rust-highfive
Copy link

r? @camsteffen

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 3, 2021
@camsteffen
Copy link
Contributor

camsteffen commented Dec 3, 2021

The dropdowns look really nice! I think there should be some sort of always-visible indicator of what is selected. Possibly just the number of selected items, or maybe even just a different style to indicate that the default selection has been changed. My main concern being that it's easy to forget that you are not looking at a complete list.

@CrazyRoka
Copy link
Contributor Author

I added badges to display selected items count. Have a look:

image

@camsteffen
Copy link
Contributor

Nice. I think the badge could be the same color as the lint category badges. Also can we see what it looks like on the right side of the button?

@CrazyRoka
Copy link
Contributor Author

I updated the code. Have a look:

  • Badge color is now #777
  • Badge is now located at the right side

image

@xFrednet
Copy link
Member

xFrednet commented Dec 5, 2021

Also, a +1 from me for the dropdown menus, they look really nice 👍

The website also supports the different color themes from mdBook. The change theme button is in the upper-left corner. Can you make sure that your changes also support the change of color? You can find the available css values here: https://github.com/rust-lang/mdBook/blob/master/src/theme/css/variables.css

@CrazyRoka
Copy link
Contributor Author

@xFrednet @camsteffen Have a look on this video:

ClippyLints.mp4

@xFrednet
Copy link
Member

xFrednet commented Dec 5, 2021

I really like it, nice work! 👍

Also cc: @flip1995 since you've suggested this tabbed filter layout. 🙃

@camsteffen
Copy link
Contributor

I am seeing JavaScript errors upon selecting options.

The button style seems to change from selected to deselected after clicking one of the options. Maybe this could be fixed with a CSS rule? If not it's probably fine.

@CrazyRoka
Copy link
Contributor Author

I am seeing JavaScript errors upon selecting options.

I could see the error in Firefox browser, but not in Chrome. Replaced invalid code with correct one.

The button style seems to change from selected to deselected after clicking one of the options. Maybe this could be fixed with a CSS rule? If not it's probably fine.

There was a style from bootstrap. I replaced it with custom one. Now selected drop-down should be slightly darker than others.

@camsteffen
Copy link
Contributor

I think it would be wise to use the Bootstrap dropdown js plugin (link), especially since we're already using Bootstrap CSS. This would be an added dependency though.

@rust-lang/clippy Everyone good with the general direction here?

@flip1995
Copy link
Member

flip1995 commented Dec 6, 2021

I like the general approach and how the drop down menus look. I don't know anything about JS / CSS, so I can't really review or give opinions on that front.

Only concern is, if it works and how it looks on mobile.

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

Selecting "All" has a small lag. This was especially noticeable on mobile.

Here's a link to a deployed version of this branch (rebased on current master): https://flip1995.github.io/rust-clippy/master/index.html

One issue I found on mobile is, that the color scheme drop down is behind the other drop downs. Otherwise it LGTM on mobile as well.
Screenshot_20211206-182635

util/gh-pages/index.html Outdated Show resolved Hide resolved
@camsteffen
Copy link
Contributor

The "Filter" field could be on the same line and wrap responsively.

@CrazyRoka
Copy link
Contributor Author

Selecting "All" has a small lag. This was especially noticeable on mobile.

I can see small lag on my modern laptop. Looks like selecting "All" will render all the lints at once and it causes Angular to take time building the DOM and parsing html:

image

We can add pagination to prevent this

@CrazyRoka
Copy link
Contributor Author

The "Filter" field could be on the same line and wrap responsively.

Implemented this one.

One issue I found on mobile is, that the color scheme drop down is behind the other drop downs.

Fixed this one

I think it would be wise to use the Bootstrap dropdown js plugin (link), especially since we're already using Bootstrap CSS. This would be an added dependency though.

Does it support multi-select? As you can see, current dropdown supports selecting multiple entries. Also, it doesn't close dropdown, so user can select multiple items and close it by clicking on the button or somewhere in the page.

@camsteffen
Copy link
Contributor

Another thing we could do about the lag is make the lint panel expanded contents render lazily with something like ngIf="expanded". That could be a standalone enhancement.

Does it support multi-select? As you can see, current dropdown supports selecting multiple entries. Also, it doesn't close dropdown, so user can select multiple items and close it by clicking on the button or somewhere in the page.

I'm only judging by the docs, but I think the dropdown plugin is pretty unopinionated - you can put any HTML in the dropdown menu and you can close it programmatically like you currently are (but I would try out the default behavior first).

@flip1995
Copy link
Member

flip1995 commented Dec 7, 2021

Redeployed: https://flip1995.github.io/rust-clippy/master/index.html

Another thing I noticed on mobile (tangentially related to this PR): The "Fork me on GitHub" banner in the top right corner slightly overlaps with the Lint groups dropdown. So when you try to open the dropdown by pressing on the error it redirects you to the Clippy GH repo, instead of opening the dropdown.

@CrazyRoka
Copy link
Contributor Author

Another thing I noticed on mobile (tangentially related to this PR): The "Fork me on GitHub" banner in the top right corner slightly overlaps with the Lint groups dropdown. So when you try to open the dropdown by pressing on the error it redirects you to the Clippy GH repo, instead of opening the dropdown.

Fixed this issue with clip-path property. So, clickable area would look like this:

image

@CrazyRoka
Copy link
Contributor Author

Another thing we could do about the lag is make the lint panel expanded contents render lazily with something like ngIf="expanded". That could be a standalone enhancement.

Performance was improved. As you can see, Browser computation is now taking the most time after click:
image

@CrazyRoka
Copy link
Contributor Author

@flip1995 @camsteffen @xFrednet I went through all the reviews, and it looks like all the issues are resolved. Let me know if I missed something.
I haven't used the dropdown plugin, so. The reason is that I implemented this with raw ng-click, but this plugin will require me to rewrite it in jquery and add additional code to the rendered HTML.
@camsteffen If you strongly suggest using the plugin instead, I will add it.

@camsteffen
Copy link
Contributor

Oh I didn't realize it requires jQuery. That's fine then. I hate jQuery lol. I still need to do a full review but I feel confident about this PR overall.

util/gh-pages/index.html Outdated Show resolved Hide resolved
@xFrednet
Copy link
Member

xFrednet commented Dec 8, 2021

The performance increase while searching is wonderful. I really like the changes!

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

This looks really good now. I love the perf improvement. Thank you for addressing all of our reviews so quickly!

Before this can be merged, please rebase your commits, in order to get rid of the merge commit.

@CrazyRoka CrazyRoka force-pushed the update-gh-pages-checkbox-styles branch from 0a54144 to 2eaa17e Compare December 9, 2021 11:51
@CrazyRoka
Copy link
Contributor Author

This looks really good now. I love the perf improvement. Thank you for addressing all of our reviews so quickly!

Before this can be merged, please rebase your commits, in order to get rid of the merge commit.

I rebased my commits and added one new change:

  • Theme menu now should be closed when interacting with the page
  • Dropdowns are now implemented with directives (less code, more maintainability)
  • Removed raw js handler for theme menu

Copy link
Contributor

@camsteffen camsteffen left a comment

Choose a reason for hiding this comment

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

How about aligning the text and checkboxes like this?

image

Feel free to clean up the commit history a bit as well.

util/gh-pages/index.html Outdated Show resolved Hide resolved
util/gh-pages/index.html Outdated Show resolved Hide resolved
util/gh-pages/index.html Show resolved Hide resolved
util/gh-pages/index.html Outdated Show resolved Hide resolved
color: var(--searchbar-fg);
border-color: var(--theme-popup-border);
filter: brightness(90%);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Bootstrap theming is normally done by downloading bootstrap-theme.css and modifying the values. We don't need an entire theme, but I think we should copy parts of that code, and add a comment saying as much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These variables are coming from rust mdBook styles. Which code do you mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can get bootstrap-theme.css from the "Download Bootstrap" link here.

From there you can copy and modify the following CSS rule, for example. Ideally all theming can be done this way.

  /* Bootstrap Theme - rules copied from bootstrap-theme.css with modified values */

  .btn-default:active,
  .btn-default.active {
-    background-color: #e0e0e0;
-    border-color: #dbdbdb;
+    background-color: var(--searchbar-bg);
+    border-color: var(--theme-popup-border);
  }

@CrazyRoka CrazyRoka force-pushed the update-gh-pages-checkbox-styles branch from 5e42d1e to 296af08 Compare December 16, 2021 17:01
@CrazyRoka
Copy link
Contributor Author

@camsteffen I reviewed your suggestions and applied them. One comment is still under review, have a look. Let me know if you have any other concerns.

@camsteffen camsteffen added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Dec 27, 2021
@camsteffen
Copy link
Contributor

@CrazyRoka just checking in. There's still one open thread. But honestly it's not super important and we can just wrap this up if you prefer.

@xFrednet
Copy link
Member

xFrednet commented Mar 9, 2022

Hey @camsteffen, do we want to merge it, since @CrazyRoka hasn't replied yet? I like these changes and would like to have them merged before they conflict with new changes 🙃

@camsteffen
Copy link
Contributor

Okay. @bors r+

@bors
Copy link
Collaborator

bors commented Mar 10, 2022

📌 Commit 296af08 has been approved by camsteffen

@bors
Copy link
Collaborator

bors commented Mar 10, 2022

⌛ Testing commit 296af08 with merge b4cfdcd...

bors added a commit that referenced this pull request Mar 10, 2022
…msteffen

Improve styles of filtering options for Clippy's lint list

Particularly solves #7958

Updated styles for filtering options. It now uses dropdown menus.

![image](https://user-images.githubusercontent.com/19844144/144608479-cdd9de0b-f101-4d49-a135-0969efb01a11.png)
@bors
Copy link
Collaborator

bors commented Mar 10, 2022

💔 Test failed - checks-action_test

@camsteffen
Copy link
Contributor

@bors retry

@bors
Copy link
Collaborator

bors commented Mar 10, 2022

⌛ Testing commit 296af08 with merge 8ae74da...

@bors
Copy link
Collaborator

bors commented Mar 10, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: camsteffen
Pushing 8ae74da to master...

@bors bors merged commit 8ae74da into rust-lang:master Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants