Update barrel exports and MF expose for 2E route pages

- Feature barrel now exports OnlineBoardStartPage, OnlineBoardSearchPage,
  OnlineBoardDetailsPage
- MF expose renders start page via React.lazy + Suspense
- Fix exactOptionalPropertyTypes issues with suffix param
- Remove unused import
This commit is contained in:
2026-04-15 08:24:41 +03:00
parent cd07542dc5
commit 6788f609e6
4 changed files with 56 additions and 23 deletions
@@ -19,7 +19,7 @@ import { FlightList } from "@/ui/flights/FlightList.js";
import { useOnlineBoard } from "../hooks/useOnlineBoard.js";
import { useLiveBoardSearch } from "../hooks/useLiveBoardSearch.js";
import { useCalendarDays } from "../hooks/useCalendarDays.js";
import { buildOnlineBoardUrl, buildFlightUrlParams } from "../url.js";
import { buildOnlineBoardUrl } from "../url.js";
import type { OnlineBoardParams } from "../url.js";
import type { SearchFlightsParams, CalendarParams } from "../api.js";
import type { FlightRequestType, ISimpleFlight } from "../types.js";
@@ -151,13 +151,21 @@ export const OnlineBoardSearchPage: FC<OnlineBoardSearchPageProps> = ({
// Navigation: click a flight to go to details
const handleFlightClick = useCallback(
(flight: ISimpleFlight) => {
const detailsUrl = buildOnlineBoardUrl({
const detailsParams: OnlineBoardParams = flight.flightId.suffix
? {
type: "details",
carrier: flight.flightId.carrier,
flightNumber: flight.flightId.flightNumber,
suffix: flight.flightId.suffix || undefined,
suffix: flight.flightId.suffix,
date: flight.flightId.date,
});
}
: {
type: "details",
carrier: flight.flightId.carrier,
flightNumber: flight.flightId.flightNumber,
date: flight.flightId.date,
};
const detailsUrl = buildOnlineBoardUrl(detailsParams);
void navigate(`/${lang}/${detailsUrl}`);
},
[navigate, lang],
+7
View File
@@ -35,3 +35,10 @@ export { useLiveBoardSearch } from "./hooks/useLiveBoardSearch.js";
export type { UseLiveBoardSearchResult } from "./hooks/useLiveBoardSearch.js";
export { useLiveFlightDetails } from "./hooks/useLiveFlightDetails.js";
export type { UseLiveFlightDetailsResult } from "./hooks/useLiveFlightDetails.js";
// 2E — Feature-specific page components
export { OnlineBoardStartPage } from "./components/OnlineBoardStartPage.js";
export { OnlineBoardSearchPage } from "./components/OnlineBoardSearchPage.js";
export type { OnlineBoardSearchPageProps } from "./components/OnlineBoardSearchPage.js";
export { OnlineBoardDetailsPage } from "./components/OnlineBoardDetailsPage.js";
export type { OnlineBoardDetailsPageProps } from "./components/OnlineBoardDetailsPage.js";
+17 -6
View File
@@ -1,11 +1,20 @@
import type { HostContract } from "@/host-contract";
/**
* MF expose wrapper for the Online Board feature.
* Phase 2 (online-board port) replaces the body with:
* `return <OnlineBoardRoot hostContract={hostContract} />;`
* where `OnlineBoardRoot` comes from `@/features/online-board`.
*
* Lazy-loads the OnlineBoardStartPage via React.lazy + Suspense.
* Full MF integration with host routing is deferred to a later phase;
* for now this renders the start page for embedded usage.
*/
import { lazy, Suspense } from "react";
import type { HostContract } from "@/host-contract";
const OnlineBoardStartPage = lazy(() =>
import("@/features/online-board/components/OnlineBoardStartPage.js").then(
(m) => ({ default: m.OnlineBoardStartPage }),
),
);
export interface OnlineBoardRemoteProps {
hostContract: HostContract;
}
@@ -13,7 +22,9 @@ export interface OnlineBoardRemoteProps {
export default function OnlineBoardRemote(_props: OnlineBoardRemoteProps): JSX.Element {
return (
<div data-mf-expose="OnlineBoard">
<p>Online Board remote stub. Populated in Phase 2.</p>
<Suspense fallback={<div aria-busy="true">Loading Online Board...</div>}>
<OnlineBoardStartPage />
</Suspense>
</div>
);
}
@@ -29,17 +29,24 @@ export default function FlightSearchPage(): JSX.Element {
);
}
return (
<Suspense fallback={<FlightListSkeleton />}>
<OnlineBoardSearchPage
params={{
type: "flight",
const searchParams = parsed.suffix
? {
type: "flight" as const,
carrier: parsed.carrier,
flightNumber: parsed.flightNumber,
suffix: parsed.suffix,
date: parsed.date,
}}
/>
}
: {
type: "flight" as const,
carrier: parsed.carrier,
flightNumber: parsed.flightNumber,
date: parsed.date,
};
return (
<Suspense fallback={<FlightListSkeleton />}>
<OnlineBoardSearchPage params={searchParams} />
</Suspense>
);
}