mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-28 00:52:52 +01:00
* Swap bootstrap asset files * Update themes and color definitions * Move general bootstrap customizations * Theme updates Theme updates * Remove BuildBundlerMinifier This lead to an error, because BuildBundlerMinifier and BundlerMinifier.Core seem to conflict here. Details: https://stackoverflow.com/a/61119586 * Rewplace btn-block class with w-100 * Update badge classes * Remove old font family head variable * Update margin classes * Cleanups * Update float classes * Update text classes * Update padding classes * Update border classes * UPdate dropdown classes * Update select classes * Update neutral custom props * Update bootstrap and customizations * Update ChromeDriver; disable smooth scroll https://github.com/SeleniumHQ/selenium/issues/8295 * Improve alert messages * Improve bootstrap customizations * Disable reduced motion See also 7358282f * Update Bootstrap data attributes * Update file inputs * Update input groups * Replace deprecated jumbotron class * Update variables; re-add negative margin util classes * Update cards * Update form labels * Debug alerts * Fix aria-labelledby associations * Dropdown-related test fixes * Fix CanUseWebhooks test * Test fixes * Nav updates * Fix nav usage in wallet send and payouts * Update alert and modal close buttons * Re-add backdrop properties * Upgrade Bootstrap to v5 final * Update screen reader classes * Update font-weight classes * Update monospace font classes * Update accordians * Update close icon usage * Cleanup * Update scripts and style integrations * Update input group texts * Update LN node setup page * Update more form control classes * Update inline forms * Add js specific test * Upgrade Vue.js * Remove unused JS * Upgrade Bootstrap to v5.0.1 * Try container related test updates * Separate jQuery bundle * Remove jQuery from LND seed backup page * Remove unused code * Refactor email autofill js * Refactor camera scanner JS * Re-add tests * Re-add BuildBundlerMinifier * Do not minify bundles containing Bootstrap Details https://github.com/madskristensen/BundlerMinifier/issues/558 * Update bundles * Cleanup JS test * Cleanup tests involving dropdowns * Cleanup tests involving collapses * Cleanup locale additions in ConfigureCore * Cleanup bundles * Remove duplicate status message * Cleanup formatting * Fix missing validation scripts * Remove unused unminified Bootstrap js files * Fix classic theme * Fix Casa theme * Fix PoS validation
98 lines
4.2 KiB
Text
98 lines
4.2 KiB
Text
@inject LinkGenerator linkGenerator
|
|
@inject UserManager<ApplicationUser> UserManager
|
|
@inject CssThemeManager CssThemeManager
|
|
@using BTCPayServer.HostedServices
|
|
@using BTCPayServer.Views.Notifications
|
|
@model BTCPayServer.Components.NotificationsDropdown.NotificationSummaryViewModel
|
|
@addTagHelper *, BundlerMinifier.TagHelpers
|
|
|
|
@if (Model.UnseenCount > 0)
|
|
{
|
|
<li class="nav-item dropdown" id="notifications-nav-item">
|
|
<a class="nav-link js-scroll-trigger @ViewData.IsActiveCategory(typeof(NotificationsNavPages))" href="#" id="NotificationsDropdownToggle" role="button" data-bs-toggle="dropdown">
|
|
<span class="d-inline-block d-lg-none">Notifications</span>
|
|
<i class="fa fa-bell d-lg-inline-block d-none"></i>
|
|
<span class="notification-badge badge rounded-pill bg-danger">@Model.UnseenCount</span>
|
|
</a>
|
|
<div class="dropdown-menu dropdown-menu-end text-center notification-dropdown" aria-labelledby="NotificationsDropdownToggle">
|
|
<div class="d-flex align-items-center justify-content-between py-3 px-4 border-bottom border-light">
|
|
<h5 class="m-0">Notifications</h5>
|
|
<form asp-controller="Notifications" asp-action="MarkAllAsSeen" asp-route-returnUrl="@Context.Request.GetCurrentPathWithQueryString()" method="post">
|
|
<button class="btn btn-link p-0" type="submit">Mark all as seen</button>
|
|
</form>
|
|
</div>
|
|
@foreach (var notif in Model.Last5)
|
|
{
|
|
<a asp-action="NotificationPassThrough" asp-controller="Notifications" asp-route-id="@notif.Id" class="notification d-flex align-items-center dropdown-item border-bottom border-light py-3 px-4">
|
|
<div class="me-3">
|
|
<vc:icon symbol="note" />
|
|
</div>
|
|
|
|
<div class="notification-item__content">
|
|
<div class="text-start text-wrap">
|
|
@notif.Body
|
|
</div>
|
|
<div class="text-start d-flex">
|
|
<small class="text-muted" data-timeago-unixms="@notif.Created.ToUnixTimeMilliseconds()">@notif.Created.ToTimeAgo()</small>
|
|
</div>
|
|
</div>
|
|
</a>
|
|
}
|
|
<div class="p-3">
|
|
<a asp-controller="Notifications" asp-action="Index">View all</a>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
}
|
|
else
|
|
{
|
|
<li class="nav-item" id="notifications-nav-item">
|
|
<a asp-controller="Notifications" asp-action="Index" title="Notifications" class="nav-link js-scroll-trigger @ViewData.IsActiveCategory(typeof(NotificationsNavPages))" id="Notifications">
|
|
<span class="d-lg-none d-sm-block">Notifications</span><i class="fa fa-bell d-lg-inline-block d-none"></i>
|
|
</a>
|
|
</li>
|
|
}
|
|
@{
|
|
var disabled = CssThemeManager.Policies.DisableInstantNotifications;
|
|
if (!disabled)
|
|
{
|
|
var user = await UserManager.GetUserAsync(User);
|
|
disabled = user?.DisabledNotifications == "all";
|
|
}
|
|
}
|
|
@if (!disabled)
|
|
{
|
|
|
|
<script type="text/javascript">
|
|
|
|
var supportsWebSockets = 'WebSocket' in window && window.WebSocket.CLOSING === 2;
|
|
|
|
if (supportsWebSockets) {
|
|
|
|
var loc = window.location, ws_uri;
|
|
if (loc.protocol === "https:") {
|
|
ws_uri = "wss:";
|
|
} else {
|
|
ws_uri = "ws:";
|
|
}
|
|
ws_uri += "//" + loc.host;
|
|
ws_uri += "@linkGenerator.GetPathByAction("SubscribeUpdates", "Notifications")";
|
|
var newDataEndpoint = "@linkGenerator.GetPathByAction("GetNotificationDropdownUI", "Notifications")";
|
|
|
|
try {
|
|
socket = new WebSocket(ws_uri);
|
|
socket.onmessage = function (e) {
|
|
$.get(newDataEndpoint, function(data){
|
|
$("#notifications-nav-item").replaceWith($(data));
|
|
});
|
|
};
|
|
socket.onerror = function (e) {
|
|
console.error("Error while connecting to websocket for notifications (callback)", e);
|
|
};
|
|
}
|
|
catch (e) {
|
|
console.error("Error while connecting to websocket for notifications", e);
|
|
}
|
|
}
|
|
</script>
|
|
}
|