diff --git a/components/details/CO2GalvoDetail.tsx b/components/details/CO2GalvoDetail.tsx
index 976542fa..8be8f18a 100644
--- a/components/details/CO2GalvoDetail.tsx
+++ b/components/details/CO2GalvoDetail.tsx
@@ -3,7 +3,6 @@
import { useEffect, useMemo, useState } from "react";
import { useSearchParams, useRouter } from "next/navigation";
-import Link from "next/link";
import SettingsSubmit from "@/components/forms/SettingsSubmit";
type Rec = {
@@ -14,25 +13,15 @@ type Rec = {
photo?: { id?: string } | string | null;
screen?: { id?: string } | string | null;
+ // ids & readable fields
mat?: { id?: string | number; name?: string | null } | null;
mat_coat?: { id?: string | number; name?: string | null } | null;
mat_color?: { id?: string | number; name?: string | null } | null;
mat_opacity?: { id?: string | number; opacity?: string | number | null } | null;
mat_thickness?: number | null;
- source?: {
- submission_id?: string | number;
- make?: string | null;
- model?: string | null;
- nm?: string | null;
- } | null;
-
- lens?: {
- id?: string | number;
- field_size?: string | number | null;
- focal_length?: string | number | null;
- } | null;
-
+ source?: { submission_id?: string | number; make?: string | null; model?: string | null; nm?: string | null } | null;
+ lens?: { id?: string | number; field_size?: string | number | null; focal_length?: string | number | null } | null;
focus?: number | null;
laser_soft?: any;
@@ -50,11 +39,7 @@ type Rec = {
async function readJson(res: Response) {
const text = await res.text();
- try {
- return text ? JSON.parse(text) : null;
- } catch {
- throw new Error(`Unexpected response (HTTP ${res.status})`);
- }
+ try { return text ? JSON.parse(text) : null; } catch { throw new Error(`Unexpected response (HTTP ${res.status})`); }
}
function ownerLabel(o: Rec["owner"]) {
@@ -63,40 +48,29 @@ function ownerLabel(o: Rec["owner"]) {
return o.username || String(o.id ?? "—");
}
-// Public Directus base for sources
-const API_BASE = (process.env.NEXT_PUBLIC_API_BASE_URL || "").replace(/\/$/, "");
+function isMine(owner: Rec["owner"], meId: string | null) {
+ if (!meId || !owner) return false;
+ if (typeof owner === "string" || typeof owner === "number") return String(owner) === meId;
+ return owner.id != null && String(owner.id) === meId;
+}
+
function fileUrl(id?: string) {
- if (!id) return "";
- return API_BASE ? `${API_BASE}/assets/${id}` : `/api/dx/assets/${id}`;
+ return id ? `/api/dx/assets/${id}` : "";
}
-function ZoomableSquareImage(props: { src: string; alt: string; onOpen: () => void }) {
- const { src, alt, onOpen } = props;
- return (
-
Loading setting…
; - if (err) - return ( -Setting not found.
; // EDIT @@ -254,87 +220,46 @@ export default function CO2GalvoDetail(props: {