Skip to the content

Capsid menu

app/components/library-overview.tsx

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

Functions

The functions of library-overview.tsx
FunctionLinesComplexityCoveredCRAPMutation
LibraryOverview8 to 833No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
<anonymous:22>22 to 291No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
<anonymous:37>37 to 574No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
<anonymous:49>49 to 531No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
<anonymous:59>59 to 801No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
<anonymous:65>65 to 773No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code

Imports

It imports app/kb/procedures/library.mjs. Imported by app/routes/protocols.tsx.

Source

import { countOf, overviewSentence, type libraryOverview } from "~/kb/procedures/library.mjs";

/**
 * The library's overview (docs/PROCEDURES.md): its counts, the phage workflow and a tile for each method, all
 * counted from the same rows as the catalog beneath it. Plain links, so every tile is also an address of the
 * filtered library and the whole block works with no script.
 */
export function LibraryOverview({ overview }: { overview: ReturnType<typeof libraryOverview> }) {
  if (overview.total === 0) return null;
  return (
    <section className="library-overview" aria-labelledby="library-overview-title">
      <h2 id="library-overview-title" className="library-overview-title">
        In the library
      </h2>
      <p className="library-counts">{overviewSentence(overview)}</p>
      {overview.start.length > 0 ? (
        <>
          <h3 className="library-subtitle" id="library-start-title">
            Start here
          </h3>
          <ol className="library-start" aria-labelledby="library-start-title">
            {overview.start.map((p) => (
              <li key={p.slug}>
                <a className="library-start-title" href={p.href}>
                  {p.title}
                </a>
                <span className="library-start-why">{p.description}</span>
              </li>
            ))}
          </ol>
        </>
      ) : null}
      <h3 className="library-subtitle" id="library-pipeline-title">
        The phage workflow
      </h3>
      <ol className="library-pipeline" aria-labelledby="library-pipeline-title">
        {overview.stages.map((stage) => (
          <li key={stage.id} className="library-stage" data-empty={stage.href ? undefined : ""}>
            {stage.href ? (
              <a href={stage.href}>
                <span className="library-stage-name">{stage.label}</span>
                <span className="library-stage-n">{countOf(stage.count, ["protocol", "protocols"])}</span>
              </a>
            ) : (
              <span className="library-stage-name">{stage.label}</span>
            )}
            {stage.tools.length > 0 ? (
              <ul className="library-stage-tools" aria-label={`Calculators for ${stage.label}`}>
                {stage.tools.map((tool) => (
                  <li key={tool.id}>
                    <a href={tool.href}>{tool.label}</a>
                  </li>
                ))}
              </ul>
            ) : null}
          </li>
        ))}
      </ol>
      {overview.browse.map((group) => (
        <div key={group.id} className="library-browse">
          <h3 className="library-subtitle" id={`library-browse-${group.id}`}>
            {group.title}
          </h3>
          <ul className="library-tiles" aria-labelledby={`library-browse-${group.id}`}>
            {group.tiles.map((tile) => (
              <li key={tile.id}>
                <a className="library-tile" href={tile.href}>
                  <span className="library-tile-name">{tile.label}</span>
                  <span className="library-tile-n">{countOf(tile.count, ["protocol", "protocols"])}</span>
                </a>
                {"about" in tile && typeof tile.about === "string" ? (
                  <a className="library-tile-about" href={tile.about}>
                    About the course
                  </a>
                ) : null}
              </li>
            ))}
          </ul>
        </div>
      ))}
    </section>
  );
}