Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Show total balance (pending + available) instead of pending balance #8140
Show total balance (pending + available) instead of pending balance #8140
Changes from 14 commits
5772d76
3c33736
98fec2f
ac07a52
6a6f894
0973d61
cc481cc
f3a90f0
abeeaa7
53e5491
44ba49f
5793404
1209e97
7518b04
c35e509
00be47d
2227bde
9d36b8a
394ec33
fccad60
01f1773
5ca7f15
0be8cf4
1edca23
005f331
4f470c4
204ce36
24c18fa
9106b3d
bc3036f
53c9227
b617834
eca0bd2
c7550fd
cb68640
5b2a7df
12996e6
ed5bfb2
c9c5587
d607985
2ec2a73
cce2f32
6f64549
dcd7b5f
0b9ab72
6605b40
b8d822c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
In loading state, total balance will be 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.
In loading state, available balance is 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.
In loading state merchant will see a grey box placeholder, so this
0
is all good (if it shows in UI could lead to questions).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.
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.
Might be worth factoring out these into semantic tooltip components, e.g.
TotalBalanceTooltip
andAvailableBalanceTooltip
. Then if there is some logic to fine-tune the content (e.g. add info about implications of a negative total balance), it's abstracted away from this top-level component.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.
Side note –
BalanceTooltip
might not be adding much value, it's effectively a synonym / wrapper forClickToolTip
.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.
Good idea. Will implement once we agree on https://github.com/Automattic/woocommerce-payments/pull/8140/files#r1498209420.
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 it serving us to have these strings factored out of the component?
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.
There are 3 usages in
client/components/account-balances/index.tsx
so there is benefit of storing it as a 'constant' but not sure having a separatestrings.ts
is a good design.I see for other component it's structured that way, having a
strings.ts
.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 see this pattern is used in our code, but I'm not convinced – to me it makes the code less meaningful to extract the strings (and documentation links, etc). One of the wonderful things about react is you can look at the code/markup and understand what the component looks like and does. Moving strings to constants makes this a little harder, since the reader needs to look up each constant to see what the string is. So when I'm working on components that feel disconnected like this, I consider pulling string back in to make it easier to maintain and more self-contained.
Anyway, I'm just sharing my thoughts – no need to change this if it' working for you :)