From db69bd7e6f1f01bd53d82afa4e7a6b98309ede9e Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Fri, 8 Dec 2023 14:01:59 +0100 Subject: [PATCH] Removed nanostore logic This module was way too cumbersome for such a simple implementation ; now the resources are just plain json loaded in astro instead of full on API routes. This also eliminates the need to have a backend service to serve the API and the app can be deployed statically --- astro.config.mjs | 6 +- public/{icons => icon}/castle-shadow.png | Bin public/{icons => icon}/castle.png | Bin public/{icons => icon}/circle.png | Bin .../{icons => icon}/location-pin-shadow.png | Bin public/{icons => icon}/location-pin.png | Bin public/{icons => icon}/monument-shadow.png | Bin public/{icons => icon}/monument.png | Bin src/components/maps/WorldMap.astro | 25 +- src/components/maps/WorldMapOverlay.astro | 10 +- src/components/maps/data/markers.json | 603 ++++++++++++++++++ src/components/maps/data/players.json | 8 + src/components/maps/overlay/SearchMarkers.vue | 13 +- src/components/maps/worldStore.ts | 43 -- src/pages/api/data/players.markers.ts | 10 - src/pages/api/data/world.markers.ts | 603 ------------------ src/pages/api/markers.json.ts | 8 - src/pages/api/players.json.ts | 8 - 18 files changed, 640 insertions(+), 697 deletions(-) rename public/{icons => icon}/castle-shadow.png (100%) rename public/{icons => icon}/castle.png (100%) rename public/{icons => icon}/circle.png (100%) rename public/{icons => icon}/location-pin-shadow.png (100%) rename public/{icons => icon}/location-pin.png (100%) rename public/{icons => icon}/monument-shadow.png (100%) rename public/{icons => icon}/monument.png (100%) create mode 100644 src/components/maps/data/markers.json create mode 100644 src/components/maps/data/players.json delete mode 100644 src/components/maps/worldStore.ts delete mode 100644 src/pages/api/data/players.markers.ts delete mode 100644 src/pages/api/data/world.markers.ts delete mode 100644 src/pages/api/markers.json.ts delete mode 100644 src/pages/api/players.json.ts diff --git a/astro.config.mjs b/astro.config.mjs index 401f83d1..3a259b70 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,14 +1,10 @@ import { defineConfig } from 'astro/config'; -import nodeJs from '@astrojs/node'; import vue from "@astrojs/vue"; // https://astro.build/config export default defineConfig({ integrations: [vue()], - output: 'server', - adapter: nodeJs({ - mode: 'standalone' - }), + output: 'static', site: 'https://maps.alexcreates.fr' }); diff --git a/public/icons/castle-shadow.png b/public/icon/castle-shadow.png similarity index 100% rename from public/icons/castle-shadow.png rename to public/icon/castle-shadow.png diff --git a/public/icons/castle.png b/public/icon/castle.png similarity index 100% rename from public/icons/castle.png rename to public/icon/castle.png diff --git a/public/icons/circle.png b/public/icon/circle.png similarity index 100% rename from public/icons/circle.png rename to public/icon/circle.png diff --git a/public/icons/location-pin-shadow.png b/public/icon/location-pin-shadow.png similarity index 100% rename from public/icons/location-pin-shadow.png rename to public/icon/location-pin-shadow.png diff --git a/public/icons/location-pin.png b/public/icon/location-pin.png similarity index 100% rename from public/icons/location-pin.png rename to public/icon/location-pin.png diff --git a/public/icons/monument-shadow.png b/public/icon/monument-shadow.png similarity index 100% rename from public/icons/monument-shadow.png rename to public/icon/monument-shadow.png diff --git a/public/icons/monument.png b/public/icon/monument.png similarity index 100% rename from public/icons/monument.png rename to public/icon/monument.png diff --git a/src/components/maps/WorldMap.astro b/src/components/maps/WorldMap.astro index 5050dfd6..f16b385e 100644 --- a/src/components/maps/WorldMap.astro +++ b/src/components/maps/WorldMap.astro @@ -1,10 +1,11 @@ --- -import { allTasks } from 'nanostores'; -import { $world } from './worldStore'; +import type { MapMarker, PlayerMarker } from '@/types/Leaflet'; -$world.listen(() => {}) -await allTasks() -const { markers, players } = $world.get() +import markersData from '@/components/maps/data/markers.json' +import playersData from '@/components/maps/data/players.json' + +const markers = markersData.data as MapMarker[] +const players = playersData as PlayerMarker ---