@c-rex/components 0.1.30 → 0.1.32
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 +13 -1
- package/src/article/article-action-bar.analysis.md +15 -0
- package/src/article/article-action-bar.tsx +31 -9
- 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 +7 -4
- 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 +18 -10
- 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 +17 -0
- package/src/favorites/favorite-button.analysis.md +18 -0
- 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 +9 -9
- package/src/info/shared.analysis.md +14 -0
- package/src/info/shared.tsx +1 -2
- package/src/navbar/language-switcher/content-language-switch.analysis.md +15 -0
- package/src/navbar/language-switcher/content-language-switch.tsx +9 -3
- 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/language-switcher/ui-language-switch.tsx +1 -1
- package/src/navbar/navbar.analysis.md +14 -0
- package/src/navbar/navbar.tsx +83 -50
- package/src/navbar/settings.analysis.md +14 -0
- package/src/navbar/settings.tsx +6 -1
- 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/page-wrapper.tsx +11 -1
- 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 +53 -0
- package/src/restriction-menu/restriction-menu-item.analysis.md +14 -0
- package/src/restriction-menu/restriction-menu-item.tsx +103 -48
- package/src/restriction-menu/restriction-menu.analysis.md +17 -0
- package/src/restriction-menu/restriction-menu.tsx +128 -130
- package/src/results/cards.analysis.md +14 -0
- package/src/results/dialog-filter.analysis.md +17 -0
- package/src/results/dialog-filter.tsx +32 -26
- package/src/results/empty.analysis.md +14 -0
- package/src/results/filter-navbar.analysis.md +16 -0
- package/src/results/filter-navbar.tsx +25 -2
- package/src/results/filter-sidebar/index.analysis.md +14 -0
- package/src/results/filter-sidebar/index.tsx +1 -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/results/utils.ts +1 -21
- package/src/search-input.analysis.md +15 -0
- package/src/search-input.tsx +4 -12
- package/src/share-button.analysis.md +19 -0
- package/src/stores/restriction-store.ts +11 -0
- package/src/stores/search-settings-store.ts +3 -3
package/src/info/shared.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { articleInfoItemType } from "@c-rex/types";
|
|
3
3
|
import { formatDateToLocale, isDate, isLanguage } from "@c-rex/utils";
|
|
4
4
|
import { Flag } from "../icons/flag-icon";
|
|
@@ -13,7 +13,6 @@ export const renderValue = (item: articleInfoItemType, uiLang: string): ReactNod
|
|
|
13
13
|
<span className="w-8 block">
|
|
14
14
|
<Flag countryCode={countryCode} />
|
|
15
15
|
</span>
|
|
16
|
-
|
|
17
16
|
);
|
|
18
17
|
}
|
|
19
18
|
|
|
@@ -0,0 +1,15 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
3
|
import { startTransition } from "react";
|
|
4
4
|
import { SharedLanguageSwitch } from "./shared";
|
|
@@ -10,9 +10,13 @@ import { toast } from "sonner"
|
|
|
10
10
|
import { useLanguageStore } from "../../stores/language-store";
|
|
11
11
|
import { useSearchSettingsStore } from "../../stores/search-settings-store";
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
type Props = {
|
|
14
|
+
contentLangDefault: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const ContentLanguageSwitch = ({ contentLangDefault }: Props) => {
|
|
14
18
|
const t = useTranslations();
|
|
15
|
-
const contentLang = useSearchSettingsStore.getState().language;
|
|
19
|
+
const contentLang = useSearchSettingsStore.getState().language || contentLangDefault;
|
|
16
20
|
const updatePreferences = useSearchSettingsStore.getState().updatePreferences;
|
|
17
21
|
|
|
18
22
|
const { availableVersions } = useAppConfig()
|
|
@@ -45,6 +49,8 @@ export const ContentLanguageSwitch = () => {
|
|
|
45
49
|
setContentLanguage(locale)
|
|
46
50
|
}
|
|
47
51
|
|
|
52
|
+
//TODO en: needs to be fixed as it's not working
|
|
53
|
+
|
|
48
54
|
const currentPath = window.location.pathname;
|
|
49
55
|
const isTopicOrBlogOrDocument = (
|
|
50
56
|
currentPath.includes(TOPICS_TYPE_AND_LINK) ||
|
|
@@ -0,0 +1,14 @@
|
|
|
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.
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Analysis: navbar
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/navbar/navbar.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.
|
package/src/navbar/navbar.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
1
|
+
import { ComponentProps, FC } from "react";
|
|
2
2
|
import Link from "next/link";
|
|
3
3
|
import { SignInBtn } from "./sign-in-out-btns";
|
|
4
4
|
import { getServerSession } from "next-auth";
|
|
@@ -7,21 +7,22 @@ import { UserMenu } from "./user-menu";
|
|
|
7
7
|
import { SearchInput } from "../search-input";
|
|
8
8
|
import { CrexSDK } from "@c-rex/core/sdk";
|
|
9
9
|
import * as AutocompleteOptions from "../generated/suggestions";
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
10
|
+
import { cn } from "@c-rex/utils";
|
|
11
|
+
import { getTranslations } from "next-intl/server";
|
|
12
|
+
import { Button } from "@c-rex/ui/button";
|
|
13
|
+
import { DropdownHoverItem } from "@c-rex/ui/dropdown-hover-item";
|
|
14
|
+
import { Menu } from "lucide-react";
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
type NavBarProps = {
|
|
14
17
|
title?: string;
|
|
15
18
|
showInput: boolean;
|
|
16
19
|
showPkgFilter: boolean;
|
|
17
20
|
onSelectPath?: string;
|
|
18
|
-
showMenu?: boolean
|
|
19
|
-
showRestrictMenu?: boolean
|
|
20
|
-
restrictionType?: keyof typeof ComponentOptions;
|
|
21
21
|
autocompleteType?: keyof typeof AutocompleteOptions;
|
|
22
22
|
//these two props are only used when showPkgFilter is false and has some values to override the default behavior
|
|
23
23
|
alternativeAutocompleteType?: keyof typeof AutocompleteOptions;
|
|
24
24
|
alternativeOnSelectPath?: string;
|
|
25
|
+
showMenu?: boolean;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export const NavBar: FC<NavBarProps> = async ({
|
|
@@ -29,11 +30,10 @@ export const NavBar: FC<NavBarProps> = async ({
|
|
|
29
30
|
showInput,
|
|
30
31
|
autocompleteType,
|
|
31
32
|
onSelectPath,
|
|
32
|
-
restrictionType,
|
|
33
33
|
showMenu = false,
|
|
34
|
-
showRestrictMenu = false,
|
|
35
34
|
...props
|
|
36
35
|
}) => {
|
|
36
|
+
const t = await getTranslations();
|
|
37
37
|
const sdk = new CrexSDK();
|
|
38
38
|
const clientConfigs = sdk.getClientConfig();
|
|
39
39
|
const serverConfigs = sdk.getServerConfig();
|
|
@@ -49,62 +49,95 @@ export const NavBar: FC<NavBarProps> = async ({
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
return (
|
|
52
|
-
<header className="sticky flex flex-col
|
|
53
|
-
<div
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
<header className="sticky flex flex-col top-0 z-40 w-full p-4 backdrop-blur-xl transition-all bg-transparent border-b gap-2">
|
|
53
|
+
<div className="w-full flex items-center justify-between gap-2">
|
|
54
|
+
<div
|
|
55
|
+
className={cn(
|
|
56
|
+
"flex items-center gap-4",
|
|
57
|
+
title && "lg:w-[calc(16rem-16px)]"
|
|
58
|
+
)}
|
|
59
|
+
>
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
<Link href="/"
|
|
62
|
+
>
|
|
59
63
|
<img
|
|
60
64
|
src="/img/logo.png"
|
|
61
65
|
alt="C-rex Logo"
|
|
62
|
-
className="
|
|
66
|
+
className="h-14"
|
|
63
67
|
/>
|
|
64
68
|
</Link>
|
|
65
69
|
|
|
66
|
-
{
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
{showMenu && (
|
|
71
|
+
<DropdownHoverItem
|
|
72
|
+
label={
|
|
73
|
+
<Button variant="outline" rounded="full" size="icon">
|
|
74
|
+
<Menu className="size-4" />
|
|
75
|
+
</Button>
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
<Button asChild variant="link">
|
|
79
|
+
<Link href="/documents">
|
|
80
|
+
{t('navigation.documents')}
|
|
81
|
+
</Link>
|
|
82
|
+
</Button>
|
|
83
|
+
<Button asChild variant="link">
|
|
84
|
+
<Link href="/topics">
|
|
85
|
+
{t('navigation.topics')}
|
|
86
|
+
</Link>
|
|
87
|
+
</Button>
|
|
88
|
+
<Button asChild variant="link">
|
|
89
|
+
<Link href="/fragments">
|
|
90
|
+
{t('navigation.fragments')}
|
|
91
|
+
</Link>
|
|
92
|
+
</Button>
|
|
93
|
+
<Button asChild variant="link">
|
|
94
|
+
<Link href="/packages">
|
|
95
|
+
{t('navigation.packages')}
|
|
96
|
+
</Link>
|
|
97
|
+
</Button>
|
|
98
|
+
<Button asChild variant="link">
|
|
99
|
+
<Link href="/information-units">
|
|
100
|
+
{t('navigation.informationUnits')}
|
|
101
|
+
</Link>
|
|
102
|
+
</Button>
|
|
103
|
+
</DropdownHoverItem>
|
|
70
104
|
)}
|
|
71
105
|
</div>
|
|
72
106
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<div className="flex items-center gap-2 absolute sm:static top-4 h-14 sm:h-min right-4">
|
|
107
|
+
{title && (
|
|
108
|
+
<div className="flex-1 hidden md:flex md:justify-center lg:justify-start">
|
|
109
|
+
<h1 className="md:text-2xl lg:text-3xl font-bold tracking-tight text-balance">{title}</h1>
|
|
110
|
+
</div>
|
|
111
|
+
)}
|
|
79
112
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
113
|
+
<div className="flex gap-2">
|
|
114
|
+
{willShowInput &&
|
|
115
|
+
<div className="hidden sm:flex flex-1 items-center px-3 border rounded-full h-8 c-rex-search-bar">
|
|
116
|
+
<SearchInput autocompleteType={autocompleteType} onSelectPath={onSelectPath} {...props} />
|
|
117
|
+
</div>
|
|
118
|
+
}
|
|
83
119
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
120
|
+
{clientConfigs.OIDC.userEnabled && (
|
|
121
|
+
<>
|
|
122
|
+
{session ? (
|
|
123
|
+
<UserMenu session={session} OIDCEndPoint={serverConfigs.OIDC.user.issuer} />
|
|
124
|
+
) : (
|
|
125
|
+
<SignInBtn />
|
|
126
|
+
)}
|
|
127
|
+
</>
|
|
128
|
+
)}
|
|
93
129
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
</div>
|
|
130
|
+
{clientConfigs.languageSwitcher.enabled && (
|
|
131
|
+
<SettingsMenu />
|
|
132
|
+
)}
|
|
98
133
|
</div>
|
|
99
|
-
|
|
100
|
-
{title && (
|
|
101
|
-
<div className="flex w-full sm:hidden items-center">
|
|
102
|
-
<h1 className="mt-4 sm:mt-0 sm:px-4 text-xl sm:text-2xl md:text-3xl font-bold tracking-tight text-balance">
|
|
103
|
-
{title}
|
|
104
|
-
</h1>
|
|
105
|
-
</div>
|
|
106
|
-
)}
|
|
107
134
|
</div>
|
|
135
|
+
|
|
136
|
+
{title && (
|
|
137
|
+
<div className="flex-1 flex justify-center md:hidden">
|
|
138
|
+
<h1 className="text-2xl font-bold tracking-tight text-balance">{title}</h1>
|
|
139
|
+
</div>
|
|
140
|
+
)}
|
|
108
141
|
</header>
|
|
109
142
|
);
|
|
110
143
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Analysis: settings
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/navbar/settings.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.
|
package/src/navbar/settings.tsx
CHANGED
|
@@ -14,9 +14,12 @@ import { useTranslations } from "next-intl";
|
|
|
14
14
|
import { FC } from 'react';
|
|
15
15
|
import { ContentLanguageSwitch } from "./language-switcher/content-language-switch";
|
|
16
16
|
import { UILanguageSwitch } from "./language-switcher/ui-language-switch";
|
|
17
|
+
import { CrexSDK } from "@c-rex/core/sdk";
|
|
17
18
|
|
|
18
19
|
export const SettingsMenu: FC = () => {
|
|
19
20
|
const t = useTranslations();
|
|
21
|
+
const sdk = new CrexSDK();
|
|
22
|
+
const clientConfigs = sdk.getClientConfig();
|
|
20
23
|
|
|
21
24
|
return (
|
|
22
25
|
<DropdownMenu>
|
|
@@ -34,7 +37,9 @@ export const SettingsMenu: FC = () => {
|
|
|
34
37
|
|
|
35
38
|
<DropdownMenuPortal>
|
|
36
39
|
<DropdownMenuSubContent>
|
|
37
|
-
<ContentLanguageSwitch
|
|
40
|
+
<ContentLanguageSwitch
|
|
41
|
+
contentLangDefault={clientConfigs.languageSwitcher.default}
|
|
42
|
+
/>
|
|
38
43
|
</DropdownMenuSubContent>
|
|
39
44
|
</DropdownMenuPortal>
|
|
40
45
|
</DropdownMenuSub>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Analysis: sign-in-out-btns
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/navbar/sign-in-out-btns.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
|
+
- 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.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Analysis: user-menu
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/navbar/user-menu.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
|
+
- 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.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Analysis: page-wrapper
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/page-wrapper.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.
|
package/src/page-wrapper.tsx
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from "react";
|
|
2
2
|
import { NavBar } from './navbar/navbar';
|
|
3
3
|
import { MultiSidebarProvider } from "@c-rex/ui/sidebar";
|
|
4
|
+
import { RestrictionMenuContainer } from "./restriction-menu/restriction-menu-container";
|
|
4
5
|
|
|
5
6
|
type Props = {
|
|
6
7
|
children: ReactNode;
|
|
7
|
-
|
|
8
|
+
showRestrictMenu?: boolean
|
|
9
|
+
} & Partial<ComponentProps<typeof NavBar>> & Partial<ComponentProps<typeof RestrictionMenuContainer>>;
|
|
8
10
|
|
|
9
11
|
export const PageWrapper = ({
|
|
10
12
|
children,
|
|
11
13
|
showInput = false,
|
|
12
14
|
showPkgFilter = false,
|
|
15
|
+
showRestrictMenu = false,
|
|
13
16
|
...props
|
|
14
17
|
}: Props) => {
|
|
15
18
|
return (
|
|
16
19
|
<MultiSidebarProvider>
|
|
17
20
|
<NavBar showInput={showInput} showPkgFilter={showPkgFilter} {...props} />
|
|
21
|
+
|
|
22
|
+
{showRestrictMenu && (
|
|
23
|
+
<div className="flex-1 container pt-6">
|
|
24
|
+
<RestrictionMenuContainer {...props} />
|
|
25
|
+
</div>
|
|
26
|
+
)}
|
|
27
|
+
|
|
18
28
|
{children}
|
|
19
29
|
</MultiSidebarProvider>
|
|
20
30
|
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Analysis: render-article
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/render-article.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.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Analysis: file-download
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/renditions/file-download.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.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Analysis: html
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/renditions/html.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
|
+
- fetch(url) runs inside async server rendering path and can increase list/page latency.
|
|
13
|
+
|
|
14
|
+
## Recommended improvements
|
|
15
|
+
- Consider cancellation guards (isMounted or AbortController) and standardized error handling.
|
|
16
|
+
- Consider caching/revalidation and lighter fallback strategy to reduce N+1 impact.
|
|
17
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Analysis: container
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/renditions/image/container.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
|
+
- imageRestrictions prop exists but is not applied to Restrict composition.
|
|
12
|
+
|
|
13
|
+
## Recommended improvements
|
|
14
|
+
- Apply imageRestrictions to Restrict or remove the prop to avoid misleading API behavior.
|
|
15
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Analysis: rendition
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/renditions/image/rendition.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.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Analysis: restriction-menu-container
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/restriction-menu/restriction-menu-container.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
|
+
- 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.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ComponentProps, FC } from "react"
|
|
4
|
+
import * as ComponentOptions from "../generated/client-components";
|
|
5
|
+
import { InformationSubjectsGetAllClient } from "../generated/client-components";
|
|
6
|
+
import { Skeleton } from "@c-rex/ui/skeleton";
|
|
7
|
+
import { RestrictionMenu } from "./restriction-menu";
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
restrictField?: string
|
|
11
|
+
navigationMenuListClassName?: string
|
|
12
|
+
itemsToRender?: number
|
|
13
|
+
requestType?: keyof typeof ComponentOptions
|
|
14
|
+
} & Partial<Omit<ComponentProps<typeof InformationSubjectsGetAllClient>, ("render" | "children" | "pathParams")>>;
|
|
15
|
+
|
|
16
|
+
export const RestrictionMenuContainer: FC<Props> = ({
|
|
17
|
+
queryParams,
|
|
18
|
+
restrictField = "informationSubjects",
|
|
19
|
+
itemsToRender = 7,
|
|
20
|
+
requestType = "InformationSubjectsGetAllClient",
|
|
21
|
+
navigationMenuListClassName = "items-center justify-between flex-row",
|
|
22
|
+
}) => {
|
|
23
|
+
const RequestComponent = ComponentOptions[requestType] as unknown as FC<ComponentProps<typeof InformationSubjectsGetAllClient>>;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<RequestComponent
|
|
27
|
+
queryParams={{
|
|
28
|
+
Fields: ["labels"],
|
|
29
|
+
PageSize: 100,
|
|
30
|
+
Links: true,
|
|
31
|
+
Sort: ["labels.value"],
|
|
32
|
+
...queryParams
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
{({ data, isLoading }) => {
|
|
36
|
+
|
|
37
|
+
if (isLoading) return (
|
|
38
|
+
<div className="flex justify-between">
|
|
39
|
+
<Skeleton className="w-12 h-9 rounded-full" />
|
|
40
|
+
{Array(itemsToRender).fill(0).map((_, index) => (
|
|
41
|
+
<Skeleton key={`skeleton-${index}`} className="w-28 h-9 rounded-full" />
|
|
42
|
+
))}
|
|
43
|
+
<Skeleton className="w-20 h-9 rounded-full" />
|
|
44
|
+
</div>
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
if (!data) return null;
|
|
48
|
+
|
|
49
|
+
return <RestrictionMenu restrictField={restrictField} items={data.items} navigationMenuListClassName={navigationMenuListClassName} />
|
|
50
|
+
}}
|
|
51
|
+
</RequestComponent>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Analysis: restriction-menu-item
|
|
2
|
+
|
|
3
|
+
- Component: packages/components/src/restriction-menu/restriction-menu-item.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
|
+
- 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.
|