diff --git a/client/src/main.jsx b/client/src/main.jsx index ef3da3a9..1c57c39f 100644 --- a/client/src/main.jsx +++ b/client/src/main.jsx @@ -285,19 +285,71 @@ function Roadmap({ roadmap }) { } function SessionList({ sessions }) { + const [search, setSearch] = useState(""); + + const filteredSessions = sessions.filter((session) => { + if (!search) return true; + + const text = search.toLowerCase(); + + return ( + session.scenario?.title?.toLowerCase().includes(text) || + session.scenario?.concepts?.some((concept) => + concept.toLowerCase().includes(text) + ) + ); + }); return ( -
- {sessions.length ? sessions.slice(0, 6).map((session) => ( +
+ +
+ + setSearch(e.target.value)} + className="session-search" + /> + + {search && ( + + )} + +
+ + + {filteredSessions.length ? ( + filteredSessions.slice(0, 6).map((session) => (
+
{session.scenario?.title} - {session.masterySignals.join(' / ')} + + + {session.masterySignals?.join(" / ")} +
+
- )) :

No sessions yet.

} -
- ); -} + )) + ) : ( +

+ {search + ? "No matching sessions found." + : "No sessions yet." + } +

+ )} + +
+)}; + createRoot(document.getElementById('root')).render(); diff --git a/client/src/styles.css b/client/src/styles.css index 70ac3f18..132a0f48 100644 --- a/client/src/styles.css +++ b/client/src/styles.css @@ -491,3 +491,26 @@ meter { grid-template-columns: 1fr; } } +.session-search { + width: 100%; + padding: 10px 14px; + margin-bottom: 16px; + border-radius: 8px; + border: 1px solid #d1d5db; + font-size: 15px; +} +.search-container { + display: flex; + gap: 10px; + margin-bottom: 16px; +} + +.session-search { + flex: 1; +} + +.clear-search { + padding: 8px 14px; + border-radius: 8px; + cursor: pointer; +} \ No newline at end of file