From f5a4b91b7cc5ceaa805ddfe1285f3ec7e5b30a90 Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Tue, 21 Oct 2025 23:36:05 +0200 Subject: Refactor solution file and update region configuration with bounds and text color --- .github/workflows/deploy.yml | 5 ++++- Costasdev.Busurbano.slnx | 4 ++-- src/frontend/app/data/RegionConfig.ts | 15 +++++++++++++++ src/frontend/app/routes/map.tsx | 19 ++++++++++++------- src/frontend/public/maps/styles/openfreemap-any.json | 6 ++++++ 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 247602f..09ecff3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -95,7 +95,7 @@ jobs: echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519 ssh-keyscan -H ${{ secrets.TARGET_HOST }} >> ~/.ssh/known_hosts - + - name: Deploy frontend run: | scp -r dist/frontend/* ${{ secrets.TARGET_USER }}@${{ secrets.TARGET_HOST }}:${{ secrets.TARGET_PATH }}/ @@ -106,5 +106,8 @@ jobs: - name: Upload backend run: scp -r dist/backend/* app@${{ secrets.TARGET_HOST }}:/opt/busurbano/ + - name: Allow execution + run: ssh ${{ secrets.TARGET_USER }}@${{ secrets.TARGET_HOST }} "echo ${{ secrets.TARGET_PASSWORD }} | sudo -S chmod +x /opt/busurbano/Costasdev.Busurbano.Backend" + - name: Start service run: ssh ${{ secrets.TARGET_USER }}@${{ secrets.TARGET_HOST }} "echo ${{ secrets.TARGET_PASSWORD }} | sudo -S /usr/bin/systemctl start busurbano" diff --git a/Costasdev.Busurbano.slnx b/Costasdev.Busurbano.slnx index 28d6605..1c35994 100644 --- a/Costasdev.Busurbano.slnx +++ b/Costasdev.Busurbano.slnx @@ -1,5 +1,5 @@ - + - \ No newline at end of file + diff --git a/src/frontend/app/data/RegionConfig.ts b/src/frontend/app/data/RegionConfig.ts index 0ce66e6..c3786ba 100644 --- a/src/frontend/app/data/RegionConfig.ts +++ b/src/frontend/app/data/RegionConfig.ts @@ -7,6 +7,11 @@ export interface RegionConfig { estimatesEndpoint: string; timetableEndpoint: string | null; defaultCenter: [number, number]; // [lat, lng] + bounds?: { + sw: [number, number]; + ne: [number, number]; + }; + textColour?: string; defaultZoom: number; showMeters: boolean; // Whether to show distance in meters } @@ -19,6 +24,11 @@ export const REGIONS: Record = { estimatesEndpoint: "/api/vigo/GetStopEstimates", timetableEndpoint: "/api/vigo/GetStopTimetable", defaultCenter: [42.229188855975046, -8.72246955783102], + bounds: { + sw: [-8.951059, 42.098923], + ne: [-8.447748, 42.3496] + }, + textColour: "#e72b37", defaultZoom: 14, showMeters: true, }, @@ -29,6 +39,11 @@ export const REGIONS: Record = { estimatesEndpoint: "/api/santiago/GetStopEstimates", timetableEndpoint: null, // Not available for Santiago defaultCenter: [42.8782, -8.5448], + bounds: { + sw: [-8.884454, 42.719102], + ne: [-8.243814, 43.02205] + }, + textColour: "#6bb238", defaultZoom: 14, showMeters: false, // Santiago doesn't provide distance data }, diff --git a/src/frontend/app/routes/map.tsx b/src/frontend/app/routes/map.tsx index 88f4e52..29b097d 100644 --- a/src/frontend/app/routes/map.tsx +++ b/src/frontend/app/routes/map.tsx @@ -17,6 +17,7 @@ import { loadStyle } from "app/maps/styleloader"; import type { Feature as GeoJsonFeature, Point } from "geojson"; import { StopSheet } from "~/components/StopSheet"; import { useTranslation } from "react-i18next"; +import { REGIONS } from "~/data/RegionConfig"; // Default minimal fallback style before dynamic loading const defaultStyle: StyleSpecification = { @@ -142,6 +143,10 @@ export default function StopMap() { zoom: mapState.zoom, }} attributionControl={false} + maxBounds={REGIONS[region].bounds ? [ + REGIONS[region].bounds!.sw, + REGIONS[region].bounds!.ne, + ] : undefined} > @@ -159,7 +164,7 @@ export default function StopMap() { source="stops-source" layout={{ "icon-image": `stop-${region}`, - "icon-size": ["interpolate", ["linear"], ["zoom"], 11, 0.4, 18, 0.8], + "icon-size": ["interpolate", ["linear"], ["zoom"], 11, 0.7, 18, 1.0], "icon-allow-overlap": true, "icon-ignore-placement": true, }} @@ -172,16 +177,16 @@ export default function StopMap() { minzoom={16} layout={{ "text-field": ["get", "name"], - "text-font": ["Noto Sans Regular"], - "text-offset": [0, 2.5], + "text-font": ["Noto Sans Bold"], + "text-offset": [0, 3], "text-anchor": "center", "text-justify": "center", - "text-size": ["interpolate", ["linear"], ["zoom"], 11, 8, 22, 14] + "text-size": ["interpolate", ["linear"], ["zoom"], 11, 8, 22, 16] }} paint={{ - "text-color": "#45a15a", - "text-halo-color": "#fff", - "text-halo-width": 1.5 + "text-color": `${REGIONS[region].textColour || "#000"}`, + "text-halo-color": "#FFF", + "text-halo-width": 1 }} /> diff --git a/src/frontend/public/maps/styles/openfreemap-any.json b/src/frontend/public/maps/styles/openfreemap-any.json index d279f8c..8fdca37 100644 --- a/src/frontend/public/maps/styles/openfreemap-any.json +++ b/src/frontend/public/maps/styles/openfreemap-any.json @@ -4393,6 +4393,12 @@ "minzoom": 17, "filter": [ "all", + [ + "!=", + [ + "get", + "class" + ], "bus"], [ "match", [ -- cgit v1.3