feat: implement Leaflet map hook and AI-assisted city card forecast view for dashboard

This commit is contained in:
2569718930@qq.com
2026-04-26 10:13:44 +08:00
parent d54050ceb0
commit 1ee8408b1f
5 changed files with 226 additions and 288 deletions
+16 -4
View File
@@ -58,10 +58,15 @@ function getMarkerDisplayOffset(cityName: string) {
}
function getMapTileUrl() {
if (
typeof document !== "undefined" &&
document.documentElement.classList.contains("light")
) {
if (typeof document === "undefined") {
return MAP_TILE_URLS.dark;
}
const lightMode =
document.documentElement.classList.contains("light") ||
document.body.classList.contains("light") ||
Boolean(document.querySelector(".scan-terminal.light"));
if (lightMode) {
return MAP_TILE_URLS.light;
}
return MAP_TILE_URLS.dark;
@@ -603,6 +608,13 @@ export function useLeafletMap({
attributeFilter: ["class"],
attributes: true,
});
if (document.body) {
observer.observe(document.body, {
attributeFilter: ["class"],
attributes: true,
subtree: true,
});
}
return () => observer.disconnect();
}, []);