Improve the look and feel of the Optimize Privacy screen
ADD
WalletWasabi.Fluent/Models/PrivacySuggestionBenefit.cs
+namespace WalletWasabi.Fluent.Models
+{
+ public record PrivacySuggestionBenefit(bool Highlight, string Message);
+}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/Styles/Themes/BaseDark.axaml
WalletWasabi.Fluent/Styles/Themes/BaseDark.axaml
<Color x:Key="LineChartAreaGradientCursorStrokeColor">#F07FAF2E</Color>
<Color x:Key="LineChartLineColor">#7FAF2E</Color>
+ <SolidColorBrush x:Key="OptimizePrivacyOptionSelectedColor">#1B273D</SolidColorBrush>
+
<SolidColorBrush x:Key="DialogOverlayColor">#7F2E2E2E</SolidColorBrush>
<BoxShadows x:Key="DialogBoxShadow">4 11 30 1 #3F000000</BoxShadows>
<BoxShadows x:Key="InfoBoxShadow">0 1 1.5 #3F000000</BoxShadows>
<BoxShadows x:Key="BoxShadow">0 1 4 #121212</BoxShadows>
<BoxShadows x:Key="OptionButtonShadow">0 2 2 #121212</BoxShadows>
+ <BoxShadows x:Key="OptimizePrivacyOptionBoxShadow1">0 12 32 0 #33000000</BoxShadows>
</Styles.Resources>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/FluentDark.xaml" />

MODIFY
WalletWasabi.Fluent/Styles/Themes/BaseLight.axaml
WalletWasabi.Fluent/Styles/Themes/BaseLight.axaml
<Color x:Key="LineChartAreaGradientCursorStrokeColor">#F078A827</Color>
<Color x:Key="LineChartLineColor">#78A827</Color>
+ <SolidColorBrush x:Key="OptimizePrivacyOptionSelectedColor">#FFFFFF</SolidColorBrush>
+
<SolidColorBrush x:Key="DialogOverlayColor">#7F7A7A7A</SolidColorBrush>
<BoxShadows x:Key="DialogBoxShadow">4 11 30 1 #3F000000</BoxShadows>
<BoxShadows x:Key="InfoBoxShadow">0 1 1.5 #3F000000</BoxShadows>
<BoxShadows x:Key="BoxShadow">0 1 4 #D1D1D1</BoxShadows>
<BoxShadows x:Key="OptionButtonShadow">0 2 2 #D1D1D1</BoxShadows>
+ <BoxShadows x:Key="OptimizePrivacyOptionBoxShadow1">0 12 32 0 #49556726</BoxShadows>
</Styles.Resources>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/FluentLight.xaml" />

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/OptimisePrivacyViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/OptimisePrivacyViewModel.cs
@@ -10,6 +10,7 @@ using System.Threading.Tasks;
using ReactiveUI;
using WalletWasabi.Blockchain.TransactionBuilding;
using WalletWasabi.Fluent.Helpers;
+using WalletWasabi.Fluent.Models;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Wallets;
@@ -43,6 +44,9 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
SetupCancel(enableCancel: false, enableCancelOnEscape: true, enableCancelOnPressed: false);
EnableBack = true;
+ Tuple<bool, string> s = new Tuple<bool, string>(false, "");
+ var h = s.Item1;
+
NextCommand = ReactiveCommand.Create(
() => OnNext(transactionInfo),
this.WhenAnyValue(x => x.SelectedPrivacySuggestion).Select(x => x is { }));
@@ -86,12 +90,12 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
smallerSuggestion = new PrivacySuggestionControlViewModel(
_transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), smallerTransaction,
- PrivacyOptimisationLevel.Better, _wallet.Synchronizer.UsdExchangeRate, "Improved Privacy");
+ PrivacyOptimisationLevel.Better, _wallet.Synchronizer.UsdExchangeRate, new PrivacySuggestionBenefit(true, "Improved Privacy"));
}
_defaultSelection = new PrivacySuggestionControlViewModel(
_transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), _requestedTransaction,
- PrivacyOptimisationLevel.Standard, _wallet.Synchronizer.UsdExchangeRate);
+ PrivacyOptimisationLevel.Standard, _wallet.Synchronizer.UsdExchangeRate, new PrivacySuggestionBenefit(false, "As Requested"));
var largerTransaction = await Task.Run(() => _wallet.BuildTransaction(
_wallet.Kitchen.SaltSoup(),
@@ -102,7 +106,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
var largerSuggestion = new PrivacySuggestionControlViewModel(
_transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), largerTransaction,
- PrivacyOptimisationLevel.Better, _wallet.Synchronizer.UsdExchangeRate, "Improved Privacy");
+ PrivacyOptimisationLevel.Better, _wallet.Synchronizer.UsdExchangeRate, new PrivacySuggestionBenefit(true, "Improved Privacy"));
// There are several scenarios, both the alternate suggestions are <, or >, or 1 < and 1 >.
// We sort them and add the suggestions accordingly.

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacySuggestionControlViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacySuggestionControlViewModel.cs
using System;
+using System.Collections.Generic;
+using System.Linq;
+using DynamicData;
using NBitcoin;
using WalletWasabi.Blockchain.TransactionBuilding;
using WalletWasabi.Fluent.Helpers;
+using WalletWasabi.Fluent.Models;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
{
@@ -15,33 +19,41 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
{
[AutoNotify] private string _amount;
[AutoNotify] private string _amountFiat;
- [AutoNotify] private string _caption;
- [AutoNotify] private string[] _benefits;
+ [AutoNotify] private List<PrivacySuggestionBenefit> _benefits;
[AutoNotify] private PrivacyOptimisationLevel _optimisationLevel;
+ [AutoNotify] private bool _optimisationLevelGood;
- public PrivacySuggestionControlViewModel(decimal originalAmount, BuildTransactionResult transactionResult, PrivacyOptimisationLevel optimisationLevel, decimal fiatExchangeRate, params string[] benefits)
+ public PrivacySuggestionControlViewModel(decimal originalAmount, BuildTransactionResult transactionResult,
+ PrivacyOptimisationLevel optimisationLevel, decimal fiatExchangeRate,
+ params PrivacySuggestionBenefit[] benefits)
{
TransactionResult = transactionResult;
_optimisationLevel = optimisationLevel;
- _benefits = benefits;
+ _benefits = benefits.ToList();
decimal total = transactionResult.CalculateDestinationAmount().ToDecimal(MoneyUnit.BTC);
var fiatTotal = total * fiatExchangeRate;
_amountFiat = total.GenerateFiatText(fiatExchangeRate, "USD");
+ _optimisationLevelGood = optimisationLevel == PrivacyOptimisationLevel.Better;
- if (optimisationLevel == PrivacyOptimisationLevel.Better)
+ if (_optimisationLevelGood)
{
var fiatOriginal = originalAmount * fiatExchangeRate;
var fiatDifference = fiatTotal - fiatOriginal;
- _caption = (fiatDifference > 0 ? $"{fiatDifference.GenerateFiatText("USD")} More" : $"{Math.Abs(fiatDifference).GenerateFiatText("USD")} Less")
+ var difference = (fiatDifference > 0
+ ? $"{fiatDifference.GenerateFiatText("USD")} More"
+ : $"{Math.Abs(fiatDifference).GenerateFiatText("USD")} Less")
.Replace("(", "").Replace(")", "");
+
+ _benefits.Add(new (false, difference));
}
else
{
- _caption = "As Requested";
+ // This is just to pad the control.
+ _benefits.Add(new (false, " "));
}
_amount = $"{total}";

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/PrivacySuggestionControl.axaml
WalletWasabi.Fluent/Views/Wallets/Send/PrivacySuggestionControl.axaml
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:conv="using:WalletWasabi.Fluent.Converters"
xmlns:vm="using:WalletWasabi.Fluent.ViewModels.Wallets.Send"
+ xmlns:models="clr-namespace:WalletWasabi.Fluent.Models"
mc:Ignorable="d"
x:DataType="vm:PrivacySuggestionControlViewModel"
x:CompileBindings="True"
+ ClipToBounds="False"
x:Class="WalletWasabi.Fluent.Views.Wallets.Send.PrivacySuggestionControl">
+ <Panel>
+ <Border Name="PART_DecorationBorder" />
+ <Border Name="PART_MainContentBorder">
<StackPanel Spacing="20">
<Panel MinHeight="150" MinWidth="150">
<StackPanel Spacing="10" VerticalAlignment="Top">
<Panel>
<Ellipse Stroke="{DynamicResource TextForegroundColor}" StrokeThickness="4" Height="115" Width="115" />
- <Ellipse Stroke="{DynamicResource TextForegroundColor}" StrokeThickness="3" StrokeDashArray="2.0, 1.5" Height="100" Width="100" />
- <PathIcon Data="{StaticResource btc_logo}" Height="50" Width="50" Foreground="{DynamicResource TextForegroundColor}" />
+ <Ellipse Stroke="{DynamicResource TextForegroundColor}" StrokeThickness="3" StrokeDashArray="2.0, 1.5"
+ Height="100" Width="100" />
+ <PathIcon Data="{StaticResource btc_logo}" Height="50" Width="50"
+ Foreground="{DynamicResource TextForegroundColor}" />
+
+ <Viewbox IsVisible="{Binding OptimisationLevelGood}" Height="48" Width="48" Margin="0 0 10 2"
+ HorizontalAlignment="Right" VerticalAlignment="Bottom">
+ <Panel>
+ <Path
+ Data="m 64.9375 11.75 c -9.9878 0 -19.7174 -3.53804 -29.25 -10.6875 -1 -0.75 -2.375 -0.75 -3.375 0 C 22.7799 8.21196 13.0503 11.75 3.0625 11.75 1.5092 11.75 0.25 13.0092 0.25 14.5625 V 34.25 c 0 18.7545 11.0909 32.534 32.7192 41.0543 0.6624 0.2609 1.3992 0.2609 2.0616 0 C 56.6591 66.784 67.75 53.0045 67.75 34.25 V 14.5625 c 0 -1.5533 -1.2592 -2.8125 -2.8125 -2.8125 z">
+ <Path.Fill>
+ <LinearGradientBrush StartPoint="0%,1%" EndPoint="100%,100%">
+ <LinearGradientBrush.GradientStops>
+ <GradientStop Color="#97D234" />
+ <GradientStop Color="#7FAF2F" Offset="1" />
+ </LinearGradientBrush.GradientStops>
+ </LinearGradientBrush>
+ </Path.Fill>
+ </Path>
+ </Panel>
+ </Viewbox>
</Panel>
+
<TextBlock Text="{Binding Amount}" FontSize="20" HorizontalAlignment="Center" />
- <TextBlock Text="{Binding AmountFiat}" HorizontalAlignment="Center" Opacity="0.6" />
- <TextBlock Text="{Binding Caption}" HorizontalAlignment="Center" Opacity="0.6" />
+ <TextBlock Text="{Binding AmountFiat}" FontSize="12" HorizontalAlignment="Center" Opacity="0.6" />
</StackPanel>
</Panel>
<Separator Height="1" Background="{DynamicResource SeparatorBackgroundBrush}" Opacity="0.2" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</ItemsControl.Styles>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate x:DataType="models:PrivacySuggestionBenefit">
+ <Panel HorizontalAlignment="Center">
+ <TextBlock IsVisible="{Binding !Highlight}" Text="{Binding Message}" />
+ <TextBlock IsVisible="{Binding Highlight}" Foreground="{DynamicResource SystemAccentColor}"
+ Text="{Binding Message}" />
+ </Panel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
- <StackPanel Spacing="30" />
+ <StackPanel Spacing="5" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</StackPanel>
+ </Border>
+ </Panel>
</UserControl>
\ No newline at end of file

Improve the look and feel of the Optimize Privacy screen