Skip to the content

Capsid menu

app/components/post-history.tsx

42 lines and 3 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.

Functions

The functions of post-history.tsx
FunctionLinesComplexityCoveredCRAPMutation
PostHistory5 to 464No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
<anonymous:17>17 to 171No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
<anonymous:28>28 to 362No 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/routes/blog.$slug.tsx.

Source

// No `dt-` class on these dates: the rail already publishes `dt-published` and `dt-updated`,
// and a second set in the same tree would tell a parser the post has many update times.
type ChangelogEntry = { date: string; note: string };

export function PostHistory({
  entries,
  publishedAt,
  sourceHash,
}: {
  entries: ChangelogEntry[];
  publishedAt: string | null;
  sourceHash: string | null;
}) {
  if (entries.length === 0) return null;

  // Dates are YYYY-MM-DD, so a string compare is a date compare.
  const ordered = [...entries].sort((a, b) => a.date.localeCompare(b.date));

  // Date and note stay separate nodes so the date alone takes the mono face.
  const facts = [
    ...(publishedAt ? [{ date: publishedAt, note: "first published" }] : []),
    ...ordered,
  ];

  return (
    <p className="post-history">
      <span className="post-history-label">Post history</span>
      {facts.map((fact, i) => (
        <span key={`${fact.date} ${fact.note}`}>
          {i > 0 ? " · " : null}
          <time className="post-history-value" dateTime={fact.date}>
            {fact.date}
          </time>{" "}
          {fact.note}
        </span>
      ))}
      {/* Absent on a row written before the column existed. */}
      {sourceHash ? (
        <>
          {" · rendered from source hash "}
          <span className="post-history-value">{sourceHash.slice(0, 7)}</span>
        </>
      ) : null}
    </p>
  );
}