UX-Update 2.0, Neues Dashboard
This commit is contained in:
@@ -107,6 +107,15 @@ public partial class DashboardViewModel : ObservableObject
|
||||
public DashboardCardOption AttendanceCard => Card("attendance");
|
||||
public DashboardCardOption SupportCard => Card("support");
|
||||
public DashboardCardOption GroupsCard => Card("groups");
|
||||
public int TodayLessonCount => TodaysLessons.Count;
|
||||
public int OpenTaskCount => OpenTasks.Count;
|
||||
public int UpcomingCount => UpcomingDates.Count;
|
||||
public int AttentionCount => OpenExcuses.Count + AttendanceWarnings.Count + SupportPlanReviews.Count
|
||||
+ OpenCorrections.Count + UnplannedLessons.Count + Alerts.Count;
|
||||
public string TodayLessonSummary => TodayLessonCount == 1 ? "1 Stunde" : $"{TodayLessonCount} Stunden";
|
||||
public string OpenTaskSummary => OpenTaskCount == 1 ? "1 Aufgabe" : $"{OpenTaskCount} Aufgaben";
|
||||
public string AttentionSummary => AttentionCount == 1 ? "1 offener Punkt" : $"{AttentionCount} offene Punkte";
|
||||
public string UpcomingSummary => UpcomingCount == 1 ? "1 Termin" : $"{UpcomingCount} Termine";
|
||||
|
||||
public DashboardViewModel(IGroupRepository groups, ISubjectRepository subjects, ILessonRepository lessons,
|
||||
IExamRepository exams, IExamResultRepository examResults, IGradeRepository grades,
|
||||
@@ -204,6 +213,31 @@ public partial class DashboardViewModel : ObservableObject
|
||||
LoadOpenCorrections(groups, today);
|
||||
LoadUnplannedLessons(groups, today);
|
||||
LoadAlerts(groups, today);
|
||||
UpdateDashboardSummary();
|
||||
}
|
||||
|
||||
private void UpdateDashboardSummary()
|
||||
{
|
||||
TodayCard.IsEmpty = TodaysLessons.Count == 0;
|
||||
TasksCard.IsEmpty = OpenTasks.Count == 0;
|
||||
CalendarCard.IsEmpty = false;
|
||||
ExcusesCard.IsEmpty = OpenExcuses.Count == 0;
|
||||
UpcomingCard.IsEmpty = UpcomingDates.Count == 0;
|
||||
CorrectionsCard.IsEmpty = OpenCorrections.Count == 0;
|
||||
UnplannedCard.IsEmpty = UnplannedLessons.Count == 0;
|
||||
AlertsCard.IsEmpty = Alerts.Count == 0;
|
||||
AttendanceCard.IsEmpty = AttendanceWarnings.Count == 0;
|
||||
SupportCard.IsEmpty = SupportPlanReviews.Count == 0;
|
||||
GroupsCard.IsEmpty = CurrentGroups.Count == 0;
|
||||
|
||||
OnPropertyChanged(nameof(TodayLessonCount));
|
||||
OnPropertyChanged(nameof(OpenTaskCount));
|
||||
OnPropertyChanged(nameof(UpcomingCount));
|
||||
OnPropertyChanged(nameof(AttentionCount));
|
||||
OnPropertyChanged(nameof(TodayLessonSummary));
|
||||
OnPropertyChanged(nameof(OpenTaskSummary));
|
||||
OnPropertyChanged(nameof(AttentionSummary));
|
||||
OnPropertyChanged(nameof(UpcomingSummary));
|
||||
}
|
||||
|
||||
private async Task LoadWeatherAsync()
|
||||
@@ -592,6 +626,7 @@ public partial class DashboardViewModel : ObservableObject
|
||||
entry.Attendance = status;
|
||||
_participationEntries.Save(entry);
|
||||
OpenExcuses.Remove(item);
|
||||
UpdateDashboardSummary();
|
||||
}
|
||||
|
||||
private void LoadCalendar()
|
||||
@@ -1034,18 +1069,29 @@ public sealed class DashboardAlertItem(Guid studentId, Guid? groupId, string stu
|
||||
public partial class DashboardCardOption : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private bool _isVisible;
|
||||
[ObservableProperty] private bool _isEmpty;
|
||||
[ObservableProperty] private int _row;
|
||||
[ObservableProperty] private int _column;
|
||||
public string Key { get; }
|
||||
public string Title { get; }
|
||||
public bool HideWhenEmpty { get; }
|
||||
public bool EffectiveIsVisible => IsVisible && (!HideWhenEmpty || !IsEmpty);
|
||||
public Action? OnVisibilityChanged { get; set; }
|
||||
|
||||
public DashboardCardOption(string key, string title, bool isVisible)
|
||||
{
|
||||
Key = key;
|
||||
Title = title;
|
||||
HideWhenEmpty = key is "excuses" or "upcoming" or "corrections" or "unplanned"
|
||||
or "alerts" or "attendance" or "support";
|
||||
_isVisible = isVisible;
|
||||
}
|
||||
|
||||
partial void OnIsVisibleChanged(bool value) => OnVisibilityChanged?.Invoke();
|
||||
partial void OnIsVisibleChanged(bool value)
|
||||
{
|
||||
OnPropertyChanged(nameof(EffectiveIsVisible));
|
||||
OnVisibilityChanged?.Invoke();
|
||||
}
|
||||
|
||||
partial void OnIsEmptyChanged(bool value) => OnPropertyChanged(nameof(EffectiveIsVisible));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user