Add Leaflet and react-leaflet dependencies for interactive map functionality Extend DDDepot type with optional latitude/longitude fields for map markers Update site metadata and admin settings page text Add client-side DepotMap component to render depot locations Update PocketBase admin token in environment configuration
18 lines
650 B
JavaScript
18 lines
650 B
JavaScript
import { useEffect, useRef } from 'react';
|
|
export function useAttribution(map, attribution) {
|
|
const attributionRef = useRef(attribution);
|
|
useEffect(function updateAttribution() {
|
|
if (attribution !== attributionRef.current && map.attributionControl != null) {
|
|
if (attributionRef.current != null) {
|
|
map.attributionControl.removeAttribution(attributionRef.current);
|
|
}
|
|
if (attribution != null) {
|
|
map.attributionControl.addAttribution(attribution);
|
|
}
|
|
}
|
|
attributionRef.current = attribution;
|
|
}, [
|
|
map,
|
|
attribution
|
|
]);
|
|
}
|