Group FAQs by a topic relation, ordered; drop unused FAQ teaser

This commit is contained in:
tleininger committed 2026-09-29 22:11:30 +02:00
1 parent 28944c155a
commit 2ea8856d65
14 files changed
+328 -128

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ else
@foreach (var group in _groups)
{
<section class="faq-topic">
<h2>@group.Key</h2>
<h2>@group.Key.Title</h2>
@foreach (var faq in group)
{
<details class="faq-item">
@@ -23,7 +23,7 @@ public partial class FaqList
[CascadingParameter]
private HttpContext? HttpContext { get; set; }
private IReadOnlyList<IGrouping<string, Faq>> _groups = [];
private IReadOnlyList<IGrouping<FaqTopic, Faq>> _groups = [];
// Set when the content source could not be reached or read. The markup then
// shows a "temporarily unavailable" note instead of "no questions", matching
@@ -35,7 +35,12 @@ public partial class FaqList
try
{
var faqs = await PocketBase.GetFaqsAsync(HttpContext?.RequestAborted ?? CancellationToken.None);
_groups = [.. faqs.GroupBy(faq => faq.Topic)];
// GetFaqsAsync sorts by topic.order first, so grouping in encounter order
// keeps the topic groups in the order an editor gave the topics. Entries
// without an expanded topic have no group and are skipped rather than
// grouped under a null heading.
_groups = [.. faqs.Where(faq => faq.Topic is not null).GroupBy(faq => faq.Topic!)];
}
catch (PocketBaseUnavailableException exception)
{