import { Show } from "solid-js"; import { Link } from "@tanstack/solid-router"; import type { Course } from "@/api/client"; import { Badge } from "@/components/ui/badge"; import { IconChevronRight, IconUsers } from "@/components/ui/icons"; import { personLabel } from "@/lib/person"; const courseInitials = (title: string) => title.trim().slice(0, 2).toLocaleUpperCase("tr-TR") || "—"; export function CourseCard(props: { course: Course; /** The şubeler line under the title: "3 sections", or a dash. */ sections: string; enrolled?: boolean; labels: { kind: string; enrolled: string; }; }) { // Teaching staff is per instance now, so a catalog card can only name the // course's owner — the şube pages name who actually teaches it. const teachers = () => [props.course.creator]; return (
{courseInitials(props.course.title)}

{props.course.title}

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

{props.course.description}

{props.sections} {teachers().map(personLabel).join(", ")}
); }