Render FAQ topics as cards, drop dead scoped CSS

This commit is contained in:
tleininger committed 2026-09-30 14:58:12 +02:00
1 parent 2ea8856d65
commit e38ebf078d
11 files changed
+260 -46

No files matched your search

@@ -90,6 +90,54 @@ public sealed class PocketBaseClient(HttpClient httpClient)
public Task<IReadOnlyList<Faq>> GetFaqsAsync(CancellationToken token = default)
=> GetRecordsAsync<Faq>("faqs", "topic.order,order", token, expand: "topic");
/// <summary>
/// Gets all public FAQ topics, ordered by <see cref="FaqTopic.Order"/>.
/// </summary>
/// <remarks>
/// Backs the FAQ overview, which lists the topics as links to their own pages.
/// The questions are not loaded here; the topic page loads them per topic via
/// <see cref="GetFaqTopicBySlugAsync"/>.
/// </remarks>
/// <inheritdoc cref="GetPagesAsync" path="/param"/>
/// <returns>
/// The public FAQ topics, or an empty list if there are none.
/// </returns>
/// <inheritdoc cref="GetPagesAsync" path="/exception"/>
public Task<IReadOnlyList<FaqTopic>> GetFaqTopicsAsync(CancellationToken token = default)
=> GetRecordsAsync<FaqTopic>("faq_topics", "order", token);
/// <summary>
/// Gets one public FAQ topic by its slug, with its questions expanded, or
/// <see langword="null"/> when no public topic has that slug.
/// </summary>
/// <remarks>
/// Backs the topic's own page at <c>/faqs/{slug}</c>: it loads the single topic
/// and, through the <c>faqs_via_topic</c> back-relation, the questions grouped
/// under it, so the page needs one request. The slug is unique, so at most one
/// record matches.
/// </remarks>
/// <param name="slug">
/// The topic slug from the URL, e.g. <c>"cafeteria"</c>.
/// </param>
/// <inheritdoc cref="GetPagesAsync" path="/param[@name='token']"/>
/// <returns>
/// The matching public topic with its questions, or <see langword="null"/> if
/// none matches.
/// </returns>
/// <inheritdoc cref="GetPagesAsync" path="/exception"/>
public async Task<FaqTopic?> GetFaqTopicBySlugAsync(
string slug,
CancellationToken token = default)
{
var topics = await GetRecordsAsync<FaqTopic>(
"faq_topics",
"order",
token,
expand: "faqs_via_topic");
return topics.FirstOrDefault(
topic => string.Equals(topic.Slug, slug, StringComparison.OrdinalIgnoreCase));
}
/// <summary>
/// Gets all public records of a collection in a single request.
/// </summary>