Skip to content

Commit

Permalink
public access token
Browse files Browse the repository at this point in the history
  • Loading branch information
activatedgeek committed Apr 13, 2024
1 parent 6aaff70 commit 5c0199c
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 30 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
env:
ASTRO_SITE: ${{ vars.ASTRO_SITE }}
GOATCOUNTER_SITE: ${{ vars.GOATCOUNTER_SITE }}
PUBLIC_MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
## Node related.
DISABLE_OPENCOLLECTIVE: 1
ADBLOCK: 1
Expand All @@ -19,13 +20,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Checkout beagle
uses: actions/checkout@v4
with:
repository: ${{ github.actor }}/${{ secrets.PAGES_REPO }}
token: ${{ secrets.GH_PAT }}
path: ${{ secrets.PAGES_REPO }}

- name: Setup Node
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install
### Environment Variables

- `ASTRO_SITE`: Full base domain, e.g. `sanyamkapoor.com`
- `MAPBOX_ACCESS_TOKEN`: [Mapbox](http://mapbox.com) access token.
- `PUBLIC_MAPBOX_ACCESS_TOKEN`: [Mapbox](http://mapbox.com) access token.

Optional:

Expand Down
4 changes: 2 additions & 2 deletions src/components/lib/Mapbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Pin from "./Pin";

export default function Mapbox({
children,
mapboxAccessToken,
token,
mapStyle = "mapbox://styles/mapbox/streets-v12",
latitude = 40.72833,
longitude = -73.99417,
Expand All @@ -21,7 +21,7 @@ export default function Mapbox({
}) {
return (
<Map
mapboxAccessToken={mapboxAccessToken}
mapboxAccessToken={token}
initialViewState={{
latitude: latitude,
longitude: longitude,
Expand Down
9 changes: 2 additions & 7 deletions src/components/maps/heatmap.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import Mapbox from "@components/lib/Mapbox";
import Heatmap from "@components/lib/Heatmap";

export default function Map({ mapboxAccessToken, data, ...props }) {
export default function Map({ data, ...props }) {
return (
<Mapbox
mapboxAccessToken={mapboxAccessToken}
mapStyle="mapbox://styles/mapbox/dark-v11"
zoom={3}
{...props}
>
<Mapbox mapStyle="mapbox://styles/mapbox/dark-v11" zoom={3} {...props}>
<Heatmap data={data} />
</Mapbox>
);
Expand Down
9 changes: 2 additions & 7 deletions src/components/maps/places.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import Mapbox, { MapboxMarkers } from "@components/lib/Mapbox";

export default function Map({ mapboxAccessToken, places, ...props }) {
export default function Map({ places, ...props }) {
return (
<Mapbox
mapboxAccessToken={mapboxAccessToken}
mapStyle="mapbox://styles/mapbox/light-v11"
zoom={3}
{...props}
>
<Mapbox mapStyle="mapbox://styles/mapbox/light-v11" zoom={3} {...props}>
<MapboxMarkers places={places} />
</Mapbox>
);
Expand Down
7 changes: 5 additions & 2 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
import Html from "@components/Html.astro";
const frontmatter = {
title: "Search",
title: "Maps",
description: "Life Maps",
authors: [{ collection: "authors", id: "sk" }],
date: new Date(),
};
---

<Html frontmatter={frontmatter}>
<h1>Astro</h1>
<main>
<h1>Maps</h1>
</main>
</Html>
2 changes: 1 addition & 1 deletion src/pages/places.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const frontmatter = {
<Html frontmatter={frontmatter}>
<Map
client:only="react"
mapboxAccessToken={import.meta.env.MAPBOX_ACCESS_TOKEN}
token={import.meta.env.PUBLIC_MAPBOX_ACCESS_TOKEN}
places={data}
/>
</Html>
2 changes: 1 addition & 1 deletion src/pages/somebody-fed-phil.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const frontmatter = {
<Html frontmatter={frontmatter}>
<Map
client:only="react"
mapboxAccessToken={import.meta.env.MAPBOX_ACCESS_TOKEN}
token={import.meta.env.PUBLIC_MAPBOX_ACCESS_TOKEN}
places={data}
zoom={2}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/us.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const frontmatter = {
<Html frontmatter={frontmatter}>
<Map
client:only="react"
mapboxAccessToken={import.meta.env.MAPBOX_ACCESS_TOKEN}
token={import.meta.env.PUBLIC_MAPBOX_ACCESS_TOKEN}
places={data}
zoom={12}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/wine.astro
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const frontmatter = {
<Html frontmatter={frontmatter}>
<Heatmap
client:only="react"
mapboxAccessToken={import.meta.env.MAPBOX_ACCESS_TOKEN}
token={import.meta.env.PUBLIC_MAPBOX_ACCESS_TOKEN}
data={data}
/>
</Html>

0 comments on commit 5c0199c

Please sign in to comment.