Files
klz-cables.com/.pnpm-store/v10/files/ab/c2b02ee4a2ff01fe07381fd2be8e63543819eb16e0d37df77c6e53ed4e72b1d76cef97f3fafd6d00e8eda48941fbe3590b8d28b6b5f2204198ad8cdd9192bf
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

73 lines
1.9 KiB
Plaintext

'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import { getBestFitFromSizes, isImage } from 'payload/shared';
import React from 'react';
import './index.scss';
import { RelationshipContent } from '../RelationshipContent/index.js';
import { UploadCard } from '../UploadCard/index.js';
const baseClass = 'upload upload--has-one';
export function UploadComponentHasOne(props) {
const {
className,
displayPreview,
fileDoc,
onRemove,
readonly,
reloadDoc,
serverURL,
showCollectionSlug = false
} = props;
const {
relationTo,
value
} = fileDoc;
const id = String(value?.id);
let src;
let thumbnailSrc;
if (value.url) {
try {
src = new URL(value.url, serverURL).toString();
} catch {
src = `${serverURL}${value.url}`;
}
}
if (value.thumbnailURL) {
try {
thumbnailSrc = new URL(value.thumbnailURL, serverURL).toString();
} catch {
thumbnailSrc = `${serverURL}${value.thumbnailURL}`;
}
}
if (isImage(value.mimeType)) {
thumbnailSrc = getBestFitFromSizes({
sizes: value.sizes,
thumbnailURL: thumbnailSrc,
url: src,
width: value.width
});
}
return /*#__PURE__*/_jsx(UploadCard, {
className: [baseClass, className].filter(Boolean).join(' '),
children: /*#__PURE__*/_jsx(RelationshipContent, {
allowEdit: !readonly,
allowRemove: !readonly,
alt: value?.alt || value?.filename,
byteSize: value.filesize,
collectionSlug: relationTo,
displayPreview: displayPreview,
filename: value.filename,
id: id,
mimeType: value?.mimeType,
onRemove: onRemove,
reloadDoc: reloadDoc,
showCollectionSlug: showCollectionSlug,
src: src,
thumbnailSrc: thumbnailSrc,
updatedAt: value.updatedAt,
x: value?.width,
y: value?.height
})
});
}
//# sourceMappingURL=index.js.map