update admin light/dark mode

This commit is contained in:
naukyy
2026-06-13 00:31:36 +07:00
parent 2c123f5af2
commit 1c96173d55
28 changed files with 2703 additions and 775 deletions
+17 -2
View File
@@ -14,12 +14,27 @@ export const initMap = (containerId) => {
position: 'bottomright'
}).addTo(map);
// Tile Layer Premium (CartoDB Dark Matter untuk Glass UI)
L.tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', {
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
const tileUrl = isDark
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png';
// Tile Layer Premium (CartoDB Dark Matter / Light All)
const tileLayer = L.tileLayer(tileUrl, {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
subdomains: 'abcd',
maxZoom: 20
}).addTo(map);
// Dynamic theme updater for tile layer
const observer = new MutationObserver(() => {
const dark = document.documentElement.getAttribute('data-theme') === 'dark';
tileLayer.setUrl(dark
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png'
);
});
observer.observe(document.documentElement, { attributes: true });
return map;
};