import { memo } from "preact/compat"; import LinesNetworkPlanDetails from "../LinesNetworkPlanDetails"; import NotificationDetails from "../NotificationDetails"; import RouteSchedule from "../RouteSchedule"; import Station from "../Station"; import useMapContext from "../utils/hooks/useMapContext"; import type { FeatureInfo } from "mobility-toolbox-js/common/typedefs"; import type { Feature } from "ol"; import type BaseLayer from "ol/layer/Base"; const contentClassName = ""; //`h-full overflow-x-hidden text-base bg-white`; export interface FeatureDetailsProps { feature?: Feature; featuresInfo?: FeatureInfo; layer?: BaseLayer; } /** * This component is repsonsible to display the details of a feature passed as prop. */ function FeatureDetails({ feature, featuresInfo, layer }: FeatureDetailsProps) { const { linesIds, linesNetworkPlanLayer, notificationId, notificationsLayer, realtimeLayer, stationId, stationsLayer, trainId, } = useMapContext(); if (!layer) { return null; } return ( <> {!!realtimeLayer && layer === realtimeLayer && trainId && ( )} {!!stationsLayer && layer === stationsLayer && stationId && } {!!linesNetworkPlanLayer && layer === linesNetworkPlanLayer && linesIds && ( )} {!!notificationsLayer && layer === notificationsLayer && notificationId && ( )} ); } export default memo(FeatureDetails);