@c-rex/components 0.1.36 → 0.1.38
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 -18
- package/src/article/article-content.tsx +26 -35
- package/src/autocomplete.tsx +26 -5
- package/src/carousel/carousel.tsx +53 -52
- package/src/check-article-lang.tsx +8 -4
- package/src/favorites/bookmark-button.tsx +26 -11
- package/src/favorites/favorite-button.tsx +67 -21
- package/src/info/info-table.tsx +60 -38
- package/src/info/set-available-versions.tsx +19 -0
- package/src/navbar/language-switcher/content-language-switch.tsx +36 -36
- package/src/navbar/language-switcher/ui-language-switch.tsx +5 -6
- package/src/navbar/navbar.tsx +17 -8
- package/src/renditions/html.tsx +38 -31
- package/src/restriction-menu/restriction-menu-item.tsx +8 -5
- package/src/restriction-menu/restriction-menu.tsx +26 -25
- package/src/results/generic/table-result-list.tsx +1 -1
- package/src/results/utils.ts +9 -2
- package/src/stores/favorites-store.ts +21 -21
- package/src/stores/language-store.ts +2 -31
- package/src/article/article-action-bar.analysis.md +0 -15
- package/src/article/article-action-bar.stories.tsx +0 -15
- package/src/article/article-content.analysis.md +0 -15
- package/src/article/article-content.stories.tsx +0 -21
- package/src/autocomplete.analysis.md +0 -17
- package/src/breadcrumb.analysis.md +0 -15
- package/src/carousel/carousel.analysis.md +0 -17
- package/src/check-article-lang.analysis.md +0 -15
- package/src/directoryNodes/tree-of-content.analysis.md +0 -14
- package/src/directoryNodes/tree-of-content.stories.tsx +0 -22
- package/src/documents/result-list.analysis.md +0 -14
- package/src/documents/result-list.stories.tsx +0 -19
- package/src/favorites/bookmark-button.analysis.md +0 -17
- package/src/favorites/bookmark-button.stories.tsx +0 -19
- package/src/favorites/favorite-button.analysis.md +0 -18
- package/src/favorites/favorite-button.stories.tsx +0 -22
- package/src/icons/file-icon.analysis.md +0 -14
- package/src/icons/file-icon.stories.tsx +0 -19
- package/src/icons/flag-icon.analysis.md +0 -14
- package/src/icons/flag-icon.stories.tsx +0 -25
- package/src/icons/loading.analysis.md +0 -14
- package/src/icons/loading.stories.tsx +0 -21
- package/src/info/info-table.analysis.md +0 -15
- package/src/info/shared.analysis.md +0 -14
- package/src/info/stories/info-table.stories.tsx +0 -31
- package/src/info/stories/shared.stories.tsx +0 -24
- package/src/navbar/language-switcher/content-language-switch.analysis.md +0 -15
- package/src/navbar/language-switcher/shared.analysis.md +0 -14
- package/src/navbar/language-switcher/ui-language-switch.analysis.md +0 -15
- package/src/navbar/navbar.analysis.md +0 -14
- package/src/navbar/settings.analysis.md +0 -14
- package/src/navbar/sign-in-out-btns.analysis.md +0 -14
- package/src/navbar/stories/navbar.stories.tsx +0 -31
- package/src/navbar/stories/settings.stories.tsx +0 -15
- package/src/navbar/stories/sign-in-out-btns.stories.tsx +0 -15
- package/src/navbar/stories/user-menu.stories.tsx +0 -20
- package/src/navbar/user-menu.analysis.md +0 -14
- package/src/page-wrapper.analysis.md +0 -14
- package/src/render-article.analysis.md +0 -15
- package/src/renditions/file-download.analysis.md +0 -14
- package/src/renditions/file-download.stories.tsx +0 -19
- package/src/renditions/html.analysis.md +0 -17
- package/src/renditions/html.stories.tsx +0 -19
- package/src/renditions/image/container.analysis.md +0 -15
- package/src/renditions/image/container.stories.tsx +0 -19
- package/src/renditions/image/rendition.analysis.md +0 -14
- package/src/renditions/image/rendition.stories.tsx +0 -19
- package/src/restriction-menu/restriction-menu-container.analysis.md +0 -14
- package/src/restriction-menu/restriction-menu-item.analysis.md +0 -14
- package/src/restriction-menu/restriction-menu.analysis.md +0 -17
- package/src/results/analysis/cards.analysis.md +0 -14
- package/src/results/analysis/dialog-filter.analysis.md +0 -17
- package/src/results/analysis/empty.analysis.md +0 -14
- package/src/results/analysis/filter-navbar.analysis.md +0 -16
- package/src/results/analysis/pagination.analysis.md +0 -14
- package/src/results/analysis/table-with-images.analysis.md +0 -15
- package/src/results/analysis/table.analysis.md +0 -15
- package/src/results/filter-sidebar/index.analysis.md +0 -14
- package/src/results/generic/table-result-list.analysis.md +0 -15
- package/src/results/generic/table-result-list.stories.tsx +0 -21
- package/src/results/stories/cards.stories.tsx +0 -66
- package/src/results/stories/dialog-filter.stories.tsx +0 -20
- package/src/results/stories/empty.stories.tsx +0 -25
- package/src/results/stories/filter-navbar.stories.tsx +0 -19
- package/src/results/stories/filter-sidebar.stories.tsx +0 -20
- package/src/results/stories/pagination.stories.tsx +0 -24
- package/src/results/stories/table-with-images.stories.tsx +0 -19
- package/src/results/stories/table.stories.tsx +0 -78
- package/src/search-input.analysis.md +0 -15
- package/src/share-button.analysis.md +0 -19
- package/src/stories/autocomplete.stories.tsx +0 -20
- package/src/stories/breadcrumb.stories.tsx +0 -93
- package/src/stories/check-article-lang.stories.tsx +0 -22
- package/src/stories/render-article.stories.tsx +0 -19
- package/src/stories/search-input.stories.tsx +0 -21
- package/src/stories/share-button.stories.tsx +0 -15
|
@@ -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 currentTopics = currentDocument?.topics ?? [];
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
...documents,
|
|
68
|
+
[documentId]: {
|
|
69
|
+
...currentDocument,
|
|
70
|
+
topics: [...currentTopics, { 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,
|
|
85
|
+
topics: currentDocument.topics.filter(topic => topic.id !== id),
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -1,43 +1,14 @@
|
|
|
1
1
|
import { LanguageAndCountries } from "@c-rex/interfaces";
|
|
2
2
|
import { create } from "zustand";
|
|
3
|
-
import { persist, createJSONStorage, StateStorage } from "zustand/middleware";
|
|
4
|
-
|
|
5
|
-
const cookieStorage: StateStorage = {
|
|
6
|
-
getItem: (name: string): string | null => {
|
|
7
|
-
if (typeof document === "undefined") return null;
|
|
8
|
-
const match = document.cookie.match(new RegExp(`(^| )${name}=([^;]+)`));
|
|
9
|
-
return match ? decodeURIComponent(match[2] as string) : null;
|
|
10
|
-
},
|
|
11
|
-
setItem: (name: string, value: string): void => {
|
|
12
|
-
if (typeof document === "undefined") return;
|
|
13
|
-
const maxAge = 60 * 60 * 24 * 365; // 1 year
|
|
14
|
-
document.cookie = `${name}=${encodeURIComponent(value)};path=/;max-age=${maxAge};SameSite=Lax`;
|
|
15
|
-
},
|
|
16
|
-
removeItem: (name: string): void => {
|
|
17
|
-
if (typeof document === "undefined") return;
|
|
18
|
-
document.cookie = `${name}=;path=/;max-age=0`;
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
3
|
|
|
22
4
|
type LanguageStoreType = {
|
|
23
|
-
uiLang: string;
|
|
24
5
|
availableLanguages: LanguageAndCountries[];
|
|
25
|
-
setUiLang: (v: string) => void;
|
|
26
6
|
setAvailableLanguages: (list: LanguageAndCountries[]) => void;
|
|
27
7
|
};
|
|
28
8
|
|
|
29
|
-
export const useLanguageStore = create<LanguageStoreType>()(
|
|
30
|
-
persist((set) => ({
|
|
31
|
-
uiLang: "",
|
|
9
|
+
export const useLanguageStore = create<LanguageStoreType>()((set) => ({
|
|
32
10
|
availableLanguages: [],
|
|
33
|
-
setUiLang: (v) => {
|
|
34
|
-
set({ uiLang: v });
|
|
35
|
-
},
|
|
36
11
|
setAvailableLanguages: (list) => {
|
|
37
12
|
set({ availableLanguages: list });
|
|
38
13
|
},
|
|
39
|
-
|
|
40
|
-
name: "c-rex-language-store",
|
|
41
|
-
storage: createJSONStorage(() => cookieStorage),
|
|
42
|
-
})
|
|
43
|
-
);
|
|
14
|
+
}));
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Analysis: article-action-bar
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/article/article-action-bar.tsx
|
|
4
|
-
- Type: Client component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=yes, window/document=no, effects=yes, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- Store subscriptions can re-render this component whenever the selected slice changes.
|
|
9
|
-
- Effects that update state can add extra renders on mount and dependency changes.
|
|
10
|
-
|
|
11
|
-
## Possible bugs/risks
|
|
12
|
-
- No critical bug is evident in this quick static pass; keep tests for error and loading paths.
|
|
13
|
-
|
|
14
|
-
## Recommended improvements
|
|
15
|
-
- Standardize loading/error handling and add regression tests to prevent divergent behavior across consuming apps.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { ArticleActionBar } from '../article-action-bar';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof ArticleActionBar> = {
|
|
5
|
-
title: 'Components/Article/ActionBar',
|
|
6
|
-
component: ArticleActionBar,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered',
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
};
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof ArticleActionBar>;
|
|
14
|
-
|
|
15
|
-
export const Basic: Story = {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Analysis: article-content
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/article/article-content.tsx
|
|
4
|
-
- Type: Server component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=no, effects=no, fetch/call=yes
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- No obvious excessive re-render trigger beyond normal prop/context updates.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- Async flows can hit race conditions during fast param/route changes.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Consider cancellation guards (isMounted or AbortController) and standardized error handling.
|
|
15
|
-
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { ArticleContent } from '../article-content';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof ArticleContent> = {
|
|
5
|
-
title: 'Components/Article/Content',
|
|
6
|
-
component: ArticleContent,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered',
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
};
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof ArticleContent>;
|
|
14
|
-
|
|
15
|
-
export const Basic: Story = {
|
|
16
|
-
args: {
|
|
17
|
-
renditions: [], // Não renderiza conteúdo
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// Exemplo completo depende de dados reais de RenditionModel e fetch, normalmente mockado em ambiente de Storybook.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Analysis: autocomplete
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/autocomplete.tsx
|
|
4
|
-
- Type: Client component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=yes, effects=yes, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- Effects that update state can add extra renders on mount and dependency changes.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- Access to window/document needs care to avoid hydration mismatch and non-browser runtime issues.
|
|
12
|
-
- The component renders list-heavy UI; key stability and memoization strongly affect perceived performance.
|
|
13
|
-
|
|
14
|
-
## Recommended improvements
|
|
15
|
-
- Keep browser-only access inside event handlers or useEffect, not in initial render paths.
|
|
16
|
-
- Review key strategy and extract memoized subcomponents for large-list rendering.
|
|
17
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Analysis: breadcrumb
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/breadcrumb.tsx
|
|
4
|
-
- Type: Client component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=no, effects=no, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- No obvious excessive re-render trigger beyond normal prop/context updates.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- The component renders list-heavy UI; key stability and memoization strongly affect perceived performance.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Review key strategy and extract memoized subcomponents for large-list rendering.
|
|
15
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Analysis: carousel
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/carousel/carousel.tsx
|
|
4
|
-
- Type: Client component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=yes, effects=yes, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- Effects that update state can add extra renders on mount and dependency changes.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- Access to window/document needs care to avoid hydration mismatch and non-browser runtime issues.
|
|
12
|
-
- The component renders list-heavy UI; key stability and memoization strongly affect perceived performance.
|
|
13
|
-
|
|
14
|
-
## Recommended improvements
|
|
15
|
-
- Keep browser-only access inside event handlers or useEffect, not in initial render paths.
|
|
16
|
-
- Review key strategy and extract memoized subcomponents for large-list rendering.
|
|
17
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Analysis: check-article-lang
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/check-article-lang.tsx
|
|
4
|
-
- Type: Client component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=yes, effects=yes, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- Effects that update state can add extra renders on mount and dependency changes.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- Access to window/document needs care to avoid hydration mismatch and non-browser runtime issues.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Keep browser-only access inside event handlers or useEffect, not in initial render paths.
|
|
15
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Analysis: tree-of-content
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/directoryNodes/tree-of-content.tsx
|
|
4
|
-
- Type: Server component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=no, effects=no, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- No obvious excessive re-render trigger beyond normal prop/context updates.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- No critical bug is evident in this quick static pass; keep tests for error and loading paths.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Standardize loading/error handling and add regression tests to prevent divergent behavior across consuming apps.
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { TreeOfContent } from './tree-of-content';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof TreeOfContent> = {
|
|
5
|
-
title: 'Components/DirectoryNodes/TreeOfContent',
|
|
6
|
-
component: TreeOfContent,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered',
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
};
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof TreeOfContent>;
|
|
14
|
-
|
|
15
|
-
export const Basic: Story = {
|
|
16
|
-
args: {
|
|
17
|
-
directoryNodes: [
|
|
18
|
-
{ id: '1', label: 'Node 1', active: true, children: [] },
|
|
19
|
-
{ id: '2', label: 'Node 2', active: false, children: [] },
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Analysis: result-list
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/documents/result-list.tsx
|
|
4
|
-
- Type: Server component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=no, effects=no, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- No obvious excessive re-render trigger beyond normal prop/context updates.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- No critical bug is evident in this quick static pass; keep tests for error and loading paths.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Standardize loading/error handling and add regression tests to prevent divergent behavior across consuming apps.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { DocumentsResultList } from '../result-list';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof DocumentsResultList> = {
|
|
5
|
-
title: 'Components/Documents/ResultList',
|
|
6
|
-
component: DocumentsResultList,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered',
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
};
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof DocumentsResultList>;
|
|
14
|
-
|
|
15
|
-
export const Basic: Story = {
|
|
16
|
-
args: {
|
|
17
|
-
items: [],
|
|
18
|
-
},
|
|
19
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Analysis: bookmark-button
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/favorites/bookmark-button.tsx
|
|
4
|
-
- Type: Client component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=yes, effects=yes, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- Effects that update state can add extra renders on mount and dependency changes.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- Access to window/document needs care to avoid hydration mismatch and non-browser runtime issues.
|
|
12
|
-
- markersList is loaded only on mount/shortId change; later store updates may not refresh the badge.
|
|
13
|
-
|
|
14
|
-
## Recommended improvements
|
|
15
|
-
- Keep browser-only access inside event handlers or useEffect, not in initial render paths.
|
|
16
|
-
- Read documents[shortId]?.topics directly through a Zustand selector to keep UI reactive.
|
|
17
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { BookmarkButton } from '../bookmark-button';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof BookmarkButton> = {
|
|
5
|
-
title: 'Components/Favorites/BookmarkButton',
|
|
6
|
-
component: BookmarkButton,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered',
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
};
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof BookmarkButton>;
|
|
14
|
-
|
|
15
|
-
export const Basic: Story = {
|
|
16
|
-
args: {
|
|
17
|
-
shortId: 'doc-1',
|
|
18
|
-
},
|
|
19
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Analysis: favorite-button
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/favorites/favorite-button.tsx
|
|
4
|
-
- Type: Client component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=yes, window/document=no, effects=yes, fetch/call=yes
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- Store subscriptions can re-render this component whenever the selected slice changes.
|
|
9
|
-
- Effects that update state can add extra renders on mount and dependency changes.
|
|
10
|
-
|
|
11
|
-
## Possible bugs/risks
|
|
12
|
-
- Async flows can hit race conditions during fast param/route changes.
|
|
13
|
-
- useEffect with empty deps calls getTopicDocumentData(id) and does not react if id/type changes.
|
|
14
|
-
|
|
15
|
-
## Recommended improvements
|
|
16
|
-
- Consider cancellation guards (isMounted or AbortController) and standardized error handling.
|
|
17
|
-
- Include id and type in effect dependencies and handle fetch cancellation on unmount.
|
|
18
|
-
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { FavoriteButton } from '../favorite-button';
|
|
3
|
-
import { RESULT_TYPES } from '@c-rex/constants';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof FavoriteButton> = {
|
|
6
|
-
title: 'Components/Favorites/FavoriteButton',
|
|
7
|
-
component: FavoriteButton,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: 'centered',
|
|
10
|
-
},
|
|
11
|
-
tags: ['autodocs'],
|
|
12
|
-
};
|
|
13
|
-
export default meta;
|
|
14
|
-
type Story = StoryObj<typeof FavoriteButton>;
|
|
15
|
-
|
|
16
|
-
export const Basic: Story = {
|
|
17
|
-
args: {
|
|
18
|
-
id: 'doc-1',
|
|
19
|
-
type: RESULT_TYPES.DOCUMENT,
|
|
20
|
-
label: 'Document 1',
|
|
21
|
-
},
|
|
22
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Analysis: file-icon
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/icons/file-icon.tsx
|
|
4
|
-
- Type: Server component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=no, effects=no, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- No obvious excessive re-render trigger beyond normal prop/context updates.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- No critical bug is evident in this quick static pass; keep tests for error and loading paths.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Standardize loading/error handling and add regression tests to prevent divergent behavior across consuming apps.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { FileIcon } from '../file-icon';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof FileIcon> = {
|
|
5
|
-
title: 'Components/Icons/FileIcon',
|
|
6
|
-
component: FileIcon,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered',
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
};
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof FileIcon>;
|
|
14
|
-
|
|
15
|
-
export const PDF: Story = {
|
|
16
|
-
args: {
|
|
17
|
-
extension: 'application/pdf',
|
|
18
|
-
},
|
|
19
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Analysis: flag-icon
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/icons/flag-icon.tsx
|
|
4
|
-
- Type: Server component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=no, effects=no, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- No obvious excessive re-render trigger beyond normal prop/context updates.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- No critical bug is evident in this quick static pass; keep tests for error and loading paths.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Standardize loading/error handling and add regression tests to prevent divergent behavior across consuming apps.
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Flag } from '../flag-icon';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Flag> = {
|
|
5
|
-
title: 'Components/Icons/Flag',
|
|
6
|
-
component: Flag,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered',
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
};
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof Flag>;
|
|
14
|
-
|
|
15
|
-
export const Brazil: Story = {
|
|
16
|
-
args: {
|
|
17
|
-
countryCode: 'BR',
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const USA: Story = {
|
|
22
|
-
args: {
|
|
23
|
-
countryCode: 'US',
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Analysis: loading
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/icons/loading.tsx
|
|
4
|
-
- Type: Server component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=no, effects=no, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- No obvious excessive re-render trigger beyond normal prop/context updates.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- No critical bug is evident in this quick static pass; keep tests for error and loading paths.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Standardize loading/error handling and add regression tests to prevent divergent behavior across consuming apps.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Loading } from '../loading';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Loading> = {
|
|
5
|
-
title: 'Components/Icons/Loading',
|
|
6
|
-
component: Loading,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered',
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
};
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof Loading>;
|
|
14
|
-
|
|
15
|
-
export const Basic: Story = {};
|
|
16
|
-
|
|
17
|
-
export const WithOpacity: Story = {
|
|
18
|
-
args: {
|
|
19
|
-
opacity: true,
|
|
20
|
-
},
|
|
21
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Analysis: info-table
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/info/info-table.tsx
|
|
4
|
-
- Type: Server component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=no, effects=no, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- No obvious excessive re-render trigger beyond normal prop/context updates.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- The component renders list-heavy UI; key stability and memoization strongly affect perceived performance.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Review key strategy and extract memoized subcomponents for large-list rendering.
|
|
15
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Analysis: shared
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/info/shared.tsx
|
|
4
|
-
- Type: Server component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=no, effects=no, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- No obvious excessive re-render trigger beyond normal prop/context updates.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- No critical bug is evident in this quick static pass; keep tests for error and loading paths.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Standardize loading/error handling and add regression tests to prevent divergent behavior across consuming apps.
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { InfoTable } from '../info-table';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof InfoTable> = {
|
|
5
|
-
title: 'Components/Info/InfoTable',
|
|
6
|
-
component: InfoTable,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered',
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
};
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof InfoTable>;
|
|
14
|
-
|
|
15
|
-
export const Basic: Story = {
|
|
16
|
-
args: {
|
|
17
|
-
title: 'Info',
|
|
18
|
-
linkPath: 'documents',
|
|
19
|
-
data: {
|
|
20
|
-
id: '1',
|
|
21
|
-
title: 'Sample Document',
|
|
22
|
-
type: 'document',
|
|
23
|
-
language: 'en-US',
|
|
24
|
-
files: {},
|
|
25
|
-
renditions: [],
|
|
26
|
-
directoryNodes: [],
|
|
27
|
-
labels: [{ value: 'Sample Document', language: 'en-US' }],
|
|
28
|
-
languages: ['en-US'],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { renderValue } from '../shared';
|
|
3
|
-
|
|
4
|
-
const meta: Meta = {
|
|
5
|
-
title: 'Components/Info/RenderValue',
|
|
6
|
-
parameters: {
|
|
7
|
-
layout: 'centered',
|
|
8
|
-
},
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
};
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj;
|
|
13
|
-
|
|
14
|
-
export const DateValue: Story = {
|
|
15
|
-
render: () => <div>{renderValue({ label: 'date', value: '2024-01-01' }, 'en-US')}</div>,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const LanguageValue: Story = {
|
|
19
|
-
render: () => <div>{renderValue({ label: 'language', value: 'en-US' }, 'en-US')}</div>,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const StringValue: Story = {
|
|
23
|
-
render: () => <div>{renderValue({ label: 'custom', value: 'Some text' }, 'en-US')}</div>,
|
|
24
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Analysis: content-language-switch
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/navbar/language-switcher/content-language-switch.tsx
|
|
4
|
-
- Type: Client component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=yes, effects=no, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- No obvious excessive re-render trigger beyond normal prop/context updates.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- Access to window/document needs care to avoid hydration mismatch and non-browser runtime issues.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Keep browser-only access inside event handlers or useEffect, not in initial render paths.
|
|
15
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Analysis: shared
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/navbar/language-switcher/shared.tsx
|
|
4
|
-
- Type: Server component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=no, window/document=no, effects=no, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- No obvious excessive re-render trigger beyond normal prop/context updates.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- No critical bug is evident in this quick static pass; keep tests for error and loading paths.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Standardize loading/error handling and add regression tests to prevent divergent behavior across consuming apps.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Analysis: ui-language-switch
|
|
2
|
-
|
|
3
|
-
- Component: packages/components/src/navbar/language-switcher/ui-language-switch.tsx
|
|
4
|
-
- Type: Client component
|
|
5
|
-
- Detected signals: useQueryStates=no, stores=yes, window/document=yes, effects=no, fetch/call=no
|
|
6
|
-
|
|
7
|
-
## Possible re-render causes
|
|
8
|
-
- Store subscriptions can re-render this component whenever the selected slice changes.
|
|
9
|
-
|
|
10
|
-
## Possible bugs/risks
|
|
11
|
-
- Access to window/document needs care to avoid hydration mismatch and non-browser runtime issues.
|
|
12
|
-
|
|
13
|
-
## Recommended improvements
|
|
14
|
-
- Keep browser-only access inside event handlers or useEffect, not in initial render paths.
|
|
15
|
-
|