mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 06:35:13 +01:00
* Update wallet navigation * Find matching text color for label bg color * Cleanup * Extract WalletNav component * Move PSBT link to Send and Rescan link to Settings * Update transactions view * Test fixes * Adapt invoices list actions * Show invoice actions only if there are any invoices * Link wallet name and balance to tranactions list * Move wallet related actions from list to settings * Fix main menu z-index Needs a value between fixed and the offcanvas backdrop, see https://getbootstrap.com/docs/5.1/layout/z-index/ * Update receive and send views
78 lines
2.7 KiB
C#
78 lines
2.7 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using BTCPayServer.Controllers;
|
|
using BTCPayServer.Data;
|
|
using BTCPayServer.Models.StoreViewModels;
|
|
using BTCPayServer.Payments;
|
|
using BTCPayServer.Payments.Lightning;
|
|
using BTCPayServer.Services.Apps;
|
|
using BTCPayServer.Services.Invoices;
|
|
using BTCPayServer.Services.Stores;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
|
using NBitcoin;
|
|
using NBitcoin.Secp256k1;
|
|
|
|
namespace BTCPayServer.Components.MainNav
|
|
{
|
|
public class MainNav : ViewComponent
|
|
{
|
|
private readonly AppService _appService;
|
|
private readonly StoreRepository _storeRepo;
|
|
private readonly UIStoresController _storesController;
|
|
private readonly BTCPayNetworkProvider _networkProvider;
|
|
private readonly UserManager<ApplicationUser> _userManager;
|
|
private readonly PaymentMethodHandlerDictionary _paymentMethodHandlerDictionary;
|
|
|
|
public MainNav(
|
|
AppService appService,
|
|
StoreRepository storeRepo,
|
|
UIStoresController storesController,
|
|
BTCPayNetworkProvider networkProvider,
|
|
UserManager<ApplicationUser> userManager,
|
|
PaymentMethodHandlerDictionary paymentMethodHandlerDictionary)
|
|
{
|
|
_storeRepo = storeRepo;
|
|
_appService = appService;
|
|
_userManager = userManager;
|
|
_networkProvider = networkProvider;
|
|
_storesController = storesController;
|
|
_paymentMethodHandlerDictionary = paymentMethodHandlerDictionary;
|
|
}
|
|
|
|
public async Task<IViewComponentResult> InvokeAsync()
|
|
{
|
|
var store = ViewContext.HttpContext.GetStoreData();
|
|
var vm = new MainNavViewModel { Store = store };
|
|
#if ALTCOINS
|
|
vm.AltcoinsBuild = true;
|
|
#endif
|
|
if (store != null)
|
|
{
|
|
var storeBlob = store.GetStoreBlob();
|
|
|
|
// Wallets
|
|
_storesController.AddPaymentMethods(store, storeBlob,
|
|
out var derivationSchemes, out var lightningNodes);
|
|
vm.DerivationSchemes = derivationSchemes;
|
|
vm.LightningNodes = lightningNodes;
|
|
|
|
// Apps
|
|
var apps = await _appService.GetAllApps(UserId, false, store.Id);
|
|
vm.Apps = apps.Select(a => new StoreApp
|
|
{
|
|
Id = a.Id,
|
|
AppName = a.AppName,
|
|
AppType = a.AppType,
|
|
IsOwner = a.IsOwner
|
|
}).ToList();
|
|
}
|
|
|
|
return View(vm);
|
|
}
|
|
|
|
private string UserId => _userManager.GetUserId(HttpContext.User);
|
|
}
|
|
}
|