Render FAQ topics as cards, drop dead scoped CSS
This commit is contained in:
1 parent
2ea8856d65
commit
e38ebf078d
11 files changed
+260
-46
No files matched your search
@@ -9,7 +9,7 @@ public partial class FaqList
|
||||
{
|
||||
[LoggerMessage(
|
||||
Level = LogLevel.Error,
|
||||
Message = "Could not load FAQs from PocketBase; content source is unavailable.")]
|
||||
Message = "Could not load FAQ topics from PocketBase; content source is unavailable.")]
|
||||
private static partial void LogSourceUnavailable(
|
||||
ILogger logger,
|
||||
Exception exception);
|
||||
@@ -23,10 +23,10 @@ public partial class FaqList
|
||||
[CascadingParameter]
|
||||
private HttpContext? HttpContext { get; set; }
|
||||
|
||||
private IReadOnlyList<IGrouping<FaqTopic, Faq>> _groups = [];
|
||||
private IReadOnlyList<FaqTopic> _topics = [];
|
||||
|
||||
// Set when the content source could not be reached or read. The markup then
|
||||
// shows a "temporarily unavailable" note instead of "no questions", matching
|
||||
// shows a "temporarily unavailable" note instead of "no topics", matching
|
||||
// the 503 this sets on the response.
|
||||
private bool _unavailable;
|
||||
|
||||
@@ -34,17 +34,11 @@ public partial class FaqList
|
||||
{
|
||||
try
|
||||
{
|
||||
var faqs = await PocketBase.GetFaqsAsync(HttpContext?.RequestAborted ?? CancellationToken.None);
|
||||
|
||||
// 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!)];
|
||||
_topics = await PocketBase.GetFaqTopicsAsync(HttpContext?.RequestAborted ?? CancellationToken.None);
|
||||
}
|
||||
catch (PocketBaseUnavailableException exception)
|
||||
{
|
||||
// An empty page would claim there are no questions. The site works, its
|
||||
// An empty page would claim there are no topics. The site works, its
|
||||
// data store is down: 503 and an honest note.
|
||||
LogSourceUnavailable(Logger, exception);
|
||||
_unavailable = true;
|
||||
|
||||
Reference in new issue
Block a user