@c-rex/templates 0.1.26 → 0.1.27
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/articles/wrapper.tsx +31 -30
- package/src/home/page.tsx +2 -2
- package/src/home/page2.tsx +2 -2
- package/src/layout.tsx +5 -4
- package/src/utils.ts +1 -1
- package/src/home/components/filter-sidebar.tsx +0 -105
package/package.json
CHANGED
package/src/articles/wrapper.tsx
CHANGED
|
@@ -6,11 +6,12 @@ import { LeftSidebar } from "@c-rex/components/left-sidebar";
|
|
|
6
6
|
import { RightSidebar } from "@c-rex/components/right-sidebar";
|
|
7
7
|
import { Breadcrumb } from "@c-rex/components/breadcrumb";
|
|
8
8
|
import { RenderArticle } from "@c-rex/components/render-article";
|
|
9
|
-
import { articleInfoItemType, DocumentsType
|
|
9
|
+
import { articleInfoItemType, DocumentsType } from "@c-rex/types";
|
|
10
10
|
import { AvailableVersionsInterface, TreeOfContent } from "@c-rex/interfaces";
|
|
11
11
|
import { Separator } from "@c-rex/ui/separator";
|
|
12
12
|
import { ArrowBigLeft, PanelRight, ArrowBigRight, FileSearchIcon, X, Search } from "lucide-react";
|
|
13
|
-
import { SearchInput } from "../../../components/src/
|
|
13
|
+
import { SearchInput } from "../../../components/src/search-input";
|
|
14
|
+
|
|
14
15
|
import { useMultiSidebar } from "@c-rex/ui/sidebar";
|
|
15
16
|
import { Button } from "@c-rex/ui/button";
|
|
16
17
|
import { useQueryState } from "nuqs";
|
|
@@ -106,36 +107,36 @@ export const ArticleWrapper = ({
|
|
|
106
107
|
<RenderArticle htmlContent={htmlContent} contentLang={articleLang} />
|
|
107
108
|
|
|
108
109
|
{/*
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
>
|
|
119
|
-
{item.id == id && (
|
|
120
|
-
<div className={cn(
|
|
121
|
-
"absolute -left-[16px] top-1/2 -translate-y-1/2 h-8 border-t-[16px] border-t-transparent border-b-[16px] border-b-transparent border-r-[16px]",
|
|
122
|
-
`border-r-${item.color}`,
|
|
123
|
-
)} />
|
|
124
|
-
)}
|
|
125
|
-
<a
|
|
126
|
-
href={`../topics/${item.id}`}
|
|
127
|
-
className="flex items-center justify-end h-8 opacity-0 group-hover:opacity-100 text-primary-foreground transition-all duration-300 text-right px-2"
|
|
110
|
+
<div className="absolute top-0 right-0 flex flex-col gap-2 items-end">
|
|
111
|
+
{favoritesList.map((item) => (
|
|
112
|
+
<div
|
|
113
|
+
key={item.id}
|
|
114
|
+
className={cn(
|
|
115
|
+
"group h-8 cursor-pointer w-4 hover:w-40 transition-all duration-300 relative",
|
|
116
|
+
`bg-${item.color}`,
|
|
117
|
+
item.id == id ? "rounded-r-sm" : "rounded-sm"
|
|
118
|
+
)}
|
|
128
119
|
>
|
|
129
|
-
|
|
130
|
-
className=
|
|
131
|
-
|
|
120
|
+
{item.id == id && (
|
|
121
|
+
<div className={cn(
|
|
122
|
+
"absolute -left-[16px] top-1/2 -translate-y-1/2 h-8 border-t-[16px] border-t-transparent border-b-[16px] border-b-transparent border-r-[16px]",
|
|
123
|
+
`border-r-${item.color}`,
|
|
124
|
+
)} />
|
|
125
|
+
)}
|
|
126
|
+
<a
|
|
127
|
+
href={`../topics/${item.id}`}
|
|
128
|
+
className="flex items-center justify-end h-8 opacity-0 group-hover:opacity-100 text-primary-foreground transition-all duration-300 text-right px-2"
|
|
132
129
|
>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
130
|
+
<span
|
|
131
|
+
className="text-right text-ellipsis overflow-hidden whitespace-nowrap"
|
|
132
|
+
title={item.label}
|
|
133
|
+
>
|
|
134
|
+
{item.label}
|
|
135
|
+
</span>
|
|
136
|
+
</a>
|
|
137
|
+
</div>
|
|
138
|
+
))}
|
|
139
|
+
</div>
|
|
139
140
|
*/}
|
|
140
141
|
</div>
|
|
141
142
|
|
package/src/home/page.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { parseAsBoolean, parseAsInteger, parseAsString, useQueryStates } from 'n
|
|
|
7
7
|
import { informationUnitsResponse } from "@c-rex/interfaces";
|
|
8
8
|
import { Button } from "@c-rex/ui/button";
|
|
9
9
|
import { Badge } from "@c-rex/ui/badge";
|
|
10
|
-
import {
|
|
10
|
+
import { ResultContainer } from "@c-rex/components/result-container";
|
|
11
11
|
import { DialogFilter } from "@c-rex/components/dialog-filter";
|
|
12
12
|
import { AutoComplete } from "@c-rex/components/autocomplete";
|
|
13
13
|
import { DEVICE_OPTIONS, OPERATOR_OPTIONS } from "@c-rex/constants";
|
|
@@ -366,7 +366,7 @@ export const HomePage: FC<HomePageProps> = ({ data }) => {
|
|
|
366
366
|
</Sheet>
|
|
367
367
|
|
|
368
368
|
<div className="flex-1">
|
|
369
|
-
<
|
|
369
|
+
<ResultContainer
|
|
370
370
|
items={data.items}
|
|
371
371
|
pagination={data.pageInfo}
|
|
372
372
|
/>
|
package/src/home/page2.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { parseAsBoolean, parseAsInteger, parseAsString, useQueryStates } from 'n
|
|
|
7
7
|
import { informationUnitsResponse } from "@c-rex/interfaces";
|
|
8
8
|
import { Button } from "@c-rex/ui/button";
|
|
9
9
|
import { Badge } from "@c-rex/ui/badge";
|
|
10
|
-
import {
|
|
10
|
+
import { ResultContainer } from "@c-rex/components/result-container";
|
|
11
11
|
import { DialogFilter } from "@c-rex/components/dialog-filter";
|
|
12
12
|
import { AutoComplete } from "@c-rex/components/autocomplete";
|
|
13
13
|
import { DEVICE_OPTIONS, OPERATOR_OPTIONS } from "@c-rex/constants";
|
|
@@ -373,7 +373,7 @@ export const HomePage: FC<HomePageProps> = ({ data }) => {
|
|
|
373
373
|
</Sheet>
|
|
374
374
|
|
|
375
375
|
<div className="flex-1">
|
|
376
|
-
<
|
|
376
|
+
<ResultContainer
|
|
377
377
|
items={data.items}
|
|
378
378
|
pagination={data.pageInfo}
|
|
379
379
|
/>
|
package/src/layout.tsx
CHANGED
|
@@ -8,8 +8,9 @@ import { cookies } from "next/headers";
|
|
|
8
8
|
import { CrexSDK } from "@c-rex/core/sdk";
|
|
9
9
|
import { getIssuerMetadata } from "@c-rex/core/OIDC";
|
|
10
10
|
import { resolveUILanguage, resolveContentLanguage } from "./utils";
|
|
11
|
-
import {
|
|
11
|
+
import { informationUnitsLanguagesServer } from "@c-rex/services/server-requests";
|
|
12
12
|
import { CONTENT_LANG_KEY, UI_LANG_KEY } from "@c-rex/constants";
|
|
13
|
+
import { transformLanguageData } from "@c-rex/utils";
|
|
13
14
|
|
|
14
15
|
interface DefaultRootLayoutProps {
|
|
15
16
|
children: React.ReactNode;
|
|
@@ -23,7 +24,6 @@ export const DefaultRootLayout = async ({ children }: DefaultRootLayoutProps) =>
|
|
|
23
24
|
const uiLangCookie = cookieStore.get(UI_LANG_KEY)?.value ?? null;
|
|
24
25
|
const clientConfigs = sdk.getClientConfig();
|
|
25
26
|
const serverConfigs = sdk.getServerConfig();
|
|
26
|
-
const languageService = new LanguageService()
|
|
27
27
|
const contentLangCookie = cookieStore.get(CONTENT_LANG_KEY)?.value ?? null;
|
|
28
28
|
|
|
29
29
|
sdk.updateConfigProp('OIDC', {
|
|
@@ -31,7 +31,8 @@ export const DefaultRootLayout = async ({ children }: DefaultRootLayoutProps) =>
|
|
|
31
31
|
issuerMetadata: metadata
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const data = await informationUnitsLanguagesServer();
|
|
35
|
+
const availableLanguages = transformLanguageData(data as { value: string; score: number; }[]);
|
|
35
36
|
|
|
36
37
|
const uiLang = resolveUILanguage({
|
|
37
38
|
uiLangCookie,
|
|
@@ -66,4 +67,4 @@ export const DefaultRootLayout = async ({ children }: DefaultRootLayoutProps) =>
|
|
|
66
67
|
</html>
|
|
67
68
|
</NuqsAdapter>
|
|
68
69
|
);
|
|
69
|
-
}
|
|
70
|
+
};
|
package/src/utils.ts
CHANGED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React, { FC } from "react";
|
|
4
|
-
import { useTranslations } from 'next-intl'
|
|
5
|
-
import { Check, ChevronDown } from "lucide-react"
|
|
6
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@c-rex/ui/collapsible";
|
|
7
|
-
import {
|
|
8
|
-
SidebarContent,
|
|
9
|
-
SidebarGroup,
|
|
10
|
-
SidebarGroupContent,
|
|
11
|
-
SidebarGroupLabel,
|
|
12
|
-
SidebarHeader,
|
|
13
|
-
SidebarMenu,
|
|
14
|
-
SidebarMenuSub,
|
|
15
|
-
SidebarMenuSubButton,
|
|
16
|
-
SidebarMenuSubItem
|
|
17
|
-
} from "@c-rex/ui/sidebar";
|
|
18
|
-
import { useBreakpoint } from "@c-rex/ui/hooks";
|
|
19
|
-
import { DEVICE_OPTIONS } from "@c-rex/constants";
|
|
20
|
-
import { SheetContent, SheetHeader } from "@c-rex/ui/sheet";
|
|
21
|
-
|
|
22
|
-
interface FilterSidebarProps {
|
|
23
|
-
tags: { [key: string]: any[] }
|
|
24
|
-
totalItemCount: number
|
|
25
|
-
updateFilterParam: (key: string, item: any) => void
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const FilterSidebar: FC<FilterSidebarProps> = ({ tags, totalItemCount, updateFilterParam }) => {
|
|
29
|
-
const t = useTranslations();
|
|
30
|
-
const device = useBreakpoint();
|
|
31
|
-
const isMobile = device !== null && (device === DEVICE_OPTIONS.MOBILE);
|
|
32
|
-
|
|
33
|
-
if (Object.keys(tags).length === 0) return null;
|
|
34
|
-
|
|
35
|
-
const content = (
|
|
36
|
-
<SidebarContent className="!gap-0">
|
|
37
|
-
|
|
38
|
-
{Object.entries(tags).map(([key, value]: any) => (
|
|
39
|
-
|
|
40
|
-
<Collapsible defaultOpen key={key} className="py-0 group/collapsible">
|
|
41
|
-
<SidebarGroup>
|
|
42
|
-
|
|
43
|
-
<SidebarGroupLabel asChild className="hover:bg-sidebar-accent text-sidebar-accent-foreground text-sm font-bold">
|
|
44
|
-
<CollapsibleTrigger className="!h-9">
|
|
45
|
-
{t(`filter.tags.${key}`)}
|
|
46
|
-
<ChevronDown className="ml-auto transition-transform group-data-[state=open]/collapsible:rotate-180" />
|
|
47
|
-
</CollapsibleTrigger>
|
|
48
|
-
</SidebarGroupLabel>
|
|
49
|
-
|
|
50
|
-
<CollapsibleContent>
|
|
51
|
-
<SidebarGroupContent>
|
|
52
|
-
<SidebarMenu>
|
|
53
|
-
<SidebarMenuSub>
|
|
54
|
-
{value.map((item: any) => (
|
|
55
|
-
<SidebarMenuSubItem key={item.shortId}>
|
|
56
|
-
<SidebarMenuSubButton
|
|
57
|
-
className="cursor-pointer"
|
|
58
|
-
isActive={item.active}
|
|
59
|
-
onClick={() => updateFilterParam(key, item)}
|
|
60
|
-
>
|
|
61
|
-
{item.label} ({item.hits}/{item.total})
|
|
62
|
-
{item.active && <Check className="ml-2" />}
|
|
63
|
-
</SidebarMenuSubButton>
|
|
64
|
-
</SidebarMenuSubItem>
|
|
65
|
-
))}
|
|
66
|
-
</SidebarMenuSub>
|
|
67
|
-
</SidebarMenu>
|
|
68
|
-
</SidebarGroupContent>
|
|
69
|
-
</CollapsibleContent>
|
|
70
|
-
</SidebarGroup>
|
|
71
|
-
</Collapsible>
|
|
72
|
-
))}
|
|
73
|
-
</SidebarContent>
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
if (isMobile) {
|
|
77
|
-
return (
|
|
78
|
-
|
|
79
|
-
<SheetContent
|
|
80
|
-
side="left"
|
|
81
|
-
className="!pt-6 !px-2 w-[400px] overflow-y-auto"
|
|
82
|
-
>
|
|
83
|
-
<SheetHeader className="justify-center items-end font-bold">
|
|
84
|
-
{t("filter.filters")}
|
|
85
|
-
<span className="text-xs text-muted-foreground leading-5">
|
|
86
|
-
{totalItemCount} {t("results.results")}
|
|
87
|
-
</span>
|
|
88
|
-
</SheetHeader>
|
|
89
|
-
{content}
|
|
90
|
-
</SheetContent>
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<div className="w-60 lg:w-80 bg-sidebar rounded-md border pb-4">
|
|
96
|
-
<SidebarHeader className="justify-center items-end font-bold">
|
|
97
|
-
{t("filter.filters")}
|
|
98
|
-
<span className="text-xs text-muted-foreground leading-5">
|
|
99
|
-
{totalItemCount} {t("results.results")}
|
|
100
|
-
</span>
|
|
101
|
-
</SidebarHeader>
|
|
102
|
-
{content}
|
|
103
|
-
</div>
|
|
104
|
-
);
|
|
105
|
-
};
|