app/components/admin/media-document-card.tsx
18 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 |
|---|---|---|---|---|---|
| extensionLabel | 2 to 6 | 5 | No data: no coverage report in this map | No data: no coverage report in this map | No data: no mutants in this code |
| DocumentCard | 9 to 19 | 1 | 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 no other module of this repo. Imported by app/components/admin/media-tile.tsx.
Source
// Not classify.mjs's extensionOf: that takes a string and returns the "" classify() relies on to throw.
function extensionLabel(object: { key: string; mime: string | null }) {
const fromKey = /\.([a-z0-9]{1,5})$/i.exec(object.key.split("/").pop() ?? "")?.[1];
if (fromKey) return fromKey.toUpperCase();
return (object.mime ?? "file").split("/").pop()?.toUpperCase() ?? "FILE";
}
// No page count: nothing stores one, and the size is already on the tile's meta line.
export function DocumentCard({
object,
}: {
object: { key: string; mime: string | null; originalName: string | null };
}) {
return (
<span className="cap-media-doc" aria-hidden="true">
{extensionLabel(object)}
</span>
);
}