Keep DayTabs enabled until calendar API resolves

With empty availableDates every day button rendered as [disabled],
leaving the user unable to navigate between days while the /days API
loads (or for routes where the calendar endpoint hasn't been wired
yet). Treat an empty availableDates array as 'unknown' — don't disable
anything, matching Angular's behaviour where tabs are tappable until
the upstream tells us a specific day has no flights.
This commit is contained in:
2026-04-18 14:12:33 +03:00
parent cb61cafbf1
commit a0176cc336
@@ -39,7 +39,12 @@ export const DayTabs: FC<DayTabsProps> = ({
const [currentPage, setCurrentPage] = useState(initialPage);
// Empty availableDates means the calendar API hasn't resolved yet (or
// the route has no day data). Treat every date as tappable in that
// case — matches Angular where the tabs stay enabled until we *know*
// the upstream reports no flights for a given day.
const availableSet = useMemo(() => new Set(availableDates), [availableDates]);
const disableByAvailability = availableDates.length > 0;
const visibleDates = allDates.slice(
currentPage * PAGE_SIZE,
@@ -68,7 +73,7 @@ export const DayTabs: FC<DayTabsProps> = ({
key={date}
date={date}
isActive={date === selectedDate}
isDisabled={!availableSet.has(date)}
isDisabled={disableByAvailability && !availableSet.has(date)}
locale={locale}
onClick={onNavigate}
/>