-
Notifications
You must be signed in to change notification settings - Fork 893
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
Add new tip dialog user interface #6626
Conversation
5d33e22
to
c0eeb37
Compare
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.
For events, please call FireWebUIListener('event-name', data)
. We should not add any more places where we hope JS function names exist at the time.
In JS, you would subscribe to the event with
window.cr.addWebUIListener('event-name', function(data) { ... })
Alternatively just give this WebUI access to the chrome.braveRewards
API since we're not showing this page on Android.
components/brave_rewards/resources/tip_dialog/components/app.style.ts
Outdated
Show resolved
Hide resolved
7f42a7d
to
e7ec8b9
Compare
e7ec8b9
to
5b39c4b
Compare
components/brave_rewards/resources/tip/components/publisher_banner.tsx
Outdated
Show resolved
Hide resolved
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.
- Probably would be good to add index.tsx in components folder so that we can just do this
import { PublisherBanner, TipForm } from './index'
instead of
import { PublisherBanner } from './publisher_banner'
import { TipForm } from './tip_form'
-
we should add OnUnblindedTokensReady observer, so that if you have banner open and you claim promotion in another tab we fetch balance in open banner
-
probably this should be 3 decimal points as well based on the fact that we have BAT with 3 points in every other place
-
X here should probably just switch back to defaul tip screen and not hide banner
-
probably it would be good to add some shadow/border around logo
-
remove duplicated username in the title for inline tipping. It's listed bellow as well and we don't have it regular tip flow
1cb2046
to
3515f74
Compare
3515f74
to
b6bdd6f
Compare
Working on one more potential design change to better deal with custom banner backgrounds that are different sizes. |
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.
is not working correctly on master either. Even though that it opens new window in which you can see rewards page nothing happens. Should be fixed with new flow for ads opt in that will be part of follow up
b6bdd6f
to
74409c2
Compare
export function injectThemeVariables (element: HTMLElement) { | ||
for (const [key, value] of Object.entries(defaultTheme.color)) { | ||
element.style.setProperty(`--brave-color-${key}`, String(value)) | ||
} |
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 great.
-
Could you put it in
components/common/
so that we can use it for other UI. I for certain would. -
I'm not sure that we should be using
defaultTheme
directly. We should be ascertaining what the current theme is based on whether we're in light or dark mode, and then switching the theme (and replacing the variable values) when the user selected theme changes. We used to have elaborate listeners, but I think these days we can usewindow.matchMedia('(prefers-color-scheme: dark)')
and put a listener on that. The idea is that you can either use the default dark and light themes, or subclass them and make specific overrides for each for your specific UI, if applicable.
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.
Moving this out so that other UIs can use it was part of the plan (hope?), but I think we should do it as a follow-on, so that we'll have a bit more time to think about how to generalize it properly. We should be able to easily migrate the code in here to use a helper that we promote to "common".
Really interesting point about matchMedia
!
74409c2
to
a103c5a
Compare
@petemill I've updated the "tip completed" animation gif - it's been reduced from 1.4MB to ~600kb. |
CI failure on "SonarCloud Code Analysis" is due to the tip dialog HTML page not have a "lang" attribute on the html tag, but the "lang" attribute is set correctly for WebUI via: <html i18n-values="dir:textdirection;lang:language"> |
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.
LGTM, one minor nit.
1abac91
to
cb1324e
Compare
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 awesome. Thanks for bringing some new ideas to code organization and both state and API management. Looking forward to sharing and evolving some of these.
Just some minor accessibility feedback.
And needs a test plan.
But 1 issue that's preventing me approving is that nothing is happening when I click "Add funds" if I try to tip an amount higher than I have.
- Clean profile
- Visit petemill.com (or any site that has 100BAT option $$$)
- Choose 100BAT
- Click Add Funds
- Observe nothing happens
components/brave_rewards/resources/tip/components/slider_switch.style.ts
Show resolved
Hide resolved
components/brave_rewards/resources/tip/components/form_submit_button.tsx
Outdated
Show resolved
Hide resolved
components/brave_rewards/resources/tip/components/icons/unverified_icon.tsx
Show resolved
Hide resolved
- Gif bundling is required for updated rewards tip dialog designs. - Webpack was previously bundling a polyfill for Node's stream module due to a detected dependency in "styled-components". - Removed unused variables.
@petemill add funds on master doesn't do anything either. This will be fixed in brave/brave-browser#12138 when we add new flows |
cb1324e
to
31e2a47
Compare
@petemill The "add funds" link was pointed to a "brave://" url which was blocked. Changing it to a "chrome://" url works and matches the behavior on master (it opens the rewards page). |
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.
Nice work. Thanks for addressing feedback.
Resolves brave/brave-browser#11361
Resolves brave/brave-browser#11393
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
(All tests should be executed for both verified and unverified publishers.)
Case 1: One-time tipping
Case 2: Setting a monthly contribution
Case 3: One-time tipping with existing monthly contribution
Case 3: Inline tipping
Banner functionality:
Reviewer Checklist:
After-merge Checklist:
changes has landed on.