settings list fix for stable build
This commit is contained in:
parent
c630bfa665
commit
8069c6287b
7 changed files with 438 additions and 607 deletions
|
|
@ -16,6 +16,8 @@ export default function FiberSettingDetailPage() {
|
|||
const [claimErr, setClaimErr] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!id) return;
|
||||
|
||||
const url =
|
||||
`${process.env.NEXT_PUBLIC_API_BASE_URL}/items/settings_fiber/${id}` +
|
||||
`?fields=` +
|
||||
|
|
@ -23,15 +25,16 @@ export default function FiberSettingDetailPage() {
|
|||
"submission_id",
|
||||
"setting_title",
|
||||
"uploader",
|
||||
// Owner (M2O): prefer username
|
||||
"owner.id",
|
||||
"owner.first_name",
|
||||
"owner.last_name",
|
||||
"owner.email",
|
||||
"owner.username",
|
||||
// Content & assets
|
||||
"setting_notes",
|
||||
"photo.filename_disk",
|
||||
"photo.title",
|
||||
"screen.filename_disk",
|
||||
"screen.title",
|
||||
// Relations / denorms
|
||||
"mat.name",
|
||||
"mat_coat.name",
|
||||
"mat_color.name",
|
||||
|
|
@ -41,8 +44,9 @@ export default function FiberSettingDetailPage() {
|
|||
"source.model",
|
||||
"lens.field_size",
|
||||
"lens.focal_length",
|
||||
// laser_soft is a STRING field
|
||||
"laser_soft",
|
||||
"focus",
|
||||
"laser_soft.name",
|
||||
"repeat_all",
|
||||
"fill_settings",
|
||||
"line_settings",
|
||||
|
|
@ -62,11 +66,11 @@ export default function FiberSettingDetailPage() {
|
|||
if (loading) return <p className="p-6">Loading setting...</p>;
|
||||
if (!setting) return <p className="p-6">Setting not found.</p>;
|
||||
|
||||
// Prefer owner's username per schema
|
||||
const ownerName = (row: any) => {
|
||||
const o = row?.owner;
|
||||
if (!o) return null;
|
||||
const name = [o.first_name, o.last_name].filter(Boolean).join(" ").trim();
|
||||
return name || o.email || null;
|
||||
return o.username || null;
|
||||
};
|
||||
|
||||
const formatBoolean = (val: any) =>
|
||||
|
|
@ -103,7 +107,8 @@ export default function FiberSettingDetailPage() {
|
|||
};
|
||||
|
||||
const openSearchInNewTab = (value: string) => {
|
||||
const url = new URL("/fiber-settings", window.location.origin);
|
||||
if (!value || typeof window === "undefined") return;
|
||||
const url = new URL("/settings/fiber", window.location.origin);
|
||||
url.searchParams.set("query", value);
|
||||
const a = document.createElement("a");
|
||||
a.href = url.toString();
|
||||
|
|
@ -180,7 +185,7 @@ export default function FiberSettingDetailPage() {
|
|||
</div>
|
||||
|
||||
<a
|
||||
href="/fiber-settings"
|
||||
href="/settings/fiber"
|
||||
className="inline-block mt-2 px-4 py-2 bg-accent text-background rounded-md text-sm self-start"
|
||||
>
|
||||
← Back to Fiber Settings
|
||||
|
|
@ -243,8 +248,9 @@ export default function FiberSettingDetailPage() {
|
|||
{/* Setup */}
|
||||
<div className="card bg-card p-4">
|
||||
<h2 className="text-xl font-semibold mb-2">Setup</h2>
|
||||
{/* laser_soft is a string field */}
|
||||
<p>
|
||||
<strong>Software:</strong> {setting.laser_soft?.name || "—"}
|
||||
<strong>Software:</strong> {setting.laser_soft || "—"}
|
||||
</p>
|
||||
<p>
|
||||
<strong>Repeat All (global):</strong> {setting.repeat_all ?? "—"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue