mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-23 17:04:19 +01:00
Empty states: Setup guide for store and wallet (#3255)
* Store Selector: Create first store button * Add setup guide to homepage * Policy update for stores list * Fix test * Initial create store button as primary * Add notifications list to homepage * Remove back to list from store create view * Adapt content padding on desktop * Add store home view with setup guide * Fix active page nav highlighting * Test fix * Remove What's Next section * Rename Store Home to Dashboard * Fix Lightning setup link * Add tests for store setup guide * Update BTCPayServer/Views/Home/Home.cshtml Co-authored-by: Pavlenex <pavle@pavle.org> * Update BTCPayServer/Views/Stores/Dashboard.cshtml Co-authored-by: Pavlenex <pavle@pavle.org> * Remove setup guide on global homepage * Remove Shopify setup link from nav * Fix content container max-width on desktop Co-authored-by: Pavlenex <pavle@pavle.org>
This commit is contained in:
@@ -8,11 +8,14 @@ using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Constants;
|
||||
using BTCPayServer.Abstractions.Contracts;
|
||||
using BTCPayServer.Client;
|
||||
using BTCPayServer.Components.StoreSelector;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Filters;
|
||||
using BTCPayServer.HostedServices;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Models.StoreViewModels;
|
||||
using BTCPayServer.Payments;
|
||||
using BTCPayServer.Payments.Lightning;
|
||||
using BTCPayServer.Security;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Services.Apps;
|
||||
@@ -38,6 +41,7 @@ namespace BTCPayServer.Controllers
|
||||
private readonly ISettingsRepository _settingsRepository;
|
||||
private readonly StoreRepository _storeRepository;
|
||||
private readonly IFileProvider _fileProvider;
|
||||
private readonly BTCPayNetworkProvider _networkProvider;
|
||||
private IHttpClientFactory HttpClientFactory { get; }
|
||||
private SignInManager<ApplicationUser> SignInManager { get; }
|
||||
public LanguageService LanguageService { get; }
|
||||
@@ -47,11 +51,13 @@ namespace BTCPayServer.Controllers
|
||||
IWebHostEnvironment webHostEnvironment,
|
||||
LanguageService languageService,
|
||||
StoreRepository storeRepository,
|
||||
BTCPayNetworkProvider networkProvider,
|
||||
SignInManager<ApplicationUser> signInManager)
|
||||
{
|
||||
_settingsRepository = settingsRepository;
|
||||
HttpClientFactory = httpClientFactory;
|
||||
LanguageService = languageService;
|
||||
_networkProvider = networkProvider;
|
||||
_storeRepository = storeRepository;
|
||||
_fileProvider = webHostEnvironment.WebRootFileProvider;
|
||||
SignInManager = signInManager;
|
||||
@@ -68,17 +74,25 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
if (SignInManager.IsSignedIn(User))
|
||||
{
|
||||
var userId = SignInManager.UserManager.GetUserId(HttpContext.User);
|
||||
var storeId = HttpContext.GetUserPrefsCookie()?.CurrentStoreId;
|
||||
if (storeId != null)
|
||||
{
|
||||
var userId = SignInManager.UserManager.GetUserId(HttpContext.User);
|
||||
var store = await _storeRepository.FindStore(storeId, userId);
|
||||
if (store != null)
|
||||
{
|
||||
HttpContext.SetStoreData(store);
|
||||
}
|
||||
}
|
||||
return View("Home");
|
||||
|
||||
var stores = await _storeRepository.GetStoresByUserId(userId);
|
||||
|
||||
var vm = new HomeViewModel
|
||||
{
|
||||
HasStore = stores.Any()
|
||||
};
|
||||
|
||||
return View("Home", vm);
|
||||
}
|
||||
|
||||
return Challenge();
|
||||
@@ -91,7 +105,6 @@ namespace BTCPayServer.Controllers
|
||||
return Json(LanguageService.GetLanguages(), new JsonSerializerSettings { Formatting = Formatting.Indented });
|
||||
}
|
||||
|
||||
|
||||
[Route("misc/permissions")]
|
||||
[Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie + "," + AuthenticationSchemes.Greenfield)]
|
||||
public IActionResult Permissions()
|
||||
|
||||
Reference in New Issue
Block a user