diff --git a/src/App.jsx b/src/App.jsx
index f08b0b3..dd4df67 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -7,7 +7,7 @@ const THEME_KEY = "sociowire:theme";
export default function App() {
const [theme, setTheme] = useState("dark");
- // charge le thème depuis le localStorage au démarrage
+ // charge le thème au démarrage
useEffect(() => {
if (typeof window === "undefined") return;
try {
@@ -23,7 +23,7 @@ export default function App() {
}
}, []);
- // applique le thème + sauvegarde
+ // applique / sauvegarde le thème
useEffect(() => {
if (typeof window === "undefined") return;
try {
@@ -39,7 +39,8 @@ export default function App() {
-
+ {/* on passe le thème à la carte */}
+
diff --git a/src/components/Map/MapView.jsx b/src/components/Map/MapView.jsx
index 7c36453..62c3b82 100644
--- a/src/components/Map/MapView.jsx
+++ b/src/components/Map/MapView.jsx
@@ -15,7 +15,7 @@ import { useUserPosition } from "./useUserPosition";
import { usePostsEngine } from "./usePostsEngine";
import PostList from "../Posts/PostList";
-export default function MapView() {
+export default function MapView({ theme = "dark" }) {
const {
containerRef,
mapRef,
@@ -23,7 +23,7 @@ export default function MapView() {
expandedElRef,
viewParams,
hasLastView,
- } = useMapCore();
+ } = useMapCore(theme);
const [mainFilter, setMainFilter] = useState("All");
const [timeFilter, setTimeFilter] = useState("RECENT");
@@ -88,7 +88,9 @@ export default function MapView() {
if (msg.type === "new_post" && msg.post) {
handleIncomingPost(msg.post);
}
- } catch {}
+ } catch {
+ // ignore
+ }
};
return () => ws && ws.close();
}, [handleIncomingPost]);
@@ -99,13 +101,6 @@ export default function MapView() {
map.flyTo({ center: userPosition, zoom: 9, speed: 1.2 });
};
- const handlePickCenter = () => {
- const map = mapRef.current;
- if (!map) return;
- const center = map.getCenter();
- setDraftCoords([center.lng, center.lat]);
- };
-
const handleOpenCreate = () => {
setIsCreating(true);
setDraftTitle("");
@@ -157,7 +152,9 @@ export default function MapView() {
if (!map) return;
const lng = post.lon ?? post.lng;
const lat = post.lat ?? post.latitude;
- if (lng && lat) map.flyTo({ center: [lng, lat], zoom: 8, speed: 1.4 });
+ if (typeof lng === "number" && typeof lat === "number") {
+ map.flyTo({ center: [lng, lat], zoom: 8, speed: 1.4 });
+ }
};
return (
@@ -165,7 +162,7 @@ export default function MapView() {
{status && {status}
}
- {/* TOP BAR SIMPLIFIÉE */}
+ {/* TOP */}