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

patreon frontend work (excluding finished dialogs) #2325

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

arc64
Copy link
Collaborator

@arc64 arc64 commented Apr 21, 2021

Displays dialogs for the following conditions

  • User is not logged in but wants to upgrade
  • User is logged in and wants to upgrade
  • Just returned from Patreon and has authorised Patreon
  • Just returned from Patreon but some kind of error occurred
  • Just returned from Patreon and user has also committed to campaign
  • User has just logged in after having begun upgrade pathway
  • External link used to prompt upgrade (/upgrade)

Copy link
Member

@louh louh left a 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;
Copy link
Member

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
Copy link
Member

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;
Copy link
Member

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).

Copy link
Collaborator Author

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

Copy link
Member

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 || [],
Copy link
Collaborator

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'
Copy link
Collaborator

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:

User.prototype.addRole = function (newRole) {

Copy link
Collaborator

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

@louh louh changed the base branch from main to next June 18, 2021 21:29
@louh louh force-pushed the next branch 2 times, most recently from 7e48556 to 972a7e0 Compare January 12, 2022 02:27
Base automatically changed from next to main January 12, 2022 02:56
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.

None yet

3 participants