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

Added purchase failed panel #13486

Merged
merged 2 commits into from
Jun 3, 2022
Merged

Added purchase failed panel #13486

merged 2 commits into from
Jun 3, 2022

Conversation

spylogsster
Copy link
Contributor

@spylogsster spylogsster commented May 26, 2022

Resolves brave/brave-browser#23028
Resolves brave/brave-browser#22731

connect-api.guardianapp.com is unavailable often for me and I see infinite loading state because the purchase check failed is not handled properly on typescript side

  • Added purchase failed state handling on typescript side
  • Added PurchaseFailedPanel view
  • Shared some styles between PurchaseFailed view and Error view
  • Improved ContactSupport view to handle response result of ticket submission:
    • Added autoclose if success
    • Added error message if failed
2022-05-26_17h02_26.mp4
Brave.Browser.Development.-.Settings.-.2.June.2022.mp4

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

  • Block connect-api.guardianapp.com in Fiddler
  • Try to setup vpn on clean profile
  • Should not stuck on infinite loading when checking purchase credentials

@github-actions github-actions bot added the CI/storybook-url Deploy storybook and provide a unique URL for each build label May 26, 2022
import getPanelBrowserAPI, * as BraveVPN from '../../api/panel_browser_api'
import { CaratStrongLeftIcon } from 'brave-ui/components/icons'

interface Props {
onCloseContactSupport: React.MouseEventHandler<HTMLButtonElement>
Copy link
Contributor Author

@spylogsster spylogsster May 26, 2022

Choose a reason for hiding this comment

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

this is used outside only by empty callbacks to setup flags, seems not necessary to pass React.MouseEventHandler @petemill ? and I added auto closing of this panel to be more user friendly when request is success

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Copy link
Member

@petemill petemill left a comment

Choose a reason for hiding this comment

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

Nice work and cleanup, but some small changes I think

@@ -0,0 +1,54 @@
import styled from 'styled-components'
Copy link
Member

Choose a reason for hiding this comment

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

Since this is the only file in this directory, how about we avoid the name repetition and just put components/styles.ts instead of components/styles/styles.ts?

Or perhaps a better idea, since these aren't really styles but are components, call them something like components/general.ts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

<message name="IDS_BRAVE_VPN_LOADING" desc="Label to show below loader icon">
One moment while loading…
</message>

<message name="IDS_BRAVE_VPN_PURCHASE_FAILED " desc="Label to show when purchase status failed">
Unable to check the status of your purchase, probably a network problem.
Copy link
Member

Choose a reason for hiding this comment

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

How about "Unable to check the status of your purchase. This could be caused by a network problem."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

{getLocale('braveVpnContactSupport')}
</S.ButtonText>
}
{isContactSupportVisible &&
Copy link
Member

Choose a reason for hiding this comment

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

I think it looks a little strange to put the support contact form underneath the error. Perhaps we do it like the existing contact form instance, and just replace the UI here (if (isContactSupportVisible) return <ContactSupport ...>).

Copy link
Contributor Author

@spylogsster spylogsster Jun 2, 2022

Choose a reason for hiding this comment

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

good idea, thanks,

Brave.Browser.Development.-.Settings.-.2.June.2022.mp4

function PurchaseFailedPanel () {
const [isContactSupportVisible, setContactSupportVisible] = React.useState(false)
const closeContactSupport = () => {
console.log('isContactSupportVisible', isContactSupportVisible)
Copy link
Member

Choose a reason for hiding this comment

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

nit: remove logging

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

I wasn't able to figure out how to block in Fiddler, so I just made hostname non-routable using hostfile. Works great! Before we release, we'll want to review all the strings - I don't think these error states were captured in Figma. Code changes look great too! 😄👍

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Copy link
Member

@petemill petemill left a comment

Choose a reason for hiding this comment

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

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve UI for VPN connection errors Contact technical support form doesn't dismiss after submission
4 participants