laser-settings Client fix

This commit is contained in:
makearmy 2025-10-03 19:05:32 -04:00
parent 4ae1a50a77
commit 4eeb46fe21

View file

@ -1,3 +1,4 @@
// app/portal/laser-settings/Client.tsx
"use client";
import dynamic from "next/dynamic";
@ -23,19 +24,17 @@ export default function LaserSettingsClient() {
const search = useSearchParams();
const t = (search.get("t") || "fiber").toLowerCase();
const id = search.get("id");
const view = (search.get("view") || "list").toLowerCase();
// map tab -> canonical detail route
// Only use legacy detail pages for tabs we haven't migrated yet.
// CO₂ Galvo renders its detail INSIDE the panel, so never iFrame it here.
const detailSrc =
!id
? null
: t === "fiber"
id && view === "detail" && (t === "fiber" || t === "uv" || t === "co2-gantry")
? t === "fiber"
? `/settings/fiber/${id}`
: t === "uv"
? `/settings/uv/${id}`
: t === "co2-galvo"
? `/settings/co2-galvo/${id}`
: t === "co2-gantry"
? `/settings/co2-gantry/${id}`
: `/settings/co2-gantry/${id}`
: null;
return (
@ -45,6 +44,7 @@ export default function LaserSettingsClient() {
<SettingsSwitcher />
</div>
{/* Only show legacy iframe for non-CO₂ Galvo tabs, and only when explicitly in detail view */}
{detailSrc && (
<div className="rounded-lg border p-4">
<div className="mb-2 text-sm opacity-70">