From 9d9f8f35ca8538b6ff3cd2dd1ec126278ce59e9f Mon Sep 17 00:00:00 2001 From: Roozbeh Karimi Date: Tue, 7 Oct 2025 16:06:04 -0400 Subject: [PATCH] new set of icons --- .gitea/workflows/deploy.yml | 56 ++++++++++++++++++ frontend/public/icons/a0.svg | 9 +++ frontend/public/icons/a1.svg | 9 +++ frontend/public/icons/a2.svg | 9 +++ frontend/public/icons/a3.svg | 9 +++ frontend/public/icons/a320.svg | 4 ++ frontend/public/icons/a330.svg | 8 +++ frontend/public/icons/a340.svg | 8 +++ frontend/public/icons/a380.svg | 8 +++ frontend/public/icons/a4.svg | 9 +++ frontend/public/icons/a5.svg | 9 +++ frontend/public/icons/a6.svg | 9 +++ frontend/public/icons/a7.svg | 11 ++++ frontend/public/icons/b0.svg | 11 ++++ frontend/public/icons/b1.svg | 9 +++ frontend/public/icons/b2.svg | 7 +++ frontend/public/icons/b3.svg | 8 +++ frontend/public/icons/b4.svg | 9 +++ frontend/public/icons/b737.svg | 8 +++ frontend/public/icons/b747.svg | 8 +++ frontend/public/icons/b767.svg | 8 +++ frontend/public/icons/b777.svg | 8 +++ frontend/public/icons/b787.svg | 8 +++ frontend/public/icons/c0.svg | 9 +++ frontend/public/icons/c130.svg | 4 ++ frontend/public/icons/cessna.svg | 3 + frontend/public/icons/crjx.svg | 8 +++ frontend/public/icons/default.svg | 9 +++ frontend/public/icons/dh8a.svg | 4 ++ frontend/public/icons/e195.svg | 8 +++ frontend/public/icons/erj.svg | 8 +++ frontend/public/icons/f100.svg | 8 +++ frontend/public/icons/f11.svg | 10 ++++ frontend/public/icons/f15.svg | 11 ++++ frontend/public/icons/f5.svg | 7 +++ frontend/public/icons/fa7x.svg | 4 ++ frontend/public/icons/glf5.svg | 4 ++ frontend/public/icons/learjet.svg | 8 +++ frontend/public/icons/md11.svg | 8 +++ frontend/src/views/map/page.jsx | 95 ++++++++++++------------------- package-lock.json | 15 ++++- package.json | 3 + 42 files changed, 406 insertions(+), 62 deletions(-) create mode 100644 .gitea/workflows/deploy.yml create mode 100644 frontend/public/icons/a0.svg create mode 100644 frontend/public/icons/a1.svg create mode 100644 frontend/public/icons/a2.svg create mode 100644 frontend/public/icons/a3.svg create mode 100644 frontend/public/icons/a320.svg create mode 100644 frontend/public/icons/a330.svg create mode 100644 frontend/public/icons/a340.svg create mode 100644 frontend/public/icons/a380.svg create mode 100644 frontend/public/icons/a4.svg create mode 100644 frontend/public/icons/a5.svg create mode 100644 frontend/public/icons/a6.svg create mode 100644 frontend/public/icons/a7.svg create mode 100644 frontend/public/icons/b0.svg create mode 100644 frontend/public/icons/b1.svg create mode 100644 frontend/public/icons/b2.svg create mode 100644 frontend/public/icons/b3.svg create mode 100644 frontend/public/icons/b4.svg create mode 100644 frontend/public/icons/b737.svg create mode 100644 frontend/public/icons/b747.svg create mode 100644 frontend/public/icons/b767.svg create mode 100644 frontend/public/icons/b777.svg create mode 100644 frontend/public/icons/b787.svg create mode 100644 frontend/public/icons/c0.svg create mode 100644 frontend/public/icons/c130.svg create mode 100644 frontend/public/icons/cessna.svg create mode 100644 frontend/public/icons/crjx.svg create mode 100644 frontend/public/icons/default.svg create mode 100644 frontend/public/icons/dh8a.svg create mode 100644 frontend/public/icons/e195.svg create mode 100644 frontend/public/icons/erj.svg create mode 100644 frontend/public/icons/f100.svg create mode 100644 frontend/public/icons/f11.svg create mode 100644 frontend/public/icons/f15.svg create mode 100644 frontend/public/icons/f5.svg create mode 100644 frontend/public/icons/fa7x.svg create mode 100644 frontend/public/icons/glf5.svg create mode 100644 frontend/public/icons/learjet.svg create mode 100644 frontend/public/icons/md11.svg diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..995498f --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,56 @@ +name: Deploy to Production + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Install dependencies + run: | + npm install + cd backend && npm install && cd .. + cd frontend && npm install && cd .. + + - name: Run backend tests + run: | + cd backend + npm test || echo "No tests configured" + + - name: Build frontend + run: | + cd frontend + npm run build + + - name: Deploy to server + env: + SERVER_HOST: ${{ secrets.SERVER_HOST }} + SERVER_USER: ${{ secrets.SERVER_USER }} + SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + run: | + # Setup SSH + mkdir -p ~/.ssh + echo "$SSH_KEY" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key + ssh-keyscan -H $SERVER_HOST >> ~/.ssh/known_hosts + + # Deploy + ssh -i ~/.ssh/deploy_key $SERVER_USER@$SERVER_HOST << 'EOF' + cd /var/www/aeroEcho + git pull origin main + npm run install:all + cd frontend && npm run build && cd .. + pm2 restart ecosystem.config.js + EOF diff --git a/frontend/public/icons/a0.svg b/frontend/public/icons/a0.svg new file mode 100644 index 0000000..f67eb7d --- /dev/null +++ b/frontend/public/icons/a0.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/a1.svg b/frontend/public/icons/a1.svg new file mode 100644 index 0000000..776b2dc --- /dev/null +++ b/frontend/public/icons/a1.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/a2.svg b/frontend/public/icons/a2.svg new file mode 100644 index 0000000..1828719 --- /dev/null +++ b/frontend/public/icons/a2.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/a3.svg b/frontend/public/icons/a3.svg new file mode 100644 index 0000000..2cbc82c --- /dev/null +++ b/frontend/public/icons/a3.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/a320.svg b/frontend/public/icons/a320.svg new file mode 100644 index 0000000..766a86c --- /dev/null +++ b/frontend/public/icons/a320.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/icons/a330.svg b/frontend/public/icons/a330.svg new file mode 100644 index 0000000..114f4c7 --- /dev/null +++ b/frontend/public/icons/a330.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/a340.svg b/frontend/public/icons/a340.svg new file mode 100644 index 0000000..7f96427 --- /dev/null +++ b/frontend/public/icons/a340.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/a380.svg b/frontend/public/icons/a380.svg new file mode 100644 index 0000000..82b4577 --- /dev/null +++ b/frontend/public/icons/a380.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/a4.svg b/frontend/public/icons/a4.svg new file mode 100644 index 0000000..a39e6ac --- /dev/null +++ b/frontend/public/icons/a4.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/a5.svg b/frontend/public/icons/a5.svg new file mode 100644 index 0000000..79274c4 --- /dev/null +++ b/frontend/public/icons/a5.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/a6.svg b/frontend/public/icons/a6.svg new file mode 100644 index 0000000..7e3147e --- /dev/null +++ b/frontend/public/icons/a6.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/a7.svg b/frontend/public/icons/a7.svg new file mode 100644 index 0000000..d28ff9c --- /dev/null +++ b/frontend/public/icons/a7.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/b0.svg b/frontend/public/icons/b0.svg new file mode 100644 index 0000000..8fcc674 --- /dev/null +++ b/frontend/public/icons/b0.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/b1.svg b/frontend/public/icons/b1.svg new file mode 100644 index 0000000..b89bd22 --- /dev/null +++ b/frontend/public/icons/b1.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/b2.svg b/frontend/public/icons/b2.svg new file mode 100644 index 0000000..a54d056 --- /dev/null +++ b/frontend/public/icons/b2.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/b3.svg b/frontend/public/icons/b3.svg new file mode 100644 index 0000000..bd649de --- /dev/null +++ b/frontend/public/icons/b3.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/b4.svg b/frontend/public/icons/b4.svg new file mode 100644 index 0000000..7acd70b --- /dev/null +++ b/frontend/public/icons/b4.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/b737.svg b/frontend/public/icons/b737.svg new file mode 100644 index 0000000..2bf1cd6 --- /dev/null +++ b/frontend/public/icons/b737.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/b747.svg b/frontend/public/icons/b747.svg new file mode 100644 index 0000000..2c45fb0 --- /dev/null +++ b/frontend/public/icons/b747.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/b767.svg b/frontend/public/icons/b767.svg new file mode 100644 index 0000000..5a8ebcb --- /dev/null +++ b/frontend/public/icons/b767.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/b777.svg b/frontend/public/icons/b777.svg new file mode 100644 index 0000000..0917327 --- /dev/null +++ b/frontend/public/icons/b777.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/b787.svg b/frontend/public/icons/b787.svg new file mode 100644 index 0000000..e64d930 --- /dev/null +++ b/frontend/public/icons/b787.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/c0.svg b/frontend/public/icons/c0.svg new file mode 100644 index 0000000..2a8aa46 --- /dev/null +++ b/frontend/public/icons/c0.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/c130.svg b/frontend/public/icons/c130.svg new file mode 100644 index 0000000..41594ad --- /dev/null +++ b/frontend/public/icons/c130.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/icons/cessna.svg b/frontend/public/icons/cessna.svg new file mode 100644 index 0000000..587495b --- /dev/null +++ b/frontend/public/icons/cessna.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/public/icons/crjx.svg b/frontend/public/icons/crjx.svg new file mode 100644 index 0000000..c56b465 --- /dev/null +++ b/frontend/public/icons/crjx.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/default.svg b/frontend/public/icons/default.svg new file mode 100644 index 0000000..f67eb7d --- /dev/null +++ b/frontend/public/icons/default.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/dh8a.svg b/frontend/public/icons/dh8a.svg new file mode 100644 index 0000000..465359b --- /dev/null +++ b/frontend/public/icons/dh8a.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/icons/e195.svg b/frontend/public/icons/e195.svg new file mode 100644 index 0000000..a0bb131 --- /dev/null +++ b/frontend/public/icons/e195.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/erj.svg b/frontend/public/icons/erj.svg new file mode 100644 index 0000000..39fbd7c --- /dev/null +++ b/frontend/public/icons/erj.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/f100.svg b/frontend/public/icons/f100.svg new file mode 100644 index 0000000..61cdf20 --- /dev/null +++ b/frontend/public/icons/f100.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/f11.svg b/frontend/public/icons/f11.svg new file mode 100644 index 0000000..9a48367 --- /dev/null +++ b/frontend/public/icons/f11.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/f15.svg b/frontend/public/icons/f15.svg new file mode 100644 index 0000000..9db46da --- /dev/null +++ b/frontend/public/icons/f15.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/f5.svg b/frontend/public/icons/f5.svg new file mode 100644 index 0000000..fdd9763 --- /dev/null +++ b/frontend/public/icons/f5.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/fa7x.svg b/frontend/public/icons/fa7x.svg new file mode 100644 index 0000000..b2079bc --- /dev/null +++ b/frontend/public/icons/fa7x.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/icons/glf5.svg b/frontend/public/icons/glf5.svg new file mode 100644 index 0000000..75a6519 --- /dev/null +++ b/frontend/public/icons/glf5.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/icons/learjet.svg b/frontend/public/icons/learjet.svg new file mode 100644 index 0000000..1836b0d --- /dev/null +++ b/frontend/public/icons/learjet.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/public/icons/md11.svg b/frontend/public/icons/md11.svg new file mode 100644 index 0000000..ae685e4 --- /dev/null +++ b/frontend/public/icons/md11.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/src/views/map/page.jsx b/frontend/src/views/map/page.jsx index 8786ca5..ce2e015 100644 --- a/frontend/src/views/map/page.jsx +++ b/frontend/src/views/map/page.jsx @@ -19,16 +19,40 @@ if (typeof window !== "undefined") { }); } +const getCategoryIcon = (category, heading = 0, size = [25, 25]) => { + console.log(category); + const iconUrl = `/icons/${category || "default"}.svg`; + + // Create a rotated divIcon wrapper for the image + const html = ` +
+ +
+ `; + + return L.divIcon({ + html, + className: "", + iconSize: size, + iconAnchor: [size[0] / 2, size[1] / 2], + }); +}; + const FlightsLayer = ({ flightsData, updateInterval = 5000 }) => { const map = useMap(); const flightsRef = useRef({}); const drawMarker = (lat, lon, icon) => { const longitudes = [lon, lon - 360, lon + 360]; - return longitudes.map((lng) => { - const marker = L.marker([lat, lng], { icon }).addTo(map); - return marker; - }); + return longitudes.map((lng) => L.marker([lat, lng], { icon }).addTo(map)); }; useEffect(() => { @@ -39,8 +63,8 @@ const FlightsLayer = ({ flightsData, updateInterval = 5000 }) => { if (!f.lat || !f.lon) return; const flightId = f.hex || f.flight || `${f.lat}_${f.lon}`; - const direction = f.track || f.nav_heading || f.true_heading || 0; - const icon = createPlaneIcon(direction); + const heading = f.track || f.true_heading || 0; // Get heading from track or true_heading + const icon = getCategoryIcon(f.category, heading); if (!flightsRef.current[flightId]) { const markers = drawMarker(f.lat, f.lon, icon); @@ -62,6 +86,7 @@ const FlightsLayer = ({ flightsData, updateInterval = 5000 }) => { endTime: now + updateInterval, markers, flightInfo: f, + heading: heading, }; } else { const flight = flightsRef.current[flightId]; @@ -70,8 +95,9 @@ const FlightsLayer = ({ flightsData, updateInterval = 5000 }) => { flight.startTime = now; flight.endTime = now + updateInterval; flight.flightInfo = f; + flight.heading = heading; - const newIcon = createPlaneIcon(direction); + const newIcon = getCategoryIcon(f.category, heading); const popupContent = ` Flight: ${f.flight?.trim() || "Unknown"}
@@ -91,6 +117,7 @@ const FlightsLayer = ({ flightsData, updateInterval = 5000 }) => { } }); + // Remove old flights const currentFlightIds = new Set( flightsData.map((f) => f.hex || f.flight || `${f.lat}_${f.lon}`) ); @@ -102,6 +129,7 @@ const FlightsLayer = ({ flightsData, updateInterval = 5000 }) => { }); }, [flightsData, map, updateInterval]); + // Animate flight movement useEffect(() => { let animFrame; const animate = () => { @@ -129,7 +157,6 @@ const InitialBounds = ({ setBoundries }) => { const map = useMap(); useEffect(() => { - // Wait for map to be ready, then set initial bounds map.whenReady(() => { const bounds = map.getBounds(); setBoundries({ @@ -142,58 +169,6 @@ const InitialBounds = ({ setBoundries }) => { return null; }; -const createPlaneIcon = (heading = 0) => { - const html = ` -
- - - -
- `; - return L.divIcon({ - html, - className: "", - iconSize: [28, 28], - iconAnchor: [14, 14], - }); -}; - -const createSimplePlaneIcon = (heading = 0) => { - const html = ` -
- ✈️ -
- `; - return L.divIcon({ - html, - className: "", - iconSize: [24, 24], - iconAnchor: [12, 12], - }); -}; - const MapView = () => { const [boundaries, setBoundaries] = useState(); const [flights, setFlights] = useState([]); diff --git a/package-lock.json b/package-lock.json index 3bc7a59..697efb0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,15 @@ { - "name": "my-fullstack-app", + "name": "aeroecho-fullstack", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "my-fullstack-app", + "name": "aeroecho-fullstack", + "version": "1.0.0", + "dependencies": { + "leaflet-rotatedmarker": "^0.2.0" + }, "devDependencies": { "concurrently": "^8.2.2" } @@ -202,6 +207,12 @@ "node": ">=8" } }, + "node_modules/leaflet-rotatedmarker": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/leaflet-rotatedmarker/-/leaflet-rotatedmarker-0.2.0.tgz", + "integrity": "sha512-yc97gxLXwbZa+Gk9VCcqI0CkvIBC9oNTTjFsHqq4EQvANrvaboib4UdeQLyTnEqDpaXHCqzwwVIDHtvz2mUiDg==", + "license": "MIT" + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", diff --git a/package.json b/package.json index fa7622b..55068b8 100644 --- a/package.json +++ b/package.json @@ -14,5 +14,8 @@ }, "devDependencies": { "concurrently": "^8.2.2" + }, + "dependencies": { + "leaflet-rotatedmarker": "^0.2.0" } }