Skip to content

Commit

Permalink
Fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperJMN committed May 28, 2024
1 parent a4f2d86 commit 40030ea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ protected HistoryItemViewModelBase(TransactionModel transaction)
.Subscribe();
}

public bool HasBeenSpedUp { get; set; }

protected HistoryItemViewModelBase(UiContext uiContext, TransactionModel transaction) : this(transaction)
{
UiContext = uiContext;
Expand Down Expand Up @@ -92,6 +90,10 @@ public bool IsSelectedProxy
public ICommand? ClipboardCopyCommand { get; protected set; }

public ICommand? SpeedUpTransactionCommand { get; protected set; }

public bool HasBeenSpedUp { get; set; }

public bool CanBeSpedUp { get; protected set; }

public ICommand? CancelTransactionCommand { get; protected set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,18 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History.HistoryItems;
public partial class TransactionHistoryItemViewModel : HistoryItemViewModelBase
{
private IWalletModel _wallet;
private readonly TransactionModel _transaction;

private TransactionHistoryItemViewModel(IWalletModel wallet, TransactionModel transaction) : base(transaction)
{
_wallet = wallet;
_transaction = transaction;

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

private bool CanBeSpedUp => _transaction.CanSpeedUpTransaction && !IsChild;


public bool TransactionOperationsVisible => Transaction.CanCancelTransaction || CanBeSpedUp;

private void OnSpeedUpTransaction(TransactionModel transaction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<!-- SpeedUp button -->
<Button Classes="plain" ToolTip.Tip="Speed Up Transaction"
Command="{Binding SpeedUpTransactionCommand}"
IsVisible="{Binding $self.IsEffectivelyEnabled}">
IsVisible="{Binding CanBeSpedUp}">
<PathIcon Classes.AlreadySpedUp="{Binding HasBeenSpedUp}"
Classes.NotSpedUp="{Binding !HasBeenSpedUp}"
Height="16">
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 $self.IsEffectivelyEnabled}"
<MenuItem Header="Speed Up Transaction" IsVisible="{Binding CanBeSpedUp}"
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 $self.IsEffectivelyEnabled}"
<MenuItem Header="Speed Up Transaction" IsVisible="{Binding CanBeSpedUp}"
Command="{Binding SpeedUpTransactionCommand}">
<MenuItem.Icon>
<PathIcon Data="{StaticResource rocket_regular}" />
Expand Down

0 comments on commit 40030ea

Please sign in to comment.