Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 59 additions & 7 deletions client/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="sessions">
{sessions.length ? sessions.slice(0, 6).map((session) => (
<div className="sessions">

<div className="search-container">

<input
type="text"
placeholder="🔍 Search sessions..."
value={search}
onChange={(e) => setSearch(e.target.value)}
className="session-search"
/>

{search && (
<button
className="clear-search"
onClick={() => setSearch("")}
>
✖ Clear
</button>
)}

</div>


{filteredSessions.length ? (
filteredSessions.slice(0, 6).map((session) => (
<article key={session._id}>
<Play size={16} />

<div>
<strong>{session.scenario?.title}</strong>
<span>{session.masterySignals.join(' / ')}</span>

<span>
{session.masterySignals?.join(" / ")}
</span>
</div>

</article>
)) : <p>No sessions yet.</p>}
</div>
);
}
))
) : (
<p>
{search
? "No matching sessions found."
: "No sessions yet."
}
</p>
)}

</div>
)};


createRoot(document.getElementById('root')).render(<App />);
23 changes: 23 additions & 0 deletions client/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}