co2-galvo owner testing
This commit is contained in:
parent
ffccff85d4
commit
a100fefc77
2 changed files with 94 additions and 371 deletions
|
|
@ -22,10 +22,13 @@ export default function CO2GalvoSettingDetailPage() {
|
|||
"setting_title",
|
||||
"uploader",
|
||||
|
||||
// 👇 include parent + requested subfields
|
||||
// include parent + subfields to survive restricted expansion
|
||||
"owner",
|
||||
"owner.id",
|
||||
"owner.username",
|
||||
"owner.first_name",
|
||||
"owner.last_name",
|
||||
"owner.email",
|
||||
|
||||
"setting_notes",
|
||||
"photo.filename_disk",
|
||||
|
|
@ -62,15 +65,19 @@ export default function CO2GalvoSettingDetailPage() {
|
|||
setLoading(true);
|
||||
fetch(url, { cache: "no-store", credentials: "include" })
|
||||
.then(async (res) => {
|
||||
const txt = await res.text();
|
||||
let j: any = null;
|
||||
try {
|
||||
j = txt ? JSON.parse(txt) : null;
|
||||
} catch {}
|
||||
if (!res.ok) {
|
||||
const j = await res.json().catch(() => ({}));
|
||||
throw new Error(j?.errors?.[0]?.message || `HTTP ${res.status}`);
|
||||
throw new Error(j?.errors?.[0]?.message || j?.message || `HTTP ${res.status}`);
|
||||
}
|
||||
return res.json();
|
||||
return j;
|
||||
})
|
||||
.then((json) => setSetting(json?.data ?? null))
|
||||
.catch((e) => {
|
||||
console.error("co2-galvo fetch failed:", e);
|
||||
console.error("CO2 Galvo detail fetch failed:", e);
|
||||
setSetting(null);
|
||||
})
|
||||
.finally(() => setLoading(false));
|
||||
|
|
@ -79,10 +86,14 @@ export default function CO2GalvoSettingDetailPage() {
|
|||
if (loading) return <p className="p-6">Loading setting...</p>;
|
||||
if (!setting) return <p className="p-6">Setting not found.</p>;
|
||||
|
||||
// ---- display helpers ----
|
||||
// Owner label: username → name → email → id → —
|
||||
const ownerDisplay: string =
|
||||
typeof setting?.owner === "object"
|
||||
? (setting.owner?.username ?? setting.owner?.id ?? "—")
|
||||
? (setting.owner?.username
|
||||
|| [setting.owner?.first_name, setting.owner?.last_name].filter(Boolean).join(" ").trim()
|
||||
|| setting.owner?.email
|
||||
|| setting.owner?.id
|
||||
|| "—")
|
||||
: typeof setting?.owner === "string"
|
||||
? setting.owner
|
||||
: "—";
|
||||
|
|
@ -95,45 +106,6 @@ export default function CO2GalvoSettingDetailPage() {
|
|||
const formatBoolean = (val: any) =>
|
||||
val ? "Enabled" : val === false ? "Disabled" : "—";
|
||||
|
||||
const renderRepeaterCard = (title: string, fields: any[], items: any[]) => {
|
||||
const filtered = (items || []).filter((item) =>
|
||||
Object.values(item).some((v) => v !== null && v !== "")
|
||||
);
|
||||
if (filtered.length === 0) return null;
|
||||
return (
|
||||
<div className="mt-6">
|
||||
<h2 className="text-2xl font-semibold mb-2">{title}</h2>
|
||||
<div className="grid gap-4 grid-cols-1 md:grid-cols-2">
|
||||
{filtered.map((item, i) => (
|
||||
<div key={i} className="border border-border rounded-lg p-4 bg-card">
|
||||
{fields.map(({ key, label, condition }: any) => {
|
||||
const value = item[key];
|
||||
if (condition && !condition(item)) return null;
|
||||
return (
|
||||
<p key={key} className="text-sm">
|
||||
<strong>{label}:</strong>{" "}
|
||||
{typeof value === "boolean" ? formatBoolean(value) : value ?? "—"}
|
||||
</p>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const openSearchInNewTab = (value: string) => {
|
||||
if (!value || typeof window === "undefined") return;
|
||||
const url = new URL("/settings/co2-galvo", window.location.origin);
|
||||
url.searchParams.set("query", value);
|
||||
const a = document.createElement("a");
|
||||
a.href = url.toString();
|
||||
a.target = "_blank";
|
||||
a.rel = "noopener noreferrer";
|
||||
a.click();
|
||||
};
|
||||
|
||||
const onClaim = async () => {
|
||||
setClaimBusy(true);
|
||||
setClaimErr(null);
|
||||
|
|
@ -142,21 +114,17 @@ export default function CO2GalvoSettingDetailPage() {
|
|||
const r = await fetch("/api/claims", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "include",
|
||||
body: JSON.stringify({
|
||||
target_collection: "settings_co2gal",
|
||||
target_id: id,
|
||||
target_id: setting.submission_id,
|
||||
}),
|
||||
cache: "no-store",
|
||||
});
|
||||
const data = await r.json().catch(() => ({}));
|
||||
if (!r.ok) {
|
||||
throw new Error(
|
||||
data?.error || data?.errors?.[0]?.message || "Failed to submit claim"
|
||||
);
|
||||
}
|
||||
setClaimMsg("Claim request submitted for review.");
|
||||
const j = await r.json().catch(() => ({}));
|
||||
if (!r.ok) throw new Error(j?.error || j?.message || `HTTP ${r.status}`);
|
||||
setClaimMsg("Claim request submitted. We'll update the owner shortly.");
|
||||
} catch (e: any) {
|
||||
setClaimErr(e?.message || "Failed to submit claim");
|
||||
setClaimErr(e?.message || "Failed to submit claim.");
|
||||
} finally {
|
||||
setClaimBusy(false);
|
||||
}
|
||||
|
|
@ -175,7 +143,6 @@ export default function CO2GalvoSettingDetailPage() {
|
|||
{JSON.stringify({ owner: setting?.owner }, null, 2)}
|
||||
</pre>
|
||||
|
||||
|
||||
<div className="space-y-1 text-sm text-muted-foreground mb-3">
|
||||
<p><strong>Owner:</strong> <span>{ownerDisplay}</span></p>
|
||||
<p><strong>Uploader:</strong> {setting.uploader || "—"}</p>
|
||||
|
|
@ -190,205 +157,16 @@ export default function CO2GalvoSettingDetailPage() {
|
|||
>
|
||||
{claimBusy ? "Submitting…" : "Claim this setting"}
|
||||
</button>
|
||||
{claimMsg && <span className="text-green-500 text-sm">{claimMsg}</span>}
|
||||
{claimErr && <span className="text-red-500 text-sm">{claimErr}</span>}
|
||||
{claimErr && <span className="text-red-600 text-sm">{claimErr}</span>}
|
||||
{claimMsg && <span className="text-green-600 text-sm">{claimMsg}</span>}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<a
|
||||
href="/settings/co2-galvo"
|
||||
className="inline-block mt-2 px-4 py-2 bg-accent text-background rounded-md text-sm self-start"
|
||||
>
|
||||
← Back to CO₂ Galvo Settings
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{/* Result Photo + Material */}
|
||||
<div className="card bg-card p-4 grid grid-cols-1 md:grid-cols-2 gap-4 items-start">
|
||||
<div className="flex justify-center">
|
||||
{setting.photo?.filename_disk && (
|
||||
<a
|
||||
href={`https://forms.lasereverything.net/assets/${setting.photo.filename_disk}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
src={`https://forms.lasereverything.net/assets/${setting.photo.filename_disk}`}
|
||||
alt={setting.photo?.title || "Laser preview"}
|
||||
width={250}
|
||||
height={250}
|
||||
className="rounded object-contain max-w-[250px] max-h-[250px]"
|
||||
/>
|
||||
</a>
|
||||
)}
|
||||
{/* ... rest of your panels ... */}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold mb-2">Material</h2>
|
||||
<p>
|
||||
<strong>Material:</strong>{" "}
|
||||
<span
|
||||
className="cursor-pointer underline hover:text-accent"
|
||||
onClick={() => openSearchInNewTab(setting.mat?.name)}
|
||||
>
|
||||
{setting.mat?.name || "—"}
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Coating:</strong>{" "}
|
||||
<span
|
||||
className="cursor-pointer underline hover:text-accent"
|
||||
onClick={() => openSearchInNewTab(setting.mat_coat?.name)}
|
||||
>
|
||||
{setting.mat_coat?.name || "—"}
|
||||
</span>
|
||||
</p>
|
||||
<p><strong>Color:</strong> {setting.mat_color?.name || "—"}</p>
|
||||
<p><strong>Opacity:</strong> {setting.mat_opacity?.opacity || "—"}</p>
|
||||
<p>
|
||||
<strong>Thickness:</strong>{" "}
|
||||
{setting.mat_thickness ? `${setting.mat_thickness} mm` : "Not Applicable"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Setup */}
|
||||
<div className="card bg-card p-4">
|
||||
<h2 className="text-xl font-semibold mb-2">Setup</h2>
|
||||
<p><strong>Software:</strong> {softwareLabel}</p>
|
||||
<p><strong>Repeat All (global):</strong> {setting.repeat_all ?? "—"}</p>
|
||||
<p className="mt-4"><strong>Focus:</strong> {setting.focus ?? "—"} mm</p>
|
||||
<small>-Values Focus Closer | +Values Focus Further</small>
|
||||
</div>
|
||||
|
||||
{/* Laser */}
|
||||
<div className="card bg-card p-4">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 items-start">
|
||||
<div className="flex justify-center">
|
||||
{setting.screen?.filename_disk ? (
|
||||
<a
|
||||
href={`https://forms.lasereverything.net/assets/${setting.screen.filename_disk}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title={setting.screen?.title || "Screenshot"}
|
||||
>
|
||||
<Image
|
||||
src={`https://forms.lasereverything.net/assets/${setting.screen.filename_disk}`}
|
||||
alt={setting.screen?.title || "Screenshot"}
|
||||
width={250}
|
||||
height={250}
|
||||
className="rounded object-contain max-w-[250px] max-h-[250px]"
|
||||
/>
|
||||
</a>
|
||||
) : (
|
||||
<div className="text-sm text-muted-foreground">No screenshot</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold mb-2">Laser</h2>
|
||||
<p><strong>Source Make:</strong> {setting.source?.make || "—"}</p>
|
||||
<p>
|
||||
<strong>Source Model:</strong>{" "}
|
||||
<span
|
||||
className="cursor-pointer underline hover:text-accent"
|
||||
onClick={() => openSearchInNewTab(setting.source?.model)}
|
||||
>
|
||||
{setting.source?.model || "—"}
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Lens:</strong>{" "}
|
||||
<span
|
||||
className="cursor-pointer underline hover:text-accent"
|
||||
onClick={() => openSearchInNewTab(setting.lens?.field_size)}
|
||||
>
|
||||
{setting.lens?.field_size || "—"}
|
||||
</span>{" "}
|
||||
mm | {setting.lens?.focal_length || "—"}
|
||||
</p>
|
||||
<p><strong>Lens Config:</strong> {setting.lens_conf?.name || "—"}</p>
|
||||
<p><strong>Aperture Type:</strong> {setting.lens_apt?.name || "—"}</p>
|
||||
<p><strong>Expansion Type:</strong> {setting.lens_exp?.name || "—"}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Notes */}
|
||||
{setting.setting_notes && (
|
||||
<div className="prose dark:prose-invert mt-6">
|
||||
<h2>Notes</h2>
|
||||
<Markdown>{setting.setting_notes}</Markdown>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<hr className="my-6 border-muted" />
|
||||
|
||||
{/* Repeaters */}
|
||||
{renderRepeaterCard(
|
||||
"Fill Settings",
|
||||
[
|
||||
{ key: "fill_name", label: "Fill Name" },
|
||||
{ key: "power", label: "Power (%)" },
|
||||
{ key: "speed", label: "Speed (mm/s)" },
|
||||
{ key: "frequency", label: "Frequency (kHz)" },
|
||||
{ key: "pulse", label: "Pulse Width (ns)" },
|
||||
{ key: "interval", label: "Interval (mm)" },
|
||||
{ key: "pass", label: "Passes" },
|
||||
{ key: "type", label: "Type" },
|
||||
{ key: "angle", label: "Angle (°)" },
|
||||
{ key: "auto", label: "Auto-Rotate" },
|
||||
{ key: "increment", label: "Increment (°)", condition: (e: any) => e.auto },
|
||||
{ key: "cross", label: "Crosshatch" },
|
||||
{ key: "flood", label: "Flood Fill" },
|
||||
{ key: "air", label: "Air Assist" },
|
||||
],
|
||||
setting.fill_settings
|
||||
)}
|
||||
|
||||
{renderRepeaterCard(
|
||||
"Line Settings",
|
||||
[
|
||||
{ key: "name", label: "Line Name" },
|
||||
{ key: "power", label: "Power (%)" },
|
||||
{ key: "speed", label: "Speed (mm/s)" },
|
||||
{ key: "frequency", label: "Frequency (kHz)" },
|
||||
{ key: "pulse", label: "Pulse Width (ns)" },
|
||||
{ key: "perf", label: "Perforation Mode" },
|
||||
{ key: "cut", label: "Cut (mm)", condition: (e: any) => e.perf },
|
||||
{ key: "skip", label: "Skip (mm)", condition: (e: any) => e.perf },
|
||||
{ key: "wobble", label: "Wobble Mode" },
|
||||
{ key: "step", label: "Step (mm)", condition: (e: any) => e.wobble },
|
||||
{ key: "size", label: "Size (mm)", condition: (e: any) => e.wobble },
|
||||
{ key: "pass", label: "Passes" },
|
||||
{ key: "air", label: "Air Assist" },
|
||||
],
|
||||
setting.line_settings
|
||||
)}
|
||||
|
||||
{renderRepeaterCard(
|
||||
"Raster Settings",
|
||||
[
|
||||
{ key: "name", label: "Raster Name" },
|
||||
{ key: "power", label: "Power (%)" },
|
||||
{ key: "speed", label: "Speed (mm/s)" },
|
||||
{ key: "frequency", label: "Frequency (kHz)" },
|
||||
{ key: "pulse", label: "Pulse Width (ns)" },
|
||||
{ key: "type", label: "Type" },
|
||||
{ key: "dither", label: "Dither" },
|
||||
{ key: "halftone_cell", label: "Cell Size (mm)", condition: (e: any) => e.dither === "halftone" },
|
||||
{ key: "halftone_angle", label: "Halftone Angle", condition: (e: any) => e.dither === "halftone" },
|
||||
{ key: "inversion", label: "Image Inverted" },
|
||||
{ key: "interval", label: "Interval (mm)" },
|
||||
{ key: "dot", label: "Dot-width Adjustment (mm)" },
|
||||
{ key: "pass", label: "Passes" },
|
||||
{ key: "cross", label: "Crosshatch" },
|
||||
{ key: "air", label: "Air Assist" },
|
||||
],
|
||||
setting.raster_settings
|
||||
)}
|
||||
{/* ... rest of the component ... */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,20 @@ export default function CO2GalvoSettingsPage() {
|
|||
}, [query]);
|
||||
|
||||
useEffect(() => {
|
||||
// ✅ use the auth proxy + include cookie so expansions (owner.*) work
|
||||
// Use the auth proxy and request BOTH the parent field and subfields.
|
||||
// This guarantees you get a raw id when expansion is restricted.
|
||||
const fields = [
|
||||
"submission_id",
|
||||
"setting_title",
|
||||
"uploader",
|
||||
// owner (m2o -> directus_users)
|
||||
"owner",
|
||||
"owner.id",
|
||||
"owner.username",
|
||||
"owner.first_name",
|
||||
"owner.last_name",
|
||||
"owner.email",
|
||||
// assets / denorms
|
||||
"photo.id",
|
||||
"photo.title",
|
||||
"mat.name",
|
||||
|
|
@ -66,9 +73,17 @@ export default function CO2GalvoSettingsPage() {
|
|||
.finally(() => setLoading(false));
|
||||
}, []);
|
||||
|
||||
// robust owner label
|
||||
const ownerLabel = (o?: Owner) =>
|
||||
(o && (o.username || String(o.id || ""))) || "—";
|
||||
// Robust owner label: object → username | name | email | id; primitive → id; missing → —
|
||||
const ownerLabel = (o?: any) => {
|
||||
if (!o) return "—";
|
||||
if (typeof o === "string" || typeof o === "number") return String(o);
|
||||
return (
|
||||
o.username ||
|
||||
[o.first_name, o.last_name].filter(Boolean).join(" ").trim() ||
|
||||
o.email ||
|
||||
String(o.id || "—")
|
||||
);
|
||||
};
|
||||
|
||||
const highlight = (text?: string) => {
|
||||
if (!debouncedQuery) return text || "";
|
||||
|
|
@ -101,143 +116,79 @@ export default function CO2GalvoSettingsPage() {
|
|||
|
||||
const lensCounts = settings.reduce((acc: Record<string, number>, cur) => {
|
||||
const v = cur.lens?.field_size;
|
||||
if (!v) return acc;
|
||||
acc[v] = (acc[v] || 0) + 1;
|
||||
if (v) acc[v] = (acc[v] || 0) + 1;
|
||||
return acc;
|
||||
}, {});
|
||||
const mostCommonLens =
|
||||
Object.entries(lensCounts).sort(
|
||||
(a, b) => (Number(b[1]) || 0) - (Number(a[1]) || 0)
|
||||
)[0]?.[0] || "—";
|
||||
|
||||
const srcCounts = settings.reduce((acc: Record<string, number>, cur) => {
|
||||
const v = cur.source?.model;
|
||||
if (!v) return acc;
|
||||
acc[v] = (acc[v] || 0) + 1;
|
||||
return acc;
|
||||
}, {});
|
||||
const mostCommonSource =
|
||||
Object.entries(srcCounts).sort(
|
||||
(a, b) => (Number(b[1]) || 0) - (Number(a[1]) || 0)
|
||||
)[0]?.[0] || "—";
|
||||
|
||||
const recent = [...settings]
|
||||
.sort((a, b) => Number(b.submission_id) - Number(a.submission_id))
|
||||
.slice(0, 5);
|
||||
|
||||
return (
|
||||
<div className="p-6 max-w-7xl mx-auto">
|
||||
<style jsx global>{`
|
||||
mark {
|
||||
background: #ffde59;
|
||||
color: #242424;
|
||||
padding: 0 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
`}</style>
|
||||
<div className="container mx-auto p-4">
|
||||
<div className="mb-6">
|
||||
<h1 className="text-2xl font-bold">CO₂ Galvo Settings</h1>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Browse community CO₂ galvo settings. Use search to narrow results.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Header / Search */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 mb-6">
|
||||
<div className="card bg-card text-card-foreground p-4">
|
||||
<h1 className="text-2xl font-bold mb-2">CO₂ Galvo Settings</h1>
|
||||
<input
|
||||
type="search"
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder="Search by material, owner, uploader, model, lens…"
|
||||
className="w-full mb-4 dark:bg-background border border-border rounded-md p-2"
|
||||
/>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
View and explore detailed CO₂ galvo settings with context.
|
||||
</p>
|
||||
</div>
|
||||
{/* search box */}
|
||||
<div className="mb-4">
|
||||
<input
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.currentTarget.value)}
|
||||
placeholder="Search by title, owner, material, model…"
|
||||
className="w-full max-w-lg border rounded px-3 py-2"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* How to use */}
|
||||
<div className="card bg-card text-card-foreground p-4">
|
||||
<h2 className="text-lg font-semibold mb-2">How to Use</h2>
|
||||
<p className="text-sm">
|
||||
Browse community CO₂ galvo settings. Use search to narrow results.
|
||||
Click a row to view full configuration, notes, and photos.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Stats */}
|
||||
<div className="card bg-card text-card-foreground p-4">
|
||||
<h2 className="text-lg font-semibold mb-2">Stats Summary</h2>
|
||||
<ul className="text-sm space-y-1">
|
||||
<li>Total Settings: {total}</li>
|
||||
<li>Unique Materials: {uniqueMaterials}</li>
|
||||
<li>Most Common Lens: {mostCommonLens}</li>
|
||||
<li>Most Used Source: {mostCommonSource}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{/* Recently Added */}
|
||||
<div className="card bg-card text-card-foreground p-4 xl:col-span-3">
|
||||
<h2 className="text-lg font-semibold mb-2">Recently Added</h2>
|
||||
<ul className="text-sm space-y-1">
|
||||
{recent.map((s) => (
|
||||
<li key={s.submission_id}>
|
||||
<Link
|
||||
href={detailHref(s.submission_id)}
|
||||
className="underline text-accent"
|
||||
>
|
||||
{s.setting_title || "Untitled"}
|
||||
</Link>{" "}
|
||||
<span className="text-muted-foreground">
|
||||
by {ownerLabel(s.owner)}
|
||||
{s.uploader ? ` (uploader: ${s.uploader})` : ""}
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
{/* stats */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
|
||||
<div className="card bg-card text-card-foreground p-4">
|
||||
<h2 className="text-lg font-semibold mb-2">How to Use</h2>
|
||||
<p className="text-sm">
|
||||
Click a row to view full configuration, notes, and photos.
|
||||
</p>
|
||||
</div>
|
||||
<div className="card bg-card text-card-foreground p-4">
|
||||
<h2 className="text-lg font-semibold mb-2">Stats Summary</h2>
|
||||
<ul className="text-sm space-y-1">
|
||||
<li>Total Settings: {total}</li>
|
||||
<li>Unique Materials: {uniqueMaterials}</li>
|
||||
<li>
|
||||
Lens Fields:{" "}
|
||||
{Object.entries(lensCounts)
|
||||
.map(([k, v]) => `${k} (${v})`)
|
||||
.join(", ") || "—"}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Table */}
|
||||
{/* table */}
|
||||
{loading ? (
|
||||
<p className="text-muted">Loading settings...</p>
|
||||
) : filtered.length === 0 ? (
|
||||
<p className="text-muted">No CO₂ galvo settings found.</p>
|
||||
<p>Loading…</p>
|
||||
) : (
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-sm">
|
||||
<table className="min-w-full text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="px-2 py-2 text-left">Photo</th>
|
||||
<tr className="bg-muted">
|
||||
<th className="px-2 py-2 text-left">Title</th>
|
||||
<th className="px-2 py-2 text-left">Owner</th>
|
||||
<th className="px-2 py-2 text-left">Uploader</th>
|
||||
<th className="px-2 py-2 text-left">Material</th>
|
||||
<th className="px-2 py-2 text-left">Coating</th>
|
||||
<th className="px-2 py-2 text-left">Source</th>
|
||||
<th className="px-2 py-2 text-left">Lens</th>
|
||||
<th className="px-2 py-2 text-left">Model</th>
|
||||
<th className="px-2 py-2 text-left">Field</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{filtered.map((s) => (
|
||||
<tr key={s.submission_id} className="border-t border-border">
|
||||
<td className="px-2 py-2">
|
||||
{s.photo?.id ? (
|
||||
<Image
|
||||
src={`https://forms.lasereverything.net/assets/${s.photo.id}`}
|
||||
alt={s.photo.title || "laser preview"}
|
||||
width={64}
|
||||
height={64}
|
||||
className="rounded-md"
|
||||
/>
|
||||
) : (
|
||||
"—"
|
||||
)}
|
||||
</td>
|
||||
<tr key={s.submission_id} className="border-b hover:bg-muted/30">
|
||||
<td className="px-2 py-2 whitespace-nowrap">
|
||||
<Link
|
||||
href={detailHref(s.submission_id)}
|
||||
className="text-accent underline"
|
||||
<Link href={detailHref(s.submission_id)} className="underline">
|
||||
<span
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: highlight(s.setting_title || "—"),
|
||||
__html: highlight(s.setting_title || "Untitled"),
|
||||
}}
|
||||
/>
|
||||
</Link>
|
||||
</td>
|
||||
<td
|
||||
className="px-2 py-2 whitespace-nowrap"
|
||||
|
|
@ -247,12 +198,6 @@ export default function CO2GalvoSettingsPage() {
|
|||
/>
|
||||
<td
|
||||
className="px-2 py-2 whitespace-nowrap"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: highlight(s.uploader || "—"),
|
||||
}}
|
||||
/>
|
||||
<td
|
||||
className="px-2 py-2 whitespace-nowrap"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: highlight(s.mat?.name || "—"),
|
||||
}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue