amount column, icon types
ADD
WalletWasabi.Fluent/Converters/TransactionTypeToResourceConverter.cs
+using System;
+using System.IO;
+using System.Linq;
+using System.Resources;
+using Avalonia;
+using Avalonia.Data.Converters;
+using Avalonia.Markup.Xaml.Styling;
+using WalletWasabi.Fluent.Model;
+
+namespace WalletWasabi.Fluent.Converters
+{
+ public class TransactionTypeToResourceConverter
+ {
+ public static readonly IValueConverter ToResource =
+ new FuncValueConverter<TransactionType, object?>(type =>
+ {
+ string key;
+
+ switch (type)
+ {
+ case TransactionType.Incoming:
+ key = "arrow_down_right_regular";
+ break;
+ case TransactionType.Outgoing:
+ key = "arrow_up_right_regular";
+ break;
+ case TransactionType.SelfSpend:
+ key = "normal_transaction";
+ break;
+ case TransactionType.CoinJoin:
+ key = "shield_regular";
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(type), type, null);
+ }
+
+ var icons = Application.Current.Styles.Select(x => (StyleInclude) x).FirstOrDefault(x => x.Source is { } && x.Source.AbsolutePath.Contains("Icons"));
+
+ if (icons is { } && icons.TryGetResource(key, out var resource))
+ {
+ return resource;
+ }
+
+ throw new InvalidDataException("Resource not found!");
+ });
+ }
+}

ADD
WalletWasabi.Fluent/Model/TransactionType.cs
+using WalletWasabi.Models;
+
+namespace WalletWasabi.Fluent.Model
+{
+ public enum TransactionType
+ {
+ Incoming,
+ Outgoing,
+ [FriendlyName("Self Spend")]
+ SelfSpend,
+ CoinJoin
+ }
+}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItemViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItemViewModel.cs
using System;
using NBitcoin;
using WalletWasabi.Blockchain.Transactions;
+using WalletWasabi.Fluent.Model;
using WalletWasabi.Models;
using WalletWasabi.Stores;
@@ -22,14 +23,25 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
var amount = transactionSummary.Amount;
if (amount < 0)
{
- OutgoingAmount = amount * -1;
+ Amount = amount * -1;
+ Type = TransactionType.Outgoing;
}
else
{
- IncomingAmount = amount;
+ Amount = amount;
+ Type = TransactionType.Incoming;
}
+
+ if (IsCoinJoin)
+ {
+ Type = TransactionType.CoinJoin;
+ }
+
+ //TODO: Self Spend type
}
+ public TransactionType Type { get; }
+
public TransactionSummary TransactionSummary { get; }
public int OrderIndex { get; }
@@ -40,9 +52,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
public bool IsConfirmed { get; }
- public Money? IncomingAmount { get; }
-
- public Money? OutgoingAmount { get; }
+ public Money Amount { get; }
public bool IsCoinJoin { get; }
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
using System;
using System.Collections.ObjectModel;
+using System.Net.Mime;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading.Tasks;
+using Avalonia;
using DynamicData;
using DynamicData.Binding;
using NBitcoin;

MODIFY
WalletWasabi.Fluent/Views/Wallets/Home/History/HistoryTable.axaml
WalletWasabi.Fluent/Views/Wallets/Home/History/HistoryTable.axaml
<DataGrid.Styles>
<Style Selector="PathIcon">
- <Setter Property="Width" Value="15"/>
- <Setter Property="Height" Value="15"/>
+ <Setter Property="Width" Value="20"/>
+ <Setter Property="Height" Value="20"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style Selector="TextBlock">
SortMemberPath="IsCoinJoin">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
- <Panel x:DataType="history:HistoryItemViewModel">
- <StackPanel IsVisible="{Binding !IsCoinJoin}">
- <PathIcon Data="{StaticResource normal_transaction}" Opacity="0.6" Width="20"/>
- <TextBlock Text="Normal" />
- </StackPanel>
- <StackPanel IsVisible="{Binding IsCoinJoin}">
- <PathIcon Data="{StaticResource shield_regular}" Opacity="0.6" Width="20" Height="20" />
- <TextBlock Text="CoinJoin" />
- </StackPanel>
- </Panel>
+ <PathIcon x:DataType="history:HistoryItemViewModel"
+ ToolTip.Tip="{Binding Type, Converter={x:Static converters:EnumConverters.ToFriendlyName}}"
+ Data="{Binding Type, Converter={x:Static converters:TransactionTypeToResourceConverter.ToResource}}"
+ Opacity="0.6"
+ HorizontalAlignment="Center" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
- <!-- Incoming -->
- <DataGridTemplateColumn Header="Incoming (BTC)"
+ <!-- Amount -->
+ <DataGridTemplateColumn Header="Amount (BTC)"
Width="*"
- SortMemberPath="IncomingAmount">
+ SortMemberPath="Amount">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
- <StackPanel x:DataType="history:HistoryItemViewModel"
- IsVisible="{Binding !!IncomingAmount}"
- HorizontalAlignment="Right">
- <PathIcon Data="{StaticResource arrow_down_right_regular}" Opacity="0.6" />
- <TextBlock Classes="monoSpaced" Text="{Binding IncomingAmount, Converter={x:Static converters:MoneyConverters.ToFormattedString}}" />
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
-
- <!-- Outgoing -->
- <DataGridTemplateColumn Header="Outgoing (BTC)"
- Width="*"
- SortMemberPath="OutgoingAmount">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel x:DataType="history:HistoryItemViewModel"
- IsVisible="{Binding !!OutgoingAmount}"
- HorizontalAlignment="Right">
- <PathIcon Data="{StaticResource arrow_up_right_regular}" Opacity="0.6" />
- <TextBlock Classes="monoSpaced" Text="{Binding OutgoingAmount, Converter={x:Static converters:MoneyConverters.ToFormattedString}}" />
- </StackPanel>
+ <TextBlock Classes="monoSpaced"
+ x:DataType="history:HistoryItemViewModel"
+ Text="{Binding Amount, Converter={x:Static converters:MoneyConverters.ToFormattedString}}"
+ HorizontalAlignment="Right"
+ Margin="10 0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

amount column, icon types