Simulator nicht verbunden warnung
This commit is contained in:
@@ -6,12 +6,28 @@ import { Report } from "../../_components/left/Report";
|
||||
import { Dme } from "(app)/pilot/_components/dme/Dme";
|
||||
import dynamic from "next/dynamic";
|
||||
import { ConnectedDispatcher } from "tracker/_components/ConnectedDispatcher";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
||||
import { getAircraftsAPI, getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { checkSimulatorConnected } from "_helpers/simulatorConnected";
|
||||
import { SimConnectionAlert } from "(app)/pilot/_components/SimConnectionAlert";
|
||||
|
||||
const Map = dynamic(() => import("_components/map/Map"), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
const DispatchPage = () => {
|
||||
const { connectedAircraft, status } = usePilotConnectionStore((state) => state);
|
||||
const { data: ownAircraftArray = [] } = useQuery({
|
||||
queryKey: ["aircrafts", connectedAircraft?.id],
|
||||
queryFn: () =>
|
||||
getAircraftsAPI({
|
||||
id: connectedAircraft?.id,
|
||||
}),
|
||||
refetchInterval: 1000,
|
||||
});
|
||||
const ownAircraft = ownAircraftArray[0];
|
||||
const simulatorConnected = ownAircraft ? checkSimulatorConnected(ownAircraft) : false;
|
||||
return (
|
||||
<div className="relative flex-1 flex transition-all duration-500 ease w-full h-screen overflow-hidden">
|
||||
{/* <MapToastCard2 /> */}
|
||||
@@ -25,7 +41,10 @@ const DispatchPage = () => {
|
||||
<div className="flex w-2/3 h-full">
|
||||
<div className="relative flex flex-1 h-full">
|
||||
<Map />
|
||||
<div className="absolute top-5 right-10 z-99999">
|
||||
<div className="absolute top-5 right-10 z-99999 space-y-2">
|
||||
{!simulatorConnected && status === "connected" && (
|
||||
<SimConnectionAlert lastUpdated={ownAircraft?.lastHeartbeat} />
|
||||
)}
|
||||
<ConnectedDispatcher />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user