Schedule row click opens flight details (TIRREDESIGN-4)

FlightList on direction=schedule now wires a row-level onClick so the
entire row navigates to the details page instead of expanding inline.
Matches Angular's schedule-search-result behaviour where each flight
row is a link to the details card.
This commit is contained in:
2026-04-22 13:45:21 +03:00
parent 99d86fba29
commit a26adad895
+24 -5
View File
@@ -40,6 +40,11 @@ export interface FlightListProps {
* Купить / Онлайн регистрация alongside Детали рейса.
*/
renderActions?: (flight: ISimpleFlight) => ReactNode;
/**
* Aeroflot booking URL per flight for the hover-reveal inline
* "Купить билет" link (TIRREDESIGN-6). Return null to hide.
*/
buyUrlFor?: (flight: ISimpleFlight) => string | null;
}
/**
@@ -57,6 +62,7 @@ export const FlightList: FC<FlightListProps> = ({
direction = "route",
renderExpandedBody,
renderActions,
buyUrlFor,
}) => {
const { t } = useTranslation();
const cardRefs = useRef<Map<string, HTMLDivElement>>(new Map());
@@ -110,16 +116,29 @@ export const FlightList: FC<FlightListProps> = ({
<FlightCard
flight={flight}
direction={direction}
// Schedule cards expand on click even without an onFlightClick
// — Angular's schedule rows are p-accordionTab so expanding is
// intrinsic to the layout.
expandable={Boolean(onFlightClick) || direction === "schedule"}
// TIRREDESIGN-4: on Schedule the whole row navigates straight to
// the flight-details card — no inline accordion expand. Board
// rows keep the legacy expand-on-click behaviour (extra ETA /
// actual-time details exposed inline next to the row).
expandable={direction === "schedule" ? false : Boolean(onFlightClick)}
initialExpanded={flight.id === initialCurrentFlightId}
{...(onFlightClick
? { onViewDetails: () => onFlightClick(flight) }
? {
onViewDetails: () => onFlightClick(flight),
// When expandable is off we need a row-level onClick to
// trigger navigation — rowClickable in FlightCard depends
// on `expandable || Boolean(onClick)`.
...(direction === "schedule"
? { onClick: () => onFlightClick(flight) }
: {}),
}
: {})}
{...(renderExpandedBody ? { renderExpandedBody } : {})}
{...(renderActions ? { renderActions } : {})}
{...(() => {
const url = buyUrlFor?.(flight);
return url ? { inlineBuyUrl: url } : {};
})()}
/>
</div>
))}