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

[VDG] Add colorful diffs in Transaction Preview #11704

Merged
merged 17 commits into from
Oct 21, 2023

Conversation

SuperJMN
Copy link
Collaborator

This adds colored hints to the changing items when hovering over a suggestion, in the Transaction Preview. It helps users identify what they're getting applying a given suggestion.

Closes #11039

@SuperJMN SuperJMN marked this pull request as ready for review October 17, 2023 08:34
Copy link
Collaborator

@MarnixCroes MarnixCroes left a comment

Choose a reason for hiding this comment

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

The amount percentage difference is inverse?
both amount and fee
e.g. have a fee of 221 sats, hover over change avoidance, fee becomes 110 sats. It says the difference is 100.91%
It should be ~ -50%

@SuperJMN
Copy link
Collaborator Author

The amount percentage difference is inverse? both amount and fee e.g. have a fee of 221 sats, hover over change avoidance, fee becomes 110 sats. It says the difference is 100.91% It should be ~ -50%

Mmm, let me review the calculation. I did some last time changes that could be wrong.

@SuperJMN
Copy link
Collaborator Author

-50%

Yes, it was exactly the opposite. Good catch. Thank you! Please check if it works now.

Copy link
Collaborator

@MarnixCroes MarnixCroes left a comment

Choose a reason for hiding this comment

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

why use NeutralDiffConverter at amount and InvertedDiffConverter at fee? in the TransactionSummary view

In the GUI, at Amount, the brush is currently always orange, both for positive and negative difference

@@ -64,6 +64,10 @@
<SolidColorBrush x:Key="PrivacyLevelStrongBrush" Color="#3E992F" />
<SolidColorBrush x:Key="PrivacyLevelNoneBrush" Color="#B8B8B8" />

<SolidColorBrush x:Key="PositiveBrush" Color="#5BB626" />
<SolidColorBrush x:Key="NegativeBrush" Color="#C3983B" />
<SolidColorBrush x:Key="ZeroBrush" Color="#C3983B" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

ZeroBrush and NegativeBrush shouldn't be the same color right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They can be, because in fact, there's no negative color defined in the specs. Should we define one? @soosr

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just have a PositiveBrush and a UncertainBrush. Later if we need a negative brush, we can add one.

@SuperJMN
Copy link
Collaborator Author

why use NeutralDiffConverter at amount and InvertedDiffConverter at fee? in the TransactionSummary view

In the GUI, at Amount, the brush is currently always orange, both for positive and negative difference

For amount it's the same because we can't decide if it's good or bad. For fees, we can :)

@MarnixCroes
Copy link
Collaborator

why use NeutralDiffConverter at amount and InvertedDiffConverter at fee? in the TransactionSummary view

In the GUI, at Amount, the brush is currently always orange, both for positive and negative difference

For amount it's the same because we can't decide if it's good or bad. For fees, we can :)

I'd say to give it a neutral color then?

@soosr
Copy link
Collaborator

soosr commented Oct 18, 2023

why use NeutralDiffConverter at amount and InvertedDiffConverter at fee? in the TransactionSummary view
In the GUI, at Amount, the brush is currently always orange, both for positive and negative difference

For amount it's the same because we can't decide if it's good or bad. For fees, we can :)

I'd say to give it a neutral color then?

Orange is the warning color it doesn't mean bad or good it just wants to get attention. For Example in settings when restart is needed.
(It might be wrongly used elsewhere, but here it is correct)

@soosr
Copy link
Collaborator

soosr commented Oct 18, 2023

@SuperJMN Fix conflicts, please.

@SuperJMN SuperJMN requested a review from soosr October 18, 2023 11:52
@MarnixCroes
Copy link
Collaborator

why use NeutralDiffConverter at amount and InvertedDiffConverter at fee? in the TransactionSummary view
In the GUI, at Amount, the brush is currently always orange, both for positive and negative difference

For amount it's the same because we can't decide if it's good or bad. For fees, we can :)

I'd say to give it a neutral color then?

Orange is the warning color it doesn't mean bad or good it just wants to get attention. For Example in settings when restart is needed. (It might be wrongly used elsewhere, but here it is correct)

ok. for me the confusing part is that at Fee the orange (diff) is bad, but at Amount it doesn't mean "bad"

@soosr
Copy link
Collaborator

soosr commented Oct 18, 2023

why use NeutralDiffConverter at amount and InvertedDiffConverter at fee? in the TransactionSummary view
In the GUI, at Amount, the brush is currently always orange, both for positive and negative difference

For amount it's the same because we can't decide if it's good or bad. For fees, we can :)

I'd say to give it a neutral color then?

Orange is the warning color it doesn't mean bad or good it just wants to get attention. For Example in settings when restart is needed. (It might be wrongly used elsewhere, but here it is correct)

ok. for me the confusing part is that at Fee the orange (diff) is bad, but at Amount it doesn't mean "bad"

The rationale behind this is to reward to good rather than punish the bad thing. Which is followed software-wide. Although I see your point, during the UI Refreshment I will remember this.

@soosr
Copy link
Collaborator

soosr commented Oct 18, 2023

@SuperJMN Could you fix the conflict?

@@ -27,4 +27,7 @@ public static class MoneyConverters

public static readonly IValueConverter ToFeeWithoutUnit =
new FuncValueConverter<Money?, string?>(n => n?.ToFeeDisplayUnitRawString());

public static readonly IValueConverter PercentageDifferenceConverter =
new FuncValueConverter<double, string>(n => n.ToString("+#0.##%;-#0.##%;0%"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add conditional formatting here? Similarly what you did with USD amounts

Copy link
Collaborator

@soosr soosr left a comment

Choose a reason for hiding this comment

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

image
Can you me this 0.2?

BTW the percentage seems to be wrong, I think the number should be multiplied by 100 in order to get a percentage.

@SuperJMN
Copy link
Collaborator Author

SuperJMN commented Oct 20, 2023

Can you me this 0.2?
BTW the percentage seems to be wrong, I think the number should be multiplied by 100 in order to get a percentage.

Fixed! Thanks for reporting!

Copy link
Collaborator

@soosr soosr left a comment

Choose a reason for hiding this comment

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

tACK

@soosr soosr merged commit 83b47f4 into WalletWasabi:master Oct 21, 2023
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transaction Warnings: Highlight the edited data when hovering over suggestions
3 participants