wip
This commit is contained in:
parent
abcf8ee75e
commit
12869e35bf
34 changed files with 1177 additions and 156 deletions
|
|
@ -0,0 +1,9 @@
|
|||
@model PlanTempus.Application.Features.Dashboard.Components.WaitlistCardViewModel
|
||||
|
||||
<swp-waitlist-card data-key="@Model.Key" data-drawer-trigger="@Model.DrawerTarget">
|
||||
<swp-waitlist-icon>
|
||||
<i class="ph ph-@Model.Icon"></i>
|
||||
<swp-waitlist-badge>@Model.Count</swp-waitlist-badge>
|
||||
</swp-waitlist-icon>
|
||||
<swp-waitlist-label>@Model.Label</swp-waitlist-label>
|
||||
</swp-waitlist-card>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace PlanTempus.Application.Features.Dashboard.Components;
|
||||
|
||||
/// <summary>
|
||||
/// ViewComponent for rendering the waitlist mini card on the dashboard.
|
||||
/// Displays a count badge and triggers the waitlist drawer when clicked.
|
||||
/// </summary>
|
||||
public class WaitlistCardViewComponent : ViewComponent
|
||||
{
|
||||
public IViewComponentResult Invoke(string key)
|
||||
{
|
||||
var model = WaitlistCardCatalog.Get(key);
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel for the WaitlistCard component.
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Catalog of waitlist cards with their data.
|
||||
/// </summary>
|
||||
public static class WaitlistCardCatalog
|
||||
{
|
||||
private static readonly Dictionary<string, WaitlistCardViewModel> 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");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue