Skip to content

Commit

Permalink
work on stnads
Browse files Browse the repository at this point in the history
  • Loading branch information
bjerrecs committed Apr 22, 2024
1 parent 77bfaa9 commit 4761996
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 21 deletions.
47 changes: 46 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"typescript": "^5.3.3"
},
"devDependencies": {
"@types/react-simple-maps": "^3.0.4"
"@types/react-simple-maps": "^3.0.4",
"daisyui": "^4.10.2"
}
}
14 changes: 8 additions & 6 deletions src/components/NewMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import * as maptilersdk from '@maptiler/sdk';
import "@maptiler/sdk/dist/maptiler-sdk.css";
import './map.css';

export default function Map(airport) {

export default function Map() {
const mapContainer = useRef(null);
var map = useRef(null);
var defaultAirport = { lng: 12.648131871581867, lat: 55.62513369975767};
const [zoom] = useState(15);
var airport = { lng: 12.648131871581867, lat: 55.62513369975767, zoom: 15};
var [zoom] = useState(airport.zoom);

maptilersdk.config.apiKey = 'YPWvjXSB1Key9mipDYw6';
if(!airport) {
airport = defaultAirport
}

useEffect(() => {
if (map.current) return; // stops map from intializing more than once
Expand All @@ -30,8 +29,11 @@ export default function Map(airport) {
}, [airport.lng, airport.lat, zoom]);

return (
<>
<div className='w-80 h-12 bg-black top-32 z-10 absolute'>Denmark</div>
<div className="map-wrap">
<div ref={mapContainer} className="map" />
</div>
</>
);
}
13 changes: 1 addition & 12 deletions src/pages/stands.astro
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
---
import Layout from "../layout/layout.astro";
const EKBI = { lng: 9.148173216130179, lat: 55.741714236886445};
const airport = EKBI;
import Map from "../components/NewMap"
---
<Layout SiteTitle="VATSIM Scandinavia">
<div class="top-32 left-24 absolute z-10">
<label class="text-2xl">Airport:</label>
<select id="select" class="w-fit bg-transparent appearance-auto text-xl">
<option value="EKCH" title="Title for Item 1" class="bg-vatsca3">EKCH</option>
<option value="EKBI" title="Title for Item 2">EKBI</option>
<option value="EKYT">EKYT</option>
</select>
</div>
<Map airport={airport} client:visible />
<Map client:visible />
</Layout>

2 changes: 1 addition & 1 deletion tailwind.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export default {
}
},
darkMode: "class",
plugins: [nextui()]
plugins: [nextui(),require("daisyui")]
}

0 comments on commit 4761996

Please sign in to comment.