-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86c6693
commit 94be72e
Showing
34 changed files
with
328 additions
and
249 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"singleQuote": true, | ||
"semi": false, | ||
"trailingComma": "es5", | ||
"printWidth": 120 | ||
} | ||
"singleQuote": true, | ||
"semi": false, | ||
"trailingComma": "es5", | ||
"printWidth": 120 | ||
} |
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 |
---|---|---|
|
@@ -2,10 +2,13 @@ | |
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Gabarito:[email protected]&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap" rel="stylesheet"> | ||
<link rel="icon" href="/FaviconAIS.png"> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Gabarito:[email protected]&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link rel="icon" href="/FaviconAIS.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Suspicios Vessel Finder</title> | ||
</head> | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,60 +1,77 @@ | ||
import { useState } from "react" | ||
import { useAppContext } from "../contexts/appcontext" | ||
import FaviconSVG from "../svgs/faviconSVG" | ||
import HamburgerSVG from "../svgs/hamburgerSVG" | ||
import CloseSVG from "../svgs/closeSVG" | ||
import { useState } from 'react' | ||
import { useAppContext } from '../contexts/appcontext' | ||
import FaviconSVG from '../svgs/faviconSVG' | ||
import HamburgerSVG from '../svgs/hamburgerSVG' | ||
import CloseSVG from '../svgs/closeSVG' | ||
|
||
interface INavbar { | ||
interface INavbar {} | ||
|
||
} | ||
|
||
export default function Navbar({ }: INavbar) { | ||
const [opened, setOpened] = useState<boolean>(false) | ||
const { myDateTime, myClockSpeed, setMyDateTime, setMyClockSpeed } = useAppContext() | ||
const convertedMyDateTime = `${myDateTime.getFullYear()}-${myDateTime.getMonth().toString().padStart(2, "0")}-${myDateTime.getDate().toString().padStart(2, "0")}T${myDateTime.getHours().toString().padStart(2, "0")}:${myDateTime.getMinutes().toString().padStart(2, "0")}` | ||
export default function Navbar({}: INavbar) { | ||
const [opened, setOpened] = useState<boolean>(false) | ||
const { myDateTime, myClockSpeed, setMyDateTime, setMyClockSpeed } = useAppContext() | ||
const convertedMyDateTime = `${myDateTime.getFullYear()}-${myDateTime.getMonth().toString().padStart(2, '0')}-${myDateTime.getDate().toString().padStart(2, '0')}T${myDateTime.getHours().toString().padStart(2, '0')}:${myDateTime.getMinutes().toString().padStart(2, '0')}` | ||
|
||
function manageSpeedChange(val: string) { | ||
try { | ||
const parsed = parseInt(val) | ||
setMyClockSpeed(parsed) | ||
} catch (e) { | ||
console.error(e) | ||
setMyClockSpeed(1) | ||
} | ||
function manageSpeedChange(val: string) { | ||
try { | ||
const parsed = parseInt(val) | ||
setMyClockSpeed(parsed) | ||
} catch (e) { | ||
console.error(e) | ||
setMyClockSpeed(1) | ||
} | ||
} | ||
|
||
function manageDateChange(val: string) { | ||
const parsed = new Date(val) | ||
setMyDateTime(parsed) | ||
} | ||
function manageDateChange(val: string) { | ||
const parsed = new Date(val) | ||
setMyDateTime(parsed) | ||
} | ||
|
||
return ( | ||
<div className="w-fit"> | ||
<div id="navbar" className="relative px-5 flex flex-row gap-4 flex-nowrap items-center w-full bg-gray-700 text-white rounded-lg p-4"> | ||
<FaviconSVG></FaviconSVG> | ||
<h1 className="text-xl font-bold">Suspicios Vessel Finder</h1> | ||
{ opened && | ||
<div id="settings-container" className="absolute left-[101%] top-0 bg-gray-200 text-gray-800 flex flex-col gap-4 p-4 w-fit rounded-md shadow-lg"> | ||
<h2 className="text-lg font-bold">Simulation settings</h2> | ||
|
||
<div className="flex flex-row justify-between gap-4"> | ||
<label className="font-medium whitespace-nowrap" htmlFor="my-speed">Simulated Speed</label> | ||
<input id="my-speed" className="w-20 text-right bg-transparent" type="number" step="1" onChange={(e) => manageSpeedChange(e.target.value)} value={myClockSpeed} /> | ||
</div> | ||
<div className="flex flex-row justify-between gap-4"> | ||
<label className="font-medium whitespace-nowrap" htmlFor='date-picker'>Simulated Date</label> | ||
<input id='date-picker' className="w-40 text-right bg-transparent" type="datetime-local" onChange={(e) => manageDateChange(e.target.value)} value={convertedMyDateTime} /> | ||
</div> | ||
</div> | ||
} | ||
<button id="menu-icon" title="Show/hide simulation settings" className="" onClick={() => setOpened(!opened)}> | ||
{ !opened ? | ||
<HamburgerSVG/> | ||
: | ||
<CloseSVG/> | ||
} | ||
</button> | ||
return ( | ||
<div className="w-fit"> | ||
<div | ||
id="navbar" | ||
className="relative px-5 flex flex-row gap-4 flex-nowrap items-center w-full bg-gray-700 text-white rounded-lg p-4" | ||
> | ||
<FaviconSVG></FaviconSVG> | ||
<h1 className="text-xl font-bold">Suspicios Vessel Finder</h1> | ||
{opened && ( | ||
<div | ||
id="settings-container" | ||
className="absolute left-[101%] top-0 bg-gray-200 text-gray-800 flex flex-col gap-4 p-4 w-fit rounded-md shadow-lg" | ||
> | ||
<h2 className="text-lg font-bold">Simulation settings</h2> | ||
|
||
<div className="flex flex-row justify-between gap-4"> | ||
<label className="font-medium whitespace-nowrap" htmlFor="my-speed"> | ||
Simulated Speed | ||
</label> | ||
<input | ||
id="my-speed" | ||
className="w-20 text-right bg-transparent" | ||
type="number" | ||
step="1" | ||
onChange={(e) => manageSpeedChange(e.target.value)} | ||
value={myClockSpeed} | ||
/> | ||
</div> | ||
<div className="flex flex-row justify-between gap-4"> | ||
<label className="font-medium whitespace-nowrap" htmlFor="date-picker"> | ||
Simulated Date | ||
</label> | ||
<input | ||
id="date-picker" | ||
className="w-40 text-right bg-transparent" | ||
type="datetime-local" | ||
onChange={(e) => manageDateChange(e.target.value)} | ||
value={convertedMyDateTime} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
</div> | ||
)} | ||
<button id="menu-icon" title="Show/hide simulation settings" className="" onClick={() => setOpened(!opened)}> | ||
{!opened ? <HamburgerSVG /> : <CloseSVG />} | ||
</button> | ||
</div> | ||
</div> | ||
) | ||
} |
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,34 +1,34 @@ | ||
import { useEffect } from 'react'; | ||
import { useVesselGuiContext } from '../contexts/vesselGuiContext'; | ||
import { ILocation } from '../models/location'; | ||
import L from "leaflet" | ||
import { useEffect } from 'react' | ||
import { useVesselGuiContext } from '../contexts/vesselGuiContext' | ||
import { ILocation } from '../models/location' | ||
import L from 'leaflet' | ||
|
||
interface IPathProps { | ||
path: ILocation[]; | ||
path: ILocation[] | ||
map: L.Map | ||
} | ||
|
||
export default function Path({ path, map }: IPathProps) { | ||
useEffect(() => { | ||
const points = path.map(loc => L.latLng(loc.point.lat, loc.point.lon)) | ||
const points = path.map((loc) => L.latLng(loc.point.lat, loc.point.lon)) | ||
|
||
const polyline = new L.Polyline(points, { | ||
color: 'red', | ||
weight: 3, | ||
opacity: 0.5, | ||
smoothFactor: 1 | ||
}); | ||
polyline.addTo(map); | ||
smoothFactor: 1, | ||
}) | ||
|
||
polyline.addTo(map) | ||
|
||
return () => { | ||
map.eachLayer(layer => { | ||
if(layer instanceof L.Polyline) { | ||
map.eachLayer((layer) => { | ||
if (layer instanceof L.Polyline) { | ||
map.removeLayer(layer) | ||
} | ||
}) | ||
}) | ||
} | ||
}, [path]) | ||
|
||
return null | ||
return null | ||
} |
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.