diff --git a/src/App.jsx b/src/App.jsx index 41c8bf1..628397a 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -59,12 +59,12 @@ export default function App() { setTheme(saved); document.body.setAttribute("data-theme", saved); } else { - setTheme("light"); - document.body.setAttribute("data-theme", "light"); + setTheme("blue"); + document.body.setAttribute("data-theme", "blue"); } } catch (e) { - setTheme("light"); - document.body.setAttribute("data-theme", "light"); + setTheme("blue"); + document.body.setAttribute("data-theme", "blue"); } }, []); diff --git a/src/components/Map/MapView.jsx b/src/components/Map/MapView.jsx index f847dde..ff963dd 100644 --- a/src/components/Map/MapView.jsx +++ b/src/components/Map/MapView.jsx @@ -5,9 +5,8 @@ import "../../styles/mapMarkers.css"; import "../../styles/posts.css"; import "../../styles/filters.css"; -import { createPost, fetchPostPreview, resolveAssetRef, fetchWeatherPosts } from "../../api/client"; +import { createPost, fetchPostPreview, resolveAssetRef } from "../../api/client"; import { LiveKitBroadcast, LiveKitViewerModal } from "../Live"; -import { WeatherModal } from "../Weather"; import { FILTER_MAIN_CATEGORIES, FILTER_CATEGORY_MAP, @@ -147,9 +146,11 @@ export default function MapView({ const WEATHER_VIEW_KEY = "sociowire:weatherView"; const [weatherViewEnabled, setWeatherViewEnabled] = useState(() => { try { - return localStorage.getItem(WEATHER_VIEW_KEY) === "true"; + const saved = localStorage.getItem(WEATHER_VIEW_KEY); + // Default to true if not set + return saved === null ? true : saved === "true"; } catch { - return false; + return true; } }); @@ -196,11 +197,6 @@ export default function MapView({ const [showLiveBroadcast, setShowLiveBroadcast] = useState(false); const [activeLivePost, setActiveLivePost] = useState(null); const [liveCoords, setLiveCoords] = useState(null); - // Weather modal state - const [activeWeatherPost, setActiveWeatherPost] = useState(null); - // Weather cities widget (top left under search) - const [weatherCities, setWeatherCities] = useState([]); - const [nearestWeather, setNearestWeather] = useState(null); const openedPostRef = useRef(null); const queryPostRef = useRef(false); const overlayTimerRef = useRef(null); @@ -1210,82 +1206,6 @@ export default function MapView({ return () => map.off("movestart", handleMove); }, [mapRef, searchQuery]); - // Fetch weather cities on mount - useEffect(() => { - const loadWeatherCities = async () => { - try { - const posts = await fetchWeatherPosts(); - if (Array.isArray(posts) && posts.length > 0) { - // Parse weather data from posts - const cities = posts.map(p => { - const title = p.title || ''; - const tempMatch = title.match(/:\s*(-?\d+)°/); - const cityMatch = title.match(/^[^\w]*([A-Za-zÃ-Ãŋ\s]+):/); - const temp = tempMatch ? parseInt(tempMatch[1], 10) : null; - const city = cityMatch ? cityMatch[1].trim() : ''; - - // Detect weather icon from emoji in title - let icon = 'đĄī¸'; - if (title.includes('âī¸')) icon = 'âī¸'; - else if (title.includes('đ')) icon = 'đ'; - else if (title.includes('â ')) icon = 'â '; - else if (title.includes('âī¸')) icon = 'âī¸'; - else if (title.includes('đĢī¸')) icon = 'đĢī¸'; - else if (title.includes('đ§ī¸')) icon = 'đ§ī¸'; - else if (title.includes('âī¸')) icon = 'âī¸'; - else if (title.includes('đĻī¸')) icon = 'đĻī¸'; - else if (title.includes('đ¨ī¸')) icon = 'đ¨ī¸'; - else if (title.includes('âī¸')) icon = 'âī¸'; - - return { ...p, city, temp, icon }; - }).filter(c => c.city && c.temp !== null); - - setWeatherCities(cities); - } - } catch (err) { - console.warn('[Weather] Failed to load cities:', err); - } - }; - - loadWeatherCities(); - // Refresh every 10 minutes - const interval = setInterval(loadWeatherCities, 10 * 60 * 1000); - return () => clearInterval(interval); - }, []); - - // Find nearest weather city when map moves - useEffect(() => { - const map = mapRef.current; - if (!map || weatherCities.length === 0) return; - - const updateNearest = () => { - try { - const center = map.getCenter(); - if (!center) return; - - let nearest = null; - let minDist = Infinity; - - for (const w of weatherCities) { - if (w.lat == null || w.lon == null) continue; - const dist = Math.sqrt( - Math.pow(center.lat - w.lat, 2) + Math.pow(center.lng - w.lon, 2) - ); - if (dist < minDist) { - minDist = dist; - nearest = w; - } - } - - if (nearest) setNearestWeather(nearest); - } catch {} - }; - - updateNearest(); - map.on("idle", updateNearest); - return () => map.off("idle", updateNearest); - }, [mapRef, weatherCities]); - const handleProfileVisitIsland = (island) => { console.log('[MapView] Visiting island from profile:', island.username); setSelectedProfile(null); // Close profile modal @@ -1801,7 +1721,7 @@ export default function MapView({