@c-rex/templates 0.1.29 → 0.1.30
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 +61 -66
- package/src/home/layout.tsx +63 -63
- package/src/home/page.tsx +376 -376
- package/src/home/page2.tsx +383 -383
- package/src/layout.tsx +70 -70
- package/src/utils.ts +48 -48
- package/src/articles/documents/layout.tsx +0 -74
- package/src/articles/documents/page.tsx +0 -79
- package/src/articles/topics/layout.tsx +0 -70
- package/src/articles/topics/page.tsx +0 -71
- package/src/articles/wrapper.tsx +0 -216
package/package.json
CHANGED
|
@@ -1,66 +1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@c-rex/templates",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"files": [
|
|
6
|
-
"src"
|
|
7
|
-
],
|
|
8
|
-
"sideEffects": false,
|
|
9
|
-
"publishConfig": {
|
|
10
|
-
"access": "public"
|
|
11
|
-
},
|
|
12
|
-
"exports": {
|
|
13
|
-
"./home/layout": {
|
|
14
|
-
"types": "./src/home/layout.tsx",
|
|
15
|
-
"import": "./src/home/layout.tsx"
|
|
16
|
-
},
|
|
17
|
-
"./
|
|
18
|
-
"types": "./src/
|
|
19
|
-
"import": "./src/
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"@c-rex/
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"react
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"peerDependencies": {
|
|
63
|
-
"react": "^18.3.1",
|
|
64
|
-
"react-dom": "^18.3.1"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@c-rex/templates",
|
|
3
|
+
"version": "0.1.30",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"src"
|
|
7
|
+
],
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
"./home/layout": {
|
|
14
|
+
"types": "./src/home/layout.tsx",
|
|
15
|
+
"import": "./src/home/layout.tsx"
|
|
16
|
+
},
|
|
17
|
+
"./layout": {
|
|
18
|
+
"types": "./src/layout.tsx",
|
|
19
|
+
"import": "./src/layout.tsx"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"lint": "eslint .",
|
|
24
|
+
"lint:fix": "eslint . --fix"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@c-rex/eslint-config": "*",
|
|
28
|
+
"@c-rex/typescript-config": "*",
|
|
29
|
+
"@turbo/gen": "^2.4.4",
|
|
30
|
+
"@types/node": "^22.13.10",
|
|
31
|
+
"@types/react": "19.0.10",
|
|
32
|
+
"@types/react-dom": "19.0.4",
|
|
33
|
+
"eslint": "^9.23.0",
|
|
34
|
+
"typescript": "latest"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@c-rex/components": "*",
|
|
38
|
+
"@c-rex/constants": "*",
|
|
39
|
+
"@c-rex/contexts": "*",
|
|
40
|
+
"@c-rex/core": "*",
|
|
41
|
+
"@c-rex/interfaces": "*",
|
|
42
|
+
"@c-rex/services": "*",
|
|
43
|
+
"@c-rex/types": "*",
|
|
44
|
+
"@c-rex/ui": "*",
|
|
45
|
+
"@c-rex/utils": "*",
|
|
46
|
+
"cheerio": "^1.1.0",
|
|
47
|
+
"i18next": "^25.1.3",
|
|
48
|
+
"next": "^14",
|
|
49
|
+
"next-intl": "^4.1.0",
|
|
50
|
+
"nuqs": "^2.4.3",
|
|
51
|
+
"react": "^18.3.1",
|
|
52
|
+
"react-dom": "^18.3.1",
|
|
53
|
+
"react-i18next": "^15.5.1",
|
|
54
|
+
"sonner": "^2.0.5",
|
|
55
|
+
"zustand": "^5.0.8"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"react": "^18.3.1",
|
|
59
|
+
"react-dom": "^18.3.1"
|
|
60
|
+
}
|
|
61
|
+
}
|
package/src/home/layout.tsx
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { HomePage } from "./page";
|
|
2
|
-
import { PageWrapper } from "@c-rex/components/page-wrapper";
|
|
3
|
-
import { OperatorType, WildCardType } from "@c-rex/types";
|
|
4
|
-
import { InformationUnitsService } from "@c-rex/services";
|
|
5
|
-
import { informationUnitsResponse } from "@c-rex/interfaces";
|
|
6
|
-
import { CrexSDK } from "@c-rex/core/sdk";
|
|
7
|
-
|
|
8
|
-
interface HomeProps {
|
|
9
|
-
searchParams: {
|
|
10
|
-
search?: string;
|
|
11
|
-
page: string;
|
|
12
|
-
language: string;
|
|
13
|
-
wildcard: string;
|
|
14
|
-
operator: string;
|
|
15
|
-
like: string;
|
|
16
|
-
packages?: string;
|
|
17
|
-
filter?: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const HomeLayout = async ({ searchParams }: HomeProps) => {
|
|
22
|
-
const { search, page, language, wildcard, operator, like, packages, filter } = searchParams;
|
|
23
|
-
const sdk = new CrexSDK();
|
|
24
|
-
const config = sdk.getServerConfig();
|
|
25
|
-
|
|
26
|
-
let data = {
|
|
27
|
-
items: [],
|
|
28
|
-
pageInfo: {
|
|
29
|
-
pageCount: 0,
|
|
30
|
-
pageNumber: 0
|
|
31
|
-
}
|
|
32
|
-
} as unknown as informationUnitsResponse;
|
|
33
|
-
|
|
34
|
-
if (search !== undefined) {
|
|
35
|
-
|
|
36
|
-
const filters: string[] = filter?.split(",") || []
|
|
37
|
-
const restrict: string[] = []
|
|
38
|
-
|
|
39
|
-
if (packages && packages.length > 0) {
|
|
40
|
-
restrict.push(`packages.shortId=${packages}`)
|
|
41
|
-
}
|
|
42
|
-
const service = new InformationUnitsService();
|
|
43
|
-
|
|
44
|
-
data = await service.getList({
|
|
45
|
-
queries: search,
|
|
46
|
-
page: Number(page),
|
|
47
|
-
fields: ["renditions", "class", "languages", "labels", "versionOf", "revision"],
|
|
48
|
-
languages: language.split(","),
|
|
49
|
-
wildcard: wildcard as WildCardType,
|
|
50
|
-
restrict: restrict,
|
|
51
|
-
operator: operator as OperatorType,
|
|
52
|
-
like: Boolean(like === "true"),
|
|
53
|
-
filters: filters,
|
|
54
|
-
tags: config.search.tags,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<PageWrapper>
|
|
60
|
-
<HomePage data={data} />
|
|
61
|
-
</PageWrapper>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
1
|
+
import { HomePage } from "./page";
|
|
2
|
+
import { PageWrapper } from "@c-rex/components/page-wrapper";
|
|
3
|
+
import { OperatorType, WildCardType } from "@c-rex/types";
|
|
4
|
+
import { InformationUnitsService } from "@c-rex/services";
|
|
5
|
+
import { informationUnitsResponse } from "@c-rex/interfaces";
|
|
6
|
+
import { CrexSDK } from "@c-rex/core/sdk";
|
|
7
|
+
|
|
8
|
+
interface HomeProps {
|
|
9
|
+
searchParams: {
|
|
10
|
+
search?: string;
|
|
11
|
+
page: string;
|
|
12
|
+
language: string;
|
|
13
|
+
wildcard: string;
|
|
14
|
+
operator: string;
|
|
15
|
+
like: string;
|
|
16
|
+
packages?: string;
|
|
17
|
+
filter?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const HomeLayout = async ({ searchParams }: HomeProps) => {
|
|
22
|
+
const { search, page, language, wildcard, operator, like, packages, filter } = searchParams;
|
|
23
|
+
const sdk = new CrexSDK();
|
|
24
|
+
const config = sdk.getServerConfig();
|
|
25
|
+
|
|
26
|
+
let data = {
|
|
27
|
+
items: [],
|
|
28
|
+
pageInfo: {
|
|
29
|
+
pageCount: 0,
|
|
30
|
+
pageNumber: 0
|
|
31
|
+
}
|
|
32
|
+
} as unknown as informationUnitsResponse;
|
|
33
|
+
|
|
34
|
+
if (search !== undefined) {
|
|
35
|
+
|
|
36
|
+
const filters: string[] = filter?.split(",") || []
|
|
37
|
+
const restrict: string[] = []
|
|
38
|
+
|
|
39
|
+
if (packages && packages.length > 0) {
|
|
40
|
+
restrict.push(`packages.shortId=${packages}`)
|
|
41
|
+
}
|
|
42
|
+
const service = new InformationUnitsService();
|
|
43
|
+
|
|
44
|
+
data = await service.getList({
|
|
45
|
+
queries: search,
|
|
46
|
+
page: Number(page),
|
|
47
|
+
fields: ["renditions", "class", "languages", "labels", "versionOf", "revision"],
|
|
48
|
+
languages: language.split(","),
|
|
49
|
+
wildcard: wildcard as WildCardType,
|
|
50
|
+
restrict: restrict,
|
|
51
|
+
operator: operator as OperatorType,
|
|
52
|
+
like: Boolean(like === "true"),
|
|
53
|
+
filters: filters,
|
|
54
|
+
tags: config.search.tags,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<PageWrapper>
|
|
60
|
+
<HomePage data={data} />
|
|
61
|
+
</PageWrapper>
|
|
62
|
+
);
|
|
63
|
+
};
|