Files
chapter-organizer/WebApp/Models/AppIcons.cs
T
poprhythm 05e5e69d0b Clean up Team page
Add an EventAttributes display
2025-10-03 12:37:11 -04:00

115 lines
3.7 KiB
C#

using Core.Entities;
using MudBlazor;
namespace WebApp.Models
{
public static class AppIcons
{
public static string EventRank = Icons.Material.Filled.AddChart;
public static string Teams = Icons.Material.Filled.Group;
public static string Student = Icons.Material.Filled.Person;
public static string TeamAssignment = Icons.Material.Filled.GroupAdd;
public static string Events = Icons.Material.Filled.Dashboard;
public static string Scheduler = Icons.Material.Filled.CalendarViewDay;
public static string LevelOfEffortIcon(int? loe)
{
return loe switch
{
1 => "①",
2 => "②",
3 => "③",
_ => Icons.Material.Filled.QuestionMark
};
}
/*https://unicodeplus.com/search*/
public static string OnSiteActivity = "ⓐ";
public static string RegionalEvent = "ⓡ";
public static string IndividualEvent = "ⓘ";
public static string PresubmissionEvent = "ⓟ";
public static string PresentationEvent = "";
public static string QuestionMark = "❔";
public static string EventEffort(EventDefinition eventDefinition)
{
return LevelOfEffortIcon(eventDefinition.LevelOfEffort);
}
public static string EventAttributes(EventDefinition eventDefinition)
{
var v = new List<string>();
if (eventDefinition.EventFormat == EventFormat.Individual)
v.Add(IndividualEvent);
if (eventDefinition.RegionalEvent)
v.Add(RegionalEvent);
if (eventDefinition.InterviewOrPresentation)
v.Add(PresentationEvent);
if (eventDefinition.Presubmission)
v.Add(PresubmissionEvent);
if (eventDefinition.OnSiteActivity)
v.Add(OnSiteActivity);
return string.Join(" ", v);
}
public static string OfficerRoleIcon(OfficerRole officerRole)
{
return officerRole switch
{
OfficerRole.President => Icons.Material.Filled.Gavel,
OfficerRole.VicePresident => Icons.Material.Filled.StarBorderPurple500,
OfficerRole.Secretary => Icons.Material.Filled.Draw,
OfficerRole.Treasurer => Icons.Material.Filled.Key,
OfficerRole.Reporter => Icons.Material.Filled.Mic,
OfficerRole.SergeantAtArms => Icons.Material.Filled.Handshake,
_ => throw new ArgumentOutOfRangeException(nameof(officerRole), officerRole, null)
};
}
public static string RankedEventColor(int rank)
{
return rank switch
{
1 => "#dd7e6b",
2 => "#ea9999",
3 => "#f9cb9c",
4 => "#ffe599",
5 => "#fff2cc",
6 => "#fffaea",
7 => "#fffefa",
8 => "#fffefc",
9 => "#fffffd",
10 => "#fffffe",
_ => "#ddd"
};
}
public static string GetOrdinal(int num)
{
if (num <= 0) return num.ToString();
switch (num % 100)
{
case 11:
case 12:
case 13:
return num + "th";
}
switch (num % 10)
{
case 1:
return num + "st";
case 2:
return num + "nd";
case 3:
return num + "rd";
default:
return num + "th";
}
}
}
}