Skip to the content

Capsid menu

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

The functions of media-document-card.tsx
FunctionLinesComplexityCoveredCRAPMutation
extensionLabel2 to 65No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
DocumentCard9 to 191No data: no coverage report in this mapNo data: no coverage report in this mapNo 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>
  );
}