From e7c5b53e7c858a6daeea06a6a0754bcb35483ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Tue, 28 Jul 2026 14:24:10 +0300 Subject: [PATCH] =?UTF-8?q?fix(courses):=20=F0=9F=A7=91=E2=80=8D?= =?UTF-8?q?=F0=9F=8F=AB=20rebuild=20class=20browsing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - make kind tabs, search, and term filters responsive - replace dense cards with compact course rows - simplify course workspace tabs and people management --- src/components/courses/course-card.tsx | 57 ++++ src/components/ui/data-toolbar.tsx | 11 +- src/components/ui/select.tsx | 8 +- src/pages/course-detail-page.tsx | 137 ++++------ src/pages/courses-page.test.tsx | 114 ++++++++ src/pages/courses-page.tsx | 363 +++++++++++-------------- 6 files changed, 396 insertions(+), 294 deletions(-) create mode 100644 src/components/courses/course-card.tsx create mode 100644 src/pages/courses-page.test.tsx diff --git a/src/components/courses/course-card.tsx b/src/components/courses/course-card.tsx new file mode 100644 index 0000000..a51956d --- /dev/null +++ b/src/components/courses/course-card.tsx @@ -0,0 +1,57 @@ +import { Show } from "solid-js"; +import { Link } from "@tanstack/solid-router"; +import type { Course } from "@/api/client"; +import { Badge } from "@/components/ui/badge"; +import { IconBook, IconChevronRight, IconUsers } from "@/components/ui/icons"; +import { personLabel } from "@/lib/person"; + +export function CourseCard(props: { + course: Course; + term: string; + enrolled?: boolean; + labels: { + capacity: string; + enrolled: string; + kind: string; + }; +}) { + const teachers = () => [props.course.creator, ...(props.course.teachers ?? [])] + .filter((person, index, all) => all.findIndex((row) => row.id === person.id) === index); + + return ( + +
+ + + +
+
+

{props.course.title}

+ {props.labels.kind} + {props.labels.enrolled} +
+

{props.course.description || "—"}

+
+ {props.term} + + + {teachers().map(personLabel).join(", ")} + +
+
+
+ +
+
+

{props.labels.capacity}

+

{props.course.capacity ?? "—"}

+
+ +
+ + ); +} diff --git a/src/components/ui/data-toolbar.tsx b/src/components/ui/data-toolbar.tsx index 461d980..48ce5dc 100644 --- a/src/components/ui/data-toolbar.tsx +++ b/src/components/ui/data-toolbar.tsx @@ -10,14 +10,15 @@ export function DataToolbar(props: { onSearchInput?: (value: string) => void; filters?: JSX.Element; actions?: JSX.Element; + inline?: boolean; class?: string; }) { const hasSearch = () => props.searchValue !== undefined || props.searchPlaceholder !== undefined || props.onSearchInput !== undefined; return ( -
-
+
+
-
+
{props.filters}
-
{props.actions}
+ +
{props.actions}
+
); } diff --git a/src/components/ui/select.tsx b/src/components/ui/select.tsx index bdfb1f4..12bc55a 100644 --- a/src/components/ui/select.tsx +++ b/src/components/ui/select.tsx @@ -80,12 +80,14 @@ export function DropdownSelect(props: Dropdo ); } -export type SelectProps = ComponentProps<"select">; +export type SelectProps = ComponentProps<"select"> & { + wrapperClass?: string; +}; export function Select(props: SelectProps) { - const [local, rest] = splitProps(props, ["class"]); + const [local, rest] = splitProps(props, ["class", "wrapperClass"]); return ( -
+
setTitle(e.currentTarget.value)} /> -
-
- -