Skip to content

Commit

Permalink
Hotfix: swap mapbox tiles for free ones (#783)
Browse files Browse the repository at this point in the history
  • Loading branch information
EricPedley authored Nov 4, 2023
1 parent 67484af commit 86f963a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/step_setup_and_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
HUSKY: 0
# frontend env variables
VITE_ENDPOINT: ${{ env.apiSubDomain }}
VITE_TILES_ENDPOINT: ${{ secrets.VITE_TILES_ENDPOINT}}
NODE_ENV: ${{ env.nodeEnv }}
# backend env variables
HOSTED_ZONE_ID: ${{ secrets.HOSTED_ZONE_ID }}
Expand Down
5 changes: 3 additions & 2 deletions apps/antalmanac/src/components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import locationIds from '$lib/location_ids';
import buildingCatalogue from '$lib/buildingCatalogue';
import type { Building } from '$lib/buildingCatalogue';
import type { CourseEvent } from '$components/Calendar/CourseCalendarEvent';
import { MAPBOX_PROXY_TILES_ENDPOINT } from '$lib/api/endpoints';
import { TILES_URL } from '$lib/api/endpoints';

const ATTRIBUTION_MARKUP =
'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors | Images from <a href="https://map.uci.edu/?id=463">UCI Map</a>';
Expand Down Expand Up @@ -232,9 +232,10 @@ export default function CourseMap() {

<TileLayer
attribution={ATTRIBUTION_MARKUP}
url={`${MAPBOX_PROXY_TILES_ENDPOINT}/{z}/{x}/{y}`}
url={`https://${TILES_URL}/{z}/{x}/{y}.png`}
tileSize={512}
maxZoom={21}
minZoom={15}
zoomOffset={-1}
/>

Expand Down
2 changes: 1 addition & 1 deletion apps/antalmanac/src/lib/api/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function endpointTransform(path: string) {
export const LOOKUP_NOTIFICATIONS_ENDPOINT = endpointTransform('/api/notifications/lookupNotifications');
export const REGISTER_NOTIFICATIONS_ENDPOINT = endpointTransform('/api/notifications/registerNotifications');
export const MAPBOX_PROXY_DIRECTIONS_ENDPOINT = endpointTransform('/mapbox/directions');
export const MAPBOX_PROXY_TILES_ENDPOINT = endpointTransform('/mapbox/tiles');
export const TILES_URL = import.meta.env.VITE_TILES_ENDPOINT || 'tile.openstreetmap.org';

// PeterPortal API
export const PETERPORTAL_GRAPHQL_ENDPOINT = 'https://api-next.peterportal.org/v1/graphql';
Expand Down
1 change: 1 addition & 0 deletions apps/antalmanac/src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface ImportMetaEnv {
// Both of these variables should rarely be set manually
VITE_ENDPOINT?: string; // Sets the subdomain to use for API calls (ex. **staging-123**.api.antalmanac.com)
VITE_LOCAL_SERVER?: string; // Sets the local server to use for API calls (e.g. http://localhost:8080)
VITE_TILES_ENDPOINT?: string; // Sets the url of the map tiles server
}

interface ImportMeta {
Expand Down

0 comments on commit 86f963a

Please sign in to comment.