Files
klz-cables.com/.pnpm-store/v10/files/03/c69659376b31d6def8a4b5a7a90963263fb36f226259f0a42339c49584099e12f3f371a0ce2a11b1d9aea53efdcb380ccfdf28b39acb14903673666b29256e
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

68 lines
1.9 KiB
Plaintext

'use client';
import { c as _c } from "react/compiler-runtime";
import { jsx as _jsx } from "react/jsx-runtime";
import { getTranslation } from '@payloadcms/translations';
import React from 'react';
import { useConfig } from '../../../../../providers/Config/index.js';
import { useTranslation } from '../../../../../providers/Translation/index.js';
export const BlocksCell = t0 => {
const $ = _c(2);
const {
cellData,
field: t1
} = t0;
const {
blockReferences,
blocks,
labels
} = t1;
const {
i18n
} = useTranslation();
const {
config
} = useConfig();
const selectedBlocks = Array.isArray(cellData) ? cellData.map(_temp) : [];
const translatedBlockLabels = (blockReferences ?? blocks)?.map(b => {
const block = typeof b === "string" ? config.blocksMap[b] : b;
return {
slug: block.slug,
label: getTranslation(block.labels.singular, i18n)
};
});
let label = `0 ${getTranslation(labels?.plural, i18n)}`;
const formatBlockList = blocks_0 => blocks_0.map(b_0 => {
const filtered = translatedBlockLabels.filter(f => f.slug === b_0)?.[0];
return filtered?.label;
}).join(", ");
if (selectedBlocks.length > 5) {
const more = selectedBlocks.length - 5;
label = `${selectedBlocks.length} ${getTranslation(labels?.plural, i18n)} - ${i18n.t("fields:itemsAndMore", {
count: more,
items: formatBlockList(selectedBlocks.slice(0, 5))
})}`;
} else {
if (selectedBlocks.length > 0) {
label = `${selectedBlocks.length} ${getTranslation(selectedBlocks.length === 1 ? labels?.singular : labels?.plural, i18n)} - ${formatBlockList(selectedBlocks)}`;
}
}
let t2;
if ($[0] !== label) {
t2 = _jsx("span", {
children: label
});
$[0] = label;
$[1] = t2;
} else {
t2 = $[1];
}
return t2;
};
function _temp(t0) {
const {
blockType
} = t0;
return blockType;
}
//# sourceMappingURL=index.js.map