Files
klz-cables.com/.pnpm-store/v10/files/73/5f4e5417ab356e3851d7eab27a8aa33d6006c9f19ea2a1895098a1068d57bdc2d0f8c0ecbaf4b8eec31909619286fab0d724e722aeee58fe5a98dbee652974
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

33 lines
1.1 KiB
Plaintext

import { jsx as _jsx } from "react/jsx-runtime";
import { toWords } from 'payload/shared';
import React from 'react';
/** @todo: improve this */
const transformWhereToNaturalLanguage = where => {
if (where.or && where.or.length > 0 && where.or[0].and && where.or[0].and.length > 0) {
const orQuery = where.or[0];
const andQuery = orQuery?.and?.[0];
if (!andQuery || typeof andQuery !== 'object') {
return 'No where query';
}
const key = Object.keys(andQuery)[0];
if (!key || !andQuery[key] || typeof andQuery[key] !== 'object') {
return 'No where query';
}
const operator = Object.keys(andQuery[key])[0];
const value = andQuery[key][operator];
if (typeof value === 'string') {
return `${toWords(key)} ${operator} ${toWords(value)}`;
} else if (Array.isArray(value)) {
return `${toWords(key)} ${operator} ${value.map(val => toWords(val)).join(' or ')}`;
}
}
return '';
};
export const QueryPresetsWhereCell = ({
cellData
}) => {
return /*#__PURE__*/_jsx("div", {
children: cellData ? transformWhereToNaturalLanguage(cellData) : 'No where query'
});
};
//# sourceMappingURL=index.js.map