using Microsoft.AspNetCore.Mvc; namespace PlanTempus.Application.Features.Dashboard.Components; public class AttentionItemViewComponent : ViewComponent { public IViewComponentResult Invoke(string key) { var model = AttentionItemCatalog.Get(key); return View(model); } } public class AttentionItemViewModel { public required string Key { get; init; } public required string Icon { get; init; } public required string Title { get; init; } public required string Description { get; init; } public required string ActionText { get; init; } public required string Severity { get; init; } } public static class AttentionItemCatalog { private static readonly Dictionary Attentions = new() { ["attention-1"] = new AttentionItemViewModel { Key = "attention-1", Icon = "x-circle", Title = "Aflyst booking", Description = "Mette Hansen aflyste kl. 15:00 – tid nu ledig", ActionText = "Fyld tid", Severity = "urgent" }, ["attention-2"] = new AttentionItemViewModel { Key = "attention-2", Icon = "clock", Title = "Ubekræftet booking", Description = "Ida Rasmussen har ikke bekræftet kl. 11:30", ActionText = "Send påmindelse", Severity = "warning" }, ["attention-3"] = new AttentionItemViewModel { Key = "attention-3", Icon = "gift", Title = "Gavekort udløber snart", Description = "GC-D2R4-6TY9 udløber om 3 uger (200 DKK)", ActionText = "Se gavekort", Severity = "info" } }; public static AttentionItemViewModel Get(string key) { if (Attentions.TryGetValue(key, out var attention)) return attention; throw new KeyNotFoundException($"AttentionItem with key '{key}' not found"); } public static IEnumerable AllKeys => Attentions.Keys; }