-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
patreon frontend work (excluding finished dialogs) #2325
base: main
Are you sure you want to change the base?
Conversation
…on returning from patreon
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.
This is a great start - I left a couple of comments below, and then I want to make some tweaks and recommendations to the flow itself which we can talk about together.
overflow: hidden; | ||
overflow-y: scroll; | ||
[role="subtitle"] { | ||
color: #1b914e; |
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.
We'd like use defined UI colors as much as possible. Here is a visual guide to UI colors, and the SCSS variables are defined here in this file.
To refer to UI colors, add this line to the top of the SCSS file:
@import "../../styles/variables.scss";
And then refer to the color closest to the one you want, e.g.
[role="subtitle"] {
color: $colour-emerald-500;
}
We can do the same for the border colors, below.
lib/util.js
Outdated
@@ -32,6 +33,9 @@ exports.asUserJson = function (user) { | |||
userJson.roles.unshift('USER') | |||
} | |||
|
|||
userJson.authorisations = { | |||
patreon: user.identities.filter((u) => u.provider === 'patreon').length > 0 |
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.
This will error if the identities
field is not defined, which was happening to me locally.
} | ||
|
||
li { | ||
margin: 16px 0px; |
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.
This is throwing a lint error because it expects the 0
to be unitless (e.g. 0
instead of 0px
).
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.
Are our lint checks different? I didn't get a commit lint check issue with this
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.
Hmm. Well, the CI linting should be the same as the checks happening locally. It was triggered here:
https://github.com/streetmix/streetmix/pull/2325/checks?check_run_id=2398180113
However, local linting usually only checks recently changed files unless you run npm run lint
specifically; it might have snuck in and didn't get get linted.
lib/util.js
Outdated
@@ -23,6 +23,7 @@ exports.asUserJson = function (user) { | |||
profileImageUrl: user.profileImageUrl, | |||
flags: user.flags || {}, | |||
roles: user.roles || [], | |||
authorisations: user.authorisations || [], |
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.
we spell it 'authorization' elsewhere in the codebase, so it might be best to be consistent
also, I wonder if we can use the same name on the frontend as client side. a 1:1 relationship seems more intuitive, so these would still be called 'identities' unless there is a specific reason to call them something different (this also matched auth0's user schema)
// profile.pledges | ||
// save refresh token for patreon auth - allws check for patreon | ||
const pledges = req.profile._json.relationships.pledges | ||
let role = 'USER' |
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.
we should be able to call the User.addRole function I wrote here:
streetmix/app/db/models/user.js
Line 98 in 00673e5
User.prototype.addRole = function (newRole) { |
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 also am worried about updating the roles inside this function.
Ideally, I think this function should be for linking the accounts. We probably dont want to have to call this function every time we want to check their status, no? So maybe we should eventually have a seperate function like syncAccountStatus or something to update/remove roles as appropriate
7e48556
to
972a7e0
Compare
Displays dialogs for the following conditions