Skip to content

Commit

Permalink
Optimize assets
Browse files Browse the repository at this point in the history
  • Loading branch information
EddieEldridge committed Dec 6, 2024
1 parent d50ae12 commit f449b2a
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 27 deletions.
Binary file removed frontend/src/assets/img/DarkWood.jpg
Binary file not shown.
Binary file removed frontend/src/assets/img/LOTRIcon.png
Binary file not shown.
Binary file removed frontend/src/assets/img/Landing_Page.png
Binary file not shown.
Binary file added frontend/src/assets/img/Landing_Page.webp
Binary file not shown.
Binary file added frontend/src/assets/img/MiddleEarthBlanco.webp
Binary file not shown.
1 change: 0 additions & 1 deletion frontend/src/assets/img/map_pin.svg

This file was deleted.

Binary file removed frontend/src/assets/img/parchment.jpg
Binary file not shown.
Binary file modified frontend/src/assets/img/pushpin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion frontend/src/assets/less/App.less
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ body {
}

#mapBackground {
background-image: url('../img/Landing_Page.png');
background-image: url('../img/Landing_Page.webp');
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
Expand Down Expand Up @@ -120,6 +120,7 @@ body {
.leaflet-marker-icon:hover {
filter: brightness(1.5);
filter: saturate(1.5);
filter: drop-shadow(5px 5px 5px #000000);
}

.ant-menu.ant-menu-dark {
Expand Down
51 changes: 27 additions & 24 deletions frontend/src/components/pages/Map.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ImageOverlay, MapContainer, Marker, Popup } from 'react-leaflet';
import L, { CRS, LatLngBounds, LatLngBoundsExpression } from 'leaflet';
import L, { CRS, LatLng, LatLngBounds, LatLngBoundsExpression } from 'leaflet';
import { useCallback, useState } from 'react';
import './../../assets/less/App.less';
import LiteYouTubeEmbed from 'react-lite-youtube-embed';
Expand All @@ -14,19 +14,8 @@ import { getMapMarkers, getXyCoords, log, } from '../../lib/utils';
import { MapLocation } from '../../lib/interfaces';

const mapBounds: LatLngBoundsExpression = new LatLngBounds([0, 0], [MAP_Y, MAP_X]);

// Function to update marker position
const updateMarkerPosition = (
mapMarkers: MapLocation[],
markerToUpdate: MapLocation,
newPosition: L.LatLngExpression
): MapLocation[] => {
return mapMarkers.map(marker =>
marker === markerToUpdate
? { ...marker, location: newPosition }
: marker
);
};
const mapCenter: LatLng = new LatLng(1953,4930);
const defaultZoom = 0.1;

export const LOTRMap = (props: any) => {
const [mapIsLoaded, setMapIsLoaded] = useState(false);
Expand All @@ -43,6 +32,19 @@ export const LOTRMap = (props: any) => {
MAP_URL = NEW_MAP_URL;
}

// Function to update marker position
const updateMarkerPosition = (
markers: MapLocation[],
markerToUpdate: MapLocation,
newPosition: L.LatLngExpression
): MapLocation[] => {
return markers.map(marker =>
marker === markerToUpdate
? { ...marker, location: newPosition }
: marker
);
};

const exportMapMarkers = () => {
const jsonOutput = {
locations: mapMarkers
Expand Down Expand Up @@ -135,23 +137,24 @@ export const LOTRMap = (props: any) => {
/>

<div id="mapContainer">
<button onClick={exportMapMarkers}>Export Markers</button>
{/* <button onClick={exportMapMarkers}>Export Markers</button> */}
<MapContainer
zoomControl={false}
id="lotrMap"
fadeAnimation={true}
bounds={mapBounds}
maxBounds={mapBounds}
maxBoundsViscosity={100}
scrollWheelZoom={true}
zoomAnimation={true}
center={mapBounds.getCenter()}
// zoomSnap={0.5}
center={mapCenter}
zoom={defaultZoom}
zoomSnap={0.5}
zoomDelta={0.1}
maxZoom={3}
minZoom={-3}
zoom={0.5}
// wheelDebounceTime={0}
// wheelPxPerZoomLevel={360}
wheelDebounceTime={0}
wheelPxPerZoomLevel={360}
ref={async (map) => {
if(map) {
setMapReference(map);
Expand Down Expand Up @@ -180,11 +183,11 @@ export const LOTRMap = (props: any) => {
alt={marker.name}
riseOnHover={true}
icon={iconLOTR}
draggable={true}
// draggable={true}
position={marker.location}
eventHandlers={{
dragend: handleMarkerDrag(marker)
}}
// eventHandlers={{
// dragend: handleMarkerDrag(marker)
// }}
>
<Popup
className='video-popup'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Leaflet Map
// export const MAP_URL = 'https://sounds-of-middle-earth.s3.eu-west-1.amazonaws.com/MiddleEarthUpscaled.webp';
export const OG_MAP_URL = 'https://i.imgur.com/22R6mSA.jpg';
export const NEW_MAP_URL = '../assets/img/MiddleEarthBlanco.jpg';
export const NEW_MAP_URL = '../assets/img/MiddleEarthBlanco.webp';
export const MAP_Y = 5656;
export const MAP_X = 8000;
export const BASE_URL = 'https://fdn17wuw0h.execute-api.eu-west-1.amazonaws.com/dev/api/v1';

0 comments on commit f449b2a

Please sign in to comment.