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({
- + {status &&
{status}
} {debugEnabled && ( <> @@ -1885,60 +1805,9 @@ export default function MapView({ > -
- {/* Weather widget - single nearest city - BELOW search bar */} - {nearestWeather && (() => { - const w = nearestWeather; - const isSunny = w.icon === 'â˜€ī¸' || w.icon === '⛅'; - const isNight = w.icon === '🌙'; - const isRainy = w.icon === 'đŸŒ§ī¸' || w.icon === 'đŸŒĻī¸' || w.icon === 'â›ˆī¸'; - const isSnow = w.icon === 'â„ī¸' || w.icon === 'đŸŒ¨ī¸'; - const bg = isNight - ? 'linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9))' - : isSunny - ? 'linear-gradient(135deg, rgba(56, 189, 248, 0.85), rgba(14, 165, 233, 0.85))' - : isRainy - ? 'linear-gradient(135deg, rgba(71, 85, 105, 0.9), rgba(51, 65, 85, 0.9))' - : isSnow - ? 'linear-gradient(135deg, rgba(148, 163, 184, 0.9), rgba(203, 213, 225, 0.9))' - : 'linear-gradient(135deg, rgba(100, 116, 139, 0.85), rgba(71, 85, 105, 0.85))'; - - return ( -
setActiveWeatherPost(w)} - style={{ - display: 'inline-flex', - alignItems: 'center', - gap: '5px', - marginTop: '8px', - padding: '5px 12px', - borderRadius: '16px', - background: bg, - border: '1px solid rgba(255,255,255,0.25)', - color: isSnow ? '#1e293b' : '#fff', - fontSize: '13px', - fontWeight: '600', - cursor: 'pointer', - backdropFilter: 'blur(8px)', - boxShadow: '0 2px 8px rgba(0,0,0,0.2)', - }} - > - {w.icon} - {w.city}: - {w.temp}° -
- ); - })()}
@@ -2235,15 +2104,6 @@ export default function MapView({ /> )} - {activeWeatherPost && ( - setActiveWeatherPost(null)} - /> - )}
); } diff --git a/src/styles/theme.css b/src/styles/theme.css index 26de30e..b8a7eaf 100644 --- a/src/styles/theme.css +++ b/src/styles/theme.css @@ -9,7 +9,7 @@ body[data-theme="blue"] .post-pin--compact .post-pin-bubble { border-color: rgba(96, 165, 250, 0.95); } -body[data-theme="light"] { background:#f8fafc; color:#111827; } +body[data-theme="light"] { background:#e5e7eb; color:#111827; } body[data-theme="light"] .sociowall-panel, body[data-theme="light"] .chat-panel,