@biolibs/bionet-tools 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/work.tsx CHANGED
@@ -15,6 +15,7 @@ import { useState, type ReactNode } from "react";
15
15
  import { useAct, useLab } from "@biolibs/bionet-react";
16
16
  import { Glossed } from "@biolibs/glossary-react";
17
17
  import { FILED_UNDER, UNFILED, planOfWork, saysWork, type Project, type Step } from "./ordering.js";
18
+ import { protocolText, protocolsFor } from "./protocol.js";
18
19
 
19
20
  /** What a step is called, by what kind of run it is. */
20
21
  const CALLED: Readonly<Record<string, string>> = {
@@ -44,6 +45,9 @@ export function WorkToDo({ onOpen }: { onOpen?: (plan: Step["plan"]) => void } =
44
45
  const [into, setInto] = useState("");
45
46
  // Writing the method out, and taking one somebody else wrote.
46
47
  const [method, setMethod] = useState<string | null>(null);
48
+ // The sheet to carry to a bench, which is a different thing from the method: one is for another
49
+ // lab's software to read, the other for a person standing up with gloves on.
50
+ const [sheet, setSheet] = useState<string | null>(null);
47
51
  const [taking, setTaking] = useState("");
48
52
  const [told, setTold] = useState<string | null>(null);
49
53
  if (lab === null || lab === undefined) return null;
@@ -70,6 +74,10 @@ export function WorkToDo({ onOpen }: { onOpen?: (plan: Step["plan"]) => void } =
70
74
  const says = plan.fields[FILED_UNDER];
71
75
  return typeof says === "string" && says.trim() !== "" ? says.trim() : UNFILED;
72
76
  };
77
+ const asASheet = (): void => {
78
+ const sheets = protocolsFor(lab, { ...(only === null || only === UNFILED ? {} : { project: only }) });
79
+ setSheet(sheets.length === 0 ? null : sheets.map(protocolText).join("\n\n---\n\n"));
80
+ };
73
81
  const writeOut = async (): Promise<void> => {
74
82
  const answer = await act("publishMethod", { ...(only === null ? {} : { project: only }) });
75
83
  setTold(answer.ok ? null : answer.error);
@@ -162,7 +170,23 @@ export function WorkToDo({ onOpen }: { onOpen?: (plan: Step["plan"]) => void } =
162
170
  <h2>The work</h2>
163
171
  <p className="empty">Nothing is proposed here. A proposal is a run somebody could carry out, and a lab member or its adviser makes one at the tool that would do it. Several together are read as one piece of work.</p>
164
172
  </section>
165
- {crossing}
173
+ {work.order.length > 0 && (
174
+ <section className="card">
175
+ <h2>Taking it to the bench</h2>
176
+ <p className="small">The same work as a sheet to print or carry: what to fetch, what to set a machine to, what to do, and what to record afterwards.</p>
177
+ <p className="dim small">
178
+ Every number on it — a volume, a temperature, a time — is one somebody set or one the lab&rsquo;s own tools worked out.
179
+ Nothing is filled in to make it look finished: what a plan does not say is listed under each step instead, so the hole is found standing at a bench and not halfway through.
180
+ </p>
181
+ <div className="row tight">
182
+ <button type="button" onClick={asASheet}>Write {only === null ? "it all" : only} as a protocol</button>
183
+ {sheet !== null && <button type="button" className="quiet" onClick={() => setSheet(null)}>Hide it</button>}
184
+ </div>
185
+ {sheet !== null && <textarea className="method sheet" value={sheet} readOnly rows={18} aria-label="The protocol, to print or carry" onFocus={(event) => event.currentTarget.select()} />}
186
+ </section>
187
+ )}
188
+
189
+ {crossing}
166
190
  </div>
167
191
  );
168
192
  }
@@ -189,6 +213,22 @@ export function WorkToDo({ onOpen }: { onOpen?: (plan: Step["plan"]) => void } =
189
213
  </p>
190
214
  </section>
191
215
 
216
+ {work.order.length > 0 && (
217
+ <section className="card">
218
+ <h2>Taking it to the bench</h2>
219
+ <p className="small">The same work as a sheet to print or carry: what to fetch, what to set a machine to, what to do, and what to record afterwards.</p>
220
+ <p className="dim small">
221
+ Every number on it — a volume, a temperature, a time — is one somebody set or one the lab&rsquo;s own tools worked out.
222
+ Nothing is filled in to make it look finished: what a plan does not say is listed under each step instead, so the hole is found standing at a bench and not halfway through.
223
+ </p>
224
+ <div className="row tight">
225
+ <button type="button" onClick={asASheet}>Write {only === null ? "it all" : only} as a protocol</button>
226
+ {sheet !== null && <button type="button" className="quiet" onClick={() => setSheet(null)}>Hide it</button>}
227
+ </div>
228
+ {sheet !== null && <textarea className="method sheet" value={sheet} readOnly rows={18} aria-label="The protocol, to print or carry" onFocus={(event) => event.currentTarget.select()} />}
229
+ </section>
230
+ )}
231
+
192
232
  {crossing}
193
233
 
194
234
  {work.toGet.length > 0 && (
@@ -232,7 +272,9 @@ export function WorkToDo({ onOpen }: { onOpen?: (plan: Step["plan"]) => void } =
232
272
  <p className="dim small">
233
273
  Uses {step.plan.inputs.map((one) => `${one.item === undefined ? partName(one.part) : tubeName(one.item)} as ${one.role}`).join(", ") || "nothing the lab holds"}
234
274
  {step.plan.expects.length > 0 && <>, making {step.plan.expects.map((one) => `${one.name} (${one.length.toLocaleString("en-US")} bp${one.circular ? ", circular" : ""})`).join(" and ")}</>}
235
- {step.plan.expects.length === 0 && <>, making nothing the lab can name: what comes of it is alive</>}
275
+ {step.plan.expects.length === 0 && (step.plan.kind === "transformation"
276
+ ? <>, making nothing the lab can name: what comes of it is alive</>
277
+ : <>, making nothing it has declared</>)}
236
278
  . Proposed by {person(step.plan.by)}.
237
279
  </p>
238
280
  {step.plan.note !== null && <p className="small why">{step.plan.note}</p>}
package/tools.css CHANGED
@@ -178,3 +178,10 @@
178
178
  .bionet .work ol.steps > li .row { margin-top: .35rem }
179
179
  .bionet .work .why { color: var(--bionet-dim); font-style: italic }
180
180
  .bionet .work textarea.method { width: 100%; font-family: ui-monospace, monospace; font-size: .7rem; margin-top: .5rem }
181
+ .bionet .work textarea.sheet { font-size: .74rem; line-height: 1.45 }
182
+
183
+ /* Laying a construct out: the pieces in order, each with what it is for and a way to move it. */
184
+ .bionet .fusion ol.pieces { margin: .4rem 0; padding: 0; list-style: none; counter-reset: piece; display: grid; gap: .3rem }
185
+ .bionet .fusion ol.pieces > li { counter-increment: piece; display: flex; gap: .5rem; align-items: baseline; justify-content: space-between;
186
+ border-left: 3px solid var(--bionet-rule); padding: .15rem .4rem }
187
+ .bionet .fusion ol.pieces > li .what::before { content: counter(piece) ". "; color: var(--bionet-dim) }