fix: update loading state handling in CalendarPage and DutyList components

- Set isLoading to false in CalendarPage to prevent unnecessary loading indicators.
- Removed the loading spinner from CalendarHeader and adjusted rendering logic in DutyList to show a placeholder when data is not yet loaded for the month.
- Enhanced tests in DutyList to verify behavior when data is empty and when data is loading, ensuring accurate user feedback during data fetching.
This commit is contained in:
2026-03-03 16:21:27 +03:00
parent 3b68e29d7b
commit 95f65141e1
4 changed files with 38 additions and 34 deletions

View File

@@ -30,13 +30,6 @@ export interface CalendarHeaderProps {
className?: string;
}
const HeaderSpinner = () => (
<span
className="block size-4 shrink-0 rounded-full border-2 border-transparent border-t-accent motion-reduce:animate-none animate-spin"
aria-hidden
/>
);
function isCurrentMonth(month: Date): boolean {
const now = new Date();
return (
@@ -82,16 +75,6 @@ export function CalendarHeader({
aria-atomic="true"
>
{monthName(monthIndex)} {year}
{isLoading && (
<span
role="status"
aria-live="polite"
aria-label={t("loading")}
className="flex items-center"
>
<HeaderSpinner />
</span>
)}
</h1>
{showToday && (
<button
@@ -116,10 +99,7 @@ export function CalendarHeader({
disabled={disabled || isLoading}
onClick={onRefresh}
>
<RefreshCwIcon
className={cn("size-5", isLoading && "motion-reduce:animate-none animate-spin")}
aria-hidden
/>
<RefreshCwIcon className="size-5" aria-hidden />
</Button>
)}
<Button