@vonaffenfels/contentful-teasermanager 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonaffenfels/contentful-teasermanager",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepublish": "yarn run build",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"contentful-resolve-response": "^1.9.2",
|
|
102
102
|
"webpack": "5.88.2"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "89b263e6c6a0b3a1bb39eeb63abf8a8c00207416",
|
|
105
105
|
"publishConfig": {
|
|
106
106
|
"access": "public"
|
|
107
107
|
}
|
|
@@ -125,7 +125,7 @@ const LogicEditorInner = ({
|
|
|
125
125
|
return [];
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
const references = await sdk.cma.entry.references({entryId: response.items[0].sys.id}, {include:
|
|
128
|
+
const references = await sdk.cma.entry.references({entryId: response.items[0].sys.id}, {include: 10});
|
|
129
129
|
const resolved = contentfulResolveResponse(references);
|
|
130
130
|
const allCategories = {};
|
|
131
131
|
|
|
@@ -141,7 +141,7 @@ const LogicEditorInner = ({
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
return Object.values(allCategories);
|
|
144
|
+
return Object.values(allCategories).filter((c) => c.tags.length > 0);
|
|
145
145
|
}),
|
|
146
146
|
]).then(([tags, categories]) => {
|
|
147
147
|
setLoading(false);
|
|
@@ -266,16 +266,11 @@ const LogicEditorInner = ({
|
|
|
266
266
|
return (
|
|
267
267
|
<Checkbox
|
|
268
268
|
key={category.id}
|
|
269
|
-
isChecked={selectedTags.some((t) => category.tags.some((c) => c.id === t.id)
|
|
269
|
+
isChecked={selectedTags.some((t) => category.tags.some((c) => c.id === t.id))}
|
|
270
270
|
onChange={(e) => {
|
|
271
271
|
let newTags = [...selectedTags];
|
|
272
272
|
|
|
273
273
|
if (e.target.checked) {
|
|
274
|
-
newTags.push({
|
|
275
|
-
label: category.title,
|
|
276
|
-
id: category.id,
|
|
277
|
-
type: "or",
|
|
278
|
-
});
|
|
279
274
|
for (const tag of category.tags) {
|
|
280
275
|
if (!selectedTags.find((t) => t.id === tag.id)) {
|
|
281
276
|
newTags.push({
|
|
@@ -286,8 +281,6 @@ const LogicEditorInner = ({
|
|
|
286
281
|
}
|
|
287
282
|
}
|
|
288
283
|
} else {
|
|
289
|
-
newTags = newTags.filter((t) => t.id !== category.id);
|
|
290
|
-
|
|
291
284
|
for (const tag of category.tags) {
|
|
292
285
|
newTags = newTags.filter((t) => t.id !== tag.id);
|
|
293
286
|
}
|
|
@@ -297,7 +290,7 @@ const LogicEditorInner = ({
|
|
|
297
290
|
}}
|
|
298
291
|
>
|
|
299
292
|
{category.title} ({selectedTags.filter((t) =>
|
|
300
|
-
category.tags.some((c) => c.id === t.id)
|
|
293
|
+
category.tags.some((c) => c.id === t.id)).length}/{category.tags.length})
|
|
301
294
|
</Checkbox>
|
|
302
295
|
);
|
|
303
296
|
})}
|
|
@@ -351,15 +344,16 @@ const LogicEditorInner = ({
|
|
|
351
344
|
</div>;
|
|
352
345
|
};
|
|
353
346
|
|
|
354
|
-
function getAllTagsFromCategory(categoryNode, allCategories = {}) {
|
|
347
|
+
function getAllTagsFromCategory(categoryNode, allCategories = {}, parentCategoryTitle = null) {
|
|
355
348
|
if (!categoryNode || !categoryNode.fields?.children) {
|
|
356
349
|
return allCategories;
|
|
357
350
|
}
|
|
358
351
|
|
|
359
352
|
const children = categoryNode.fields.children.de || [];
|
|
353
|
+
const title = parentCategoryTitle ? `${parentCategoryTitle} > ${categoryNode.fields.title.de}` : categoryNode.fields.title.de;
|
|
360
354
|
|
|
361
355
|
allCategories[categoryNode.sys.id] = {
|
|
362
|
-
title
|
|
356
|
+
title,
|
|
363
357
|
tags: [],
|
|
364
358
|
id: categoryNode.sys.id,
|
|
365
359
|
};
|
|
@@ -399,7 +393,7 @@ function getAllTagsFromCategory(categoryNode, allCategories = {}) {
|
|
|
399
393
|
}
|
|
400
394
|
}
|
|
401
395
|
|
|
402
|
-
getAllTagsFromCategory(child, allCategories);
|
|
396
|
+
getAllTagsFromCategory(child, allCategories, title);
|
|
403
397
|
}
|
|
404
398
|
|
|
405
399
|
allCategories[categoryNode.sys.id].tags = [...new Set(allCategories[categoryNode.sys.id].tags)];
|