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:
@@ -40,6 +40,11 @@ export interface FlightListProps {
|
|||||||
* Купить / Онлайн регистрация alongside Детали рейса.
|
* Купить / Онлайн регистрация alongside Детали рейса.
|
||||||
*/
|
*/
|
||||||
renderActions?: (flight: ISimpleFlight) => ReactNode;
|
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",
|
direction = "route",
|
||||||
renderExpandedBody,
|
renderExpandedBody,
|
||||||
renderActions,
|
renderActions,
|
||||||
|
buyUrlFor,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const cardRefs = useRef<Map<string, HTMLDivElement>>(new Map());
|
const cardRefs = useRef<Map<string, HTMLDivElement>>(new Map());
|
||||||
@@ -110,16 +116,29 @@ export const FlightList: FC<FlightListProps> = ({
|
|||||||
<FlightCard
|
<FlightCard
|
||||||
flight={flight}
|
flight={flight}
|
||||||
direction={direction}
|
direction={direction}
|
||||||
// Schedule cards expand on click even without an onFlightClick
|
// TIRREDESIGN-4: on Schedule the whole row navigates straight to
|
||||||
// — Angular's schedule rows are p-accordionTab so expanding is
|
// the flight-details card — no inline accordion expand. Board
|
||||||
// intrinsic to the layout.
|
// rows keep the legacy expand-on-click behaviour (extra ETA /
|
||||||
expandable={Boolean(onFlightClick) || direction === "schedule"}
|
// actual-time details exposed inline next to the row).
|
||||||
|
expandable={direction === "schedule" ? false : Boolean(onFlightClick)}
|
||||||
initialExpanded={flight.id === initialCurrentFlightId}
|
initialExpanded={flight.id === initialCurrentFlightId}
|
||||||
{...(onFlightClick
|
{...(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 } : {})}
|
{...(renderExpandedBody ? { renderExpandedBody } : {})}
|
||||||
{...(renderActions ? { renderActions } : {})}
|
{...(renderActions ? { renderActions } : {})}
|
||||||
|
{...(() => {
|
||||||
|
const url = buyUrlFor?.(flight);
|
||||||
|
return url ? { inlineBuyUrl: url } : {};
|
||||||
|
})()}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user