diff --git a/apps/dispatch-server/socket-events/connect-dispatch.ts b/apps/dispatch-server/socket-events/connect-dispatch.ts index ba41eee5..ddd6528c 100644 --- a/apps/dispatch-server/socket-events/connect-dispatch.ts +++ b/apps/dispatch-server/socket-events/connect-dispatch.ts @@ -51,7 +51,9 @@ export const handleConnectDispatch = data: { publicUser: getPublicUser(user) as any, esimatedLogoutTime: - logoffHours && logoffMinutes ? getNextDateWithTime(logoffHours, logoffMinutes) : null, + logoffHours !== undefined && logoffMinutes !== undefined + ? getNextDateWithTime(logoffHours, logoffMinutes) + : null, lastHeartbeat: new Date().toISOString(), userId: user.id, zone: selectedZone, diff --git a/apps/dispatch-server/socket-events/connect-pilot.ts b/apps/dispatch-server/socket-events/connect-pilot.ts index efe7582b..0f9b4118 100644 --- a/apps/dispatch-server/socket-events/connect-pilot.ts +++ b/apps/dispatch-server/socket-events/connect-pilot.ts @@ -79,7 +79,9 @@ export const handleConnectPilot = data: { publicUser: getPublicUser(user) as any, esimatedLogoutTime: - logoffHours && logoffMinutes ? getNextDateWithTime(logoffHours, logoffMinutes) : null, + logoffHours !== undefined && logoffMinutes !== undefined + ? getNextDateWithTime(logoffHours, logoffMinutes) + : null, userId: userId, stationId: parseInt(stationId), lastHeartbeat: debug ? nowPlus2h.toISOString() : undefined, diff --git a/apps/dispatch/app/(app)/dispatch/_components/navbar/_components/Connection.tsx b/apps/dispatch/app/(app)/dispatch/_components/navbar/_components/Connection.tsx index 5189ab0f..2bb6bbab 100644 --- a/apps/dispatch/app/(app)/dispatch/_components/navbar/_components/Connection.tsx +++ b/apps/dispatch/app/(app)/dispatch/_components/navbar/_components/Connection.tsx @@ -22,9 +22,6 @@ export const ConnectionBtn = () => { const session = useSession(); const uid = session.data?.user?.id; - // useEffect für die Logoff-Zeit - const [logoffHours, logoffMinutes] = form.logoffTime?.split(":").map(Number) || []; - useEffect(() => { // Disconnect the socket when the component unmounts return () => { @@ -101,11 +98,13 @@ export const ConnectionBtn = () => { className="btn" onClick={async () => { if (!connection.connectedDispatcher?.id) return; + const [logoffHours, logoffMinutes] = + form.logoffTime?.split(":").map(Number) || []; await changeDispatcherMutation.mutateAsync({ id: connection.connectedDispatcher?.id, data: { esimatedLogoutTime: - logoffHours && logoffMinutes + logoffHours !== undefined && logoffMinutes !== undefined ? getNextDateWithTime(logoffHours, logoffMinutes) : null, }, diff --git a/apps/dispatch/app/(app)/pilot/_components/navbar/_components/Connection.tsx b/apps/dispatch/app/(app)/pilot/_components/navbar/_components/Connection.tsx index 83c0a5ce..09258ea9 100644 --- a/apps/dispatch/app/(app)/pilot/_components/navbar/_components/Connection.tsx +++ b/apps/dispatch/app/(app)/pilot/_components/navbar/_components/Connection.tsx @@ -54,8 +54,6 @@ export const ConnectionBtn = () => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [connection.disconnect]); - const [logoffHours, logoffMinutes] = form.logoffTime?.split(":").map(Number) || []; - const { data: connectedAircrafts } = useQuery({ queryKey: ["aircrafts"], queryFn: () => getConnectedAircraftsAPI(), @@ -182,11 +180,15 @@ export const ConnectionBtn = () => { className="btn" onClick={async () => { if (!connection.connectedAircraft) return; + const [logoffHours, logoffMinutes] = + form.logoffTime?.split(":").map(Number) || []; + + console.log(logoffHours, logoffMinutes, form.logoffTime); await aircraftMutation.mutateAsync({ sessionId: connection.connectedAircraft.id, change: { esimatedLogoutTime: - logoffHours && logoffMinutes + logoffHours !== undefined && logoffMinutes !== undefined ? getNextDateWithTime(logoffHours, logoffMinutes) : null, }, @@ -202,6 +204,7 @@ export const ConnectionBtn = () => { onSubmit={() => false} onClick={() => { connection.disconnect(); + modalRef.current?.close(); }} > Verbindung Trennen diff --git a/apps/hub/app/(app)/admin/keyword/page.tsx b/apps/hub/app/(app)/admin/keyword/page.tsx index 94f7714d..25a57b1a 100644 --- a/apps/hub/app/(app)/admin/keyword/page.tsx +++ b/apps/hub/app/(app)/admin/keyword/page.tsx @@ -1,3 +1,4 @@ +"use client"; import { DatabaseBackupIcon } from "lucide-react"; import { PaginatedTable } from "../../../_components/PaginatedTable"; import Link from "next/link"; diff --git a/apps/hub/app/(app)/admin/station/page.tsx b/apps/hub/app/(app)/admin/station/page.tsx index 12397a9a..07b5611f 100644 --- a/apps/hub/app/(app)/admin/station/page.tsx +++ b/apps/hub/app/(app)/admin/station/page.tsx @@ -10,7 +10,7 @@ const page = () => { <>