@c-rex/components 0.1.31 → 0.1.33
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 +1 -1
- package/src/article/article-action-bar.analysis.md +15 -0
- package/src/article/article-content.analysis.md +15 -0
- package/src/article/article-content.tsx +3 -3
- package/src/autocomplete.analysis.md +17 -0
- package/src/autocomplete.tsx +2 -2
- package/src/breadcrumb.analysis.md +15 -0
- package/src/breadcrumb.tsx +4 -4
- package/src/carousel/carousel.analysis.md +17 -0
- package/src/carousel/carousel.tsx +2 -2
- package/src/check-article-lang.analysis.md +15 -0
- package/src/directoryNodes/tree-of-content.analysis.md +14 -0
- package/src/documents/result-list.analysis.md +14 -0
- package/src/documents/result-list.tsx +2 -2
- package/src/favorites/bookmark-button.analysis.md +15 -0
- package/src/favorites/bookmark-button.tsx +39 -37
- package/src/favorites/favorite-button.analysis.md +17 -0
- package/src/favorites/favorite-button.tsx +30 -7
- package/src/generated/create-client-request.tsx +15 -6
- package/src/icons/file-icon.analysis.md +14 -0
- package/src/icons/flag-icon.analysis.md +14 -0
- package/src/icons/loading.analysis.md +14 -0
- package/src/info/info-table.analysis.md +15 -0
- package/src/info/info-table.tsx +8 -8
- package/src/info/shared.analysis.md +14 -0
- package/src/navbar/language-switcher/content-language-switch.analysis.md +15 -0
- package/src/navbar/language-switcher/shared.analysis.md +14 -0
- package/src/navbar/language-switcher/ui-language-switch.analysis.md +15 -0
- package/src/navbar/navbar.analysis.md +14 -0
- package/src/navbar/settings.analysis.md +14 -0
- package/src/navbar/sign-in-out-btns.analysis.md +14 -0
- package/src/navbar/user-menu.analysis.md +14 -0
- package/src/page-wrapper.analysis.md +14 -0
- package/src/render-article.analysis.md +15 -0
- package/src/renditions/file-download.analysis.md +14 -0
- package/src/renditions/html.analysis.md +17 -0
- package/src/renditions/image/container.analysis.md +15 -0
- package/src/renditions/image/rendition.analysis.md +14 -0
- package/src/restriction-menu/restriction-menu-container.analysis.md +14 -0
- package/src/restriction-menu/restriction-menu-container.tsx +2 -2
- package/src/restriction-menu/restriction-menu-item.analysis.md +14 -0
- package/src/restriction-menu/restriction-menu.analysis.md +17 -0
- package/src/restriction-menu/restriction-menu.tsx +4 -6
- package/src/results/cards.analysis.md +14 -0
- package/src/results/dialog-filter.analysis.md +17 -0
- package/src/results/dialog-filter.tsx +32 -27
- package/src/results/empty.analysis.md +14 -0
- package/src/results/filter-navbar.analysis.md +16 -0
- package/src/results/filter-sidebar/index.analysis.md +14 -0
- package/src/results/generic/table-result-list.analysis.md +15 -0
- package/src/results/generic/table-result-list.tsx +3 -3
- package/src/results/pagination.analysis.md +14 -0
- package/src/results/table-with-images.analysis.md +15 -0
- package/src/results/table-with-images.tsx +2 -2
- package/src/results/table.analysis.md +15 -0
- package/src/results/table.tsx +4 -4
- package/src/search-input.analysis.md +15 -0
- package/src/share-button.analysis.md +19 -0
- package/src/stores/favorites-store.ts +21 -21
|
@@ -60,29 +60,29 @@ export const useFavoritesStore = create<FavoritesStore>()(
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
const favoriteTopic = (documents: Record<string, { topics: Favorite[] }>, documentId: string, id: string, label: string, color: string): Record<string, { topics: Favorite[] }> => {
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return documentsCopy
|
|
63
|
+
const currentDocument = documents[documentId];
|
|
64
|
+
const topics = currentDocument?.topics || [];
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
...documents,
|
|
68
|
+
[documentId]: {
|
|
69
|
+
...(currentDocument?.label ? { label: currentDocument.label } : {}),
|
|
70
|
+
topics: [...topics, { id, label, color }],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
74
73
|
};
|
|
75
74
|
|
|
76
75
|
const unfavoriteTopic = (documents: Record<string, { topics: Favorite[] }>, documentId: string, id: string): Record<string, { topics: Favorite[] }> => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (notFound) {
|
|
82
|
-
return documentsCopy;
|
|
76
|
+
const currentDocument = documents[documentId];
|
|
77
|
+
if (!currentDocument) {
|
|
78
|
+
return documents;
|
|
83
79
|
}
|
|
84
80
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
81
|
+
return {
|
|
82
|
+
...documents,
|
|
83
|
+
[documentId]: {
|
|
84
|
+
...(currentDocument.label ? { label: currentDocument.label } : {}),
|
|
85
|
+
topics: currentDocument.topics.filter((topic) => topic.id !== id),
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|