Added soem things
This commit is contained in:
@@ -10,6 +10,7 @@ import router from "routes/router";
|
|||||||
import cors from "cors";
|
import cors from "cors";
|
||||||
import { handleSendMessage } from "socket-events/send-message";
|
import { handleSendMessage } from "socket-events/send-message";
|
||||||
import { handleConnectPilot } from "socket-events/connect-pilot";
|
import { handleConnectPilot } from "socket-events/connect-pilot";
|
||||||
|
import { handleConnectDesktop } from "socket-events/connect-desktop";
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const server = createServer(app);
|
const server = createServer(app);
|
||||||
@@ -21,8 +22,10 @@ export const io = new Server(server, {
|
|||||||
io.use(jwtMiddleware);
|
io.use(jwtMiddleware);
|
||||||
|
|
||||||
io.on("connection", (socket) => {
|
io.on("connection", (socket) => {
|
||||||
|
console.log("New socket connection", socket.id);
|
||||||
socket.on("connect-dispatch", handleConnectDispatch(socket, io));
|
socket.on("connect-dispatch", handleConnectDispatch(socket, io));
|
||||||
socket.on("connect-pilot", handleConnectPilot(socket, io));
|
socket.on("connect-pilot", handleConnectPilot(socket, io));
|
||||||
|
socket.on("connect-desktop", handleConnectDesktop(socket, io));
|
||||||
socket.on("send-message", handleSendMessage(socket, io));
|
socket.on("send-message", handleSendMessage(socket, io));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
15
apps/dispatch-server/socket-events/connect-desktop.ts
Normal file
15
apps/dispatch-server/socket-events/connect-desktop.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { User } from "@repo/db";
|
||||||
|
import { Socket, Server } from "socket.io";
|
||||||
|
|
||||||
|
export const handleConnectDesktop =
|
||||||
|
(socket: Socket, io: Server) => (socket: Socket) => {
|
||||||
|
const user = socket.data.user as User;
|
||||||
|
console.log("connect-desktop", user.publicId);
|
||||||
|
socket.join(`user:${user.id}`);
|
||||||
|
socket.join(`desktop:${user.id}`);
|
||||||
|
|
||||||
|
socket.on("ptt", (data) => {
|
||||||
|
console.log("ptt", data);
|
||||||
|
socket.to(`user:${user.id}`).emit("ptt", data);
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -66,7 +66,6 @@ export const handleConnectPilot =
|
|||||||
stationId: parseInt(stationId),
|
stationId: parseInt(stationId),
|
||||||
posLat: 51.45,
|
posLat: 51.45,
|
||||||
posLng: 9.77,
|
posLng: 9.77,
|
||||||
simulatorConnected: true,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export const Audio = () => {
|
|||||||
className={cn(
|
className={cn(
|
||||||
"btn btn-sm btn-soft border-none hover:bg-inherit",
|
"btn btn-sm btn-soft border-none hover:bg-inherit",
|
||||||
!isTalking && "bg-transparent hover:bg-sky-400/20",
|
!isTalking && "bg-transparent hover:bg-sky-400/20",
|
||||||
isTalking && "bg-red-500 hover:bg-red-600",
|
isTalking && "bg-green-700 hover:bg-green-600",
|
||||||
state === "disconnected" && "bg-red-500 hover:bg-red-500",
|
state === "disconnected" && "bg-red-500 hover:bg-red-500",
|
||||||
state === "error" && "bg-red-500 hover:bg-red-500",
|
state === "error" && "bg-red-500 hover:bg-red-500",
|
||||||
state === "connecting" &&
|
state === "connecting" &&
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { dispatchSocket } from "dispatch/socket";
|
||||||
import { serverApi } from "helpers/axios";
|
import { serverApi } from "helpers/axios";
|
||||||
import {
|
import {
|
||||||
handleActiveSpeakerChange,
|
handleActiveSpeakerChange,
|
||||||
@@ -7,12 +8,14 @@ import {
|
|||||||
handleTrackUnsubscribed,
|
handleTrackUnsubscribed,
|
||||||
} from "helpers/liveKitEventHandler";
|
} from "helpers/liveKitEventHandler";
|
||||||
import { ConnectionQuality, Room, RoomEvent } from "livekit-client";
|
import { ConnectionQuality, Room, RoomEvent } from "livekit-client";
|
||||||
|
import { pilotSocket } from "pilot/socket";
|
||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
|
|
||||||
let interval: NodeJS.Timeout;
|
let interval: NodeJS.Timeout;
|
||||||
|
|
||||||
type TalkState = {
|
type TalkState = {
|
||||||
isTalking: boolean;
|
isTalking: boolean;
|
||||||
|
source: string;
|
||||||
state: "connecting" | "connected" | "disconnected" | "error";
|
state: "connecting" | "connected" | "disconnected" | "error";
|
||||||
message: string | null;
|
message: string | null;
|
||||||
connectionQuality: ConnectionQuality;
|
connectionQuality: ConnectionQuality;
|
||||||
@@ -33,10 +36,17 @@ export const useAudioStore = create<TalkState>((set, get) => ({
|
|||||||
isTalking: false,
|
isTalking: false,
|
||||||
message: null,
|
message: null,
|
||||||
state: "disconnected",
|
state: "disconnected",
|
||||||
|
source: "",
|
||||||
remoteParticipants: 0,
|
remoteParticipants: 0,
|
||||||
connectionQuality: ConnectionQuality.Unknown,
|
connectionQuality: ConnectionQuality.Unknown,
|
||||||
room: null,
|
room: null,
|
||||||
toggleTalking: () => set((state) => ({ isTalking: !state.isTalking })),
|
toggleTalking: () => {
|
||||||
|
const { room, isTalking } = get();
|
||||||
|
if (!room) return;
|
||||||
|
room.localParticipant.setMicrophoneEnabled(!isTalking);
|
||||||
|
|
||||||
|
set((state) => ({ isTalking: !state.isTalking }));
|
||||||
|
},
|
||||||
connect: async (roomName) => {
|
connect: async (roomName) => {
|
||||||
set({ state: "connecting" });
|
set({ state: "connecting" });
|
||||||
console.log("Connecting to room: ", roomName);
|
console.log("Connecting to room: ", roomName);
|
||||||
@@ -78,6 +88,7 @@ export const useAudioStore = create<TalkState>((set, get) => ({
|
|||||||
await room.connect(url, token);
|
await room.connect(url, token);
|
||||||
console.log(room);
|
console.log(room);
|
||||||
set({ room });
|
set({ room });
|
||||||
|
|
||||||
interval = setInterval(() => {
|
interval = setInterval(() => {
|
||||||
set({
|
set({
|
||||||
remoteParticipants:
|
remoteParticipants:
|
||||||
@@ -97,3 +108,28 @@ export const useAudioStore = create<TalkState>((set, get) => ({
|
|||||||
get().room?.disconnect();
|
get().room?.disconnect();
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
interface PTTData {
|
||||||
|
shouldTransmit: boolean;
|
||||||
|
source: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePTT = (data: PTTData) => {
|
||||||
|
const { shouldTransmit, source } = data;
|
||||||
|
const { room } = useAudioStore.getState();
|
||||||
|
if (!room) return;
|
||||||
|
|
||||||
|
useAudioStore.setState({
|
||||||
|
isTalking: shouldTransmit,
|
||||||
|
source,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (shouldTransmit) {
|
||||||
|
room.localParticipant.setMicrophoneEnabled(true);
|
||||||
|
} else {
|
||||||
|
room.localParticipant.setMicrophoneEnabled(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
pilotSocket.on("ptt", handlePTT);
|
||||||
|
dispatchSocket.on("ptt", handlePTT);
|
||||||
|
|||||||
@@ -1,24 +1,41 @@
|
|||||||
import { Prisma, prisma } from "@repo/db";
|
import { PositionLog, Prisma, prisma, User } from "@repo/db";
|
||||||
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
||||||
|
import { verify } from "jsonwebtoken";
|
||||||
|
|
||||||
export const PUT = async (req: Request) => {
|
export const PUT = async (req: Request) => {
|
||||||
const session = await getServerSession();
|
const session = await getServerSession();
|
||||||
if (!session)
|
const token = req.headers.get("authorization")?.split(" ")[1];
|
||||||
|
if (!token)
|
||||||
|
return Response.json({ message: "Missing token" }, { status: 401 });
|
||||||
|
|
||||||
|
const payload = await new Promise<User>((resolve, reject) => {
|
||||||
|
verify(token, process.env.NEXTAUTH_HUB_SECRET as string, (err, decoded) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
|
resolve(decoded as User);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!session && !payload)
|
||||||
return Response.json({ message: "Unauthorized" }, { status: 401 });
|
return Response.json({ message: "Unauthorized" }, { status: 401 });
|
||||||
|
|
||||||
|
const userId = session?.user.id || payload.id;
|
||||||
const { position, h145 } = (await req.json()) as {
|
const { position, h145 } = (await req.json()) as {
|
||||||
position: Prisma.PositionLogCreateInput;
|
position: PositionLog;
|
||||||
h145: boolean;
|
h145: boolean;
|
||||||
};
|
};
|
||||||
|
console.log("position", userId);
|
||||||
if (!position) {
|
if (!position) {
|
||||||
return Response.json(
|
return Response.json({ message: "Missing id or position" });
|
||||||
{ message: "Missing id or position" },
|
|
||||||
{ status: 400 },
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("position", position);
|
||||||
|
|
||||||
const activeAircraft = await prisma.connectedAircraft.findFirst({
|
const activeAircraft = await prisma.connectedAircraft.findFirst({
|
||||||
where: {
|
where: {
|
||||||
userId: session.user.id,
|
userId,
|
||||||
logoutTime: null,
|
logoutTime: null,
|
||||||
},
|
},
|
||||||
orderBy: {
|
orderBy: {
|
||||||
@@ -36,7 +53,10 @@ export const PUT = async (req: Request) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const positionLog = await prisma.positionLog.create({
|
const positionLog = await prisma.positionLog.create({
|
||||||
data: position,
|
data: {
|
||||||
|
...position,
|
||||||
|
userId,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
await prisma.connectedAircraft.update({
|
await prisma.connectedAircraft.update({
|
||||||
@@ -44,6 +64,7 @@ export const PUT = async (req: Request) => {
|
|||||||
id: activeAircraft?.id,
|
id: activeAircraft?.id,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
|
userId,
|
||||||
lastHeartbeat: new Date(),
|
lastHeartbeat: new Date(),
|
||||||
posAlt: positionLog.alt,
|
posAlt: positionLog.alt,
|
||||||
posLat: positionLog.lat,
|
posLat: positionLog.lat,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import { ConnectedAircraft, Station } from "@repo/db";
|
|||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { getConnectedAircraftsAPI } from "querys/aircrafts";
|
import { getConnectedAircraftsAPI } from "querys/aircrafts";
|
||||||
import { getMissionsAPI } from "querys/missions";
|
import { getMissionsAPI } from "querys/missions";
|
||||||
|
import { checkSimulatorConnected } from "helpers/simulatorConnected";
|
||||||
|
|
||||||
export const FMS_STATUS_COLORS: { [key: string]: string } = {
|
export const FMS_STATUS_COLORS: { [key: string]: string } = {
|
||||||
"0": "rgb(140,10,10)",
|
"0": "rgb(140,10,10)",
|
||||||
@@ -394,7 +395,7 @@ const AircraftMarker = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment key={aircraft.id}>
|
<Fragment key={aircraft.id}>
|
||||||
{aircraft.simulatorConnected && (
|
{checkSimulatorConnected(aircraft.lastHeartbeat) && (
|
||||||
<Marker
|
<Marker
|
||||||
ref={markerRef}
|
ref={markerRef}
|
||||||
position={[aircraft.posLat!, aircraft.posLng!]}
|
position={[aircraft.posLat!, aircraft.posLng!]}
|
||||||
@@ -433,6 +434,7 @@ export const AircraftLayer = () => {
|
|||||||
const { data: aircrafts } = useQuery({
|
const { data: aircrafts } = useQuery({
|
||||||
queryKey: ["aircrafts"],
|
queryKey: ["aircrafts"],
|
||||||
queryFn: getConnectedAircraftsAPI,
|
queryFn: getConnectedAircraftsAPI,
|
||||||
|
refetchInterval: 10000,
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import {
|
|||||||
Mountain,
|
Mountain,
|
||||||
Navigation,
|
Navigation,
|
||||||
RadioTower,
|
RadioTower,
|
||||||
SirenIcon,
|
|
||||||
Sunset,
|
Sunset,
|
||||||
TextSearch,
|
TextSearch,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
MISSION_STATUS_TEXT_COLORS,
|
MISSION_STATUS_TEXT_COLORS,
|
||||||
} from "dispatch/_components/map/MissionMarkers";
|
} from "dispatch/_components/map/MissionMarkers";
|
||||||
import { cn } from "helpers/cn";
|
import { cn } from "helpers/cn";
|
||||||
|
import { checkSimulatorConnected } from "helpers/simulatorConnected";
|
||||||
import { getConnectedAircraftsAPI } from "querys/aircrafts";
|
import { getConnectedAircraftsAPI } from "querys/aircrafts";
|
||||||
import { getMissionsAPI } from "querys/missions";
|
import { getMissionsAPI } from "querys/missions";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
@@ -102,7 +103,7 @@ const PopupContent = ({
|
|||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{aircrafts
|
{aircrafts
|
||||||
.filter((a) => a.simulatorConnected)
|
.filter((a) => checkSimulatorConnected(a.lastHeartbeat))
|
||||||
.map((aircraft) => (
|
.map((aircraft) => (
|
||||||
<div
|
<div
|
||||||
key={aircraft.id}
|
key={aircraft.id}
|
||||||
@@ -169,7 +170,7 @@ export const MarkerCluster = () => {
|
|||||||
const zoom = map.getZoom();
|
const zoom = map.getZoom();
|
||||||
let newCluster: typeof cluster = [];
|
let newCluster: typeof cluster = [];
|
||||||
aircrafts
|
aircrafts
|
||||||
?.filter((a) => a.simulatorConnected)
|
?.filter((a) => checkSimulatorConnected(a.lastHeartbeat))
|
||||||
.forEach((aircraft) => {
|
.forEach((aircraft) => {
|
||||||
const lat = aircraft.posLat!;
|
const lat = aircraft.posLat!;
|
||||||
const lng = aircraft.posLng!;
|
const lng = aircraft.posLng!;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { Connection } from "./_components/Connection";
|
import { Connection } from "./_components/Connection";
|
||||||
import { ThemeSwap } from "./_components/ThemeSwap";
|
import { ThemeSwap } from "./_components/ThemeSwap";
|
||||||
import { Audio } from "./_components/Audio";
|
import { Audio } from "../../../_components/Audio";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ExitIcon, ExternalLinkIcon } from "@radix-ui/react-icons";
|
import { ExitIcon, ExternalLinkIcon } from "@radix-ui/react-icons";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|||||||
@@ -1,143 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
|
|
||||||
import {
|
|
||||||
Disc,
|
|
||||||
Mic,
|
|
||||||
PlugZap,
|
|
||||||
ServerCrash,
|
|
||||||
ShieldQuestion,
|
|
||||||
Signal,
|
|
||||||
SignalLow,
|
|
||||||
SignalMedium,
|
|
||||||
WifiOff,
|
|
||||||
ZapOff,
|
|
||||||
} from "lucide-react";
|
|
||||||
import { useAudioStore } from "_store/audioStore";
|
|
||||||
import { cn } from "helpers/cn";
|
|
||||||
import { ConnectionQuality } from "livekit-client";
|
|
||||||
import { ROOMS } from "_data/livekitRooms";
|
|
||||||
|
|
||||||
export const Audio = () => {
|
|
||||||
const connection = useDispatchConnectionStore();
|
|
||||||
const {
|
|
||||||
isTalking,
|
|
||||||
toggleTalking,
|
|
||||||
connect,
|
|
||||||
state,
|
|
||||||
connectionQuality,
|
|
||||||
disconnect,
|
|
||||||
remoteParticipants,
|
|
||||||
room,
|
|
||||||
message,
|
|
||||||
} = useAudioStore();
|
|
||||||
const [selectedRoom, setSelectedRoom] = useState<string>("LST_01");
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const joinRoom = async () => {
|
|
||||||
if (connection.status != "connected") return;
|
|
||||||
if (state === "connected") return;
|
|
||||||
connect(selectedRoom);
|
|
||||||
};
|
|
||||||
|
|
||||||
joinRoom();
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
disconnect();
|
|
||||||
};
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [connection.status]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="bg-base-200 rounded-box flex items-center gap-2 p-1">
|
|
||||||
{state === "error" && (
|
|
||||||
<div className="h-4 flex items-center">{message}</div>
|
|
||||||
)}
|
|
||||||
<button
|
|
||||||
onClick={() => {
|
|
||||||
if (state === "connected") toggleTalking();
|
|
||||||
if (state === "error" || state === "disconnected")
|
|
||||||
connect(selectedRoom);
|
|
||||||
}}
|
|
||||||
className={cn(
|
|
||||||
"btn btn-sm btn-soft border-none hover:bg-inherit",
|
|
||||||
!isTalking && "bg-transparent hover:bg-sky-400/20",
|
|
||||||
isTalking && "bg-red-500 hover:bg-red-600",
|
|
||||||
state === "disconnected" && "bg-red-500 hover:bg-red-500",
|
|
||||||
state === "error" && "bg-red-500 hover:bg-red-500",
|
|
||||||
state === "connecting" &&
|
|
||||||
"bg-yellow-500 hover:bg-yellow-500 cursor-default",
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{state === "connected" && <Mic className="w-5 h-5" />}
|
|
||||||
{state === "disconnected" && <WifiOff className="w-5 h-5" />}
|
|
||||||
{state === "connecting" && <PlugZap className="w-5 h-5" />}
|
|
||||||
{state === "error" && <ServerCrash className="w-5 h-5" />}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{state === "connected" && (
|
|
||||||
<details className="dropdown relative z-[1050]">
|
|
||||||
<summary className="dropdown btn btn-ghost flex items-center gap-1">
|
|
||||||
{connectionQuality === ConnectionQuality.Excellent && (
|
|
||||||
<Signal className="w-5 h-5" />
|
|
||||||
)}
|
|
||||||
{connectionQuality === ConnectionQuality.Good && (
|
|
||||||
<SignalMedium className="w-5 h-5" />
|
|
||||||
)}
|
|
||||||
{connectionQuality === ConnectionQuality.Poor && (
|
|
||||||
<SignalLow className="w-5 h-5" />
|
|
||||||
)}
|
|
||||||
{connectionQuality === ConnectionQuality.Lost && (
|
|
||||||
<ZapOff className="w-5 h-5" />
|
|
||||||
)}
|
|
||||||
{connectionQuality === ConnectionQuality.Unknown && (
|
|
||||||
<ShieldQuestion className="w-5 h-5" />
|
|
||||||
)}
|
|
||||||
<div className="badge badge-sm badge-soft badge-success">
|
|
||||||
{remoteParticipants}
|
|
||||||
</div>
|
|
||||||
</summary>
|
|
||||||
<ul className="menu dropdown-content bg-base-200 rounded-box z-[1050] w-52 p-2 shadow-sm">
|
|
||||||
{ROOMS.map((r) => (
|
|
||||||
<li key={r}>
|
|
||||||
<button
|
|
||||||
className="btn btn-sm btn-ghost text-left flex items-center justify-start gap-2 relative"
|
|
||||||
onClick={() => {
|
|
||||||
if (selectedRoom === r) return;
|
|
||||||
setSelectedRoom(r);
|
|
||||||
connect(r);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{room?.name === r && (
|
|
||||||
<Disc
|
|
||||||
className="text-success text-sm absolute left-2"
|
|
||||||
width={15}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<span className="flex-1 text-center">{r}</span>
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
<li>
|
|
||||||
<button
|
|
||||||
className="btn btn-sm btn-ghost text-left flex items-center justify-start gap-2 relative"
|
|
||||||
onClick={() => {
|
|
||||||
disconnect();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<WifiOff
|
|
||||||
className="text-error text-sm absolute left-2"
|
|
||||||
width={15}
|
|
||||||
/>
|
|
||||||
<span className="flex-1 text-center">Disconnect</span>
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -93,7 +93,9 @@ export const ConnectionBtn = () => {
|
|||||||
}}
|
}}
|
||||||
className="btn btn-soft btn-info"
|
className="btn btn-soft btn-info"
|
||||||
>
|
>
|
||||||
Verbinden
|
{connection.status == "disconnected"
|
||||||
|
? "Verbinden"
|
||||||
|
: connection.status}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
2
apps/dispatch/app/helpers/simulatorConnected.ts
Normal file
2
apps/dispatch/app/helpers/simulatorConnected.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export const checkSimulatorConnected = (date: Date) =>
|
||||||
|
date && Date.now() - new Date(date).getTime() <= 30_000;
|
||||||
@@ -74,7 +74,6 @@ export const Mrt = () => {
|
|||||||
width: "auto",
|
width: "auto",
|
||||||
maxHeight: "100%",
|
maxHeight: "100%",
|
||||||
maxWidth: "100%",
|
maxWidth: "100%",
|
||||||
overflow: "hidden",
|
|
||||||
color: "white",
|
color: "white",
|
||||||
gridTemplateColumns:
|
gridTemplateColumns:
|
||||||
"21.83% 4.43% 24.42% 18.08% 5.93% 1.98% 6.00% 1.69% 6.00% 9.35%",
|
"21.83% 4.43% 24.42% 18.08% 5.93% 1.98% 6.00% 1.69% 6.00% 9.35%",
|
||||||
|
|||||||
@@ -147,7 +147,9 @@ export const ConnectionBtn = () => {
|
|||||||
}}
|
}}
|
||||||
className="btn btn-soft btn-info"
|
className="btn btn-soft btn-info"
|
||||||
>
|
>
|
||||||
Verbinden
|
{connection.status == "disconnected"
|
||||||
|
? "Verbinden"
|
||||||
|
: connection.status}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { Connection } from "./Connection";
|
import { Connection } from "./Connection";
|
||||||
import { ThemeSwap } from "./ThemeSwap";
|
import { ThemeSwap } from "./ThemeSwap";
|
||||||
import { Audio } from "./Audio";
|
import { Audio } from "../../../_components/Audio";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ExitIcon, ExternalLinkIcon } from "@radix-ui/react-icons";
|
import { ExitIcon, ExternalLinkIcon } from "@radix-ui/react-icons";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { redirect } from "next/navigation";
|
|||||||
import { getServerSession } from "../api/auth/[...nextauth]/auth";
|
import { getServerSession } from "../api/auth/[...nextauth]/auth";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "VAR v2: Disponent",
|
title: "VAR v2: Pilot",
|
||||||
description: "Die neue VAR Leitstelle.",
|
description: "Die neue VAR Leitstelle.",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import { Mrt } from "pilot/_components/mrt/Mrt";
|
import { Mrt } from "pilot/_components/mrt/Mrt";
|
||||||
import { Chat } from "../_components/left/Chat";
|
import { Chat } from "../_components/left/Chat";
|
||||||
import { Report } from "../_components/left/Report";
|
import { Report } from "../_components/left/Report";
|
||||||
import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
|
||||||
import { Dme } from "pilot/_components/dme/Dme";
|
import { Dme } from "pilot/_components/dme/Dme";
|
||||||
|
|
||||||
const DispatchPage = () => {
|
const DispatchPage = () => {
|
||||||
@@ -19,8 +18,12 @@ const DispatchPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<Mrt />
|
<div className="relative flex-1">
|
||||||
<Dme />
|
<Mrt />
|
||||||
|
</div>
|
||||||
|
<div className="relative flex-1">
|
||||||
|
<Dme />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
"@tailwindcss/postcss": "^4.0.14",
|
"@tailwindcss/postcss": "^4.0.14",
|
||||||
"@tanstack/react-query": "^5.75.4",
|
"@tanstack/react-query": "^5.75.4",
|
||||||
"axios": "^1.9.0",
|
"axios": "^1.9.0",
|
||||||
|
"jsonwebtoken": "^9.0.2",
|
||||||
"leaflet": "^1.9.4",
|
"leaflet": "^1.9.4",
|
||||||
"livekit-client": "^2.9.7",
|
"livekit-client": "^2.9.7",
|
||||||
"livekit-server-sdk": "^2.10.2",
|
"livekit-server-sdk": "^2.10.2",
|
||||||
|
|||||||
Binary file not shown.
1
package-lock.json
generated
1
package-lock.json
generated
@@ -29,6 +29,7 @@
|
|||||||
"@tailwindcss/postcss": "^4.0.14",
|
"@tailwindcss/postcss": "^4.0.14",
|
||||||
"@tanstack/react-query": "^5.75.4",
|
"@tanstack/react-query": "^5.75.4",
|
||||||
"axios": "^1.9.0",
|
"axios": "^1.9.0",
|
||||||
|
"jsonwebtoken": "^9.0.2",
|
||||||
"leaflet": "^1.9.4",
|
"leaflet": "^1.9.4",
|
||||||
"livekit-client": "^2.9.7",
|
"livekit-client": "^2.9.7",
|
||||||
"livekit-server-sdk": "^2.10.2",
|
"livekit-server-sdk": "^2.10.2",
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ model ConnectedAircraft {
|
|||||||
posSpeed Int?
|
posSpeed Int?
|
||||||
posHeading Int?
|
posHeading Int?
|
||||||
simulator String?
|
simulator String?
|
||||||
simulatorConnected Boolean @default(false)
|
|
||||||
posH145active Boolean @default(false)
|
posH145active Boolean @default(false)
|
||||||
stationId Int
|
stationId Int
|
||||||
loginTime DateTime @default(now())
|
loginTime DateTime @default(now())
|
||||||
|
|||||||
Reference in New Issue
Block a user