mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Async dashboard (#3916)
* Dashboard: Load Lightning balance async, display default currency * Simplify approach, improve views and scripts * Async tiles Async tiles * Add period for app sales * Fix missing keypad view sales * Fix after rebase * Fix awaited call * Fix build Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com>
This commit is contained in:
@@ -21,32 +21,27 @@ namespace BTCPayServer.Components.StoreRecentTransactions;
|
||||
|
||||
public class StoreRecentTransactions : ViewComponent
|
||||
{
|
||||
private string CryptoCode;
|
||||
private readonly StoreRepository _storeRepo;
|
||||
private readonly ApplicationDbContextFactory _dbContextFactory;
|
||||
private readonly BTCPayWalletProvider _walletProvider;
|
||||
|
||||
public BTCPayNetworkProvider NetworkProvider { get; }
|
||||
|
||||
public StoreRecentTransactions(
|
||||
StoreRepository storeRepo,
|
||||
BTCPayNetworkProvider networkProvider,
|
||||
NBXplorerConnectionFactory connectionFactory,
|
||||
BTCPayWalletProvider walletProvider,
|
||||
ApplicationDbContextFactory dbContextFactory)
|
||||
BTCPayWalletProvider walletProvider)
|
||||
{
|
||||
_storeRepo = storeRepo;
|
||||
NetworkProvider = networkProvider;
|
||||
_walletProvider = walletProvider;
|
||||
_dbContextFactory = dbContextFactory;
|
||||
CryptoCode = networkProvider.DefaultNetwork.CryptoCode;
|
||||
}
|
||||
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync(StoreData store)
|
||||
public async Task<IViewComponentResult> InvokeAsync(StoreRecentTransactionsViewModel vm)
|
||||
{
|
||||
var walletId = new WalletId(store.Id, CryptoCode);
|
||||
var derivationSettings = store.GetDerivationSchemeSettings(NetworkProvider, walletId.CryptoCode);
|
||||
if (vm.Store == null) throw new ArgumentNullException(nameof(vm.Store));
|
||||
if (vm.CryptoCode == null) throw new ArgumentNullException(nameof(vm.CryptoCode));
|
||||
|
||||
vm.WalletId = new WalletId(vm.Store.Id, vm.CryptoCode);
|
||||
|
||||
if (vm.InitialRendering) return View(vm);
|
||||
|
||||
var derivationSettings = vm.Store.GetDerivationSchemeSettings(NetworkProvider, vm.CryptoCode);
|
||||
var transactions = new List<StoreRecentTransactionViewModel>();
|
||||
if (derivationSettings?.AccountDerivation is not null)
|
||||
{
|
||||
@@ -66,13 +61,8 @@ public class StoreRecentTransactions : ViewComponent
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
||||
var vm = new StoreRecentTransactionsViewModel
|
||||
{
|
||||
Store = store,
|
||||
WalletId = walletId,
|
||||
Transactions = transactions
|
||||
};
|
||||
vm.Transactions = transactions;
|
||||
|
||||
return View(vm);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user