Skip to the content

Capsid menu

app/routes/workspace._index.tsx

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

Functions

The functions of workspace._index.tsx
FunctionLinesComplexityCoveredCRAPMutation
meta9 to 111No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
loader14 to 251No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
LabOverview27 to 484No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code

Imports

It imports app/lab/actor.server.ts, app/lab/titles.mjs. No module of this repo imports it.

Source

import { Link, data } from "react-router";
import { can } from "@dustinedwards/site-runtime/members";

import { PageHead } from "capsomer/react/page-head";
import { labActorContext } from "~/lab/actor.server";
import { PERMISSION, titleLabel } from "~/lab/titles.mjs";
import type { Route } from "./+types/workspace._index";

export function meta() {
  return [{ title: "Overview ยท Lab" }, { name: "robots", content: "noindex" }];
}

/** What this person may do here, from their permissions, never their title. */
export async function loader({ context }: Route.LoaderArgs) {
  const actor = context.get(labActorContext);
  return data(
    {
      title: titleLabel(actor.title),
      manages: can(actor, PERMISSION.manageMembers),
      reads: can(actor, PERMISSION.read),
      records: can(actor, PERMISSION.recordRun),
    },
    { headers: { "cache-control": "private, no-store" } },
  );
}

export default function LabOverview({ loaderData }: Route.ComponentProps) {
  return (
    <>
      <PageHead title="Lab" lead={`You are signed in as ${loaderData.title}.`} />
      {loaderData.reads ? (
        <p>
          <Link to="/lab/inventory">Inventory</Link>: the lots on the shelf, how much is left and where.
        </p>
      ) : null}
      {loaderData.records ? (
        <p>
          <Link to="/lab/runs">Runs</Link>: record a run of a protocol with the lots it used.
        </p>
      ) : null}
      {loaderData.manages ? (
        <p>
          <Link to="/lab/members">Members</Link>: who may sign in to the lab, their titles and when their access ends.
        </p>
      ) : null}
    </>
  );
}