Skip to the content

Capsid menu

app/routes/admin.kb.item.tsx

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

Functions

The functions of admin.kb.item.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
loader13 to 151No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
action17 to 191No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code
EditItem21 to 283No data: no coverage report in this mapNo data: no coverage report in this mapNo data: no mutants in this code

Imports

It imports app/components/admin/kb-file-editor.tsx, app/components/admin/kb-form.tsx, app/kb/editor-route.server.ts. No module of this repo imports it.

Source

import { KbFileEditor } from "~/components/admin/kb-file-editor";
import { KbFormEditor } from "~/components/admin/kb-form";
import { kbEditorAction, kbEditorLoader } from "~/kb/editor-route.server";

import type { Route } from "./+types/admin.kb.item";

/* One lab registry item's file, edited and saved through the registry save (docs/KNOWLEDGE-BASE.md, step 3). */

export function meta({ params }: Route.MetaArgs) {
  return [{ title: `Edit ${params.kind}/${params.id} · Knowledge Base · Admin` }, { name: "robots", content: "noindex" }];
}

export function loader(args: Route.LoaderArgs) {
  return kbEditorLoader(args, { type: "item", kind: args.params.kind, id: args.params.id });
}

export function action(args: Route.ActionArgs) {
  return kbEditorAction(args, { type: "item", kind: args.params.kind, id: args.params.id });
}

export default function EditItem({ loaderData, actionData }: Route.ComponentProps) {
  const { file, form, view, saved, created } = loaderData;
  // The form is the editor; the file itself is behind Advanced (?view=file).
  if (view === "form" && form) {
    return <KbFormEditor key={file.sha} file={file} form={form} saved={saved} created={created} actionData={actionData} />;
  }
  return <KbFileEditor key={file.sha} file={file} saved={saved} actionData={actionData} />;
}