feat: in-app help, notifications panel and global search (#32)
F1 and "?" now open the wiki page of the screen inside the application (/aiuto, mockup 011) from a copy of the wiki shipped next to the program, so help works offline and always matches the installed version. Markdown is converted in-house and fully encoded; images of the repository are served from the copy. KHAEMHAT_HELP_URL sets the online wiki behind "Apri nel wiki"; "Segnala un problema" opens a new issue of that repo. A test checks that every page and menu entry has an existing wiki page. The bell opens a notifications panel (mockup 010) with all/unread filters and mark read. Broadcast notifications are now read per user through sys_notification_reads / notification_reads instead of one shared read_at. The global search asks ISearchProvider implementations through GlobalSearchService after a short pause; the first provider finds help pages and sections, # and @ say which modules will fill them. Escape also closes a side panel when the focus fell out of it. Decisions in ADR 0023. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
acb7e598d1
commit
f415dc37a8
39 files changed
+1976
-107
No files matched your search
@@ -5,6 +5,7 @@ using Khaemhat.Core.Common;
|
||||
using Khaemhat.Infrastructure.Logging;
|
||||
using Khaemhat.Infrastructure.Security;
|
||||
using Khaemhat.Web.Components;
|
||||
using Khaemhat.Web.Help;
|
||||
using Khaemhat.Web.Security;
|
||||
using Microsoft.AspNetCore.Antiforgery;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
@@ -109,6 +110,7 @@ public static class KhaemhatApp
|
||||
app.MapStaticAssets();
|
||||
app.MapSignOut();
|
||||
app.MapCompanySwitch();
|
||||
app.MapHelp();
|
||||
app.MapRazorComponents<App>()
|
||||
.AddInteractiveServerRenderMode();
|
||||
|
||||
@@ -130,6 +132,27 @@ public static class KhaemhatApp
|
||||
}
|
||||
}
|
||||
|
||||
// The images of the help pages (mockups, icons) from the copy of the wiki, and /help, the address of SPEC §17, which
|
||||
// leads to the help page inside the application (mockup 011).
|
||||
private static void MapHelp(this IEndpointRouteBuilder endpoints)
|
||||
{
|
||||
endpoints.MapGet(WikiLibrary.MediaPath + "/{**path}", (string path, WikiLibrary wiki) =>
|
||||
wiki.MediaFile(path) is { } file
|
||||
? Results.File(file, Path.GetExtension(file).ToLowerInvariant() switch
|
||||
{
|
||||
".svg" => "image/svg+xml",
|
||||
".jpg" or ".jpeg" => "image/jpeg",
|
||||
".gif" => "image/gif",
|
||||
".webp" => "image/webp",
|
||||
_ => "image/png",
|
||||
})
|
||||
: Results.NotFound())
|
||||
.AllowAnonymous();
|
||||
endpoints.MapGet("/help/{**page}", (HttpContext context, string? page) =>
|
||||
Results.Redirect(context.Request.PathBase + WikiLibrary.BasePath + (string.IsNullOrEmpty(page) ? string.Empty : "/" + Uri.EscapeDataString(page))));
|
||||
endpoints.MapGet("/help", (HttpContext context) => Results.Redirect(context.Request.PathBase + WikiLibrary.BasePath));
|
||||
}
|
||||
|
||||
// POST /session/company: an instance account chooses the company of its session (top bar, SPEC §10.2). The page
|
||||
// is reloaded, so the new circuit starts in the new company.
|
||||
private static void MapCompanySwitch(this IEndpointRouteBuilder endpoints) =>
|
||||
|
||||
@@ -10,6 +10,7 @@ using Khaemhat.Application.Localization;
|
||||
using Khaemhat.Application.Modules;
|
||||
using Khaemhat.Application.Notifications;
|
||||
using Khaemhat.Application.Preferences;
|
||||
using Khaemhat.Application.Search;
|
||||
using Khaemhat.Application.Security;
|
||||
using Khaemhat.Core.Caching;
|
||||
using Khaemhat.Core.Files;
|
||||
@@ -27,6 +28,7 @@ using Khaemhat.Infrastructure.Files;
|
||||
using Khaemhat.Infrastructure.Licensing;
|
||||
using Khaemhat.Infrastructure.Logging;
|
||||
using Khaemhat.Infrastructure.Security;
|
||||
using Khaemhat.Web.Help;
|
||||
using Khaemhat.Web.Security;
|
||||
using Khaemhat.Web.Shell;
|
||||
|
||||
@@ -50,6 +52,9 @@ internal static class KhaemhatServices
|
||||
{
|
||||
var dataAssembly = typeof(CompanyRegistry).Assembly;
|
||||
services.AddSingleton(options);
|
||||
services.AddSingleton(_ => new WikiLibrary());
|
||||
services.AddSingleton<ISearchProvider, HelpSearchProvider>();
|
||||
services.AddSingleton<GlobalSearchService>();
|
||||
services.AddSingleton(logSink);
|
||||
services.AddSingleton(TimeProvider.System);
|
||||
services.AddSingleton<BootstrapState>();
|
||||
|
||||
Reference in new issue
Block a user