@using System.Drawing
@using System.Runtime.InteropServices
@using System.Diagnostics
@if (Data is { Count: > 0 })
{
@* 12*5=60 *@
@* row 0: month labels with colspan *@
@* @foreach (var month in Enumerable.Range(1, 12)) *@
@* { *@
@*
*@
@* @(new DateTime(2021, month, 1).ToString("MMM")[..3]) *@
@*
*@
@* } *@
@* column 0: day labels *@
@* @for (var i = 0; i < 7; i++) *@
@* { *@
@*
*@
@* @(((DayOfWeek)i).ToString()[..3]) *@
@*
*@
@* } *@
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
Sun
Mon
Tue
Wed
Thu
Fri
Sat
@* pad activity cell dates... *@
@* the actual activity cells *@
@code{
bool needsBorder = false;
}
@for (DateOnly date = new DateOnly(Data.Keys.First().Year, 1, 1); date <= new DateOnly(Data.Keys.First().Year, 1, 1).AddYears(1).AddDays(-1); date = date.AddDays(1))
{
var hasData = Data.TryGetValue(date, out var color);
var needsTopBorder = date.Day == 1 && date.Month != 1 && date.DayOfWeek != DayOfWeek.Sunday;
if (date.DayOfWeek == DayOfWeek.Sunday)
needsBorder = date.AddDays(7).Day <= 7 && date.Month != 12;
var needsLeftBorder = date.Day <= 7;
@if (hasData)
{
}
else
{
}
}
}
@code {
private Dictionary