@yimingliao/cms 0.0.155 → 0.0.157
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/dist/export/client/components/resources/index.js +17 -0
- package/dist/src/client/applications/resources/seo-metadata/seo-metadata-empty-translation.js +54 -0
- package/dist/src/client/applications/resources/seo-metadata/use-upsert-form-data.js +15 -0
- package/dist/src/client/interfaces/components/resources/category/category-relations-section.js +3 -11
- package/dist/src/client/interfaces/components/resources/folder/file-manager/file-manager-header.js +115 -0
- package/dist/src/client/interfaces/components/resources/folder/file-manager-list.js +127 -0
- package/dist/src/client/interfaces/components/resources/folder/folder-card.js +62 -0
- package/dist/src/client/interfaces/components/resources/folder/folder-full-path.js +40 -0
- package/dist/src/client/interfaces/components/resources/folder/folder-list.js +156 -0
- package/dist/src/client/interfaces/components/resources/folder/folder-relations-section.js +75 -0
- package/dist/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/base-tags.js +187 -0
- package/dist/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/json-ld-tags.js +78 -0
- package/dist/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/open-graph-tags.js +441 -0
- package/dist/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/twitter-tags.js +125 -0
- package/dist/src/client/interfaces/components/resources/seo-metadata/seo-form/reference-card.js +85 -0
- package/dist/src/client/interfaces/components/resources/seo-metadata/seo-form/seo-form-side-fields.js +56 -0
- package/dist/src/client/interfaces/components/resources/seo-metadata/seo-form/seo-form.js +186 -0
- package/dist/src/client/interfaces/components/resources/seo-metadata/seo-metadata-dialog.js +69 -0
- package/dist/src/client/interfaces/components/resources/tag/tag-card.js +78 -0
- package/dist/src/client/interfaces/components/resources/tag/tag-list.js +142 -0
- package/dist/src/client/interfaces/components/resources/tag/tag-relations-section.js +70 -0
- package/dist/src/client/interfaces/components/resources/topic/topic-card.js +91 -0
- package/dist/src/client/interfaces/components/resources/topic/topic-list.js +141 -0
- package/dist/src/client/interfaces/components/resources/topic/topic-relations-section.js +104 -0
- package/dist/types/export/client/components/resources/index.d.ts +1 -1
- package/dist/types/export/client/components/resources/index.d.ts.map +1 -1
- package/dist/types/src/client/applications/resources/seo-metadata/index.d.ts +2 -0
- package/dist/types/src/client/applications/resources/seo-metadata/index.d.ts.map +1 -0
- package/dist/types/src/client/applications/resources/seo-metadata/seo-metadata-empty-translation.d.ts +34 -0
- package/dist/types/src/client/applications/resources/seo-metadata/seo-metadata-empty-translation.d.ts.map +1 -0
- package/dist/types/src/client/applications/resources/seo-metadata/use-upsert-form-data.d.ts +79 -0
- package/dist/types/src/client/applications/resources/seo-metadata/use-upsert-form-data.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/category/category-relations-section.d.ts.map +1 -1
- package/dist/types/src/client/interfaces/components/resources/file/file-list.d.ts +1 -1
- package/dist/types/src/client/interfaces/components/resources/file/file-list.d.ts.map +1 -1
- package/dist/types/src/client/interfaces/components/resources/folder/file-manager/file-manager-header.d.ts +8 -0
- package/dist/types/src/client/interfaces/components/resources/folder/file-manager/file-manager-header.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/folder/file-manager-list.d.ts +28 -0
- package/dist/types/src/client/interfaces/components/resources/folder/file-manager-list.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/folder/folder-card.d.ts +13 -0
- package/dist/types/src/client/interfaces/components/resources/folder/folder-card.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/folder/folder-full-path.d.ts +9 -0
- package/dist/types/src/client/interfaces/components/resources/folder/folder-full-path.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/folder/folder-list.d.ts +26 -0
- package/dist/types/src/client/interfaces/components/resources/folder/folder-list.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/folder/folder-relations-section.d.ts +10 -0
- package/dist/types/src/client/interfaces/components/resources/folder/folder-relations-section.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/folder/index.d.ts +6 -0
- package/dist/types/src/client/interfaces/components/resources/folder/index.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/index.d.ts +4 -0
- package/dist/types/src/client/interfaces/components/resources/index.d.ts.map +1 -1
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/index.d.ts +3 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/index.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/base-tags.d.ts +11 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/base-tags.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/index.d.ts +5 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/index.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/json-ld-tags.d.ts +9 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/json-ld-tags.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/open-graph-tags.d.ts +13 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/open-graph-tags.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/twitter-tags.d.ts +9 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/fields/twitter-tags.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/index.d.ts +3 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/index.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/reference-card.d.ts +2 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/reference-card.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/seo-form-side-fields.d.ts +8 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/seo-form-side-fields.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/seo-form.d.ts +28 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-form/seo-form.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-metadata-dialog.d.ts +11 -0
- package/dist/types/src/client/interfaces/components/resources/seo-metadata/seo-metadata-dialog.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/tag/index.d.ts +4 -0
- package/dist/types/src/client/interfaces/components/resources/tag/index.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/tag/tag-card.d.ts +11 -0
- package/dist/types/src/client/interfaces/components/resources/tag/tag-card.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/tag/tag-list.d.ts +18 -0
- package/dist/types/src/client/interfaces/components/resources/tag/tag-list.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/tag/tag-relations-section.d.ts +9 -0
- package/dist/types/src/client/interfaces/components/resources/tag/tag-relations-section.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/topic/index.d.ts +4 -0
- package/dist/types/src/client/interfaces/components/resources/topic/index.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/topic/topic-card.d.ts +11 -0
- package/dist/types/src/client/interfaces/components/resources/topic/topic-card.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/topic/topic-list.d.ts +17 -0
- package/dist/types/src/client/interfaces/components/resources/topic/topic-list.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/topic/topic-relations-section.d.ts +12 -0
- package/dist/types/src/client/interfaces/components/resources/topic/topic-relations-section.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -6,6 +6,11 @@ export { AdminRefreshTokenCard } from '../../../../src/client/interfaces/compone
|
|
|
6
6
|
export { createFileCard } from '../../../../src/client/interfaces/components/resources/file/file-card.js';
|
|
7
7
|
export { createFileList } from '../../../../src/client/interfaces/components/resources/file/file-list.js';
|
|
8
8
|
export { createFileRelationsSection } from '../../../../src/client/interfaces/components/resources/file/file-relations-section.js';
|
|
9
|
+
export { FolderCard } from '../../../../src/client/interfaces/components/resources/folder/folder-card.js';
|
|
10
|
+
export { createFolderList } from '../../../../src/client/interfaces/components/resources/folder/folder-list.js';
|
|
11
|
+
export { createFolderRelationsSection } from '../../../../src/client/interfaces/components/resources/folder/folder-relations-section.js';
|
|
12
|
+
export { createFileManagerList } from '../../../../src/client/interfaces/components/resources/folder/file-manager-list.js';
|
|
13
|
+
export { FolderFullPath } from '../../../../src/client/interfaces/components/resources/folder/folder-full-path.js';
|
|
9
14
|
export { createPostCard } from '../../../../src/client/interfaces/components/resources/post/post-card.js';
|
|
10
15
|
export { createPostList } from '../../../../src/client/interfaces/components/resources/post/post-list.js';
|
|
11
16
|
export { createPostRelationsSection } from '../../../../src/client/interfaces/components/resources/post/post-relations-section.js';
|
|
@@ -15,3 +20,15 @@ export { PostTypeGate } from '../../../../src/client/interfaces/components/resou
|
|
|
15
20
|
export { CategoryCard } from '../../../../src/client/interfaces/components/resources/category/category-card.js';
|
|
16
21
|
export { createCategoryList } from '../../../../src/client/interfaces/components/resources/category/category-list.js';
|
|
17
22
|
export { createCategoryRelationsSection } from '../../../../src/client/interfaces/components/resources/category/category-relations-section.js';
|
|
23
|
+
export { TopicCard } from '../../../../src/client/interfaces/components/resources/topic/topic-card.js';
|
|
24
|
+
export { createTopicList } from '../../../../src/client/interfaces/components/resources/topic/topic-list.js';
|
|
25
|
+
export { createTopicRelationsSection } from '../../../../src/client/interfaces/components/resources/topic/topic-relations-section.js';
|
|
26
|
+
export { TagCard } from '../../../../src/client/interfaces/components/resources/tag/tag-card.js';
|
|
27
|
+
export { createTagList } from '../../../../src/client/interfaces/components/resources/tag/tag-list.js';
|
|
28
|
+
export { createTagRelationsSection } from '../../../../src/client/interfaces/components/resources/tag/tag-relations-section.js';
|
|
29
|
+
export { createSeoMetadataDialog } from '../../../../src/client/interfaces/components/resources/seo-metadata/seo-metadata-dialog.js';
|
|
30
|
+
export { createSeoForm } from '../../../../src/client/interfaces/components/resources/seo-metadata/seo-form/seo-form.js';
|
|
31
|
+
export { createBaseTags } from '../../../../src/client/interfaces/components/resources/seo-metadata/seo-form/fields/base-tags.js';
|
|
32
|
+
export { createOpenGraphTags } from '../../../../src/client/interfaces/components/resources/seo-metadata/seo-form/fields/open-graph-tags.js';
|
|
33
|
+
export { createTwitterTags } from '../../../../src/client/interfaces/components/resources/seo-metadata/seo-form/fields/twitter-tags.js';
|
|
34
|
+
export { createJsonLdTags } from '../../../../src/client/interfaces/components/resources/seo-metadata/seo-form/fields/json-ld-tags.js';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function createSeoMetadataEmptyTranslation(buildTranslations) {
|
|
2
|
+
return buildTranslations([
|
|
3
|
+
// -----------------------------------------------------------------------
|
|
4
|
+
// Basic
|
|
5
|
+
// -----------------------------------------------------------------------
|
|
6
|
+
{ key: "title", value: null },
|
|
7
|
+
{ key: "description", value: null },
|
|
8
|
+
// identity
|
|
9
|
+
{ key: "author", value: null },
|
|
10
|
+
// url
|
|
11
|
+
{ key: "canonical", value: null },
|
|
12
|
+
{ key: "alternate", value: [] },
|
|
13
|
+
// robots
|
|
14
|
+
{ key: "robots", value: null },
|
|
15
|
+
// -----------------------------------------------------------------------
|
|
16
|
+
// Open Graph
|
|
17
|
+
// -----------------------------------------------------------------------
|
|
18
|
+
{ key: "ogTitle", value: null },
|
|
19
|
+
{ key: "ogDescription", value: null },
|
|
20
|
+
// url
|
|
21
|
+
{ key: "ogUrl", value: null },
|
|
22
|
+
// identity
|
|
23
|
+
{ key: "ogType", value: null },
|
|
24
|
+
{ key: "ogSiteName", value: null },
|
|
25
|
+
// image
|
|
26
|
+
{ key: "ogImage", value: null },
|
|
27
|
+
{ key: "ogImageAlt", value: null },
|
|
28
|
+
{ key: "ogImageType", value: null },
|
|
29
|
+
{ key: "ogImageWidth", value: 0 },
|
|
30
|
+
{ key: "ogImageHeight", value: 0 },
|
|
31
|
+
// locale
|
|
32
|
+
{ key: "ogLocale", value: null },
|
|
33
|
+
{ key: "ogLocaleAlternate", value: [] },
|
|
34
|
+
// article
|
|
35
|
+
{ key: "ogArticlePublishedTime", value: null },
|
|
36
|
+
{ key: "ogArticleModifiedTime", value: null },
|
|
37
|
+
{ key: "ogArticleAuthor", value: null },
|
|
38
|
+
{ key: "ogArticleSection", value: null },
|
|
39
|
+
{ key: "ogArticleTag", value: [] },
|
|
40
|
+
// -----------------------------------------------------------------------
|
|
41
|
+
// Twitter
|
|
42
|
+
// -----------------------------------------------------------------------
|
|
43
|
+
{ key: "twitterCard", value: null },
|
|
44
|
+
// identity
|
|
45
|
+
{ key: "twitterSite", value: null },
|
|
46
|
+
{ key: "twitterCreator", value: null },
|
|
47
|
+
// -----------------------------------------------------------------------
|
|
48
|
+
// JSON-LD
|
|
49
|
+
// -----------------------------------------------------------------------
|
|
50
|
+
{ key: "jsonLd", value: [] }
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { createSeoMetadataEmptyTranslation };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { createSeoMetadataEmptyTranslation } from './seo-metadata-empty-translation.js';
|
|
3
|
+
|
|
4
|
+
function useSeoMetadataUpsertFormData({
|
|
5
|
+
id,
|
|
6
|
+
buildTranslations
|
|
7
|
+
}) {
|
|
8
|
+
const [formData, setFormData] = useState(() => ({
|
|
9
|
+
postId: id ?? "",
|
|
10
|
+
translations: createSeoMetadataEmptyTranslation(buildTranslations)
|
|
11
|
+
}));
|
|
12
|
+
return { formData, setFormData };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { useSeoMetadataUpsertFormData };
|
package/dist/src/client/interfaces/components/resources/category/category-relations-section.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useTranslator } from 'intor/react';
|
|
4
3
|
import 'mime-types';
|
|
5
4
|
import { ensureArray } from '../../../../../shared/utils/ensure-array.js';
|
|
5
|
+
import 'intor/react';
|
|
6
6
|
import 'lucide-react';
|
|
7
7
|
import 'react';
|
|
8
8
|
import 'ua-parser-js';
|
|
@@ -40,15 +40,8 @@ function createCategoryRelationsSection({
|
|
|
40
40
|
}) {
|
|
41
41
|
return function CategoryRelationsSection({
|
|
42
42
|
category,
|
|
43
|
-
usableFields = [
|
|
44
|
-
"isActive",
|
|
45
|
-
"isIndexActive",
|
|
46
|
-
"isSlugActive",
|
|
47
|
-
"isFeatured",
|
|
48
|
-
"isShownOnHome"
|
|
49
|
-
]
|
|
43
|
+
usableFields = ["isActive", "isIndexActive", "isSlugActive"]
|
|
50
44
|
}) {
|
|
51
|
-
const { t } = useTranslator();
|
|
52
45
|
const posts = ensureArray(category?.children);
|
|
53
46
|
return /* @__PURE__ */ jsx(AccordionContainer, { children: /* @__PURE__ */ jsx(
|
|
54
47
|
Accordion,
|
|
@@ -56,8 +49,7 @@ function createCategoryRelationsSection({
|
|
|
56
49
|
hasBorder: true,
|
|
57
50
|
accordionHeaderProps: {
|
|
58
51
|
count: posts.length,
|
|
59
|
-
isRelated: true
|
|
60
|
-
children: t("resources.post.text")
|
|
52
|
+
isRelated: true
|
|
61
53
|
},
|
|
62
54
|
children: /* @__PURE__ */ jsx(
|
|
63
55
|
PostList,
|
package/dist/src/client/interfaces/components/resources/folder/file-manager/file-manager-header.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslator } from 'intor/react';
|
|
4
|
+
import { ArrowUp, Folder } from 'lucide-react';
|
|
5
|
+
import { PATHS } from '../../../../../../constants/paths/index.js';
|
|
6
|
+
import '../../../../../../constants/redirect-paths.js';
|
|
7
|
+
import '../../../../../../domain/resources/admin/constants.js';
|
|
8
|
+
import { normalizeFolderKey } from '../../../../../../domain/resources/folder/utils/normalize-folder-key.js';
|
|
9
|
+
import { ROOT_FOLDER_NAME } from '../../../../../../domain/resources/constants.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import 'ua-parser-js';
|
|
12
|
+
import { cn } from '../../../../../applications/shadcn/utils.js';
|
|
13
|
+
import 'next/navigation';
|
|
14
|
+
import '@radix-ui/react-avatar';
|
|
15
|
+
import '../../../shadcn/badge.js';
|
|
16
|
+
import '../../../shadcn/button.js';
|
|
17
|
+
import '@radix-ui/react-collapsible';
|
|
18
|
+
import '@radix-ui/react-dialog';
|
|
19
|
+
import '@radix-ui/react-dropdown-menu';
|
|
20
|
+
import '../../../shadcn/input-group.js';
|
|
21
|
+
import '../../../shadcn/item.js';
|
|
22
|
+
import '@radix-ui/react-label';
|
|
23
|
+
import '@radix-ui/react-select';
|
|
24
|
+
import '@radix-ui/react-separator';
|
|
25
|
+
import '../../../shadcn/sidebar.js';
|
|
26
|
+
import 'next-themes';
|
|
27
|
+
import 'sonner';
|
|
28
|
+
import '@radix-ui/react-tabs';
|
|
29
|
+
import '@radix-ui/react-tooltip';
|
|
30
|
+
import { Button } from '../../../ui/buttons/button.js';
|
|
31
|
+
import { ReturnButton } from '../../../ui/buttons/return-button.js';
|
|
32
|
+
import 'next/link';
|
|
33
|
+
import 'mime-types';
|
|
34
|
+
import 'next/image';
|
|
35
|
+
|
|
36
|
+
function FileManagerHeader({
|
|
37
|
+
folder,
|
|
38
|
+
folderKey
|
|
39
|
+
}) {
|
|
40
|
+
const { t } = useTranslator();
|
|
41
|
+
const { folderKeys, segments, parentKey } = normalizeFolderKey(folderKey);
|
|
42
|
+
const partialTags = folderKeys.map((key, index) => ({
|
|
43
|
+
key,
|
|
44
|
+
title: segments[index]
|
|
45
|
+
}));
|
|
46
|
+
const isAtRoot = folderKeys.length === 0;
|
|
47
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex gap-6", children: [
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
ReturnButton,
|
|
50
|
+
{
|
|
51
|
+
icon: ArrowUp,
|
|
52
|
+
onClick: () => globalThis.history.pushState({}, "", `?folderKey=${parentKey}`),
|
|
53
|
+
isDisabled: isAtRoot,
|
|
54
|
+
children: t("main.file-manager.back.text")
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
58
|
+
/* @__PURE__ */ jsxs(
|
|
59
|
+
Button,
|
|
60
|
+
{
|
|
61
|
+
size: "sm",
|
|
62
|
+
href: `${PATHS.resources.folder.path}/${folder?.id}`,
|
|
63
|
+
openNewTab: true,
|
|
64
|
+
variant: "outline",
|
|
65
|
+
className: "w-fit rounded-full text-xs",
|
|
66
|
+
isLoading: !folder,
|
|
67
|
+
isDisabled: folder?.name === ROOT_FOLDER_NAME,
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsx(Folder, {}),
|
|
70
|
+
folder?.name === ROOT_FOLDER_NAME ? t("resources.folder.root.text") : folder?.name
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-6 items-center text-xs", children: [
|
|
75
|
+
/* @__PURE__ */ jsxs("label", { className: "opacity-75", children: [
|
|
76
|
+
t("main.file-manager.current-path.text"),
|
|
77
|
+
"\uFF1A"
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
Button,
|
|
81
|
+
{
|
|
82
|
+
size: "xs",
|
|
83
|
+
variant: "ghost",
|
|
84
|
+
onClick: () => globalThis.history.pushState({}, "", `?folderKey=`),
|
|
85
|
+
className: cn(isAtRoot && "pointer-events-none opacity-50"),
|
|
86
|
+
children: t("resources.folder.root.text")
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm opacity-50", children: "/" }),
|
|
90
|
+
partialTags.map(({ key: currentKey, title }) => /* @__PURE__ */ jsxs("div", { className: "flex-center", children: [
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
Button,
|
|
93
|
+
{
|
|
94
|
+
size: "xs",
|
|
95
|
+
variant: "ghost",
|
|
96
|
+
onClick: () => globalThis.history.pushState(
|
|
97
|
+
{},
|
|
98
|
+
"",
|
|
99
|
+
`?folderKey=${currentKey}`
|
|
100
|
+
),
|
|
101
|
+
isDisabled: currentKey === folderKey,
|
|
102
|
+
children: /* @__PURE__ */ jsxs("span", { children: [
|
|
103
|
+
" ",
|
|
104
|
+
title
|
|
105
|
+
] })
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
/* @__PURE__ */ jsx("span", { children: currentKey && `/` })
|
|
109
|
+
] }, currentKey + title))
|
|
110
|
+
] })
|
|
111
|
+
] })
|
|
112
|
+
] });
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { FileManagerHeader };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslator } from 'intor/react';
|
|
4
|
+
import { useSearchParams } from 'next/navigation';
|
|
5
|
+
import '../../../../../constants/paths/auth.js';
|
|
6
|
+
import '../../../../../constants/paths/main.js';
|
|
7
|
+
import '../../../../../constants/paths/resources.js';
|
|
8
|
+
import { CACHE_KEYS } from '../../../../../constants/cache-keys.js';
|
|
9
|
+
import '../../../../../constants/redirect-paths.js';
|
|
10
|
+
import '../../../../../domain/resources/admin/constants.js';
|
|
11
|
+
import { fileManagerDoubleClick } from '../../../../../domain/resources/folder/utils/file-manager-double-click.js';
|
|
12
|
+
import 'mime-types';
|
|
13
|
+
import { DO_NOT_FETCH_KEY } from '../../../../../shared/list-items.js';
|
|
14
|
+
import 'lucide-react';
|
|
15
|
+
import 'react';
|
|
16
|
+
import 'ua-parser-js';
|
|
17
|
+
import 'clsx';
|
|
18
|
+
import 'tailwind-merge';
|
|
19
|
+
import '@radix-ui/react-avatar';
|
|
20
|
+
import '../../shadcn/badge.js';
|
|
21
|
+
import '../../shadcn/button.js';
|
|
22
|
+
import '@radix-ui/react-collapsible';
|
|
23
|
+
import '@radix-ui/react-dialog';
|
|
24
|
+
import '@radix-ui/react-dropdown-menu';
|
|
25
|
+
import '../../shadcn/input-group.js';
|
|
26
|
+
import '../../shadcn/item.js';
|
|
27
|
+
import '@radix-ui/react-label';
|
|
28
|
+
import '@radix-ui/react-select';
|
|
29
|
+
import '@radix-ui/react-separator';
|
|
30
|
+
import '../../shadcn/sidebar.js';
|
|
31
|
+
import 'next-themes';
|
|
32
|
+
import 'sonner';
|
|
33
|
+
import '@radix-ui/react-tabs';
|
|
34
|
+
import '@radix-ui/react-tooltip';
|
|
35
|
+
import 'next/link';
|
|
36
|
+
import { Accordion } from '../../ui/features/accordion/accordion.js';
|
|
37
|
+
import 'next/image';
|
|
38
|
+
import { FileManagerHeader } from './file-manager/file-manager-header.js';
|
|
39
|
+
|
|
40
|
+
function createFileManagerList({
|
|
41
|
+
useQuery,
|
|
42
|
+
folderFindFullAction,
|
|
43
|
+
FolderList,
|
|
44
|
+
FileList
|
|
45
|
+
}) {
|
|
46
|
+
return function FileManagerList({
|
|
47
|
+
// Item states (Folder)
|
|
48
|
+
folderStates,
|
|
49
|
+
setFolderStates,
|
|
50
|
+
// Use In File Manager Page (Files)
|
|
51
|
+
showFiles,
|
|
52
|
+
fileStates,
|
|
53
|
+
setFileStates,
|
|
54
|
+
// Pick Mode (Folder List Modal)
|
|
55
|
+
pickedItems,
|
|
56
|
+
handleClick,
|
|
57
|
+
isInModal,
|
|
58
|
+
excludeId
|
|
59
|
+
}) {
|
|
60
|
+
const { t } = useTranslator();
|
|
61
|
+
const key = useSearchParams().get("folderKey") ?? "";
|
|
62
|
+
const { data: folder } = useQuery(
|
|
63
|
+
() => folderFindFullAction({ key }),
|
|
64
|
+
[CACHE_KEYS.folder.findByKey, key],
|
|
65
|
+
{ select: (data) => data?.folder }
|
|
66
|
+
);
|
|
67
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col gap-4", children: [
|
|
68
|
+
/* @__PURE__ */ jsx(FileManagerHeader, { folder: folder ?? null, folderKey: key }),
|
|
69
|
+
!folderStates && /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
70
|
+
FolderList,
|
|
71
|
+
{
|
|
72
|
+
parentFolderId: folder?.id ?? DO_NOT_FETCH_KEY,
|
|
73
|
+
setItemStates: setFolderStates,
|
|
74
|
+
isInFileManager: true,
|
|
75
|
+
pickedItems,
|
|
76
|
+
handleClick,
|
|
77
|
+
handleDoubleClick: fileManagerDoubleClick,
|
|
78
|
+
excludeId,
|
|
79
|
+
isInModal
|
|
80
|
+
}
|
|
81
|
+
) }),
|
|
82
|
+
folderStates && /* @__PURE__ */ jsx(
|
|
83
|
+
Accordion,
|
|
84
|
+
{
|
|
85
|
+
accordionHeaderProps: {
|
|
86
|
+
children: t("resources.folder.text"),
|
|
87
|
+
count: folderStates.count ?? 0
|
|
88
|
+
},
|
|
89
|
+
initialOpen: true,
|
|
90
|
+
deps: [folderStates.isFetching],
|
|
91
|
+
children: /* @__PURE__ */ jsx(
|
|
92
|
+
FolderList,
|
|
93
|
+
{
|
|
94
|
+
parentFolderId: folder?.id ?? DO_NOT_FETCH_KEY,
|
|
95
|
+
setItemStates: setFolderStates,
|
|
96
|
+
isInFileManager: true,
|
|
97
|
+
pickedItems,
|
|
98
|
+
handleClick,
|
|
99
|
+
excludeId
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
showFiles && /* @__PURE__ */ jsx(
|
|
105
|
+
Accordion,
|
|
106
|
+
{
|
|
107
|
+
accordionHeaderProps: {
|
|
108
|
+
children: t("resources.file.text"),
|
|
109
|
+
count: fileStates?.count ?? 0
|
|
110
|
+
},
|
|
111
|
+
initialOpen: true,
|
|
112
|
+
deps: [fileStates?.isFetching],
|
|
113
|
+
children: /* @__PURE__ */ jsx(
|
|
114
|
+
FileList,
|
|
115
|
+
{
|
|
116
|
+
folderId: folder?.id ?? DO_NOT_FETCH_KEY,
|
|
117
|
+
setItemStates: setFileStates,
|
|
118
|
+
openNewTab: true
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] });
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { createFileManagerList };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Lock } from 'lucide-react';
|
|
4
|
+
import { PATHS } from '../../../../../constants/paths/index.js';
|
|
5
|
+
import '../../../../../constants/redirect-paths.js';
|
|
6
|
+
import '../../../../../domain/resources/admin/constants.js';
|
|
7
|
+
import { isFolderLocked } from '../../../../../domain/resources/folder/utils/is-folder-locked.js';
|
|
8
|
+
import 'react';
|
|
9
|
+
import 'ua-parser-js';
|
|
10
|
+
import { cn } from '../../../../applications/shadcn/utils.js';
|
|
11
|
+
import 'next/navigation';
|
|
12
|
+
import 'intor/react';
|
|
13
|
+
import '@radix-ui/react-avatar';
|
|
14
|
+
import '../../shadcn/badge.js';
|
|
15
|
+
import '../../shadcn/button.js';
|
|
16
|
+
import '@radix-ui/react-collapsible';
|
|
17
|
+
import '@radix-ui/react-dialog';
|
|
18
|
+
import '@radix-ui/react-dropdown-menu';
|
|
19
|
+
import '../../shadcn/input-group.js';
|
|
20
|
+
import '../../shadcn/item.js';
|
|
21
|
+
import '@radix-ui/react-label';
|
|
22
|
+
import '@radix-ui/react-select';
|
|
23
|
+
import '@radix-ui/react-separator';
|
|
24
|
+
import '../../shadcn/sidebar.js';
|
|
25
|
+
import 'next-themes';
|
|
26
|
+
import 'sonner';
|
|
27
|
+
import '@radix-ui/react-tabs';
|
|
28
|
+
import '@radix-ui/react-tooltip';
|
|
29
|
+
import { ResourceCard } from '../../ui/cards/resource-card/resource-card.js';
|
|
30
|
+
import 'next/link';
|
|
31
|
+
import 'mime-types';
|
|
32
|
+
import 'next/image';
|
|
33
|
+
|
|
34
|
+
const WIDTH = "10rem";
|
|
35
|
+
const HEIGHT = "10rem";
|
|
36
|
+
function FolderCard({
|
|
37
|
+
folder,
|
|
38
|
+
// Link Props
|
|
39
|
+
openNewTab = false,
|
|
40
|
+
anchorProps,
|
|
41
|
+
isInFileManager = false,
|
|
42
|
+
// Base
|
|
43
|
+
className = ""
|
|
44
|
+
}) {
|
|
45
|
+
const isLocked = isFolderLocked(folder) || folder?.isLocked;
|
|
46
|
+
const href = !isInFileManager ? `${PATHS.resources.folder.path}/${folder?.id}` : `${PATHS.main.fileManager.path}?folderKey=${folder?.key}`;
|
|
47
|
+
return /* @__PURE__ */ jsx(
|
|
48
|
+
ResourceCard,
|
|
49
|
+
{
|
|
50
|
+
className,
|
|
51
|
+
style: { width: WIDTH, height: HEIGHT },
|
|
52
|
+
href,
|
|
53
|
+
openNewTab,
|
|
54
|
+
anchorProps,
|
|
55
|
+
cardStatusBarProps: { children: isLocked && /* @__PURE__ */ jsx(Lock, { className: "size-5" }) },
|
|
56
|
+
cardTextContentProps: { title: folder?.name },
|
|
57
|
+
children: /* @__PURE__ */ jsx("div", { className: cn("flex-center size-full", "absolute z-0"), children: /* @__PURE__ */ jsx("span", { className: cn("scale-[3]", "transition"), children: "\u{1F4C1}" }) })
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { FolderCard };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import '@radix-ui/react-avatar';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'ua-parser-js';
|
|
5
|
+
import 'clsx';
|
|
6
|
+
import 'tailwind-merge';
|
|
7
|
+
import 'next/navigation';
|
|
8
|
+
import '../../shadcn/badge.js';
|
|
9
|
+
import '../../shadcn/button.js';
|
|
10
|
+
import '@radix-ui/react-collapsible';
|
|
11
|
+
import '@radix-ui/react-dialog';
|
|
12
|
+
import 'lucide-react';
|
|
13
|
+
import '@radix-ui/react-dropdown-menu';
|
|
14
|
+
import '../../shadcn/input-group.js';
|
|
15
|
+
import '../../shadcn/item.js';
|
|
16
|
+
import '@radix-ui/react-label';
|
|
17
|
+
import '@radix-ui/react-select';
|
|
18
|
+
import '@radix-ui/react-separator';
|
|
19
|
+
import '../../shadcn/sidebar.js';
|
|
20
|
+
import 'next-themes';
|
|
21
|
+
import 'sonner';
|
|
22
|
+
import { Spinner } from '../../shadcn/spinner.js';
|
|
23
|
+
import '@radix-ui/react-tabs';
|
|
24
|
+
import '@radix-ui/react-tooltip';
|
|
25
|
+
|
|
26
|
+
function FolderFullPath({ parentFolder, name, isLoading }) {
|
|
27
|
+
if (isLoading) {
|
|
28
|
+
return /* @__PURE__ */ jsx(Spinner, {});
|
|
29
|
+
}
|
|
30
|
+
return /* @__PURE__ */ jsxs("span", { className: "flex tracking-wide", children: [
|
|
31
|
+
parentFolder && /* @__PURE__ */ jsxs("span", { className: "opacity-75", children: [
|
|
32
|
+
`/`,
|
|
33
|
+
parentFolder.key
|
|
34
|
+
] }),
|
|
35
|
+
/* @__PURE__ */ jsx("span", { children: `/` }),
|
|
36
|
+
/* @__PURE__ */ jsx("span", { className: "font-[600] break-all", children: name })
|
|
37
|
+
] });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { FolderFullPath };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslator } from 'intor/react';
|
|
4
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
5
|
+
import '../../../../../constants/paths/auth.js';
|
|
6
|
+
import '../../../../../constants/paths/main.js';
|
|
7
|
+
import '../../../../../constants/paths/resources.js';
|
|
8
|
+
import { CACHE_KEYS } from '../../../../../constants/cache-keys.js';
|
|
9
|
+
import '../../../../../constants/redirect-paths.js';
|
|
10
|
+
import '../../../../../domain/resources/admin/constants.js';
|
|
11
|
+
import { fileManagerDoubleClick } from '../../../../../domain/resources/folder/utils/file-manager-double-click.js';
|
|
12
|
+
import 'mime-types';
|
|
13
|
+
import { debounce } from '../../../../../shared/utils/debounce.js';
|
|
14
|
+
import { ensureArray } from '../../../../../shared/utils/ensure-array.js';
|
|
15
|
+
import { DO_NOT_FETCH_KEY } from '../../../../../shared/list-items.js';
|
|
16
|
+
import 'ua-parser-js';
|
|
17
|
+
import { cn } from '../../../../applications/shadcn/utils.js';
|
|
18
|
+
import 'next/navigation';
|
|
19
|
+
import 'lucide-react';
|
|
20
|
+
import '@radix-ui/react-avatar';
|
|
21
|
+
import '../../shadcn/badge.js';
|
|
22
|
+
import '../../shadcn/button.js';
|
|
23
|
+
import '@radix-ui/react-collapsible';
|
|
24
|
+
import '@radix-ui/react-dialog';
|
|
25
|
+
import '@radix-ui/react-dropdown-menu';
|
|
26
|
+
import '../../shadcn/input-group.js';
|
|
27
|
+
import '../../shadcn/item.js';
|
|
28
|
+
import '@radix-ui/react-label';
|
|
29
|
+
import '@radix-ui/react-select';
|
|
30
|
+
import '@radix-ui/react-separator';
|
|
31
|
+
import '../../shadcn/sidebar.js';
|
|
32
|
+
import 'next-themes';
|
|
33
|
+
import 'sonner';
|
|
34
|
+
import '@radix-ui/react-tabs';
|
|
35
|
+
import '@radix-ui/react-tooltip';
|
|
36
|
+
import { ListCardsContainer } from '../../ui/blocks/list-cards-container/list-cards-container.js';
|
|
37
|
+
import 'next/link';
|
|
38
|
+
import { FieldBody } from '../../ui/form/field-body.js';
|
|
39
|
+
import 'next/image';
|
|
40
|
+
import { Tick } from '../../ui/features/tick.js';
|
|
41
|
+
import { FolderCard } from './folder-card.js';
|
|
42
|
+
|
|
43
|
+
function createFolderList({
|
|
44
|
+
useQuery,
|
|
45
|
+
folderFindListCardsAction
|
|
46
|
+
}) {
|
|
47
|
+
return function FolderList({
|
|
48
|
+
setItemStates,
|
|
49
|
+
// Fetch Condition
|
|
50
|
+
parentFolderId,
|
|
51
|
+
folderIds,
|
|
52
|
+
// Link Props
|
|
53
|
+
openNewTab = false,
|
|
54
|
+
isInFileManager = false,
|
|
55
|
+
// Pick Mode
|
|
56
|
+
pickedItems,
|
|
57
|
+
handleClick,
|
|
58
|
+
isInModal = false,
|
|
59
|
+
handleDoubleClick = fileManagerDoubleClick,
|
|
60
|
+
excludeId
|
|
61
|
+
}) {
|
|
62
|
+
const { t } = useTranslator();
|
|
63
|
+
const [page, setPage] = useState(1);
|
|
64
|
+
const [pageSize, setPageSize] = useState(20);
|
|
65
|
+
const [searchString, setSearchString] = useState("");
|
|
66
|
+
const debouncedSetSearchString = useMemo(
|
|
67
|
+
() => debounce((v) => setSearchString(v), 300),
|
|
68
|
+
[]
|
|
69
|
+
);
|
|
70
|
+
const { data, isFetching } = useQuery(
|
|
71
|
+
() => folderFindListCardsAction({
|
|
72
|
+
page,
|
|
73
|
+
pageSize,
|
|
74
|
+
searchString,
|
|
75
|
+
...parentFolderId && { parentFolderId },
|
|
76
|
+
...folderIds && { folderIds }
|
|
77
|
+
}),
|
|
78
|
+
[
|
|
79
|
+
CACHE_KEYS.findListCards("folder"),
|
|
80
|
+
page,
|
|
81
|
+
pageSize,
|
|
82
|
+
searchString,
|
|
83
|
+
parentFolderId,
|
|
84
|
+
JSON.stringify(folderIds)
|
|
85
|
+
],
|
|
86
|
+
{ enabled: parentFolderId !== DO_NOT_FETCH_KEY }
|
|
87
|
+
// Use in File Manager
|
|
88
|
+
);
|
|
89
|
+
const folders = useMemo(
|
|
90
|
+
() => ensureArray(data?.items).filter((i) => i.id !== excludeId),
|
|
91
|
+
[data?.items, excludeId]
|
|
92
|
+
);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
setItemStates?.({
|
|
95
|
+
items: folders,
|
|
96
|
+
count: data?.total ?? 0,
|
|
97
|
+
isFetching
|
|
98
|
+
});
|
|
99
|
+
}, [folders, data?.total, isFetching, setItemStates]);
|
|
100
|
+
return /* @__PURE__ */ jsx(
|
|
101
|
+
ListCardsContainer,
|
|
102
|
+
{
|
|
103
|
+
page,
|
|
104
|
+
setPage,
|
|
105
|
+
pageSize,
|
|
106
|
+
setPageSize,
|
|
107
|
+
total: data?.total ?? 0,
|
|
108
|
+
searchString,
|
|
109
|
+
setSearchString: debouncedSetSearchString,
|
|
110
|
+
isFetching,
|
|
111
|
+
headerChildren: isInModal && /* @__PURE__ */ jsxs(FieldBody, { className: "bg-base-200 w-fit! text-sm", children: [
|
|
112
|
+
"\u{1F4A1} ",
|
|
113
|
+
t("resources.folder.click-hint.text")
|
|
114
|
+
] }),
|
|
115
|
+
children: folders.map((folder) => {
|
|
116
|
+
const isPicked = pickedItems?.some((item) => item.id === folder.id);
|
|
117
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative w-fit", children: [
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
FolderCard,
|
|
120
|
+
{
|
|
121
|
+
folder,
|
|
122
|
+
openNewTab,
|
|
123
|
+
isInFileManager,
|
|
124
|
+
className: cn(pickedItems && !isPicked && "opacity-50"),
|
|
125
|
+
anchorProps: {
|
|
126
|
+
...handleClick ? {
|
|
127
|
+
onClick: (e) => {
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
handleClick(folder);
|
|
130
|
+
}
|
|
131
|
+
} : {},
|
|
132
|
+
...handleDoubleClick ? {
|
|
133
|
+
onDoubleClick: (e) => {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
handleDoubleClick(folder);
|
|
136
|
+
}
|
|
137
|
+
} : {}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
folder.id
|
|
141
|
+
),
|
|
142
|
+
pickedItems && /* @__PURE__ */ jsx(
|
|
143
|
+
Tick,
|
|
144
|
+
{
|
|
145
|
+
isPicked: isPicked ?? false,
|
|
146
|
+
className: "absolute top-2 right-2"
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
] }, folder.id);
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { createFolderList };
|