UI tidbits #136

Merged
yrammos merged 6 commits from ui-tidbits into master 2020-06-17 05:08:21 +02:00
yrammos commented 2020-06-14 23:33:52 +02:00 (Migrated from github.com)

This is a PR in 5 thematic commits:

Navbar improvements

  • To avoid duplication and clutter, the Add User button remains invisible until at least one user has been stored in the session.
  • Navbars display the username and icon of the active user; the fa-user icon is used as placeholder if the user has not uploaded a picture.
  • The above functionality is made reasonably responsive on small screens, with ellipses truncating the username whenever space is constrained.

Account selector improvements (Login => Manage logged-in users)

  • Radio buttons are eliminated and replaced with a clickable "table" (in fact it's still a series of <input>s).
  • Profile photos (or placeholders) are displayed alongside the full names.
  • All bottom-row buttons are eliminated because they duplicate functions already on the screen ("New Account), or they do not work ("Grants"), or they make the workflow too labyrinthine for the user (IMO). The new screen is dedicated to a single function—fast user switching without mental friction (having to switch accounts is usually confusing and surprising enough in itself).

Login improvements

  • An enlarged fa-user placeholder is used in the absence of an uploaded profile picture.
  • Grant-related messages and buttons are replaced with a "no grants available" message if that is indeed the case.

Cosmetic tweaks (subjective)

  • Login page content is centered for readability on small screens and quick identification of the most pertinent content ("Continue", "Log out").
  • Buttons are colored to reflect their meaning and importance.
  • Small things here and there.
This is a PR in 5 thematic commits: #### Navbar improvements - To avoid duplication and clutter, the Add User button remains invisible until at least one user has been stored in the session. - Navbars display the username and icon of the active user; the `fa-user` icon is used as placeholder if the user has not uploaded a picture. - The above functionality is made reasonably responsive on small screens, with ellipses truncating the username whenever space is constrained. #### Account selector improvements (Login => Manage logged-in users) - Radio buttons are eliminated and replaced with a clickable "table" (in fact it's still a series of `<input>`s). - Profile photos (or placeholders) are displayed alongside the full names. - All bottom-row buttons are eliminated because they duplicate functions already on the screen ("New Account), or they do not work ("Grants"), or they make the workflow too labyrinthine for the user (IMO). The new screen is dedicated to a single function—fast user switching without mental friction (having to switch accounts is usually confusing and surprising enough in itself). #### Login improvements - An enlarged `fa-user` placeholder is used in the absence of an uploaded profile picture. - Grant-related messages and buttons are replaced with a "no grants available" message if that is indeed the case. #### Cosmetic tweaks (subjective) - Login page content is centered for readability on small screens and quick identification of the most pertinent content ("Continue", "Log out"). - Buttons are colored to reflect their meaning and importance. - Small things here and there.
babelouest (Migrated from github.com) reviewed 2020-06-15 02:13:05 +02:00
@ -42,6 +42,7 @@
"error-value-expected": "Waarde vereist",
"grant-title": "{{- client}} vraagt de volgende toegangsrechten",
"grant": "Toegang toestaan",
"grant-none-available": "No grants have been requested",
babelouest (Migrated from github.com) commented 2020-06-15 02:13:05 +02:00

No need to include this one in the Dutch translation, if a i18n isn't found in the selected language, the fallback language (i.e. english) will be used

No need to include this one in the Dutch translation, if a i18n isn't found in the selected language, the fallback language (i.e. english) will be used
babelouest (Migrated from github.com) reviewed 2020-06-15 02:22:52 +02:00
babelouest (Migrated from github.com) left a comment

My review is only technical, because I love the result! Thanks again for the grateful help!

My review is only technical, because I love the result! Thanks again for the grateful help!
@ -42,6 +42,7 @@
"error-value-expected": "Value required",
"grant-title": "{{- client}} requires access to the following scopes",
"grant": "Grant access",
"grant-none-available": "No grants have been requested",
babelouest (Migrated from github.com) commented 2020-06-15 02:18:04 +02:00

I'd say No requested scope is available instead.
Unless I'm wrong from the beginning, I use the word 'scope' for the resource requested and the word 'grant' as the authorization a user has granted a client with one or more scopes. Do you agree?

I'd say `No requested scope is available` instead. Unless I'm wrong from the beginning, I use the word 'scope' for the resource requested and the word 'grant' as the authorization a user has granted a client with one or more scopes. Do you agree?
@ -89,10 +89,20 @@ class GrantScope extends Component {
infoSomeScopeUnavailable = <div className="alert alert-info" role="alert">{i18next.t("login.info-some-scope-unavailable")}</div>
}
return (
(!Array.isArray(this.state.scope) || this.state.scope.length < 1)
babelouest (Migrated from github.com) commented 2020-06-15 02:20:21 +02:00

I think Array.isArray is overkill, this.state.scope is always supposed to be an array, even an empty one.

Also, using a one-liner makes it more difficult to read than a simple if

I think `Array.isArray` is overkill, `this.state.scope` is always supposed to be an array, even an empty one. Also, using a one-liner makes it more difficult to read than a simple `if`
babelouest (Migrated from github.com) commented 2020-06-15 02:21:33 +02:00

As mentionned in React doc, style in react should be avoided, I'd use css instead

As mentionned in [React doc](https://en.reactjs.org/docs/dom-elements.html#style), `style` in react should be avoided, I'd use css instead
babelouest commented 2020-06-15 02:24:11 +02:00 (Migrated from github.com)

Wow, that's the kind of pull request I love, thanks a lot @yrammos !

I'll make some technical changes but I won't change a bit of the result.

Wow, that's the kind of pull request I love, thanks a lot @yrammos ! I'll make some technical changes but I won't change a bit of the result.
babelouest (Migrated from github.com) reviewed 2020-06-15 03:01:49 +02:00
babelouest (Migrated from github.com) commented 2020-06-15 03:01:49 +02:00

I was also wondering if having a green button and a red button right next to each other is a good idea, the contrast is very high.

I tried using other bootstrap classes or separating the buttons but I wouldn't say it's better.
Capture d’écran du 2020-06-14 20-53-09
I'll try it for a few and I'll probably get used to it. :-)

I was also wondering if having a green button and a red button right next to each other is a good idea, the contrast is very high. I tried using other bootstrap classes or separating the buttons but I wouldn't say it's better. ![Capture d’écran du 2020-06-14 20-53-09](https://user-images.githubusercontent.com/3966617/84608589-26038300-ae81-11ea-8ba0-afc378cc6507.png) I'll try it for a few and I'll probably get used to it. :-)
babelouest (Migrated from github.com) reviewed 2020-06-15 03:08:06 +02:00
@ -1,4 +1,4 @@
import React, { Component } from 'react';
import React, { Component, useState, useEffect } from 'react';
import i18next from 'i18next';
babelouest (Migrated from github.com) commented 2020-06-15 03:07:45 +02:00

It looks like useState and useEffect are not used in the component, we should remove them from the import I guess

It looks like `useState` and `useEffect` are not used in the component, we should remove them from the import I guess
yrammos (Migrated from github.com) reviewed 2020-06-15 10:32:08 +02:00
@ -42,6 +42,7 @@
"error-value-expected": "Waarde vereist",
"grant-title": "{{- client}} vraagt de volgende toegangsrechten",
"grant": "Toegang toestaan",
"grant-none-available": "No grants have been requested",
yrammos (Migrated from github.com) commented 2020-06-15 10:32:08 +02:00

@babelouest while the line is technically redundant, I inserted it as a trigger for Dutch-speaking contributors to fill-in the missing translation. Your call entirely, of course...

@babelouest while the line is technically redundant, I inserted it as a trigger for Dutch-speaking contributors to fill-in the missing translation. Your call entirely, of course...
yrammos (Migrated from github.com) reviewed 2020-06-15 10:37:41 +02:00
@ -42,6 +42,7 @@
"error-value-expected": "Value required",
"grant-title": "{{- client}} requires access to the following scopes",
"grant": "Grant access",
"grant-none-available": "No grants have been requested",
yrammos (Migrated from github.com) commented 2020-06-15 10:37:41 +02:00

Hmm… I'm following you; my only concern with your proposal is it might give the impression of a server-side technical problem, as if some scope (or resource) as such did not exist. Is this indeed the intended message? My understanding is rather that the resource may well exist but the user has no permissions to access it. I might be entirely wrong, though.

Hmm… I'm following you; my only concern with your proposal is it might give the impression of a server-side technical problem, as if some scope (or resource) as such did not exist. Is this indeed the intended message? My understanding is rather that the resource may well exist but the user has no permissions to access it. I might be entirely wrong, though.
yrammos (Migrated from github.com) reviewed 2020-06-15 10:41:20 +02:00
@ -89,10 +89,20 @@ class GrantScope extends Component {
infoSomeScopeUnavailable = <div className="alert alert-info" role="alert">{i18next.t("login.info-some-scope-unavailable")}</div>
}
return (
(!Array.isArray(this.state.scope) || this.state.scope.length < 1)
yrammos (Migrated from github.com) commented 2020-06-15 10:41:20 +02:00

You know, I vaguely remember having a simple if (this.state.scope === []) conditional there but it would never be satisfied. I was working under time pressure, though, so I might be wrong. I'd just suggest that you test if you replace with a simpler statement.

As for tertiary conditionals, I confess I have a penchant for them. Sorry… :)

You know, I vaguely remember having a simple `if (this.state.scope === [])` conditional there but it would never be satisfied. I was working under time pressure, though, so I might be wrong. I'd just suggest that you test if you replace with a simpler statement. As for tertiary conditionals, I confess I have a penchant for them. Sorry… :)
yrammos (Migrated from github.com) reviewed 2020-06-15 10:43:16 +02:00
yrammos (Migrated from github.com) commented 2020-06-15 10:43:15 +02:00

Well it should be avoided everywhere. Sorry about that… Bad habit from childhood.

Well it should be avoided everywhere. Sorry about that… Bad habit from childhood.
yrammos (Migrated from github.com) reviewed 2020-06-15 10:45:26 +02:00
yrammos (Migrated from github.com) commented 2020-06-15 10:45:26 +02:00

I tried the "warning" style (orange) for logout but it seemed unconvincing. Custom button colors are always a possibility, of course. Thanks for adding padding between the two buttons, as I see in your screenshot.

I tried the "warning" style (orange) for logout but it seemed unconvincing. Custom button colors are always a possibility, of course. Thanks for adding padding between the two buttons, as I see in your screenshot.
yrammos (Migrated from github.com) reviewed 2020-06-15 10:47:34 +02:00
@ -1,4 +1,4 @@
import React, { Component } from 'react';
import React, { Component, useState, useEffect } from 'react';
import i18next from 'i18next';
yrammos (Migrated from github.com) commented 2020-06-15 10:47:34 +02:00

Apologies — these are leftovers from an abandoned experiment regarding window resize events. They may be safely removed.

Apologies — these are leftovers from an abandoned experiment regarding window resize events. They may be safely removed.
yrammos (Migrated from github.com) reviewed 2020-06-15 10:52:08 +02:00
yrammos (Migrated from github.com) commented 2020-06-15 10:52:08 +02:00

(By the way, it is always possible to use the btn-secondary (gray) class for the "Logout" button, as well. Its privileged position next to "Continue" might bring it out just enough—but not too much. I don't have a strong opinion about this. I'd never wear a green t-shirt with red trousers—or anything with red trousers—but with buttons on a very temporary webpage I can find the contrast pleasing.)

(By the way, it is always possible to use the `btn-secondary` (gray) class for the "Logout" button, as well. Its privileged position next to "Continue" might bring it out just enough—but not too much. I don't have a strong opinion about this. I'd never wear a green t-shirt with red trousers—or anything with red trousers—but with buttons on a very temporary webpage I can find the contrast pleasing.)
yrammos commented 2020-06-15 11:39:47 +02:00 (Migrated from github.com)

@babelouest taking the liberty to add one more (last) commit to this PR. The "New User" link on the Profile page navbar was missing the &prompt=login URL parameter, I think.

@babelouest taking the liberty to add one more (last) commit to this PR. The "New User" link on the Profile page navbar was missing the `&prompt=login` URL parameter, I think.
babelouest (Migrated from github.com) reviewed 2020-06-15 13:52:42 +02:00
@ -42,6 +42,7 @@
"error-value-expected": "Waarde vereist",
"grant-title": "{{- client}} vraagt de volgende toegangsrechten",
"grant": "Toegang toestaan",
"grant-none-available": "No grants have been requested",
babelouest (Migrated from github.com) commented 2020-06-15 13:52:41 +02:00

I know someone who could help us ;)

I know someone who could help us ;)
babelouest (Migrated from github.com) reviewed 2020-06-15 13:53:49 +02:00
@ -42,6 +42,7 @@
"error-value-expected": "Value required",
"grant-title": "{{- client}} requires access to the following scopes",
"grant": "Grant access",
"grant-none-available": "No grants have been requested",
babelouest (Migrated from github.com) commented 2020-06-15 13:53:49 +02:00

How about "You don't have access to the requested scopes"?

How about `"You don't have access to the requested scopes"`?
babelouest (Migrated from github.com) reviewed 2020-06-15 13:56:53 +02:00
@ -89,10 +89,20 @@ class GrantScope extends Component {
infoSomeScopeUnavailable = <div className="alert alert-info" role="alert">{i18next.t("login.info-some-scope-unavailable")}</div>
}
return (
(!Array.isArray(this.state.scope) || this.state.scope.length < 1)
babelouest (Migrated from github.com) commented 2020-06-15 13:56:53 +02:00

As for tertiary conditionals, I confess I have a penchant for them. Sorry… :)

I know the feeling, I use them a lot in the backend

> As for tertiary conditionals, I confess I have a penchant for them. Sorry… :) I know the feeling, I use them a lot in the backend
babelouest (Migrated from github.com) reviewed 2020-06-15 14:10:06 +02:00
@ -89,10 +89,20 @@ class GrantScope extends Component {
infoSomeScopeUnavailable = <div className="alert alert-info" role="alert">{i18next.t("login.info-some-scope-unavailable")}</div>
}
return (
(!Array.isArray(this.state.scope) || this.state.scope.length < 1)
babelouest (Migrated from github.com) commented 2020-06-15 14:10:05 +02:00

@yrammos , I realize I already made something similar, but in the App.js
Although, there's only the error message displayed, I think we should add the connected user as well. The error message is in the i18n entry login.error-scope-unavailable

@yrammos , I realize I already made something similar, but in the [App.js](https://github.com/babelouest/glewlwyd/blob/master/webapp-src/src/Login/App.js#L271) Although, there's only the error message displayed, I think we should add the connected user as well. The error message is in the i18n entry `login.error-scope-unavailable`
yrammos (Migrated from github.com) reviewed 2020-06-15 14:44:30 +02:00
@ -42,6 +42,7 @@
"error-value-expected": "Value required",
"grant-title": "{{- client}} requires access to the following scopes",
"grant": "Grant access",
"grant-none-available": "No grants have been requested",
yrammos (Migrated from github.com) commented 2020-06-15 14:44:30 +02:00

That sounds fine to me.

That sounds fine to me.
yrammos (Migrated from github.com) reviewed 2020-06-15 14:49:59 +02:00
@ -89,10 +89,20 @@ class GrantScope extends Component {
infoSomeScopeUnavailable = <div className="alert alert-info" role="alert">{i18next.t("login.info-some-scope-unavailable")}</div>
}
return (
(!Array.isArray(this.state.scope) || this.state.scope.length < 1)
yrammos (Migrated from github.com) commented 2020-06-15 14:49:59 +02:00

@babelouest I don’t think I came across that ,but don’t hesitate to tell me if you’d like me to rewire something.

@babelouest I don’t think I came across that ,but don’t hesitate to tell me if you’d like me to rewire something.
babelouest (Migrated from github.com) reviewed 2020-06-15 22:31:12 +02:00
@ -89,10 +89,20 @@ class GrantScope extends Component {
infoSomeScopeUnavailable = <div className="alert alert-info" role="alert">{i18next.t("login.info-some-scope-unavailable")}</div>
}
return (
(!Array.isArray(this.state.scope) || this.state.scope.length < 1)
babelouest (Migrated from github.com) commented 2020-06-15 22:31:12 +02:00

For now, I reset to the original code, I made it specifically when a user is redirected to the login page with a scope list and the user has no scope from the list. Can you retry your tests that lead you to your similar change? I may have forgotten some use cases. If so I'll fix the original code.

For now, I reset to the original code, I made it specifically when a user is redirected to the login page with a scope list and the user has no scope from the list. Can you retry your tests that lead you to your similar change? I may have forgotten some use cases. If so I'll fix the original code.
babelouest (Migrated from github.com) reviewed 2020-06-15 22:31:24 +02:00
babelouest (Migrated from github.com) commented 2020-06-15 22:31:24 +02:00

done

done
babelouest commented 2020-06-15 22:34:56 +02:00 (Migrated from github.com)

Hello @yrammos , I did my fix in the branch yrammos-ui-tidbits, can you check that out to verify all your changes are still present?

Hello @yrammos , I did my fix in the branch [yrammos-ui-tidbits](https://github.com/babelouest/glewlwyd/tree/yrammos-ui-tidbits), can you check that out to verify all your changes are still present?
yrammos (Migrated from github.com) reviewed 2020-06-16 12:31:06 +02:00
@ -89,10 +89,20 @@ class GrantScope extends Component {
infoSomeScopeUnavailable = <div className="alert alert-info" role="alert">{i18next.t("login.info-some-scope-unavailable")}</div>
}
return (
(!Array.isArray(this.state.scope) || this.state.scope.length < 1)
yrammos (Migrated from github.com) commented 2020-06-16 12:31:06 +02:00

@babelouest ah, I now see what you're referring to. The original code indeed seems to work just as well.

@babelouest ah, I now see what you're referring to. The original code indeed seems to work just as well.
yrammos commented 2020-06-16 13:33:08 +02:00 (Migrated from github.com)

Hello @babelouest, thank you for this! It looks and works very well.

Meanwhile, in #137 you will find a supplementary PR with fixes to bugs that were introduced on master but are best merged into yrammos-ui-tidbits. Would you kindly review those, as well?

Hello @babelouest, thank you for this! It looks and works very well. Meanwhile, in #137 you will find a supplementary PR with fixes to bugs that were introduced on `master` but are best merged into `yrammos-ui-tidbits`. Would you kindly review those, as well?
babelouest commented 2020-06-16 22:50:31 +02:00 (Migrated from github.com)

@yrammos , let's get back to this PR then, I made some changes in it in my branch yrammos-ui-tidbits, does this branch have all your UI changes in it? If so we can merge it, this will close this PR.

@yrammos , let's get back to this PR then, I made some changes in it in my branch [yrammos-ui-tidbits](https://github.com/babelouest/glewlwyd/tree/yrammos-ui-tidbits), does this branch have all your UI changes in it? If so we can merge it, this will close this PR.
yrammos commented 2020-06-17 01:03:40 +02:00 (Migrated from github.com)

@babelouest your branch works well on my end, except for the following line, where btn-outline-primary should be replaced with btn-secondary. (The outlined button is from a custom theme that accidentally leaked into the PR.)

github.com/babelouest/glewlwyd@c7eedb4c8e/webapp-src/src/Profile/Navbar.js (L200)

Also, in retrospect it's not clear to me why the "grants" part of the PR was reverted (the user is still prompted to approve grants (https://github.com/babelouest/glewlwyd/pull/136#discussion_r440429356). Apparently my PR doesn't handle certain scenarios?

Other than these two points, I think we can close this PR and move on.

@babelouest your branch works well on my end, except for the following line, where `btn-outline-primary` should be replaced with `btn-secondary`. (The outlined button is from a custom theme that accidentally leaked into the PR.) https://github.com/babelouest/glewlwyd/blob/c7eedb4c8e3695a28f060b6a2b6a01b570febdb3/webapp-src/src/Profile/Navbar.js#L200 Also, in retrospect it's not clear to me why the "grants" part of the PR was reverted (the user is still prompted to approve grants (https://github.com/babelouest/glewlwyd/pull/136#discussion_r440429356). Apparently my PR doesn't handle certain scenarios? Other than these two points, I think we can close this PR and move on.
babelouest commented 2020-06-17 05:12:17 +02:00 (Migrated from github.com)

@yrammos , I fixed the button class you mention in glewlwyd/webapp-src/src/Profile/Navbar.js on line 200.

Concerning the grants message I reverted, I suggest we fix it in a separate discussion, can you open an issue to describe the bug and the expected behavior? I believe it will be better off fixed that way.

Meanwhile, I merged this pull request to apply the large amount of improvements it provides.

@yrammos , I fixed the button class you mention in `glewlwyd/webapp-src/src/Profile/Navbar.js` on line 200. Concerning the grants message I reverted, I suggest we fix it in a separate discussion, can you open an issue to describe the bug and the expected behavior? I believe it will be better off fixed that way. Meanwhile, I merged this pull request to apply the large amount of improvements it provides.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
KittenSquad/glewlwyd!136
No description provided.