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

Update repo flow to use popups #4979

Merged
merged 4 commits into from
Oct 11, 2023
Merged

Conversation

siggisim
Copy link
Member

@siggisim siggisim commented Oct 7, 2023

This is still a bit of a work in progress, but this state is definitely better than what's currently live in dev.

This PR does a few things, happy to break it up if it's a pain to review:

  • Switches to using popups instead of redirects for all linking / auth
    • This allows us to remove like 3 or 4 buttons that were needed for all sorts of edge cases
    • Moves the edge case handling to when either the create repo button is clicked or the deploy button is clicked
  • Adds some query parameters which allows us to render a nice title with an image if present
  • Adds a cookie with the last github app installation id so we can automatically select it if it was just installed

Screenshot:
Screenshot 2023-10-06 at 5 12 51 PM

@siggisim siggisim requested a review from bduffany October 7, 2023 00:20
Comment on lines +2 to +3
font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans,
Droid Sans, Helvetica Neue, sans-serif;
Copy link
Member

Choose a reason for hiding this comment

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

not sure if you wanted this to match the main app font, but we're using Open Sans currently

Suggested change
font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans,
Droid Sans, Helvetica Neue, sans-serif;
font-family: "Open Sans", sans-serif;

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like to try using this system-ui stack that we use for our marketing page. I messed around with making this the default for our whole app UI as well, but wanted to wait a bit and test it out before taking the leap.

@@ -118,16 +131,57 @@ export default class RepoComponent extends React.Component<RepoComponentProps, R
this.fetchSecrets();
}

async loginAndLinkGithub() {
if (!this.props.user) {
await this.loginToGithub();
Copy link
Member

Choose a reason for hiding this comment

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

if loginToGithub fails then it will continue to linkGithubAccount, because loginToGithub does catch on the promise. Is that OK?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I didn't quite know how catch interacted with await. I've updated this to remove the catches and added a single try/catch to protect the whole thing.

Side note, I think async/await is provides a such nice syntax for flattening deeply nested serial promises - but the try catch syntax makes it look so ugly :(

isGCPDeploy && !this.state.secretsResponse?.secret.map((s) => s.name).includes(gcpRefreshTokenKey);

if (isGCPDeploy && needsGCPLink) {
await this.linkGoogleCloud()
Copy link
Member

Choose a reason for hiding this comment

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

if there's an error then it will continue due to the catch - is that OK here too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Similar to above, I removed that catch and extended the scope of the try/catch below to cover this.

@siggisim siggisim merged commit 37138e0 into master Oct 11, 2023
11 checks passed
@siggisim siggisim deleted the siggi-dev-branch-20231006-171125 branch October 11, 2023 20:58
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