@c-rex/components 0.1.38 → 0.1.39
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/README.md +73 -73
- package/package.json +250 -218
- package/src/article/article-action-bar.tsx +110 -110
- package/src/article/article-content.tsx +18 -46
- package/src/autocomplete.tsx +201 -201
- package/src/breadcrumb.tsx +124 -124
- package/src/carousel/carousel.tsx +353 -353
- package/src/check-article-lang.tsx +47 -47
- package/src/directoryNodes/directory-tree-context.tsx +388 -0
- package/src/directoryNodes/tree-of-content.tsx +68 -67
- package/src/documents/result-list.tsx +124 -127
- package/src/favorites/bookmark-button.tsx +97 -94
- package/src/favorites/favorite-button.tsx +137 -120
- package/src/footer/footer-shell.tsx +52 -0
- package/src/footer/footer.tsx +7 -0
- package/src/footer/legal-links-block.tsx +25 -0
- package/src/footer/organization-contact-block.tsx +94 -0
- package/src/footer/social-links-block.tsx +38 -0
- package/src/footer/types.ts +10 -0
- package/src/footer/vcard-footer.tsx +72 -0
- package/src/generated/client-components.tsx +1366 -1350
- package/src/generated/create-client-request.tsx +116 -113
- package/src/generated/create-server-request.tsx +70 -61
- package/src/generated/create-suggestions-request.tsx +55 -55
- package/src/generated/server-components.tsx +1056 -1056
- package/src/generated/suggestions.tsx +302 -299
- package/src/icons/file-icon.tsx +8 -8
- package/src/icons/flag-icon.tsx +15 -15
- package/src/icons/loading.tsx +11 -11
- package/src/icons/social-icon.tsx +24 -0
- package/src/info/info-card.tsx +43 -0
- package/src/info/{info-table.tsx → information-unit-metadata-grid.tsx} +157 -168
- package/src/info/shared.tsx +49 -25
- package/src/navbar/language-switcher/content-language-switch.tsx +92 -92
- package/src/navbar/language-switcher/shared.tsx +33 -33
- package/src/navbar/language-switcher/ui-language-switch.tsx +37 -37
- package/src/navbar/navbar.tsx +157 -152
- package/src/navbar/settings.tsx +62 -62
- package/src/navbar/sign-in-out-btns.tsx +35 -35
- package/src/navbar/user-menu.tsx +60 -60
- package/src/page-wrapper.tsx +54 -31
- package/src/render-article.module.css +155 -0
- package/src/render-article.tsx +75 -68
- package/src/renditions/file-download.tsx +83 -83
- package/src/renditions/html.tsx +64 -64
- package/src/renditions/image/container.tsx +54 -54
- package/src/renditions/image/rendition.tsx +55 -55
- package/src/restriction-menu/restriction-menu-container.tsx +117 -53
- package/src/restriction-menu/restriction-menu-item.tsx +155 -147
- package/src/restriction-menu/restriction-menu.tsx +341 -156
- package/src/results/dialog-filter.tsx +166 -166
- package/src/results/empty.tsx +15 -15
- package/src/results/filter-navbar.tsx +294 -261
- package/src/results/filter-sidebar/__tests__/utils.test.ts +129 -0
- package/src/results/filter-sidebar/index.tsx +270 -126
- package/src/results/filter-sidebar/utils.ts +196 -164
- package/src/results/generic/table-result-list.tsx +97 -99
- package/src/results/{table-with-images.tsx → information-unit-search-results-card-list.tsx} +125 -127
- package/src/results/{cards.tsx → information-unit-search-results-cards.tsx} +99 -99
- package/src/results/{table.tsx → information-unit-search-results-table.tsx} +104 -104
- package/src/results/pagination.tsx +81 -81
- package/src/results/summary.ts +30 -0
- package/src/results/utils.ts +54 -54
- package/src/search-input.tsx +70 -70
- package/src/share-button.tsx +49 -49
- package/src/stores/favorites-store.ts +88 -88
- package/src/stores/highlight-store.ts +15 -15
- package/src/stores/language-store.ts +14 -14
- package/src/stores/restriction-store.ts +11 -11
- package/src/stores/search-settings-store.ts +68 -64
- package/src/info/set-available-versions.tsx +0 -19
|
@@ -1,127 +1,125 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
2
|
-
import { CommonItemsModel } from "@c-rex/interfaces";
|
|
3
|
-
import { FileStack } from "lucide-react";
|
|
4
|
-
import { FileDownloadDropdown } from "../renditions/file-download";
|
|
5
|
-
import { cn
|
|
6
|
-
import { Button } from "@c-rex/ui/button";
|
|
7
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "@c-rex/ui/tooltip";
|
|
8
|
-
import { Favorite, ResultTypes } from "@c-rex/types";
|
|
9
|
-
import { RESULT_TYPES } from "@c-rex/constants";
|
|
10
|
-
import { FavoriteButton } from "../favorites/favorite-button";
|
|
11
|
-
import { ImageRenditionContainer } from "../renditions/image/container";
|
|
12
|
-
import { BookmarkButton } from "../favorites/bookmark-button";
|
|
13
|
-
import { HtmlRendition } from "../renditions/html";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const itemType =
|
|
37
|
-
const disabled = disabledResults.includes(itemType);
|
|
38
|
-
const isDocument = itemType === RESULT_TYPES.DOCUMENT;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
title
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
);
|
|
127
|
-
};
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { CommonItemsModel } from "@c-rex/interfaces";
|
|
3
|
+
import { FileStack } from "lucide-react";
|
|
4
|
+
import { FileDownloadDropdown } from "../renditions/file-download";
|
|
5
|
+
import { cn } from "@c-rex/utils";
|
|
6
|
+
import { Button } from "@c-rex/ui/button";
|
|
7
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "@c-rex/ui/tooltip";
|
|
8
|
+
import { Favorite, ResultTypes } from "@c-rex/types";
|
|
9
|
+
import { RESULT_TYPES } from "@c-rex/constants";
|
|
10
|
+
import { FavoriteButton } from "../favorites/favorite-button";
|
|
11
|
+
import { ImageRenditionContainer } from "../renditions/image/container";
|
|
12
|
+
import { BookmarkButton } from "../favorites/bookmark-button";
|
|
13
|
+
import { HtmlRendition } from "../renditions/html";
|
|
14
|
+
import { getResultItemSummary } from "./summary";
|
|
15
|
+
|
|
16
|
+
interface InformationUnitSearchResultsCardListProps {
|
|
17
|
+
items: CommonItemsModel[];
|
|
18
|
+
query?: string;
|
|
19
|
+
markersList?: Favorite[];
|
|
20
|
+
disabledResults?: ResultTypes[];
|
|
21
|
+
imageRestrictions?: string[];
|
|
22
|
+
showActions?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export const InformationUnitSearchResultsCardList: FC<InformationUnitSearchResultsCardListProps> = ({
|
|
27
|
+
items,
|
|
28
|
+
query = "",
|
|
29
|
+
disabledResults = [],
|
|
30
|
+
imageRestrictions = [],
|
|
31
|
+
showActions = true,
|
|
32
|
+
}) => {
|
|
33
|
+
return (
|
|
34
|
+
<div className="flex-1">
|
|
35
|
+
{items.map((item, index) => {
|
|
36
|
+
const { title, itemType, multipleVersions, packageId } = getResultItemSummary(item);
|
|
37
|
+
const disabled = disabledResults.includes(itemType);
|
|
38
|
+
const isDocument = itemType === RESULT_TYPES.DOCUMENT;
|
|
39
|
+
|
|
40
|
+
let itemLink = `/topics/${item.shortId}/content`
|
|
41
|
+
if (isDocument) {
|
|
42
|
+
itemLink = `/documents/${item.shortId}/details`
|
|
43
|
+
}
|
|
44
|
+
itemLink += `?q=${query}`
|
|
45
|
+
|
|
46
|
+
if (packageId) {
|
|
47
|
+
itemLink += `&package=${packageId}`
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
key={item.shortId}
|
|
53
|
+
className={cn(
|
|
54
|
+
"min-h-12 flex flex-wrap items-center border px-4 py-2 gap-2 rounded",
|
|
55
|
+
index == items.length - 1 ? "" : "mb-4",
|
|
56
|
+
`c-rex-result-item c-rex-result-${itemType}`,
|
|
57
|
+
disabled && "c-rex-result-item-disabled",
|
|
58
|
+
)}
|
|
59
|
+
>
|
|
60
|
+
<div className="h-16 w-16 flex items-start">
|
|
61
|
+
<ImageRenditionContainer
|
|
62
|
+
itemShortId={item.shortId!}
|
|
63
|
+
imageRestrictions={imageRestrictions}
|
|
64
|
+
emptyImageStyle="h-16 w-16"
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div className="flex-1 p-2 flex flex-col">
|
|
69
|
+
<span className="text-sm text-muted-foreground">
|
|
70
|
+
{item.revision}
|
|
71
|
+
</span>
|
|
72
|
+
|
|
73
|
+
<span className="text-lg font-medium">
|
|
74
|
+
{disabled ? (
|
|
75
|
+
title
|
|
76
|
+
) : (
|
|
77
|
+
<a className="hover:underline" href={itemLink}>{title}</a>
|
|
78
|
+
)}
|
|
79
|
+
</span>
|
|
80
|
+
|
|
81
|
+
<span className="text-sm">
|
|
82
|
+
{itemType}
|
|
83
|
+
</span>
|
|
84
|
+
<span className="text-sm">
|
|
85
|
+
<HtmlRendition shortId={item.shortId!} />
|
|
86
|
+
</span>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div className="flex flex-col p-2 ml-auto justify-center">
|
|
90
|
+
<div className="flex gap-2">
|
|
91
|
+
<FileDownloadDropdown renditions={item.renditions} />
|
|
92
|
+
|
|
93
|
+
<FavoriteButton
|
|
94
|
+
id={item.shortId!}
|
|
95
|
+
type={itemType}
|
|
96
|
+
label={title}
|
|
97
|
+
/>
|
|
98
|
+
|
|
99
|
+
{multipleVersions.length > 1 && (
|
|
100
|
+
<Tooltip>
|
|
101
|
+
<TooltipTrigger asChild>
|
|
102
|
+
<Button variant="ghost" size="icon">
|
|
103
|
+
<FileStack />
|
|
104
|
+
</Button>
|
|
105
|
+
</TooltipTrigger>
|
|
106
|
+
<TooltipContent>
|
|
107
|
+
Available in: {multipleVersions.join(", ")}
|
|
108
|
+
</TooltipContent>
|
|
109
|
+
</Tooltip>
|
|
110
|
+
)}
|
|
111
|
+
|
|
112
|
+
{isDocument && (
|
|
113
|
+
<BookmarkButton
|
|
114
|
+
shortId={item.shortId!}
|
|
115
|
+
triggerVariant="ghost"
|
|
116
|
+
/>
|
|
117
|
+
)}
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
})}
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { FC, useState } from "react";
|
|
4
|
-
|
|
5
|
-
import Link from "next/link";
|
|
6
|
-
import { cn } from "@c-rex/utils";
|
|
7
|
-
import { Badge } from "@c-rex/ui/badge";
|
|
8
|
-
import { useTranslations } from "next-intl";
|
|
9
|
-
import { TopicsResponseItem } from "@c-rex/interfaces";
|
|
10
|
-
import { Card } from "@c-rex/ui/card";
|
|
11
|
-
import { useQueryState } from "nuqs";
|
|
12
|
-
|
|
13
|
-
interface
|
|
14
|
-
items: TopicsResponseItem[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const t = useTranslations("results")
|
|
19
|
-
const [isLoading, setLoading] = useState(true);
|
|
20
|
-
const [query] = useQueryState("search");
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div className="grid gap-6 grid-cols-2">
|
|
24
|
-
|
|
25
|
-
{items.map((item, index) => (
|
|
26
|
-
<Card
|
|
27
|
-
key={item.shortId}
|
|
28
|
-
className={cn(
|
|
29
|
-
`c-rex-result-item
|
|
30
|
-
index == 0
|
|
31
|
-
? "col-span-2 grid grid-cols-1 gap-3 md:grid-cols-2 md:gap-6"
|
|
32
|
-
: "flex flex-col space-y-2",
|
|
33
|
-
item.disabled ? "c-rex-result-item-disabled" : ""
|
|
34
|
-
)}
|
|
35
|
-
>
|
|
36
|
-
|
|
37
|
-
<div className={
|
|
38
|
-
cn(
|
|
39
|
-
"w-full overflow-hidden",
|
|
40
|
-
index == 0 ? "rounded-tl-xl rounded-bl-xl" : "rounded-t-xl"
|
|
41
|
-
)}>
|
|
42
|
-
{item.image && (
|
|
43
|
-
<img
|
|
44
|
-
src={item.image}
|
|
45
|
-
alt={item.title}
|
|
46
|
-
className={cn(
|
|
47
|
-
"size-full object-cover object-center",
|
|
48
|
-
isLoading ? "bg-gray-300 animate-pulse" : "",
|
|
49
|
-
)}
|
|
50
|
-
style={{
|
|
51
|
-
width: "100%", height: index == 0 ? "auto" : "190px"
|
|
52
|
-
}}
|
|
53
|
-
loading={index == 0 ? "eager" : "lazy"}
|
|
54
|
-
onLoad={() => setLoading(false)}
|
|
55
|
-
onError={() => setLoading(false)}
|
|
56
|
-
/>
|
|
57
|
-
)}
|
|
58
|
-
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<div
|
|
62
|
-
className={cn(
|
|
63
|
-
"flex flex-1 flex-col p-4",
|
|
64
|
-
index == 0 ? "justify-around" : "justify-between",
|
|
65
|
-
)}
|
|
66
|
-
>
|
|
67
|
-
<div className="w-full">
|
|
68
|
-
<h2 className="my-1.5 line-clamp-2 font-heading text-2xl">
|
|
69
|
-
{item.title}
|
|
70
|
-
</h2>
|
|
71
|
-
|
|
72
|
-
{item.type && (
|
|
73
|
-
<Badge variant="secondary">
|
|
74
|
-
{item.type}
|
|
75
|
-
</Badge>
|
|
76
|
-
)}
|
|
77
|
-
</div>
|
|
78
|
-
<div className="mt-4 flex items-end flex-row gap-2">
|
|
79
|
-
<p className="m-0 flex-1 text-sm text-muted-foreground">{item.description?.substring(0, 100)}...</p>
|
|
80
|
-
|
|
81
|
-
{item.created && (
|
|
82
|
-
<p className="m-0 text-sm text-muted-foreground">{item.created}</p>
|
|
83
|
-
)}
|
|
84
|
-
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
{!item.disabled && (
|
|
89
|
-
<Link href={`${item.link}?q=${query}`} className="absolute inset-0">
|
|
90
|
-
<span className="sr-only">{t("viewArticle")}</span>
|
|
91
|
-
</Link>
|
|
92
|
-
)}
|
|
93
|
-
</Card>
|
|
94
|
-
))}
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export default
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { FC, useState } from "react";
|
|
4
|
+
|
|
5
|
+
import Link from "next/link";
|
|
6
|
+
import { cn } from "@c-rex/utils";
|
|
7
|
+
import { Badge } from "@c-rex/ui/badge";
|
|
8
|
+
import { useTranslations } from "next-intl";
|
|
9
|
+
import { TopicsResponseItem } from "@c-rex/interfaces";
|
|
10
|
+
import { Card } from "@c-rex/ui/card";
|
|
11
|
+
import { useQueryState } from "nuqs";
|
|
12
|
+
|
|
13
|
+
interface InformationUnitSearchResultsCardsProps {
|
|
14
|
+
items: TopicsResponseItem[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const InformationUnitSearchResultsCards: FC<InformationUnitSearchResultsCardsProps> = ({ items }) => {
|
|
18
|
+
const t = useTranslations("results")
|
|
19
|
+
const [isLoading, setLoading] = useState(true);
|
|
20
|
+
const [query] = useQueryState("search");
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className="grid gap-6 grid-cols-2">
|
|
24
|
+
|
|
25
|
+
{items.map((item, index) => (
|
|
26
|
+
<Card
|
|
27
|
+
key={item.shortId}
|
|
28
|
+
className={cn(
|
|
29
|
+
`c-rex-result-item information-unit-search-results-card relative p-0 c-rex-result-${item.type.toLowerCase()}`,
|
|
30
|
+
index == 0
|
|
31
|
+
? "col-span-2 grid grid-cols-1 gap-3 md:grid-cols-2 md:gap-6"
|
|
32
|
+
: "flex flex-col space-y-2",
|
|
33
|
+
item.disabled ? "c-rex-result-item-disabled" : ""
|
|
34
|
+
)}
|
|
35
|
+
>
|
|
36
|
+
|
|
37
|
+
<div className={
|
|
38
|
+
cn(
|
|
39
|
+
"w-full overflow-hidden",
|
|
40
|
+
index == 0 ? "rounded-tl-xl rounded-bl-xl" : "rounded-t-xl"
|
|
41
|
+
)}>
|
|
42
|
+
{item.image && (
|
|
43
|
+
<img
|
|
44
|
+
src={item.image}
|
|
45
|
+
alt={item.title}
|
|
46
|
+
className={cn(
|
|
47
|
+
"size-full object-cover object-center",
|
|
48
|
+
isLoading ? "bg-gray-300 animate-pulse" : "",
|
|
49
|
+
)}
|
|
50
|
+
style={{
|
|
51
|
+
width: "100%", height: index == 0 ? "auto" : "190px"
|
|
52
|
+
}}
|
|
53
|
+
loading={index == 0 ? "eager" : "lazy"}
|
|
54
|
+
onLoad={() => setLoading(false)}
|
|
55
|
+
onError={() => setLoading(false)}
|
|
56
|
+
/>
|
|
57
|
+
)}
|
|
58
|
+
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div
|
|
62
|
+
className={cn(
|
|
63
|
+
"flex flex-1 flex-col p-4",
|
|
64
|
+
index == 0 ? "justify-around" : "justify-between",
|
|
65
|
+
)}
|
|
66
|
+
>
|
|
67
|
+
<div className="w-full">
|
|
68
|
+
<h2 className="my-1.5 line-clamp-2 font-heading text-2xl">
|
|
69
|
+
{item.title}
|
|
70
|
+
</h2>
|
|
71
|
+
|
|
72
|
+
{item.type && (
|
|
73
|
+
<Badge variant="secondary">
|
|
74
|
+
{item.type}
|
|
75
|
+
</Badge>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
<div className="mt-4 flex items-end flex-row gap-2">
|
|
79
|
+
<p className="m-0 flex-1 text-sm text-muted-foreground">{item.description?.substring(0, 100)}...</p>
|
|
80
|
+
|
|
81
|
+
{item.created && (
|
|
82
|
+
<p className="m-0 text-sm text-muted-foreground">{item.created}</p>
|
|
83
|
+
)}
|
|
84
|
+
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
{!item.disabled && (
|
|
89
|
+
<Link href={`${item.link}?q=${query}`} className="absolute inset-0">
|
|
90
|
+
<span className="sr-only">{t("viewArticle")}</span>
|
|
91
|
+
</Link>
|
|
92
|
+
)}
|
|
93
|
+
</Card>
|
|
94
|
+
))}
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default InformationUnitSearchResultsCards;
|