Refactor RunPlayHistory to optimize play retrieval logic and enhance StoragePanelSkeleton accessibility
ci / build-backend (push) Successful in 2m28s
ci / build-frontend (push) Successful in 51s
ci / tests (push) Successful in 2m47s
ci / sonar (push) Successful in 5m40s

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.
This commit is contained in:
Leonid Pershin
2026-07-29 10:22:37 +03:00
parent 5952ba4536
commit 775f287c29
2 changed files with 8 additions and 6 deletions
@@ -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;
@@ -33,7 +33,9 @@ export function StoragePanelSkeleton() {
const { t } = useTranslation()
return (
<div className="flex flex-col gap-4" role="status" aria-label={t('common.loading')}>
// <output> вместо role="status": у него та же роль нативно, и её видят читалки,
// которые про ARIA-роль на div знают хуже.
<output className="flex flex-col gap-4" aria-label={t('common.loading')}>
<Card>
<CardContent className="flex flex-col gap-4">
<div className="flex flex-wrap items-center justify-between gap-2">
@@ -92,6 +94,6 @@ export function StoragePanelSkeleton() {
</div>
</CardContent>
</Card>
</div>
</output>
)
}