diff --git a/frontend/src/css/ExplorePage.css b/frontend/src/css/ExplorePage.css index ac8444e..e25ef7c 100644 --- a/frontend/src/css/ExplorePage.css +++ b/frontend/src/css/ExplorePage.css @@ -82,6 +82,7 @@ html[data-theme="dark"] .pill.active { background: var(--accent); color: var(--b align-self: center; margin-top: 12px; margin-bottom: 12px; + z-index: 100; } .explore-search.closer { margin-top: 12px; @@ -97,6 +98,8 @@ html[data-theme="dark"] .pill.active { background: var(--accent); color: var(--b border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow-1); + position: relative; + z-index: 1; } .search-input-wrap input { flex: 1; @@ -113,7 +116,7 @@ html[data-theme="dark"] .pill.active { background: var(--accent); color: var(--b top: calc(100% + 4px); left: 0; right: 0; - z-index: 20; + z-index: 101; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); diff --git a/frontend/src/pages/ExplorePage.jsx b/frontend/src/pages/ExplorePage.jsx index 71a1dda..4cbc283 100644 --- a/frontend/src/pages/ExplorePage.jsx +++ b/frontend/src/pages/ExplorePage.jsx @@ -140,11 +140,20 @@ export default function ExplorePage() { const suggestions = useMemo(() => { const q = (query || "").trim().toLowerCase(); if (!q) return []; - return locations + + // hashmaps are o(1) lookup to track unique locations + const seen = new Map(); + locations .map((r) => r.trip_location) .filter(Boolean) .filter((loc) => loc.toLowerCase().includes(q)) - .slice(0, 8); + .forEach((loc) => { + const key = loc.toLowerCase().trim(); + if (!seen.has(key)) { + seen.set(key, loc); + } + }); + return Array.from(seen.values()).slice(0, 8); }, [locations, query]); // click-outside to close suggestions