From 775f287c29de1f540094f8669eea7c592e7563ec Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Wed, 29 Jul 2026 10:22:37 +0300 Subject: [PATCH] Refactor RunPlayHistory to optimize play retrieval logic and enhance StoragePanelSkeleton accessibility Updated the RunPlayHistory class to improve the logic for retrieving the latest play by using LINQ's Max method, ensuring that empty play lists are handled correctly. Additionally, modified the StoragePanelSkeleton component to replace the div with an output element for better accessibility, allowing screen readers to recognize the loading status more effectively. --- .../Programming/Planning/RunPlayHistory.cs | 8 ++++---- .../src/features/admin/storage/StoragePanelSkeleton.tsx | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/src/TeleWave.Domain/Programming/Planning/RunPlayHistory.cs b/backend/src/TeleWave.Domain/Programming/Planning/RunPlayHistory.cs index 00e58c4..f503a0b 100644 --- a/backend/src/TeleWave.Domain/Programming/Planning/RunPlayHistory.cs +++ b/backend/src/TeleWave.Domain/Programming/Planning/RunPlayHistory.cs @@ -26,12 +26,12 @@ public sealed class RunPlayHistory DateTimeOffset? last = null; foreach (var showId in ShowsOf(element)) { - if (!_byShow.TryGetValue(showId, out var plays)) + if (!_byShow.TryGetValue(showId, out var plays) || plays.Count == 0) continue; - foreach (var play in plays) - if (last is null || play > last) - last = play; + var latest = plays.Max(); + if (last is null || latest > last) + last = latest; } return last; diff --git a/frontend/src/features/admin/storage/StoragePanelSkeleton.tsx b/frontend/src/features/admin/storage/StoragePanelSkeleton.tsx index f7dc811..be5fef4 100644 --- a/frontend/src/features/admin/storage/StoragePanelSkeleton.tsx +++ b/frontend/src/features/admin/storage/StoragePanelSkeleton.tsx @@ -33,7 +33,9 @@ export function StoragePanelSkeleton() { const { t } = useTranslation() return ( -
+ // вместо role="status": у него та же роль нативно, и её видят читалки, + // которые про ARIA-роль на div знают хуже. +
@@ -92,6 +94,6 @@ export function StoragePanelSkeleton() {
-
+ ) }