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:
Alby96andClaude Opus 5.5 committed 2026-11-11 19:39:17 +01:00
1 parent acb7e598d1
commit f415dc37a8
39 files changed
+1976 -107

No files matched your search

@@ -48,7 +48,7 @@ else
}
<div class="kh-actions">
<a class="btn" href="./">@T["Common.BackHome"]</a>
<a class="btn ghost" href="@(HelpLinks.DefaultBaseUrl + "Roadmap")" target="_blank" rel="noopener">@T["Pages.ComingSoon.Roadmap"]</a>
<a class="btn ghost" href="@Khaemhat.Web.Help.WikiLibrary.Href("Roadmap")">@T["Pages.ComingSoon.Roadmap"]</a>
</div>
</div>
}
@@ -0,0 +1,73 @@
@page "/aiuto"
@page "/aiuto/{Name}"
@attribute [Authorize]
@using Khaemhat.Application.Configuration
@using Khaemhat.Web.Help
@inject WikiLibrary Wiki
@inject KhaemhatOptions Options
@* The help of SPEC §17 (mockup 011): the wiki page of the screen, from the copy shipped with the application, with
the wiki index at the side, "Apri nel wiki" for the online version and "Segnala un problema". F1 and the "?" of the
top bar open it on the page of the current screen. *@
<KhPageTitle Text="@T.Format("Pages.Help.TabTitle", Current?.Title ?? T["Pages.Help.Title"])" Icon="help" />
<div class="phead">
<div>
<div class="crumbs">@T["Pages.Help.Crumb"]@if (Section is { } section){<text> › @section.Title</text>} › <b>@(Current?.Title ?? Name)</b></div>
<h1>@T.Format("Pages.Help.Heading", Current?.Title ?? T["Pages.Help.Title"])</h1>
</div>
<div class="grow"></div>
<a class="btn" href="@OnlineUrl" target="_blank" rel="noopener"><KhIcon Name="external" /> @T["Pages.Help.OpenWiki"]</a>
@if (IssuesUrl is { } issues)
{
<a class="btn" href="@issues" target="_blank" rel="noopener"><KhIcon Name="alert" /> @T["Pages.Help.Report"]</a>
}
</div>
<div class="kh-help">
<nav class="panel kh-help-index" aria-label="@T["Pages.Help.Index"]">
@foreach (var group in Wiki.Sidebar)
{
<div class="kh-help-group">@group.Title</div>
@foreach (var (page, label) in group.Pages)
{
<a class="kh-help-link @(string.Equals(page, PageName, StringComparison.OrdinalIgnoreCase) ? "on" : null)" href="@WikiLibrary.Href(page)"
aria-current="@(string.Equals(page, PageName, StringComparison.OrdinalIgnoreCase) ? "page" : null)">
<KhIcon Name="file" Class="sm" /> @label
</a>
}
}
</nav>
<article class="panel kh-help-body">
@if (!Wiki.IsAvailable)
{
<div class="callout warn"><KhIcon Name="alert" /> <span>@T["Pages.Help.Missing"]</span></div>
}
else if (Current is null)
{
<div class="callout warn"><KhIcon Name="alert" /> <span>@T.Format("Pages.Help.NotFound", Name ?? string.Empty)</span></div>
}
else
{
@((MarkupString)Current.Html)
}
</article>
</div>
@code {
/// <summary>The wiki page, such as <c>Interfaccia-e-scorciatoie</c>; empty for the wiki home.</summary>
[Parameter]
public string? Name { get; set; }
private string PageName => string.IsNullOrWhiteSpace(Name) ? "Home" : Name;
private WikiPage? Current => Wiki.Get(PageName);
private WikiSection? Section => Wiki.Sidebar.FirstOrDefault(s => s.Pages.Any(p => string.Equals(p.Page, PageName, StringComparison.OrdinalIgnoreCase)));
private string BaseUrl => HelpLinks.BaseUrl(Options.HelpUrl);
private string OnlineUrl => BaseUrl + (Current?.Name ?? PageName);
private string? IssuesUrl => HelpLinks.IssuesUrl(BaseUrl);
}