app/components/admin/media-list-header.tsx
52 lines and 2 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| MediaListHeader | 14 to 56 | 2 | No data: no coverage report in this map | No data: no coverage report in this map | No data: no mutants in this code |
| <anonymous:26> | 26 to 49 | 9 | No data: no coverage report in this map | No data: no coverage report in this map | No data: no mutants in this code |
Imports
It imports app/lib/media/view.mjs. Imported by app/components/admin/media-grid.tsx.
Source
import { Link } from "react-router";
import { sortHref } from "~/lib/media/view.mjs";
const LIST_COLUMNS: Array<[sortKey: string | null, label: string, num: boolean]> = [
["name", "Name", false],
["usage", "Usage", false],
[null, "Dims", true],
["size", "Size", true],
["added", "Added", true],
];
// Dims is not sortable: half the library has no dimensions, which would collapse into one block.
export function MediaListHeader({
view,
}: {
view: Parameters<typeof sortHref>[0];
}) {
const arrow = view.dir === "asc" ? "↑" : "↓";
return (
<tr>
<th scope="col">
<span className="cap-sr-only">Select</span>
</th>
{LIST_COLUMNS.map(([key, label, num]) =>
key === null ? (
<th key={label} scope="col" data-num={num || undefined}>
{label}
</th>
) : (
<th
key={key}
scope="col"
data-num={num || undefined}
aria-sort={view.sort === key ? (view.dir === "asc" ? "ascending" : "descending") : undefined}
>
<Link to={sortHref(view, key, { toggle: true })} className="cap-table-sort" data-sort={key}>
{label}
<span aria-hidden="true">{view.sort === key ? ` ${arrow}` : ""}</span>
{/* The sorted column says so in words inside its link. */}
{view.sort === key ? (
<span className="cap-sr-only">
, sorted {view.dir === "asc" ? "ascending" : "descending"}
</span>
) : null}
</Link>
</th>
),
)}
<th scope="col">
<span className="cap-sr-only">Copy the address</span>
</th>
</tr>
);
}