list and details cleanup
This commit is contained in:
parent
2e8297d426
commit
4359803a3f
1 changed files with 14 additions and 5 deletions
|
|
@ -28,8 +28,8 @@ type Rec = {
|
||||||
|
|
||||||
// CO₂ Galvo fixed lists
|
// CO₂ Galvo fixed lists
|
||||||
lens_conf?: { id?: string | number; name?: string | null } | null;
|
lens_conf?: { id?: string | number; name?: string | null } | null;
|
||||||
lens_apt?: { id?: string | number; name?: string | null } | null;
|
lens_apt?: { id?: string | number; name?: string | null } | string | number | null;
|
||||||
lens_exp?: { id?: string | number; name?: string | null } | null;
|
lens_exp?: { id?: string | number; name?: string | null } | string | number | null;
|
||||||
|
|
||||||
repeat_all?: number | null;
|
repeat_all?: number | null;
|
||||||
|
|
||||||
|
|
@ -74,6 +74,14 @@ export default function CO2GalvoDetail({ id, editable }: { id: string | number;
|
||||||
}
|
}
|
||||||
const yesNo = (v: any) => (v ? "Yes" : "No");
|
const yesNo = (v: any) => (v ? "Yes" : "No");
|
||||||
|
|
||||||
|
// 🔧 NEW: always stringify possibly-object options for display
|
||||||
|
const optLabel = (v: any): string => {
|
||||||
|
if (v == null) return "—";
|
||||||
|
if (typeof v === "string" || typeof v === "number") return String(v);
|
||||||
|
if (typeof v === "object") return v.name ?? (v.id != null ? String(v.id) : "—");
|
||||||
|
return "—";
|
||||||
|
};
|
||||||
|
|
||||||
// fetch me id
|
// fetch me id
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let alive = true;
|
let alive = true;
|
||||||
|
|
@ -233,7 +241,7 @@ export default function CO2GalvoDetail({ id, editable }: { id: string | number;
|
||||||
};
|
};
|
||||||
const DITHER_LABEL = (v: string | undefined) => (v ? v.charAt(0).toUpperCase() + v.slice(1) : "—");
|
const DITHER_LABEL = (v: string | undefined) => (v ? v.charAt(0).toUpperCase() + v.slice(1) : "—");
|
||||||
|
|
||||||
// ----- EDIT MODE (restore working behavior) -----
|
// ----- EDIT MODE -----
|
||||||
if (editMode && rec) {
|
if (editMode && rec) {
|
||||||
const toId = (v: any) =>
|
const toId = (v: any) =>
|
||||||
v == null ? "" : typeof v === "object" ? (v.id ?? v.submission_id ?? "") : String(v);
|
v == null ? "" : typeof v === "object" ? (v.id ?? v.submission_id ?? "") : String(v);
|
||||||
|
|
@ -345,8 +353,9 @@ export default function CO2GalvoDetail({ id, editable }: { id: string | number;
|
||||||
<Field label="Software" value={softName} />
|
<Field label="Software" value={softName} />
|
||||||
<Field label="Laser Source" value={sourceText || "—"} />
|
<Field label="Laser Source" value={sourceText || "—"} />
|
||||||
<Field label="Lens Configuration" value={rec.lens_conf?.name || "—"} />
|
<Field label="Lens Configuration" value={rec.lens_conf?.name || "—"} />
|
||||||
<Field label="Scan Head Aperture" value={rec.lens_apt?.name || rec.lens_apt || null} suffix="mm" />
|
{/* 🔧 patched to stringify */}
|
||||||
<Field label="Beam Expander" value={rec.lens_exp?.name || rec.lens_exp || null} suffix="x" />
|
<Field label="Scan Head Aperture" value={optLabel(rec.lens_apt)} suffix="mm" />
|
||||||
|
<Field label="Beam Expander" value={optLabel(rec.lens_exp)} suffix="x" />
|
||||||
<Field
|
<Field
|
||||||
label="Scan Lens"
|
label="Scan Lens"
|
||||||
value={
|
value={
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue