Skip to content

Commit

Permalink
Remove Speed Up actions in children
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperJMN committed May 27, 2024
1 parent 4c51650 commit 87c9b46
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Fluent.Models.UI;
using WalletWasabi.Fluent.Models.Wallets;
Expand All @@ -9,9 +10,9 @@ public partial class SpeedUpHistoryItemViewModel : HistoryItemViewModelBase
public SpeedUpHistoryItemViewModel(UiContext uiContext, IWalletModel wallet, TransactionModel transaction, HistoryItemViewModelBase? parent) : base(uiContext, transaction)
{
ShowDetailsCommand = ReactiveCommand.Create(() => UiContext.Navigate().To().TransactionDetails(wallet, transaction));
SpeedUpTransactionCommand = parent?.SpeedUpTransactionCommand;
SpeedUpTransactionCommand = ReactiveCommand.Create(() => { }, Observable.Return(false));
CancelTransactionCommand = parent?.CancelTransactionCommand;
}

public bool TransactionOperationsVisible => Transaction.CanCancelTransaction || Transaction.CanSpeedUpTransaction;
public bool TransactionOperationsVisible => Transaction.CanCancelTransaction;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ private TransactionHistoryItemViewModel(IWalletModel wallet, TransactionModel tr
_wallet = wallet;

ShowDetailsCommand = ReactiveCommand.Create(() => UiContext.Navigate().To().TransactionDetails(wallet, transaction));
SpeedUpTransactionCommand = ReactiveCommand.Create(() => OnSpeedUpTransaction(transaction), Observable.Return(transaction.CanSpeedUpTransaction));
SpeedUpTransactionCommand = ReactiveCommand.Create(() => OnSpeedUpTransaction(transaction), Observable.Return(transaction.CanSpeedUpTransaction && !IsChild));
CancelTransactionCommand = ReactiveCommand.Create(() => OnCancelTransaction(transaction), Observable.Return(transaction.CanCancelTransaction));
}

public bool TransactionOperationsVisible => Transaction.CanCancelTransaction || Transaction.CanSpeedUpTransaction;
public bool TransactionOperationsVisible => Transaction.CanCancelTransaction || Transaction.CanSpeedUpTransaction && !IsChild;

private void OnSpeedUpTransaction(TransactionModel transaction)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ private HistoryItemViewModelBase CreateViewModel(TransactionModel transaction, H

foreach (var child in children)
{
viewModel.Children.Add(CreateViewModel(child, viewModel));
var historyItemViewModelBase = CreateViewModel(child, viewModel);
viewModel.Children.Add(historyItemViewModelBase);
}

return viewModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<!-- SpeedUp -->
<Button Classes="plain" ToolTip.Tip="Speed Up Transaction"
Command="{Binding SpeedUpTransactionCommand}"
IsVisible="{Binding Transaction.CanSpeedUpTransaction}">
IsVisible="{Binding $self.IsEffectivelyEnabled}">
<PathIcon Data="{StaticResource rocket_regular}" Height="16" />
</Button>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</MenuItem.Icon>
</MenuItem>
<Separator IsVisible="{Binding TransactionOperationsVisible}" />
<MenuItem Header="Speed Up Transaction" IsVisible="{Binding Transaction.CanSpeedUpTransaction}"
<MenuItem Header="Speed Up Transaction" IsVisible="{Binding $self.IsEffectivelyEnabled}"
Command="{Binding SpeedUpTransactionCommand}">
<MenuItem.Icon>
<PathIcon Data="{StaticResource rocket_regular}" />
Expand Down Expand Up @@ -86,7 +86,7 @@
</ContextMenu>

<ContextMenu x:Key="SpeedUpContextMenu" x:DataType="historyItems:SpeedUpHistoryItemViewModel">
<MenuItem Header="Speed Up Transaction" IsVisible="{Binding Transaction.CanSpeedUpTransaction}"
<MenuItem Header="Speed Up Transaction" IsVisible="{Binding $self.IsEffectivelyEnabled}"
Command="{Binding SpeedUpTransactionCommand}">
<MenuItem.Icon>
<PathIcon Data="{StaticResource rocket_regular}" />
Expand Down

0 comments on commit 87c9b46

Please sign in to comment.