Skip to the content

Capsid menu

app/components/admin/shell-parts.tsx

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

Functions

The functions of shell-parts.tsx
FunctionLinesComplexityCoveredCRAPMutation
Icon17 to 231No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
shellLink29 to 371No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
ShellLink30 to 361No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
crumbLink40 to 441No 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/kb-file-editor.tsx, app/components/admin/kb-form.tsx, app/components/admin/post-editor.tsx, app/routes/admin.posts.$slug.history.tsx, app/routes/admin.tsx, app/routes/workspace.inventory.lot.tsx, app/routes/workspace.runs.run.tsx, app/routes/workspace.tsx.

Source

// What the admin and lab shells share (routes/admin.tsx, routes/workspace.tsx): the theme bootstrap, the icon frame and
// the shell's link.

import type { ReactNode } from "react";
import { Link } from "react-router";
import type { LinkProps } from "capsomer/react/admin-shell";
import type { BreadcrumbProps } from "capsomer/react/breadcrumb";

/**
 * Capsomer's own one-liner (theme-switch.md), run before first paint so a remembered theme never
 * flashes the other one. The plane's nonce is what lets the policy run it.
 */
export const THEME_SCRIPT =
  'try{var t=localStorage.getItem("cap-theme");if(t==="light"||t==="dark")document.documentElement.setAttribute("data-theme",t)}catch(e){}';

/* The shell's own family: a 24 box, a 1.6 stroke, drawn in currentColor (admin-shell.md, "Icons"). */
export function Icon({ d }: { d: string }) {
  return (
    <svg className="cap-admin-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
      <path d={d} />
    </svg>
  );
}

/**
 * The shell's link for one plane. A link out of the plane is a document navigation: the public pages bring their own
 * stylesheets, which would otherwise be loaded beside Capsomer's.
 */
export function shellLink(prefix: string) {
  return function ShellLink({ href, children, ...rest }: LinkProps): ReactNode {
    return (
      <Link to={href} reloadDocument={!href.startsWith(prefix)} {...rest}>
        {children}
      </Link>
    );
  };
}

/** A breadcrumb level as a router link, for Capsomer's PageHead. */
export const crumbLink: BreadcrumbProps["renderLink"] = ({ href, className, children }) => (
  <Link to={href} className={className}>
    {children}
  </Link>
);