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

[ENG-6117] Add Filter for Orcid on Instutional Dashboard #2315

Conversation

Johnetordoff
Copy link
Collaborator

@Johnetordoff Johnetordoff commented Sep 9, 2024

  • Ticket: [https://openscience.atlassian.net/browse/ENG-6117]
  • Feature flag: n/a

Purpose

Add the ability to filter users by Orcid status, ensure filter works with sorting.

Summary of Changes

  • adds slider inputs to user institutional dashboard tab
  • adds component code to make Orcid filters work
  • adds template code for layout.

Screenshot(s)

Screenshot 2024-09-10 at 5 10 42 PM
Screenshot 2024-09-10 at 5 10 39 PM
Screenshot 2024-09-10 at 5 10 35 PM

Side Effects

QA Notes

@Johnetordoff Johnetordoff force-pushed the filter-orcid branch 14 times, most recently from 5bdd0e5 to affe0a4 Compare September 9, 2024 20:44
@Johnetordoff Johnetordoff marked this pull request as ready for review September 9, 2024 20:52
Copy link
Contributor

@futa-ikeda futa-ikeda left a comment

Choose a reason for hiding this comment

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

I have some concerns with the implementation of the toggle-slider right now. I'm hoping there's a slightly easier way to implement this, so will do a little bit of research to see if there's a potentially more accessible way to implement it.

I had another comment regarding the usage of sass color variables ($color-name) instead of hard-coded hex values in the css files.

Comment on lines 5 to 26
<div local-class='orcid-switch'>
<label for='switches-container' local-class='orcid-toggle-label'>{{t 'institutions.dashboard.users_list.has_orcid'}}</label>
<div local-class='switches-container'>
<input type='radio' id='switchOrcidNo' name='switchPlan' value='No' checked={{not this.hasOrcid}} {{on 'change' (fn this.toggleOrcidFilter false)}} />
<input type='radio' id='switchOrcidYes' name='switchPlan' value='Yes' checked={{this.hasOrcid}} {{on 'change' (fn this.toggleOrcidFilter true)}} />
<label for='switchOrcidNo'><span></span></label>
<label for='switchOrcidYes'><span></span></label>
<div local-class='switch-wrapper'>
<div local-class='switch'>
<div>
<button type='button' {{on 'click' (fn this.clickToggleOrcidFilter this.hasOrcid)}}>
<span></span>
</button>
</div>
<div>
<button type='button' {{on 'click' (fn this.clickToggleOrcidFilter this.hasOrcid)}}>
<span></span>
</button>
</div>
</div>
</div>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

I've got a some concerns with this implementation of the slider. My biggest concern with this right now is the usage of extra <button> elements overlayed on top of the <input> and <label> elements. It feels like we are forcing a type of behavior onto these inputs that may not be appropriate. Could we use a single <input type='checkbox'> instead of a combination of <input type='radio'> with <button>s on top? I think that would simplify the HTML and CSS greatly and make it more accessible

Comment on lines 107 to 110
--switches-bg-color: #d3d3d3; /* lightgrey */
--switches-label-color: #808080; /* grey */
--switch-bg-color: #808080; /* grey */
--switch-text-color: #d3d3d3; /* lightgrey */
Copy link
Contributor

Choose a reason for hiding this comment

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

For CSS colors, we typically try to use our predefined color variables (defined in app/styles/_variables.scss). This prevents us from having too many different "one-off" colors and also helps readability without having to leave comments in the CSS next to the color values (although I appreciate comments in CSS files, generally speaking!). So this could be re-written as something like:

Suggested change
--switches-bg-color: #d3d3d3; /* lightgrey */
--switches-label-color: #808080; /* grey */
--switch-bg-color: #808080; /* grey */
--switch-text-color: #d3d3d3; /* lightgrey */
--switches-bg-color: $color-bg-gray-light;
--switches-label-color: $color-bg-gray;
--switch-bg-color: $color-bg-gray;
--switch-text-color: $color-bg-gray-light;


/* Hide the radio buttons */
.switches-container input {
visibility: hidden;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little reluctant to use visibility: hidden; here, as it seems to make it un-tabbable, and that feels like a bit of an accessibility smell to me.

@Johnetordoff Johnetordoff force-pushed the filter-orcid branch 4 times, most recently from aef1660 to 8d3ddab Compare September 10, 2024 21:05
@@ -9,10 +9,6 @@ interface SortArrowArgs {

export default class SortArrow extends Component<SortArrowArgs> {

get sortBy() {
return this.args.sortBy || 'user_name';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought I'd just clean this up here in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, I think this is a good update. I did notice that in this component file, there's still some references to this deleted property, so instances of this.sortBy should be replaced with this.args.sortBy (line 17, 21)

Copy link
Contributor

@futa-ikeda futa-ikeda left a comment

Choose a reason for hiding this comment

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

We're close! Just a couple of small things

@@ -9,10 +9,6 @@ interface SortArrowArgs {

export default class SortArrow extends Component<SortArrowArgs> {

get sortBy() {
return this.args.sortBy || 'user_name';
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, I think this is a good update. I did notice that in this component file, there's still some references to this deleted property, so instances of this.sortBy should be replaced with this.args.sortBy (line 17, 21)

opacity: 0;
width: 0;
height: 0;
display: none;
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe doing display: none on an input will make it impossible to tab to, so I'd like to remove this property for accessibility sake.

transition: background-color 0.4s;
background-color: #ccc;
cursor: pointer;
position: relative;
Copy link
Contributor

Choose a reason for hiding this comment

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

If we remove display: none from the input as above, we'll have to likely change this to position: absolute and maybe remove display: flex so the slider goes over the input element

margin-left: 3px;
border-radius: 50%;
transition: transform 0.4s, background-color 0.4s;
position: relative;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will have to be position: absolute as well if the input is now shown

Comment on lines 7 to 9
<label for='switches-container' local-class='orcid-toggle-label'>{{t 'institutions.dashboard.users_list.has_orcid'}}</label>
<label local-class='switch'>
<input type='checkbox' checked={{this.hasOrcid}} {{on 'change' (fn this.toggleOrcidFilter (not this.hasOrcid))}}>
Copy link
Contributor

Choose a reason for hiding this comment

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

The input doesn't have a valid label right now, so you will have to add id='switches-container' to the <input> element to associate the "Has ORCID" label to this input

Copy link
Contributor

@futa-ikeda futa-ikeda left a comment

Choose a reason for hiding this comment

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

🌟

@futa-ikeda futa-ikeda merged commit f6311c4 into CenterForOpenScience:feature/insti-dash-improv Sep 11, 2024
9 checks passed
Johnetordoff pushed a commit to Johnetordoff/ember-osf-web that referenced this pull request Sep 11, 2024
…ForOpenScience/ember-osf-web into filter-dashboard

* 'feature/insti-dash-improv' of https://github.com/CenterForOpenScience/ember-osf-web:
  [ENG-6117] Add Filter for Orcid on Instutional Dashboard (CenterForOpenScience#2315)
  [ENG-6181] Update search mirage view (CenterForOpenScience#2318)

# Conflicts:
#	app/institutions/dashboard/-components/institutional-users-list/component.ts
#	app/institutions/dashboard/-components/institutional-users-list/styles.scss
#	app/institutions/dashboard/-components/institutional-users-list/template.hbs
@futa-ikeda futa-ikeda added this to the 24.09.0 milestone Nov 20, 2024
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