47 lines
1.8 KiB
C#
47 lines
1.8 KiB
C#
using cfs_tracker.Services;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
namespace cfs_tracker.ViewModels;
|
|
|
|
public partial class WeekDaySummaryViewModel : ObservableObject
|
|
{
|
|
public DateTime Date { get; init; }
|
|
public string DateText { get; init; } = string.Empty;
|
|
public string MorningText { get; init; } = "-";
|
|
public string AfternoonText { get; init; } = "-";
|
|
public Color MorningColor { get; init; } = Colors.Transparent;
|
|
public Color AfternoonColor { get; init; } = Colors.Transparent;
|
|
public string ActivitiesText { get; init; } = string.Empty;
|
|
public string SymptomsText { get; init; } = string.Empty;
|
|
public bool HasDetails => !string.IsNullOrWhiteSpace(ActivitiesText) || !string.IsNullOrWhiteSpace(SymptomsText);
|
|
public bool HasActivities => !string.IsNullOrWhiteSpace(ActivitiesText);
|
|
public bool HasSymptoms => !string.IsNullOrWhiteSpace(SymptomsText);
|
|
public string DetailsButtonText => IsExpanded
|
|
? LocalizationService.Translate("WeekPage_SummaryHide")
|
|
: LocalizationService.Translate("WeekPage_SummaryShow");
|
|
public string ActivitiesSummaryText => LocalizationService.Format("WeekPage_ActivitiesFormat", ActivitiesText);
|
|
public string SymptomsSummaryText => LocalizationService.Format("WeekPage_SymptomsFormat", SymptomsText);
|
|
|
|
[ObservableProperty]
|
|
private bool isExpanded;
|
|
|
|
public IRelayCommand ToggleExpandedCommand { get; }
|
|
|
|
public WeekDaySummaryViewModel()
|
|
{
|
|
ToggleExpandedCommand = new RelayCommand(() =>
|
|
{
|
|
if (!HasDetails)
|
|
return;
|
|
|
|
IsExpanded = !IsExpanded;
|
|
});
|
|
}
|
|
|
|
partial void OnIsExpandedChanged(bool value)
|
|
{
|
|
OnPropertyChanged(nameof(DetailsButtonText));
|
|
}
|
|
}
|