diff --git a/src/api/client.js b/src/api/client.js index f6459df..cbc919b 100644 --- a/src/api/client.js +++ b/src/api/client.js @@ -27,8 +27,8 @@ export async function fetchPosts(filters = {}) { }); if (!res.ok) { - console.error("fetchPosts failed", res.status); - throw new Error("Failed to load posts"); + console.warn("fetchPosts failed (treated as empty)", res.status); + return []; } const data = await res.json(); diff --git a/src/components/Map/MapView.jsx b/src/components/Map/MapView.jsx index 268a452..e77bd38 100644 --- a/src/components/Map/MapView.jsx +++ b/src/components/Map/MapView.jsx @@ -60,6 +60,54 @@ export default function MapView({ const bottomCategories = FILTER_CATEGORY_MAP[mainFilter] || ["All"]; + /* SW_SUBCAT_ICONS:BEGIN */ + const getSubcatIcon = (main, sub) => { + const M = { + All: { + All: "fa-solid fa-layer-group", + }, + + News: { + All: "fa-solid fa-layer-group", + World: "fa-solid fa-globe", + Politics: "fa-solid fa-landmark-flag", + Tech: "fa-solid fa-microchip", + Finance: "fa-solid fa-chart-line", + Local: "fa-solid fa-location-dot", + }, + + Friends: { + All: "fa-solid fa-layer-group", + Nearby: "fa-solid fa-location-crosshairs", + Chats: "fa-solid fa-comments", + Groups: "fa-solid fa-user-group", + Stories: "fa-solid fa-book-open", + Favs: "fa-solid fa-heart", + }, + + Events: { + All: "fa-solid fa-layer-group", + Today: "fa-solid fa-calendar-day", + Weekend: "fa-solid fa-calendar-week", + Music: "fa-solid fa-music", + Sports: "fa-solid fa-football", + Local: "fa-solid fa-location-dot", + }, + + Market: { + All: "fa-solid fa-layer-group", + Actu: "fa-solid fa-newspaper", + Tech: "fa-solid fa-microchip", + Finan: "fa-solid fa-money-bill-trend-up", + Sport: "fa-solid fa-basketball", + Deals: "fa-solid fa-tags", + }, + }; + + return (M[main] && M[main][sub]) || ""; + }; + /* SW_SUBCAT_ICONS:END */ + // keep subFilter valid useEffect(() => { if (!bottomCategories.length) return; @@ -274,7 +322,12 @@ export default function MapView({ className={"sw-bottom-item" + (subFilter === c ? " sw-bottom-active" : "")} onClick={() => setSubFilter(c)} > -
{c === "All" ? "All" : c.slice(0, 2)}
+
+ {(() => { + const ic = getSubcatIcon(mainFilter, c); + return ic ? : c === "All" ? "All" : c.slice(0, 2); + })()} +
{c}
))} diff --git a/src/components/Map/usePostsEngine.js b/src/components/Map/usePostsEngine.js index b63b226..963944e 100644 --- a/src/components/Map/usePostsEngine.js +++ b/src/components/Map/usePostsEngine.js @@ -165,8 +165,8 @@ export function usePostsEngine({ } catch (err) { console.error("Erreur chargement posts:", err); if (!cancelled) { - setStatus("Error loading posts."); - setLoadError("Error loading posts."); + setStatus("No posts found."); + setLoadError(""); setLoadingPosts(false); } } diff --git a/src/styles/filters.css b/src/styles/filters.css index fa12dcd..158c9da 100644 --- a/src/styles/filters.css +++ b/src/styles/filters.css @@ -30,6 +30,13 @@ font-size:.78rem; box-shadow:0 3px 10px rgba(0,0,0,.75); } + +/* SW_SUBCAT_ICON_CSS */ +.sw-bottom-circle i{ + font-size: 18px; + line-height: 1; +} +/* SW_SUBCAT_ICON_CSS:END */ .sw-bottom-label { font-size:.65rem; color:#e5e7eb; text-shadow:0 1px 2px rgba(0,0,0,.9); } .sw-bottom-active .sw-bottom-circle { background: rgba(37, 99, 235, 0.82); border-color:#60a5fa; } .sw-bottom-active .sw-bottom-label { color:#bfdbfe; font-weight:600; } @@ -52,3 +59,81 @@ } .sw-subcats-float .sw-bottom-row::-webkit-scrollbar{ height: 0; } + +/* SW_FILTER_ICON_VISIBILITY:BEGIN */ + +/* Make subcategory icons inherit color (so they show) */ +.sw-bottom-item{ color:#e5e7eb; } +.sw-bottom-circle{ color:#e5e7eb; } +.sw-bottom-circle i{ + color: currentColor; + font-size: 20px; /* closer to right-side icons feel */ + line-height: 1; + opacity: .96; + filter: drop-shadow(0 1px 2px rgba(0,0,0,.65)); +} + +/* Active state: brighter icon/text like category buttons */ +.sw-bottom-active .sw-bottom-circle{ + color:#dbeafe; + box-shadow:0 0 14px rgba(56,189,248,.60); + border-color: rgba(96,165,250,.95); +} +.sw-bottom-active .sw-bottom-label{ + color:#bfdbfe; + font-weight:700; +} + +/* ---------- LIGHT THEME FIXES (readable) ---------- */ +body[data-theme="light"] .sw-bottom-row{ + background: rgba(255,255,255,0.95); + border: 1px solid rgba(148,163,184,0.85); + box-shadow: 0 6px 18px rgba(0,0,0,.12); +} + +body[data-theme="light"] .sw-bottom-item{ color:#0B1220; } +body[data-theme="light"] .sw-bottom-circle{ + background: rgba(255,255,255,0.92); + border-color: rgba(148,163,184,0.85); + box-shadow: 0 3px 10px rgba(0,0,0,.10); + color:#0B1220; +} +body[data-theme="light"] .sw-bottom-label{ + color:#0B1220; + text-shadow:none; +} + +body[data-theme="light"] .sw-bottom-active .sw-bottom-circle{ + background: rgba(30,107,255,0.92); + border-color: rgba(30,107,255,0.95); + color:#ffffff; + box-shadow:0 0 14px rgba(30,107,255,.35); +} +body[data-theme="light"] .sw-bottom-active .sw-bottom-label{ + color:#0B1220; + font-weight:800; +} + +/* Also fix right-side category buttons in light theme */ +body[data-theme="light"] .sw-icon-btn{ color:#0B1220; } +body[data-theme="light"] .sw-icon-circle{ + background: rgba(255,255,255,0.92); + border-color: rgba(148,163,184,0.85); + box-shadow: 0 3px 10px rgba(0,0,0,.10); +} +body[data-theme="light"] .sw-icon-label{ + color:#0B1220; + text-shadow:none; +} +body[data-theme="light"] .sw-icon-active .sw-icon-circle{ + background: rgba(30,107,255,0.92); + border-color: rgba(30,107,255,0.95); + box-shadow:0 0 14px rgba(30,107,255,.35); +} +body[data-theme="light"] .sw-icon-active .sw-icon-label{ + color:#0B1220; + font-weight:800; +} + +/* SW_FILTER_ICON_VISIBILITY:END */ + diff --git a/src/styles/map.css b/src/styles/map.css index c8a310e..6832f52 100644 --- a/src/styles/map.css +++ b/src/styles/map.css @@ -1,5 +1,5 @@ :root{ - --sw-subcats-nudge: -35px; /* subcats vertical nudge */ + --sw-subcats-nudge: -45px; /* subcats vertical nudge */ --sw-below-overlap: 40px; /* wall overlaps map a bit */ } diff --git a/src/styles/posts.css b/src/styles/posts.css index c12ee8f..cfc9930 100644 --- a/src/styles/posts.css +++ b/src/styles/posts.css @@ -10,11 +10,14 @@ /* Small top nudge down (as requested) */ .sociowall-panel, .chat-panel{ + max-width: 32vw; + min-width: 160px; + flex: 1 1 0; /* ✅ 1/4 */ margin-top: 5px; /* ✅ descend 5px */ } .sociowall-panel{ - flex: 1 1 auto; + flex: 3 1 0; /* ✅ 3/4 */ min-width:0; /* IMPORTANT: prevents pushing chat */ min-height: 160px; background: rgba(15, 23, 42, 0.96); @@ -113,3 +116,22 @@ .chat-panel{ width:100%; min-width:0; max-width:none; flex: 1 1 auto; } .post-list{ max-height: 46vh; } } + +/* SW_LAYOUT_RATIO_FIX:BEGIN */ +.below-row{ flex-wrap: nowrap !important; } + +.sociowall-panel{ + flex: 3 1 0 !important; /* ✅ 3/4 */ + width: auto !important; + max-width: none !important; + min-width: 0 !important; +} + +.chat-panel{ + flex: 1 1 0 !important; /* ✅ 1/4 */ + width: auto !important; + max-width: none !important; + min-width: 140px !important; +} +/* SW_LAYOUT_RATIO_FIX:END */ +