-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update: frontend from tanega repo commit: #623ab16 https://github.com/tanega/trailwatch-front-kickoff * feat: frontend ignore public data geometries * fix: Docker frontend code volume share removed because of building files missing Because frontend needs frontend build that is done during building docker, mounting volume for dev removes this building Entrytpoint could be modified to detect that frontend needs to be rebuild but for the moment, removing volume mounting to assure frontend works * feat: amélioration du docker frontend, Dockerfile séparé # Conflicts: # docker/Dockerfile * fix: frontend missing map-store * fix: fix load data to use bloom/tasks (loading positions missing) # Conflicts: # docker-compose-load-data.yaml * update: frontend from tanega repo commit: #623ab16 https://github.com/tanega/trailwatch-front-kickoff * fix: Docker frontend code volume share removed because of building files missing Because frontend needs frontend build that is done during building docker, mounting volume for dev removes this building Entrytpoint could be modified to detect that frontend needs to be rebuild but for the moment, removing volume mounting to assure frontend works # Conflicts: # docker-compose.yaml * feat: amélioration du docker frontend, Dockerfile séparé # Conflicts: # docker-compose.yaml * fix: docker compose files double volumes --------- Co-authored-by: herve.le-bars <herve.le-bars@aviation-civile.gouv.fr>
- Loading branch information
Showing
283 changed files
with
4,251 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM node:18-alpine | ||
ARG APP_DIR=/app | ||
|
||
WORKDIR ${APP_DIR} | ||
|
||
# Install dependencies based on the preferred package manager | ||
COPY frontend/package.json frontend/yarn.lock* frontend/package-lock.json* frontend/pnpm-lock.yaml* ./ | ||
RUN \ | ||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ | ||
elif [ -f package-lock.json ]; then npm ci; \ | ||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i; \ | ||
# Allow install without lockfile, so example works even without Node.js installed locally | ||
else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \ | ||
fi | ||
|
||
COPY frontend/. . | ||
#COPY frontend/app frontend/components frontend/config frontend/lib frontend/styles frontend/types . | ||
#COPY frontend/public public | ||
#COPY frontend/next.config.mjs . | ||
#COPY frontend/tsconfig.json . | ||
|
||
# Next.js collects completely anonymous telemetry data about general usage. Learn more here: https://nextjs.org/telemetry | ||
# Uncomment the following line to disable telemetry at run time | ||
# ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
# Note: Don't expose ports here, Compose will handle that for us | ||
|
||
# Start Next.js in development mode based on the preferred package manager | ||
CMD \ | ||
if [ -f yarn.lock ]; then yarn dev; \ | ||
elif [ -f package-lock.json ]; then npm run dev; \ | ||
elif [ -f pnpm-lock.yaml ]; then pnpm dev; \ | ||
else npm run dev; \ | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import LeftPanel from "@/components/core/left-panel" | ||
import MapControls from "@/components/core/map-controls" | ||
import DemoMap from "@/components/core/map/main-map" | ||
import PositionPreview from "@/components/core/map/position-preview" | ||
|
||
export default function MapPage() { | ||
return ( | ||
<> | ||
<LeftPanel /> | ||
<DemoMap /> | ||
<MapControls /> | ||
<PositionPreview /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
"use client" | ||
|
||
import { useState } from "react" | ||
import allVessels from "@/public/data/geometries/all_vessels_with_mmsi.json" | ||
import latestPositions from "@/public/data/geometries/vessels_latest_positions.json" | ||
import { FlyToInterpolator } from "deck.gl" | ||
import { ShipIcon } from "lucide-react" | ||
|
||
import { Vessel } from "@/types/vessel" | ||
import { | ||
CommandDialog, | ||
CommandEmpty, | ||
CommandGroup, | ||
CommandInput, | ||
CommandItem, | ||
CommandList, | ||
CommandSeparator, | ||
} from "@/components/ui/command" | ||
import { useMapStore } from "@/components/providers/map-store-provider" | ||
|
||
import { VesselPosition } from "../map/main-map" | ||
|
||
type Props = { | ||
wideMode: boolean | ||
} | ||
|
||
const SEPARATOR = "___" | ||
|
||
export function VesselFinderDemo({ wideMode }: Props) { | ||
const [open, setOpen] = useState(false) | ||
const [search, setSearch] = useState<string>("") | ||
const { | ||
addTrackedVesselMMSI, | ||
trackedVesselMMSIs, | ||
setActivePosition, | ||
viewState, | ||
setViewState, | ||
} = useMapStore((state) => state) | ||
|
||
const onSelectVessel = (vesselIdentifier: string) => { | ||
const mmsi = parseInt(vesselIdentifier.split(SEPARATOR)[1]) | ||
if (mmsi && !trackedVesselMMSIs.includes(mmsi)) { | ||
addTrackedVesselMMSI(mmsi) | ||
} | ||
if (mmsi) { | ||
const selectedVesselLatestPosition = latestPositions.find( | ||
(position) => position.vessel_mmsi === mmsi | ||
) | ||
if (selectedVesselLatestPosition) { | ||
setActivePosition(selectedVesselLatestPosition as VesselPosition) | ||
setViewState({ | ||
...viewState, | ||
longitude: selectedVesselLatestPosition.position_longitude, | ||
latitude: selectedVesselLatestPosition.position_latitude, | ||
zoom: 7, | ||
pitch: 40, | ||
transitionInterpolator: new FlyToInterpolator({ speed: 2 }), | ||
transitionDuration: "auto", | ||
}) | ||
} | ||
} | ||
setOpen(false) | ||
} | ||
|
||
return ( | ||
<> | ||
<button | ||
type="button" | ||
className="dark:highlight-white/5 flex items-center rounded-md bg-color-3 py-1.5 pl-2 pr-3 text-sm leading-6 text-slate-400 shadow-sm ring-1 ring-color-2 hover:bg-slate-700 hover:ring-slate-300" | ||
onClick={() => setOpen(true)} | ||
> | ||
<svg | ||
width="24" | ||
height="24" | ||
fill="none" | ||
aria-hidden="true" | ||
className="mr-3 flex-none" | ||
> | ||
<path | ||
d="m19 19-3.5-3.5" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
></path> | ||
<circle | ||
cx="11" | ||
cy="11" | ||
r="6" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
></circle> | ||
</svg> | ||
{wideMode && <>Find vessels...</>} | ||
</button> | ||
|
||
<CommandDialog open={open} onOpenChange={setOpen}> | ||
<CommandInput | ||
placeholder="Type MMSI, IMO or vessel name to search..." | ||
value={search} | ||
onValueChange={setSearch} | ||
/> | ||
<CommandList> | ||
<CommandEmpty>No results found.</CommandEmpty> | ||
<CommandGroup heading="Vessels"> | ||
{allVessels.map((vessel: Vessel) => { | ||
return ( | ||
<CommandItem | ||
key={`${vessel.imo}-${vessel.name}`} | ||
onSelect={(value) => onSelectVessel(value)} | ||
value={`${vessel.name}${SEPARATOR}${vessel.mmsi}${SEPARATOR}${vessel.imo}`} // so we can search by name, mmsi, imo | ||
> | ||
<ShipIcon className="mr-2 size-4" /> | ||
<span>{vessel.name}</span> | ||
<span className="ml-2 text-xxxs"> | ||
{" "} | ||
MMSI {vessel.mmsi} | IMO {vessel.imo} | ||
</span> | ||
</CommandItem> | ||
) | ||
})} | ||
</CommandGroup> | ||
<CommandSeparator /> | ||
</CommandList> | ||
</CommandDialog> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.