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

34 lines
911 B
Plaintext

'use client';
export const defaultLoadingOverlayState = {
isLoading: false,
loaders: [],
loadingText: '',
overlayType: null
};
export const reducer = (state, action) => {
const loadersCopy = [...state.loaders];
const {
type = 'fullscreen',
key = 'user',
loadingText
} = action.payload;
if (action.type === 'add') {
loadersCopy.push({
type,
key,
loadingText
});
} else if (action.type === 'remove') {
const index = loadersCopy.findIndex(item => item.key === key && item.type === type);
loadersCopy.splice(index, 1);
}
const nextLoader = loadersCopy?.length > 0 ? loadersCopy[loadersCopy.length - 1] : null;
return {
isLoading: Boolean(nextLoader),
loaders: loadersCopy,
loadingText: nextLoader?.loadingText || state?.loadingText,
overlayType: nextLoader?.type || state?.overlayType
};
};
//# sourceMappingURL=reducer.js.map