using Microsoft.AspNetCore.Mvc; namespace PlanTempus.Application.Features.Dashboard.Components; /// /// ViewComponent for rendering the waitlist mini card on the dashboard. /// Displays a count badge and triggers the waitlist drawer when clicked. /// public class WaitlistCardViewComponent : ViewComponent { public IViewComponentResult Invoke(string key) { var model = WaitlistCardCatalog.Get(key); return View(model); } } /// /// ViewModel for the WaitlistCard component. /// public class WaitlistCardViewModel { public required string Key { get; init; } public required string Label { get; init; } public required string Icon { get; init; } public required int Count { get; init; } public required string DrawerTarget { get; init; } } /// /// Catalog of waitlist cards with their data. /// public static class WaitlistCardCatalog { private static readonly Dictionary Cards = new() { ["waitlist"] = new WaitlistCardViewModel { Key = "waitlist", Label = "På venteliste", Icon = "users-three", Count = 4, DrawerTarget = "waitlist-drawer" } }; public static WaitlistCardViewModel Get(string key) { if (Cards.TryGetValue(key, out var card)) return card; throw new KeyNotFoundException($"WaitlistCard with key '{key}' not found"); } }