First version

This commit is contained in:
2026-03-19 23:11:13 +01:00
parent 7503d77c82
commit 8615d1de07
71 changed files with 3128 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
using cfs_tracker.Models;
namespace cfs_tracker.ViewModels;
public class DayEntryItemViewModel
{
public int Id { get; init; }
public DateTime Timestamp { get; init; }
public string TimeText { get; init; } = "";
public string StateText { get; init; } = "";
public string SourceText { get; init; } = "";
public Color BackgroundColor { get; init; } = Colors.Transparent;
public Color TextColor { get; init; } = Colors.Black;
public static DayEntryItemViewModel FromEntry(HealthEntry entry)
{
var state = entry.State;
var background = state switch
{
HealthState.Green => Color.FromArgb("#4CAF50"),
HealthState.Yellow => Color.FromArgb("#FBC02D"),
HealthState.Red => Color.FromArgb("#E53935"),
HealthState.Gray => Color.FromArgb("#757575"),
_ => Colors.Transparent
};
var textColor = state switch
{
HealthState.Gray => Colors.White,
HealthState.Green => Colors.White,
_ => Colors.Black
};
return new DayEntryItemViewModel
{
Id = entry.Id,
Timestamp = entry.Timestamp,
TimeText = entry.Timestamp.ToString("HH:mm"),
StateText = state switch
{
HealthState.Green => "Gut",
HealthState.Yellow => "So lala",
HealthState.Red => "Schlecht",
HealthState.Gray => "Totalausfall",
_ => ""
},
SourceText = entry.Source switch
{
EntrySource.App => "App",
EntrySource.Notification => "Push",
_ => ""
},
BackgroundColor = background,
TextColor = textColor
};
}
}