fixed dispatch eslint errors
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { useDebounce } from "_helpers/useDebounce";
|
||||
import { useDebounce } from "@repo/shared-components";
|
||||
import { useAudioStore } from "_store/audioStore";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
@@ -112,5 +112,6 @@ export const useSounds = ({
|
||||
callToLong.current!.pause();
|
||||
};
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isTransmitting]);
|
||||
};
|
||||
|
||||
@@ -11,10 +11,10 @@ export const CustomErrorBoundary = ({ children }: { children?: React.ReactNode }
|
||||
let errorTest;
|
||||
let errorCode = 500;
|
||||
if ("statusCode" in error) {
|
||||
errorCode = (error as any).statusCode;
|
||||
errorCode = error.statusCode;
|
||||
}
|
||||
if ("message" in error || error instanceof Error) {
|
||||
errorTest = (error as any).message;
|
||||
errorTest = error.message;
|
||||
} else if (typeof error === "string") {
|
||||
errorTest = error;
|
||||
} else {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
"use client";
|
||||
|
||||
import { toast } from "react-hot-toast";
|
||||
import { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-query";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { ReactNode, useEffect, useState } from "react";
|
||||
import { dispatchSocket } from "(app)/dispatch/socket";
|
||||
import { Mission, NotificationPayload } from "@repo/db";
|
||||
import { NotificationPayload } from "@repo/db";
|
||||
import { HPGnotificationToast } from "_components/customToasts/HPGnotification";
|
||||
import { useMapStore } from "_store/mapStore";
|
||||
import { AdminMessageToast } from "_components/customToasts/AdminMessage";
|
||||
@@ -30,7 +30,7 @@ export function QueryProvider({ children }: { children: ReactNode }) {
|
||||
}),
|
||||
);
|
||||
useEffect(() => {
|
||||
const invalidateMission = (mission: Mission) => {
|
||||
const invalidateMission = () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["missions"],
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
"use client";
|
||||
import { FieldValues, Path } from "react-hook-form";
|
||||
import SelectTemplate, { Props as SelectTemplateProps, StylesConfig } from "react-select";
|
||||
import { cn } from "@repo/shared-components";
|
||||
import dynamic from "next/dynamic";
|
||||
@@ -99,7 +99,7 @@ const SelectCom = ({
|
||||
);
|
||||
};
|
||||
|
||||
const SelectWrapper = <T extends FieldValues>(props: SelectProps) => <SelectCom {...props} />;
|
||||
const SelectWrapper = (props: SelectProps) => <SelectCom {...props} />;
|
||||
|
||||
export const Select = dynamic(() => Promise.resolve(SelectWrapper), {
|
||||
ssr: false,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NotificationPayload, ValidationFailed, ValidationSuccess } from "@repo/db";
|
||||
import { ValidationFailed, ValidationSuccess } from "@repo/db";
|
||||
import { BaseNotification } from "_components/customToasts/BaseNotification";
|
||||
import { MapStore, useMapStore } from "_store/mapStore";
|
||||
import { MapStore } from "_store/mapStore";
|
||||
import { Check, Cross } from "lucide-react";
|
||||
import toast, { Toast } from "react-hot-toast";
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import { FMS_STATUS_COLORS } from "_helpers/fmsStatusColors";
|
||||
import { editConnectedAircraftAPI, getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { getStationsAPI } from "_querys/stations";
|
||||
import { useMapStore } from "_store/mapStore";
|
||||
import { cpSync } from "fs";
|
||||
import { X } from "lucide-react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Toast, toast } from "react-hot-toast";
|
||||
@@ -67,7 +66,7 @@ export const StatusToast = ({ event, t }: { event: StationStatus; t: Toast }) =>
|
||||
} else if (event.status == connectedAircraft?.fmsStatus && !aircraftDataAcurate) {
|
||||
setAircraftDataAccurate(true);
|
||||
}
|
||||
}, [connectedAircraft, station]);
|
||||
}, [aircraftDataAcurate, connectedAircraft, event.status, t.id]);
|
||||
|
||||
useEffect(() => {
|
||||
let soundRef: React.RefObject<HTMLAudioElement | null> | null = null;
|
||||
|
||||
@@ -41,7 +41,7 @@ export const Chat = () => {
|
||||
useEffect(() => {
|
||||
if (!session.data?.user.id) return;
|
||||
setOwnId(session.data?.user.id);
|
||||
}, [session.data?.user.id]);
|
||||
}, [session.data?.user.id, setOwnId]);
|
||||
|
||||
const filteredDispatcher = dispatcher?.filter((d) => d.userId !== session.data?.user.id);
|
||||
const filteredAircrafts = aircrafts?.filter((a) => a.userId !== session.data?.user.id);
|
||||
@@ -118,7 +118,7 @@ export const Chat = () => {
|
||||
const dispatcherUser = dispatcher?.find((d) => d.userId === addTabValue);
|
||||
const user = aircraftUser || dispatcherUser;
|
||||
if (!user) return;
|
||||
let role = "Station" in user ? user.Station.bosCallsignShort : user.zone;
|
||||
const role = "Station" in user ? user.Station.bosCallsignShort : user.zone;
|
||||
addChat(addTabValue, `${asPublicUser(user.publicUser).fullName} (${role})`);
|
||||
setSelectedChat(addTabValue);
|
||||
}}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { cn } from "@repo/shared-components";
|
||||
import { ListCollapse, Plane } from "lucide-react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getMissionsAPI } from "_querys/missions";
|
||||
import { Station } from "@repo/db";
|
||||
import { Mission, Station } from "@repo/db";
|
||||
import { getConnectedAircraftsAPI } from "_querys/aircrafts";
|
||||
import { FMS_STATUS_COLORS, FMS_STATUS_TEXT_COLORS } from "_helpers/fmsStatusColors";
|
||||
import { useMapStore } from "_store/mapStore";
|
||||
@@ -20,7 +20,13 @@ export const SituationBoard = () => {
|
||||
const { data: missions } = useQuery({
|
||||
queryKey: ["missions", "missions-on-stations"],
|
||||
queryFn: () =>
|
||||
getMissionsAPI(
|
||||
getMissionsAPI<
|
||||
Mission & {
|
||||
MissionsOnStations: (Station & {
|
||||
Station: Station;
|
||||
})[];
|
||||
}
|
||||
>(
|
||||
{
|
||||
state: {
|
||||
not: "finished",
|
||||
@@ -125,8 +131,8 @@ export const SituationBoard = () => {
|
||||
<td>{mission.missionKeywordAbbreviation}</td>
|
||||
<td>{mission.addressCity}</td>
|
||||
<td>
|
||||
{(mission as any).MissionsOnStations?.map(
|
||||
(mos: { Station: Station }) => mos.Station?.bosCallsignShort,
|
||||
{mission.MissionsOnStations?.map(
|
||||
(mos) => mos.Station?.bosCallsignShort,
|
||||
).join(", ")}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -262,7 +262,7 @@ const AircraftMarker = ({ aircraft }: { aircraft: ConnectedAircraft & { Station:
|
||||
return () => {
|
||||
marker?.off("click", handleClick);
|
||||
};
|
||||
}, [aircraft.id, openAircraftMarker, setOpenAircraftMarker, markerRef.current]);
|
||||
}, [aircraft.id, openAircraftMarker, setOpenAircraftMarker]);
|
||||
|
||||
const [anchor, setAnchor] = useState<"topleft" | "topright" | "bottomleft" | "bottomright">(
|
||||
"topleft",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
import { usePannelStore } from "_store/pannelStore";
|
||||
import { Control, Icon, LatLngExpression } from "leaflet";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
LayerGroup,
|
||||
LayersControl,
|
||||
@@ -15,7 +14,7 @@ import {
|
||||
Marker,
|
||||
Tooltip,
|
||||
} from "react-leaflet";
|
||||
// @ts-ignore
|
||||
// @ts-expect-error geojson hat keine Typen
|
||||
import type { FeatureCollection, Geometry } from "geojson";
|
||||
import L from "leaflet";
|
||||
import LEITSTELLENBERECHE from "./_geojson/Leitstellen.json";
|
||||
@@ -197,7 +196,7 @@ const StationsLayer = ({ attribution }: { attribution: Control.Attribution }) =>
|
||||
);
|
||||
};
|
||||
|
||||
const EsriSatellite = ({ attribution }: { attribution: Control.Attribution }) => {
|
||||
const EsriSatellite = () => {
|
||||
const accessToken = process.env.NEXT_PUBLIC_ESRI_ACCESS;
|
||||
return (
|
||||
<>
|
||||
@@ -221,8 +220,7 @@ const StrassentexteEsri = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const OpenAIP = ({ attribution }: { attribution: Control.Attribution }) => {
|
||||
const accessToken = process.env.NEXT_PUBLIC_OPENAIP_ACCESS;
|
||||
const OpenAIP = () => {
|
||||
const ref = useRef<L.TileLayer | null>(null);
|
||||
|
||||
return (
|
||||
@@ -241,7 +239,7 @@ const OpenAIP = ({ attribution }: { attribution: Control.Attribution }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const NiederschlagOverlay = ({ attribution }: { attribution: Control.Attribution }) => {
|
||||
const NiederschlagOverlay = () => {
|
||||
const tileLayerRef = useRef<L.TileLayer.WMS | null>(null);
|
||||
|
||||
return (
|
||||
@@ -311,7 +309,7 @@ export const BaseMaps = () => {
|
||||
<RadioAreaLayer />
|
||||
</LayersControl.Overlay>
|
||||
<LayersControl.Overlay name={"Niederschlag"}>
|
||||
<NiederschlagOverlay attribution={map.attributionControl} />
|
||||
<NiederschlagOverlay />
|
||||
</LayersControl.Overlay>
|
||||
|
||||
<LayersControl.Overlay name={"Windkraftanlagen offshore"}>
|
||||
@@ -322,7 +320,7 @@ export const BaseMaps = () => {
|
||||
<StationsLayer attribution={map.attributionControl} />
|
||||
</LayersControl.Overlay>
|
||||
<LayersControl.Overlay name={"OpenAIP"}>
|
||||
<OpenAIP attribution={map.attributionControl} />
|
||||
<OpenAIP />
|
||||
</LayersControl.Overlay>
|
||||
|
||||
<LayersControl.BaseLayer name="OpenStreetMap Dark" checked>
|
||||
@@ -348,7 +346,7 @@ export const BaseMaps = () => {
|
||||
</LayersControl.BaseLayer>
|
||||
<LayersControl.BaseLayer name="ESRI Satellite">
|
||||
<LayerGroup>
|
||||
<EsriSatellite attribution={map.attributionControl} />
|
||||
<EsriSatellite />
|
||||
<StrassentexteEsri />
|
||||
</LayerGroup>
|
||||
</LayersControl.BaseLayer>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { OSMWay, Prisma } from "@repo/db";
|
||||
import { OSMWay } from "@repo/db";
|
||||
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
|
||||
import { useMapStore } from "_store/mapStore";
|
||||
import { usePannelStore } from "_store/pannelStore";
|
||||
@@ -8,8 +8,6 @@ import { getOsmAddress } from "_querys/osm";
|
||||
import { useEffect, useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { Popup, useMap } from "react-leaflet";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { editMissionAPI } from "_querys/missions";
|
||||
import { findClosestPolygon } from "_helpers/findClosestPolygon";
|
||||
|
||||
export const ContextMenu = () => {
|
||||
@@ -22,8 +20,9 @@ export const ContextMenu = () => {
|
||||
setSearchPopup,
|
||||
toggleSearchElementSelection,
|
||||
} = useMapStore();
|
||||
const { missionFormValues, setMissionFormValues, setOpen, isOpen, editingMissionId } =
|
||||
usePannelStore((state) => state);
|
||||
const { missionFormValues, setMissionFormValues, setOpen, isOpen } = usePannelStore(
|
||||
(state) => state,
|
||||
);
|
||||
const [showRulerOptions, setShowRulerOptions] = useState(false);
|
||||
const [rulerHover, setRulerHover] = useState(false);
|
||||
const [rulerOptionsHover, setRulerOptionsHover] = useState(false);
|
||||
|
||||
@@ -72,7 +72,7 @@ const MissionPopupContent = ({
|
||||
default:
|
||||
return <span className="text-gray-100">Error</span>;
|
||||
}
|
||||
}, [currentTab, mission]);
|
||||
}, [currentTab, hpgNeedsAttention, mission]);
|
||||
|
||||
const setOpenMissionMarker = useMapStore((state) => state.setOpenMissionMarker);
|
||||
const { anchor } = useSmartPopup();
|
||||
@@ -350,6 +350,10 @@ const MissionMarker = ({ mission }: { mission: Mission }) => {
|
||||
editingMissionId,
|
||||
mission.addressLat,
|
||||
mission.addressLng,
|
||||
mission.hpgLocationLat,
|
||||
mission.hpgLocationLng,
|
||||
mission.hpgValidationState,
|
||||
mission.id,
|
||||
missionFormValues?.addressLat,
|
||||
missionFormValues?.addressLng,
|
||||
]);
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useEffect } from "react";
|
||||
|
||||
export const SearchElements = () => {
|
||||
const { searchElements, openMissionMarker, setSearchElements } = useMapStore();
|
||||
const { isOpen: pannelOpen, editingMissionId } = usePannelStore((state) => state);
|
||||
const { isOpen: pannelOpen } = usePannelStore((state) => state);
|
||||
const { data: missions } = useQuery({
|
||||
queryKey: ["missions"],
|
||||
queryFn: () =>
|
||||
@@ -42,7 +42,7 @@ export const SearchElements = () => {
|
||||
);
|
||||
setSearchElements(elements.filter((e) => !!e));
|
||||
}
|
||||
}, [openMissionMarker, pannelOpen, missions]);
|
||||
}, [openMissionMarker, pannelOpen, missions, setSearchElements]);
|
||||
|
||||
const SearchElement = ({ element }: { element: OSMWay }) => {
|
||||
const { toggleSearchElementSelection } = useMapStore();
|
||||
|
||||
@@ -250,7 +250,7 @@ const StationTab = ({ aircraft }: { aircraft: ConnectedAircraft & { Station: Sta
|
||||
const lstName = useMemo(() => {
|
||||
if (!aircraft.posLng || !aircraft.posLat) return station.bosRadioArea;
|
||||
return findLeitstelleForPosition(aircraft.posLng, aircraft.posLat);
|
||||
}, [aircraft.posLng, aircraft.posLat]);
|
||||
}, [aircraft.posLng, aircraft.posLat, station.bosRadioArea]);
|
||||
|
||||
return (
|
||||
<div className="p-4 text-base-content">
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
SmartphoneNfc,
|
||||
CheckCheck,
|
||||
Cross,
|
||||
Radio,
|
||||
Route,
|
||||
} from "lucide-react";
|
||||
import {
|
||||
@@ -26,12 +25,9 @@ import {
|
||||
HpgState,
|
||||
HpgValidationState,
|
||||
Mission,
|
||||
MissionAlertLog,
|
||||
MissionCompletedLog,
|
||||
MissionLog,
|
||||
MissionMessageLog,
|
||||
Prisma,
|
||||
Station,
|
||||
} from "@repo/db";
|
||||
import { usePannelStore } from "_store/pannelStore";
|
||||
import { useSession } from "next-auth/react";
|
||||
@@ -143,13 +139,16 @@ const Einsatzdetails = ({
|
||||
state: "finished",
|
||||
missionLog: {
|
||||
push: {
|
||||
type: "completed-log",
|
||||
auto: false,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
user: getPublicUser(session.data?.user, { ignorePrivacy: true }),
|
||||
},
|
||||
} as any,
|
||||
toJSON: () => ({
|
||||
type: "message-log",
|
||||
auto: false,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
message: "Einsatz abgeschlossen",
|
||||
user: getPublicUser(session.data.user, { ignorePrivacy: true }),
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -408,11 +407,6 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
|
||||
refetchMissionStationIds();
|
||||
}, [mission.missionStationIds, refetchMissionStationIds]);
|
||||
|
||||
const { data: allStations } = useQuery({
|
||||
queryKey: ["stations"],
|
||||
queryFn: () => getStationsAPI(),
|
||||
});
|
||||
|
||||
const sendAlertMutation = useMutation({
|
||||
mutationKey: ["missions"],
|
||||
mutationFn: ({
|
||||
@@ -527,6 +521,7 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
|
||||
menuPlacement="top"
|
||||
className="min-w-[320px] flex-1"
|
||||
isMulti={false}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
onChange={(v: any) => {
|
||||
setSelectedStation(v);
|
||||
}}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
"use client";
|
||||
import { PublicUser } from "@repo/db";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { cn, PenaltyDropdown } from "@repo/shared-components";
|
||||
import { PenaltyDropdown } from "@repo/shared-components";
|
||||
import { getConnectedAircraftsAPI, kickAircraftAPI } from "_querys/aircrafts";
|
||||
import { getConnectedDispatcherAPI, kickDispatcherAPI } from "_querys/dispatcher";
|
||||
import { getLivekitRooms, kickLivekitParticipant } from "_querys/livekit";
|
||||
import { ParticipantInfo } from "livekit-server-sdk";
|
||||
import {
|
||||
Eye,
|
||||
LockKeyhole,
|
||||
Plane,
|
||||
RedoDot,
|
||||
@@ -17,7 +16,7 @@ import {
|
||||
UserCheck,
|
||||
Workflow,
|
||||
} from "lucide-react";
|
||||
import { ReactNode, useRef, useState } from "react";
|
||||
import { useRef } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export default function AdminPanel() {
|
||||
|
||||
@@ -5,7 +5,6 @@ import { SettingsIcon, Volume2 } from "lucide-react";
|
||||
import MicVolumeBar from "_components/MicVolumeIndication";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { editUserAPI, getUserAPI } from "_querys/user";
|
||||
import { Prisma } from "@repo/db";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useAudioStore } from "_store/audioStore";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
Reference in New Issue
Block a user