Add IsEmptyWallet property to balance chart tile
MODIFY
WalletWasabi.Fluent/Helpers/TileHelper.cs
WalletWasabi.Fluent/Helpers/TileHelper.cs
@@ -46,7 +46,7 @@ namespace WalletWasabi.Fluent.Helpers
TilePresetIndex = walletViewModel.LayoutIndex
},
- new WalletBalanceChartTileViewModel(walletViewModel.History.UnfilteredTransactions)
+ new WalletBalanceChartTileViewModel(walletViewModel.History)
{
TilePresets = new ObservableCollection<TilePresetViewModel>()
{
@@ -85,7 +85,7 @@ namespace WalletWasabi.Fluent.Helpers
TilePresetIndex = walletViewModel.LayoutIndex
},
- new WalletBalanceChartTileViewModel(walletViewModel.History.UnfilteredTransactions)
+ new WalletBalanceChartTileViewModel(walletViewModel.History)
{
TilePresets = new ObservableCollection<TilePresetViewModel>()
{

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/Tiles/WalletBalanceChartTileViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/Tiles/WalletBalanceChartTileViewModel.cs
@@ -9,17 +9,21 @@ using ReactiveUI;
using WalletWasabi.Fluent.Helpers;
using WalletWasabi.Fluent.Models;
using WalletWasabi.Fluent.Morph;
+using WalletWasabi.Fluent.ViewModels.Wallets.Home.History;
using WalletWasabi.Fluent.ViewModels.Wallets.Home.History.HistoryItems;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles
{
public partial class WalletBalanceChartTileViewModel : TileViewModel
{
- private readonly ObservableCollection<HistoryItemViewModelBase> _history;
+ private readonly HistoryViewModel _history;
+ private readonly ObservableCollection<HistoryItemViewModelBase> _unfilteredTransactions;
+ [AutoNotify(SetterModifier = AccessModifier.Private)] private bool _isEmptyWallet;
- public WalletBalanceChartTileViewModel(ObservableCollection<HistoryItemViewModelBase> history)
+ public WalletBalanceChartTileViewModel(HistoryViewModel history)
{
_history = history;
+ _unfilteredTransactions = history.UnfilteredTransactions;
Animator = new LineChartAnimatorViewModel();
@@ -32,6 +36,9 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles
IsSelected = item == TimePeriodOption.ThreeMonths
});
}
+
+ _history.WhenAnyValue(x => x.IsTransactionHistoryEmpty)
+ .Subscribe(x => IsEmptyWallet = x);
}
public LineChartAnimatorViewModel Animator { get; }
@@ -42,7 +49,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles
{
base.OnActivated(disposables);
- _history.ToObservableChangeSet()
+ _unfilteredTransactions.ToObservableChangeSet()
.Throttle(TimeSpan.FromMilliseconds(50))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(_ => UpdateSample(TimePeriodOptions.First(x => x.IsSelected)))
@@ -61,9 +68,9 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles
switch (timePeriod)
{
case TimePeriodOption.All:
- if (_history.Any())
+ if (_unfilteredTransactions.Any())
{
- var oldest = _history.Last().Date;
+ var oldest = _unfilteredTransactions.Last().Date;
UpdateSample((DateTimeOffset.Now - oldest) / 125, DateTimeOffset.Now - oldest);
}
@@ -131,7 +138,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles
Animator.XValues.Clear();
Animator.YValues.Clear();
- var values = _history.SelectTimeSampleBackwards(
+ var values = _unfilteredTransactions.SelectTimeSampleBackwards(
x => x.Date,
x => x.Balance,
sampleTime,

Add IsEmptyWallet property to balance chart tile