Files
klz-cables.com/.pnpm-store/v10/files/2d/a1cb6015acc8be6927e1d0db7ae2474291325bfd232fa75d6869b6e1b04bbee0df0b257ddc2c2d10387c0b2bd56ac7ec8082561e8c635e6456f46ba9fa1adb
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

102 lines
2.9 KiB
Plaintext

'use client';
import { c as _c } from "react/compiler-runtime";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { getTranslation } from '@payloadcms/translations';
import React from 'react';
import { useConfig } from '../../../providers/Config/index.js';
import { useFolder } from '../../../providers/Folders/index.js';
import { useTranslation } from '../../../providers/Translation/index.js';
import { Button } from '../../Button/index.js';
import { CheckboxPopup } from '../../CheckboxPopup/index.js';
import './index.scss';
const baseClass = 'collection-type';
export function FilterFolderTypePill() {
const $ = _c(13);
const {
activeCollectionFolderSlugs: visibleCollectionSlugs,
allCollectionFolderSlugs: folderCollectionSlugs,
folderCollectionSlug,
refineFolderData
} = useFolder();
const {
i18n,
t
} = useTranslation();
const {
config,
getEntityConfig
} = useConfig();
let t0;
if ($[0] !== config || $[1] !== folderCollectionSlug || $[2] !== folderCollectionSlugs || $[3] !== getEntityConfig || $[4] !== i18n) {
t0 = () => config.collections.reduce((acc, collection) => {
if (collection.folders && folderCollectionSlugs.includes(collection.slug)) {
acc.push({
label: getTranslation(collection.labels?.plural, i18n),
value: collection.slug
});
}
return acc;
}, [{
label: getTranslation(getEntityConfig({
collectionSlug: folderCollectionSlug
}).labels?.plural, i18n),
value: folderCollectionSlug
}]);
$[0] = config;
$[1] = folderCollectionSlug;
$[2] = folderCollectionSlugs;
$[3] = getEntityConfig;
$[4] = i18n;
$[5] = t0;
} else {
t0 = $[5];
}
const [allCollectionOptions] = React.useState(t0);
let t1;
if ($[6] !== allCollectionOptions || $[7] !== refineFolderData || $[8] !== t || $[9] !== visibleCollectionSlugs) {
let t2;
if ($[11] !== refineFolderData) {
t2 = t3 => {
const {
selectedValues: relationTo
} = t3;
refineFolderData({
query: {
relationTo
},
updateURL: true
});
};
$[11] = refineFolderData;
$[12] = t2;
} else {
t2 = $[12];
}
t1 = _jsx(CheckboxPopup, {
Button: _jsxs(Button, {
buttonStyle: "pill",
el: "div",
icon: "chevron",
margin: false,
size: "small",
children: [visibleCollectionSlugs.length ? _jsx("span", {
className: `${baseClass}__count`,
children: visibleCollectionSlugs.length
}) : null, t("version:type")]
}),
onChange: t2,
options: allCollectionOptions,
selectedValues: visibleCollectionSlugs
}, "relation-to-selection-popup");
$[6] = allCollectionOptions;
$[7] = refineFolderData;
$[8] = t;
$[9] = visibleCollectionSlugs;
$[10] = t1;
} else {
t1 = $[10];
}
return t1;
}
//# sourceMappingURL=index.js.map