{#snippet columnVisibilityItems(variant: "dropdown" | "context")} {#if variant === "dropdown"} Toggle columns {#each columns as col} {@const id = col.id!} {@const label = typeof col.header === "string" ? col.header : id} { columnVisibility = { ...columnVisibility, [id]: checked }; }} class="relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm cursor-pointer select-none outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground" > {#snippet children({ checked })} {#if checked} {/if} {label} {/snippet} {/each} {#if hasCustomVisibility} Reset to default {/if} {:else} Toggle columns {#each columns as col} {@const id = col.id!} {@const label = typeof col.header === "string" ? col.header : id} { columnVisibility = { ...columnVisibility, [id]: checked }; }} class="relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm cursor-pointer select-none outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground" > {#snippet children({ checked })} {#if checked} {/if} {label} {/snippet} {/each} {#if hasCustomVisibility} Reset to default {/if} {/if} {/snippet}
View Show or hide table columns {#snippet child({ wrapperProps, props, open })} {#if open}
{@render columnVisibilityItems("dropdown")}
{/if} {/snippet}
{#each table.getHeaderGroups() as headerGroup} {#each headerGroup.headers as header} {#if header.column.getIsVisible()} {/if} {/each} {/each} {#if loading && courses.length === 0} {#each Array(5) as _} {#each table.getVisibleLeafColumns() as col} {/each} {/each} {:else if courses.length === 0} {:else} {#each table.getRowModel().rows as row (row.id)} {@const course = row.original} toggleRow(course.crn)} > {#each row.getVisibleCells() as cell (cell.id)} {@const colId = cell.column.id} {#if colId === "crn"} {:else if colId === "course_code"} {@const subjectDesc = subjectMap[course.subject]} {:else if colId === "title"} {:else if colId === "instructor"} {@const primary = getPrimaryInstructor(course.instructors)} {:else if colId === "time"} {:else if colId === "location"} {:else if colId === "seats"} {/if} {/each} {#if expandedCrn === course.crn} {/if} {/each} {/if}
{#if header.column.getCanSort()} {#if typeof header.column.columnDef.header === "string"} {header.column.columnDef.header} {:else} {/if} {#if header.column.getIsSorted() === "asc"} {:else if header.column.getIsSorted() === "desc"} {:else} {/if} {:else if typeof header.column.columnDef.header === "string"} {header.column.columnDef.header} {:else} {/if}
No courses found. Try adjusting your filters.
{course.crn} {course.subject} {course.courseNumber}{#if course.sequenceNumber}-{course.sequenceNumber}{/if} {course.title} {primaryInstructorDisplay(course)} {#if primaryRating(course)} {@const r = primaryRating(course)!} {r.rating.toFixed(1)}★ {/if} {#if timeIsTBA(course)} TBA {:else} {@const mt = course.meetingTimes[0]} {#if !isMeetingTimeTBA(mt)} {formatMeetingDays(mt)} {" "} {/if} {#if !isTimeTBA(mt)} {formatTime(mt.begin_time)}–{formatTime(mt.end_time)} {:else} TBA {/if} {/if} {#if formatLocation(course)} {formatLocation(course)} {:else} {/if} {#if openSeats(course) === 0}Full{:else}{openSeats(course)} open{/if} {course.enrollment}/{course.maxEnrollment}{#if course.waitCount > 0} · WL {course.waitCount}/{course.waitCapacity}{/if}
{#snippet child({ wrapperProps, props, open })} {#if open}
{@render columnVisibilityItems("context")}
{/if} {/snippet}