import { useSelector } from "react-redux";

import type { ReduxStateType } from "@store/types";
import { AutoInflight } from "./flows/AutoInflight";
import { ManualInFlight } from "./flows/ManualInFlight";

export const InFlight = () => {
	const { data } = useSelector((state: ReduxStateType) => state.inflight);

	if (data && data.routingMode === "manual") {
		return <ManualInFlight initialData={data} />;
	}

	return <AutoInflight />;
};
