mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Remove hand written API objects.
This commit is contained in:
parent
6ee235545f
commit
4b4336391a
@ -1,6 +1,6 @@
|
||||
import { RootState } from "../app/store";
|
||||
import { gameLoaded, gameUnloaded } from "./actions";
|
||||
import { ControlPoint } from "./controlpoint";
|
||||
import { ControlPoint } from "./liberationApi";
|
||||
import { PayloadAction, createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
interface ControlPointsState {
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
import { LatLng } from "leaflet";
|
||||
|
||||
export interface ControlPoint {
|
||||
id: number;
|
||||
name: string;
|
||||
blue: boolean;
|
||||
position: LatLng;
|
||||
mobile: boolean;
|
||||
destination: LatLng | null;
|
||||
sidc: string;
|
||||
}
|
||||
@ -4,8 +4,6 @@ import backend from "./backend";
|
||||
import Combat from "./combat";
|
||||
import { endCombat, newCombat, updateCombat } from "./combatSlice";
|
||||
import { updateControlPoint } from "./controlPointsSlice";
|
||||
import { ControlPoint } from "./controlpoint";
|
||||
import { Flight } from "./flight";
|
||||
import {
|
||||
deselectFlight,
|
||||
registerFlight,
|
||||
@ -19,11 +17,15 @@ import {
|
||||
deleteFrontLine,
|
||||
updateFrontLine,
|
||||
} from "./frontLinesSlice";
|
||||
import FrontLine from "./frontline";
|
||||
import reloadGameState from "./gamestate";
|
||||
import { liberationApi } from "./liberationApi";
|
||||
import {
|
||||
liberationApi,
|
||||
ControlPoint,
|
||||
Flight,
|
||||
FrontLine,
|
||||
Tgo,
|
||||
} from "./liberationApi";
|
||||
import { navMeshUpdated } from "./navMeshSlice";
|
||||
import Tgo from "./tgo";
|
||||
import { updateTgo } from "./tgosSlice";
|
||||
import { threatZonesUpdated } from "./threatZonesSlice";
|
||||
import { LatLng } from "leaflet";
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
import { Waypoint } from "./waypoint";
|
||||
import { LatLng } from "leaflet";
|
||||
|
||||
export interface Flight {
|
||||
id: string;
|
||||
blue: boolean;
|
||||
position: LatLng | null;
|
||||
sidc: string;
|
||||
waypoints: Waypoint[] | null;
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
import { RootState } from "../app/store";
|
||||
import { gameLoaded, gameUnloaded } from "./actions";
|
||||
import { Flight } from "./flight";
|
||||
import { Flight } from "./liberationApi";
|
||||
import { PayloadAction, createSlice } from "@reduxjs/toolkit";
|
||||
import { LatLng } from "leaflet";
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { RootState } from "../app/store";
|
||||
import { gameLoaded, gameUnloaded } from "./actions";
|
||||
import FrontLine from "./frontline";
|
||||
import { FrontLine } from "./liberationApi";
|
||||
import { PayloadAction, createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
interface FrontLinesState {
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
import { LatLng } from "leaflet";
|
||||
|
||||
export interface FrontLine {
|
||||
id: string;
|
||||
extents: LatLng[];
|
||||
}
|
||||
|
||||
export default FrontLine;
|
||||
@ -1,9 +1,12 @@
|
||||
import { ControlPoint } from "./controlpoint";
|
||||
import { Flight } from "./flight";
|
||||
import FrontLine from "./frontline";
|
||||
import { NavMeshes, ThreatZoneContainer } from "./liberationApi";
|
||||
import SupplyRoute from "./supplyroute";
|
||||
import Tgo from "./tgo";
|
||||
import {
|
||||
ControlPoint,
|
||||
Flight,
|
||||
FrontLine,
|
||||
NavMeshes,
|
||||
SupplyRoute,
|
||||
Tgo,
|
||||
ThreatZoneContainer,
|
||||
} from "./liberationApi";
|
||||
import { LatLngLiteral } from "leaflet";
|
||||
|
||||
export default interface Game {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { RootState } from "../app/store";
|
||||
import { gameLoaded, gameUnloaded } from "./actions";
|
||||
import SupplyRoute from "./supplyroute";
|
||||
import { SupplyRoute } from "./liberationApi";
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
interface SupplyRoutesState {
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
import { LatLng } from "leaflet";
|
||||
|
||||
export interface SupplyRoute {
|
||||
points: LatLng[];
|
||||
front_active: boolean;
|
||||
is_sea: boolean;
|
||||
blue: boolean;
|
||||
active_transports: string[];
|
||||
}
|
||||
|
||||
export default SupplyRoute;
|
||||
@ -1,17 +0,0 @@
|
||||
import { LatLng } from "leaflet";
|
||||
|
||||
export interface Tgo {
|
||||
id: string;
|
||||
name: string;
|
||||
control_point_name: string;
|
||||
category: string;
|
||||
blue: boolean;
|
||||
position: LatLng;
|
||||
units: string[];
|
||||
threat_ranges: number[];
|
||||
detection_ranges: number[];
|
||||
dead: boolean;
|
||||
sidc: string;
|
||||
}
|
||||
|
||||
export default Tgo;
|
||||
@ -1,6 +1,6 @@
|
||||
import { RootState } from "../app/store";
|
||||
import { gameLoaded, gameUnloaded } from "./actions";
|
||||
import { Tgo } from "./tgo";
|
||||
import { Tgo } from "./liberationApi";
|
||||
import { PayloadAction, createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
interface TgosState {
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
import { LatLng } from "leaflet";
|
||||
|
||||
export interface Waypoint {
|
||||
name: string;
|
||||
position: LatLng;
|
||||
altitude_ft: number;
|
||||
altitude_reference: string;
|
||||
is_movable: boolean;
|
||||
should_mark: boolean;
|
||||
include_in_path: boolean;
|
||||
timing: string;
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import { Flight } from "../../api/flight";
|
||||
import { Flight } from "../../api/liberationApi";
|
||||
import { Icon, Point } from "leaflet";
|
||||
import { Symbol } from "milsymbol";
|
||||
import { Marker } from "react-leaflet";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import Tgo from "../../api/tgo";
|
||||
import { Tgo } from "../../api/liberationApi";
|
||||
import { selectTgos } from "../../api/tgosSlice";
|
||||
import { useAppSelector } from "../../app/hooks";
|
||||
import { Circle, LayerGroup } from "react-leaflet";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import backend from "../../api/backend";
|
||||
import { ControlPoint as ControlPointModel } from "../../api/controlpoint";
|
||||
import { ControlPoint as ControlPointModel } from "../../api/liberationApi";
|
||||
import {
|
||||
useClearControlPointDestinationMutation,
|
||||
useSetControlPointDestinationMutation,
|
||||
@ -10,6 +10,7 @@ import {
|
||||
Point,
|
||||
Marker as LMarker,
|
||||
Polyline as LPolyline,
|
||||
LatLngLiteral,
|
||||
} from "leaflet";
|
||||
import { Symbol as MilSymbol } from "milsymbol";
|
||||
import {
|
||||
@ -64,7 +65,7 @@ function formatLatLng(latLng: LatLng) {
|
||||
|
||||
function destinationTooltipText(
|
||||
cp: ControlPointModel,
|
||||
destinationish: LatLng,
|
||||
destinationish: LatLngLiteral,
|
||||
inRange: boolean
|
||||
) {
|
||||
const destination = new LatLng(destinationish.lat, destinationish.lng);
|
||||
@ -93,12 +94,12 @@ function PrimaryMarker(props: ControlPointProps) {
|
||||
const [hasDestination, setHasDestination] = useState<boolean>(
|
||||
props.controlPoint.destination != null
|
||||
);
|
||||
const [pathDestination, setPathDestination] = useState<LatLng>(
|
||||
const [pathDestination, setPathDestination] = useState<LatLngLiteral>(
|
||||
props.controlPoint.destination
|
||||
? props.controlPoint.destination
|
||||
: props.controlPoint.position
|
||||
);
|
||||
const [position, setPosition] = useState<LatLng>(
|
||||
const [position, setPosition] = useState<LatLngLiteral>(
|
||||
props.controlPoint.destination
|
||||
? props.controlPoint.destination
|
||||
: props.controlPoint.position
|
||||
@ -189,8 +190,7 @@ function PrimaryMarker(props: ControlPointProps) {
|
||||
dragend: async (event) => {
|
||||
const currentPosition = new LatLng(
|
||||
pathDestination.lat,
|
||||
pathDestination.lng,
|
||||
pathDestination.alt
|
||||
pathDestination.lng
|
||||
);
|
||||
const destination = event.target.getLatLng();
|
||||
setDestination(destination);
|
||||
@ -225,7 +225,7 @@ function PrimaryMarker(props: ControlPointProps) {
|
||||
|
||||
interface SecondaryMarkerProps {
|
||||
controlPoint: ControlPointModel;
|
||||
destination: LatLng | null;
|
||||
destination: LatLngLiteral | undefined;
|
||||
}
|
||||
|
||||
function SecondaryMarker(props: SecondaryMarkerProps) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Flight } from "../../api/flight";
|
||||
import { Flight } from "../../api/liberationApi";
|
||||
import { useGetCommitBoundaryForFlightQuery } from "../../api/liberationApi";
|
||||
import WaypointMarker from "../waypointmarker";
|
||||
import { ReactElement } from "react";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Flight } from "../../api/flight";
|
||||
import { selectFlights, selectSelectedFlight } from "../../api/flightsSlice";
|
||||
import { Flight } from "../../api/liberationApi";
|
||||
import { useAppSelector } from "../../app/hooks";
|
||||
import FlightPlan from "../flightplan";
|
||||
import { LayerGroup } from "react-leaflet";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { FrontLine as FrontLineModel } from "../../api/frontline";
|
||||
import { FrontLine as FrontLineModel } from "../../api/liberationApi";
|
||||
import { Polyline } from "react-leaflet";
|
||||
|
||||
interface FrontLineProps {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { SupplyRoute as SupplyRouteModel } from "../../api/supplyroute";
|
||||
import { SupplyRoute as SupplyRouteModel } from "../../api/liberationApi";
|
||||
import SplitLines from "../splitlines/SplitLines";
|
||||
import { Polyline as LPolyline } from "leaflet";
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
@ -2,7 +2,7 @@ import {
|
||||
useOpenNewTgoPackageDialogMutation,
|
||||
useOpenTgoInfoDialogMutation,
|
||||
} from "../../api/liberationApi";
|
||||
import { Tgo as TgoModel } from "../../api/tgo";
|
||||
import { Tgo as TgoModel } from "../../api/liberationApi";
|
||||
import SplitLines from "../splitlines/SplitLines";
|
||||
import { Icon, Point } from "leaflet";
|
||||
import { Symbol as MilSymbol } from "milsymbol";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import backend from "../../api/backend";
|
||||
import { Flight } from "../../api/flight";
|
||||
import { Waypoint } from "../../api/waypoint";
|
||||
import { Flight } from "../../api/liberationApi";
|
||||
import { Waypoint } from "../../api/liberationApi";
|
||||
import { Icon } from "leaflet";
|
||||
import { Marker as LMarker } from "leaflet";
|
||||
import icon from "leaflet/dist/images/marker-icon.png";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user