using System.Collections.Frozen;
using Elternbeirat.Web.Shared;
namespace Elternbeirat.Web.Features.Home;
///
/// Chooses the icon of a home page tile from the page's slug.
///
///
/// Pure presentation, so it lives in code: the schema has no icon field, and adding
/// one needs a schema change that cannot reach production yet. A page without an
/// entry here (e.g. one an editor just created) gets , so a
/// new page always shows up as a complete tile.
///
///
public static class TileIcons
{
///
/// The icon for a slug without its own entry: a generic page.
///
public const string Default = "file-text";
///
/// Icon name per slug. Every value must be a name in .
///
private static readonly FrozenDictionary Icons =
new Dictionary
{
["board"] = "users",
["patrons"] = "heart-handshake",
["faqs"] = "help-circle",
["downloads"] = "download",
["posts"] = "newspaper",
["events"] = "calendar",
["contact"] = "mail",
}.ToFrozenDictionary(StringComparer.Ordinal);
///
/// Returns the icon name for a page.
///
/// The page's slug, e.g. board.
/// An icon name from ; for an unknown slug.
public static string For(string slug) =>
Icons.GetValueOrDefault(slug, Default);
}