This commit is contained in:
Janus C. H. Knudsen 2026-01-11 18:18:36 +01:00
parent abcf8ee75e
commit 12869e35bf
34 changed files with 1177 additions and 156 deletions

View file

@ -1,75 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace PlanTempus.Application.Features.Dashboard.Components;
public class NotificationItemViewComponent : ViewComponent
{
public IViewComponentResult Invoke(string key)
{
var model = NotificationItemCatalog.Get(key);
return View(model);
}
}
public class NotificationItemViewModel
{
public required string Key { get; init; }
public required string Icon { get; init; }
public required string Title { get; init; }
public required string Text { get; init; }
public required string Time { get; init; }
public bool IsUnread { get; init; }
}
public static class NotificationItemCatalog
{
private static readonly Dictionary<string, NotificationItemViewModel> Notifications = new()
{
["notif-1"] = new NotificationItemViewModel
{
Key = "notif-1",
Icon = "calendar-plus",
Title = "Ny booking",
Text = "fra Emma Christensen til Balayage",
Time = "For 15 min. siden",
IsUnread = true
},
["notif-2"] = new NotificationItemViewModel
{
Key = "notif-2",
Icon = "star",
Title = "Ny anmeldelse",
Text = "5 stjerner fra Sofie Nielsen",
Time = "For 1 time siden",
IsUnread = true
},
["notif-3"] = new NotificationItemViewModel
{
Key = "notif-3",
Icon = "x",
Title = "Aflysning",
Text = "Mette Hansen aflyste kl. 15:00",
Time = "For 2 timer siden",
IsUnread = false
},
["notif-4"] = new NotificationItemViewModel
{
Key = "notif-4",
Icon = "check",
Title = "Bekræftet",
Text = "Louise Andersen bekræftede kl. 13:00",
Time = "I går kl. 18:30",
IsUnread = false
}
};
public static NotificationItemViewModel Get(string key)
{
if (Notifications.TryGetValue(key, out var notification))
return notification;
throw new KeyNotFoundException($"NotificationItem with key '{key}' not found");
}
public static IEnumerable<string> AllKeys => Notifications.Keys;
}