Minor cleanups (#5460)

This commit is contained in:
d11n 2023-11-20 11:18:19 +01:00 committed by GitHub
parent 773f8a9aea
commit ccf9cfa332
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 14 additions and 25 deletions

View file

@ -1,4 +1,3 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.JSInterop;
namespace BTCPayServer.Blazor

View file

@ -1,4 +1,3 @@
@using System.Security.Claims
@using BTCPayServer.Abstractions.Contracts;
@using BTCPayServer.Configuration;
@using BTCPayServer.Data;
@ -86,7 +85,8 @@
}
public void Dispose() => _EventAggregatorListener?.Dispose();
string SeenCount(int? count)
static string SeenCount(int? count)
{
if (count is not int c)
return "0";
@ -94,12 +94,14 @@
return $"{NotificationManager.MaxUnseen - 1}+";
return c.ToString();
}
void UpdateState((List<NotificationViewModel> Items, int? Count) res)
{
UnseenCount = SeenCount(res.Count);
Last5 = res.Items;
}
protected async override Task OnParametersSetAsync()
protected override async Task OnParametersSetAsync()
{
if (await GetUserId() is string userId)
{
@ -117,15 +119,16 @@
}
}
}
async Task<string>
GetUserId()
async Task<string> GetUserId()
{
var state = await _AuthenticationStateProvider.GetAuthenticationStateAsync();
if (!state.User.Identity.IsAuthenticated)
return null;
return _UserManager.GetUserId(state.User);
}
public async Task MarkAllAsSeen()
private async Task MarkAllAsSeen()
{
if (await GetUserId() is string userId)
{
@ -133,6 +136,7 @@
UnseenCount = "0";
}
}
private static string NotificationIcon(string type)
{
return type switch

View file

@ -1,7 +1,5 @@
@using BTCPayServer.Services
@using BTCPayServer.Abstractions.Contracts
@using BTCPayServer.Abstractions.Extensions
@using BTCPayServer.Abstractions.TagHelpers
@inject ThemeSettings Theme
@inject IFileService FileService
@model BTCPayServer.Components.MainLogo.MainLogoViewModel

View file

@ -4,7 +4,6 @@
@using BTCPayServer.Views.Manage
@using BTCPayServer.Views.PaymentRequest
@using BTCPayServer.Views.Wallets
@using BTCPayServer.Abstractions.Extensions
@using BTCPayServer.Client
@using BTCPayServer.Components.ThemeSwitch
@using BTCPayServer.Components.UIExtensionPoint

View file

@ -1,4 +1,3 @@
@using BTCPayServer.Abstractions.Extensions
@using BTCPayServer.Abstractions.Contracts
@using BTCPayServer.Client
@using BTCPayServer.Components.MainLogo

View file

@ -1,6 +1,4 @@
@using BTCPayServer.Abstractions.Extensions
@using BTCPayServer.Services
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using BTCPayServer.Abstractions.Contracts
@inject ThemeSettings Theme
@inject IFileService FileService

View file

@ -239,7 +239,7 @@
<td colspan="2" class="pt-4">
<button id="CartSubmit" class="btn btn-primary btn-lg w-100" :disabled="payButtonLoading" type="submit">
<div v-if="payButtonLoading" class="spinner-border spinner-border-sm" id="pay-button-spinner" role="status">
<span class="sr-only">Loading...</span>
<span class="visually-hidden">Loading...</span>
</div>
<template v-else>Pay</template>
</button>

View file

@ -53,7 +53,7 @@
</div>
<button class="btn btn-lg btn-primary mx-3" type="submit" :disabled="payButtonLoading" id="pay-button">
<div v-if="payButtonLoading" class="spinner-border spinner-border-sm" id="pay-button-spinner" role="status">
<span class="sr-only">Loading...</span>
<span class="visually-hidden">Loading...</span>
</div>
<template v-else>Charge</template>
</button>

View file

@ -1,15 +1,12 @@
@using BTCPayServer.Abstractions.Extensions
@using BTCPayServer.Components.StoreSelector
@using BTCPayServer.Components.MainNav
@inject Microsoft.AspNetCore.Http.IHttpContextAccessor _context;
@inject BTCPayServer.Services.BTCPayServerEnvironment _env
@inject SignInManager<ApplicationUser> _signInManager
@inject UserManager<ApplicationUser> _userManager
@inject LinkGenerator _linkGenerator
@inject BTCPayServer.Services.PoliciesSettings PoliciesSettings
@{
var notificationsReturnUrl = Context.Request.GetCurrentPathWithQueryString();
var notificationDisabled = PoliciesSettings.DisableInstantNotifications;
if (!notificationDisabled)
{

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -85,10 +85,6 @@ a.unobtrusive-link {
text-decoration: inherit;
}
.btn.btn-link:focus {
box-shadow: none;
}
[aria-expanded] > svg.icon-caret-down {
flex-shrink: 0;
width: 24px;

View file

@ -155,7 +155,7 @@ const initLabelManagers = () => {
document.addEventListener("DOMContentLoaded", () => {
// sticky header
const stickyHeader = document.querySelector('#mainContent > section > .sticky-header');
const stickyHeader = document.querySelector('#mainContent > section .sticky-header');
if (stickyHeader) {
const setStickyHeaderHeight = () => {
document.documentElement.style.setProperty('--sticky-header-height', `${stickyHeader.offsetHeight}px`)
@ -164,7 +164,6 @@ document.addEventListener("DOMContentLoaded", () => {
debounce('resize', setStickyHeaderHeight, 50)
});
setStickyHeaderHeight();
}
// initialize timezone offset value if field is present in page