@yimingliao/cms 0.0.150 → 0.0.152
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/index.js +18 -8
- package/dist/export/client/components/resources/index.js +17 -0
- package/dist/export/client/shadcn/index.js +3 -1
- package/dist/src/client/interfaces/components/resources/admin/admin-card.js +81 -0
- package/dist/src/client/interfaces/components/resources/admin/admin-list.js +126 -0
- package/dist/src/client/interfaces/components/resources/admin/admin-refresh-tokens/active-sessions-badge.js +55 -0
- package/dist/src/client/interfaces/components/resources/admin/admin-refresh-tokens/active-spot.js +19 -0
- package/dist/src/client/interfaces/components/resources/admin/admin-refresh-tokens/admin-refresh-token-card.js +73 -0
- package/dist/src/client/interfaces/components/resources/admin/admin-refresh-tokens/related-admin-refresh-tokens.js +20 -0
- package/dist/src/client/interfaces/components/resources/admin/admin-relations-section.js +79 -0
- package/dist/src/client/interfaces/components/resources/category/category-card.js +80 -0
- package/dist/src/client/interfaces/components/resources/category/category-list.js +154 -0
- package/dist/src/client/interfaces/components/resources/category/category-relations-section.js +76 -0
- package/dist/src/client/interfaces/components/resources/file/file-card.js +1 -0
- package/dist/src/client/interfaces/components/resources/file/file-list.js +1 -0
- package/dist/src/client/interfaces/components/resources/file/file-relations-section.js +112 -0
- package/dist/src/client/interfaces/components/resources/file/is-locked-buttons.js +1 -0
- package/dist/src/client/interfaces/components/resources/file/type-buttons.js +1 -0
- package/dist/src/client/interfaces/components/resources/post/control-fields-buttons.js +111 -0
- package/dist/src/client/interfaces/components/resources/post/post-card.js +112 -0
- package/dist/src/client/interfaces/components/resources/post/post-list.js +162 -0
- package/dist/src/client/interfaces/components/resources/post/post-relations-section.js +76 -0
- package/dist/src/client/interfaces/components/resources/post/post-status-bar-icons.js +24 -0
- package/dist/src/client/interfaces/components/resources/post/post-type-gate.js +13 -0
- package/dist/src/client/interfaces/components/shadcn/item.js +181 -0
- package/dist/src/client/interfaces/components/shadcn/table.js +111 -0
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/list-cards-container.js +1 -0
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/page-size-selector.js +1 -0
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/pagination.js +1 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header.js +1 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch-create.js +1 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/create.js +1 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/edit.js +1 -0
- package/dist/src/client/interfaces/components/ui/buttons/button.js +1 -0
- package/dist/src/client/interfaces/components/ui/cards/action-buttons-card.js +1 -0
- package/dist/src/client/interfaces/components/ui/cards/resource-card/card-status-bar.js +1 -0
- package/dist/src/client/interfaces/components/ui/cards/resource-card/card-text-content.js +1 -0
- package/dist/src/client/interfaces/components/ui/cards/resource-card/resource-card.js +1 -0
- package/dist/src/client/interfaces/components/ui/display/array-list.js +1 -0
- package/dist/src/client/interfaces/components/ui/display/badge.js +1 -0
- package/dist/src/client/interfaces/components/ui/display/object-array-list.js +1 -0
- package/dist/src/client/interfaces/components/ui/features/accordion/accordion-container.js +1 -0
- package/dist/src/client/interfaces/components/ui/features/expandable-list/expand-bar.js +1 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-info/file-info.js +1 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-info/file-name.js +1 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-container.js +1 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-placeholder.js +1 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview.js +1 -0
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-body.js +1 -0
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-trigger.js +1 -0
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal.js +1 -0
- package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields.js +1 -0
- package/dist/src/client/interfaces/components/ui/form/field-body.js +1 -0
- package/dist/src/client/interfaces/components/ui/form/field.js +1 -0
- package/dist/src/client/interfaces/components/ui/i18n/display/i18n-array-display.js +1 -0
- package/dist/src/client/interfaces/components/ui/i18n/display/i18n-display.js +1 -0
- package/dist/src/client/interfaces/components/ui/i18n/display/i18n-object-array-display.js +1 -0
- package/dist/src/client/interfaces/components/ui/i18n/i18n-tabs-wrapper.js +53 -0
- package/dist/src/client/interfaces/components/ui/i18n/inputs/i18n-array-input.js +1 -0
- package/dist/src/client/interfaces/components/ui/i18n/inputs/i18n-date-input.js +1 -0
- package/dist/src/client/interfaces/components/ui/i18n/inputs/i18n-editor.js +1 -0
- package/dist/src/client/interfaces/components/ui/i18n/inputs/i18n-input.js +1 -0
- package/dist/src/client/interfaces/components/ui/i18n/inputs/i18n-json-input.js +1 -0
- package/dist/src/client/interfaces/components/ui/i18n/inputs/i18n-number-input.js +1 -0
- package/dist/src/client/interfaces/components/ui/i18n/inputs/i18n-object-array-input.js +1 -0
- package/dist/src/client/interfaces/components/ui/i18n/inputs/i18n-textarea.js +1 -0
- package/dist/src/client/interfaces/components/ui/inputs/array-input.js +1 -0
- package/dist/src/client/interfaces/components/ui/inputs/checkbox.js +1 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/editor.js +1 -0
- package/dist/src/client/interfaces/components/ui/inputs/input.js +1 -0
- package/dist/src/client/interfaces/components/ui/inputs/password-input.js +1 -0
- package/dist/src/client/interfaces/components/ui/inputs/search-input.js +1 -0
- package/dist/src/client/interfaces/components/ui/inputs/select.js +1 -0
- package/dist/src/client/interfaces/components/ui/inputs/textarea.js +1 -0
- package/dist/src/client/interfaces/components/ui/layouts/auth-skeleton.js +1 -0
- package/dist/src/client/interfaces/components/ui/layouts/dashboard-skeleton.js +1 -0
- package/dist/src/client/interfaces/components/ui/layouts/navbar/i18n-selector.js +1 -0
- package/dist/src/client/interfaces/components/ui/layouts/navbar/nav-user.js +1 -0
- package/dist/src/client/interfaces/components/ui/layouts/navbar/navbar.js +2 -1
- package/dist/src/client/interfaces/components/ui/layouts/navbar/sign-out-button.js +1 -0
- package/dist/src/client/interfaces/components/ui/layouts/navbar/theme-selector.js +1 -0
- package/dist/src/client/interfaces/components/ui/layouts/sidebar/nav-main.js +1 -0
- package/dist/src/client/interfaces/pages/auth/change-password/page.js +1 -0
- package/dist/src/client/interfaces/pages/auth/email-unverified/page.js +1 -0
- package/dist/src/client/interfaces/pages/auth/forgot-password/page.js +1 -0
- package/dist/src/client/interfaces/pages/auth/layout.js +1 -0
- package/dist/src/client/interfaces/pages/auth/reset-password/page.js +1 -0
- package/dist/src/client/interfaces/pages/auth/sign-in/page.js +1 -0
- package/dist/src/client/interfaces/pages/auth/verify-email/page.js +1 -0
- package/dist/src/client/interfaces/pages/dashboard/layout.js +1 -0
- package/dist/types/export/client/components/index.d.ts +1 -1
- package/dist/types/export/client/components/index.d.ts.map +1 -1
- package/dist/types/export/client/components/resources/index.d.ts +2 -0
- package/dist/types/export/client/components/resources/index.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-card.d.ts +12 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-card.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-list.d.ts +19 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-list.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-refresh-tokens/active-sessions-badge.d.ts +9 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-refresh-tokens/active-sessions-badge.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-refresh-tokens/active-spot.d.ts +4 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-refresh-tokens/active-spot.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-refresh-tokens/admin-refresh-token-card.d.ts +10 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-refresh-tokens/admin-refresh-token-card.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-refresh-tokens/related-admin-refresh-tokens.d.ts +6 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-refresh-tokens/related-admin-refresh-tokens.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-relations-section.d.ts +9 -0
- package/dist/types/src/client/interfaces/components/resources/admin/admin-relations-section.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/admin/index.d.ts +6 -0
- package/dist/types/src/client/interfaces/components/resources/admin/index.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/category/category-card.d.ts +11 -0
- package/dist/types/src/client/interfaces/components/resources/category/category-card.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/category/category-list.d.ts +20 -0
- package/dist/types/src/client/interfaces/components/resources/category/category-list.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/category/category-relations-section.d.ts +9 -0
- package/dist/types/src/client/interfaces/components/resources/category/category-relations-section.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/category/index.d.ts +4 -0
- package/dist/types/src/client/interfaces/components/resources/category/index.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/file/file-relations-section.d.ts +12 -0
- package/dist/types/src/client/interfaces/components/resources/file/file-relations-section.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/file/index.d.ts +1 -0
- package/dist/types/src/client/interfaces/components/resources/file/index.d.ts.map +1 -1
- package/dist/types/src/client/interfaces/components/resources/index.d.ts +4 -1
- package/dist/types/src/client/interfaces/components/resources/index.d.ts.map +1 -1
- package/dist/types/src/client/interfaces/components/resources/post/control-fields-buttons.d.ts +16 -0
- package/dist/types/src/client/interfaces/components/resources/post/control-fields-buttons.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/post/index.d.ts +6 -0
- package/dist/types/src/client/interfaces/components/resources/post/index.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/post/post-card.d.ts +14 -0
- package/dist/types/src/client/interfaces/components/resources/post/post-card.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/post/post-list.d.ts +25 -0
- package/dist/types/src/client/interfaces/components/resources/post/post-list.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/post/post-relations-section.d.ts +9 -0
- package/dist/types/src/client/interfaces/components/resources/post/post-relations-section.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/post/post-status-bar-icons.d.ts +8 -0
- package/dist/types/src/client/interfaces/components/resources/post/post-status-bar-icons.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/resources/post/post-type-gate.d.ts +10 -0
- package/dist/types/src/client/interfaces/components/resources/post/post-type-gate.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/shadcn/index.d.ts +3 -1
- package/dist/types/src/client/interfaces/components/shadcn/index.d.ts.map +1 -1
- package/dist/types/src/client/interfaces/components/shadcn/item.d.ts +24 -0
- package/dist/types/src/client/interfaces/components/shadcn/item.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/shadcn/table.d.ts +11 -0
- package/dist/types/src/client/interfaces/components/shadcn/table.d.ts.map +1 -0
- package/dist/types/src/client/interfaces/components/ui/i18n/index.d.ts +1 -0
- package/dist/types/src/client/interfaces/components/ui/i18n/index.d.ts.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
4
|
+
import '../../../../../constants/paths/auth.js';
|
|
5
|
+
import '../../../../../constants/paths/main.js';
|
|
6
|
+
import '../../../../../constants/paths/resources.js';
|
|
7
|
+
import { CACHE_KEYS } from '../../../../../constants/cache-keys.js';
|
|
8
|
+
import '../../../../../constants/redirect-paths.js';
|
|
9
|
+
import '../../../../../domain/resources/admin/constants.js';
|
|
10
|
+
import { POST_TYPES } from '../../../../../domain/resources/post/props.js';
|
|
11
|
+
import 'mime-types';
|
|
12
|
+
import { debounce } from '../../../../../shared/utils/debounce.js';
|
|
13
|
+
import { ensureArray } from '../../../../../shared/utils/ensure-array.js';
|
|
14
|
+
import { DO_NOT_FETCH_KEY } from '../../../../../shared/list-items.js';
|
|
15
|
+
import 'ua-parser-js';
|
|
16
|
+
import { cn } from '../../../../applications/shadcn/utils.js';
|
|
17
|
+
import 'next/navigation';
|
|
18
|
+
import 'intor/react';
|
|
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 'next/image';
|
|
39
|
+
import { Tick } from '../../ui/features/tick.js';
|
|
40
|
+
import { ControlFieldsButtons } from '../post/control-fields-buttons.js';
|
|
41
|
+
import { CategoryCard } from './category-card.js';
|
|
42
|
+
|
|
43
|
+
function createCategoryList({
|
|
44
|
+
useQuery,
|
|
45
|
+
postFindListCardsAction
|
|
46
|
+
}) {
|
|
47
|
+
return function CategoryList({
|
|
48
|
+
usableFields,
|
|
49
|
+
setItemStates,
|
|
50
|
+
// Fetch Conditions
|
|
51
|
+
topicId,
|
|
52
|
+
postIds,
|
|
53
|
+
// Link Props
|
|
54
|
+
openNewTab = false,
|
|
55
|
+
// Pick Mode
|
|
56
|
+
pickedItems,
|
|
57
|
+
handleClick
|
|
58
|
+
}) {
|
|
59
|
+
const [page, setPage] = useState(1);
|
|
60
|
+
const [pageSize, setPageSize] = useState(20);
|
|
61
|
+
const [searchString, setSearchString] = useState("");
|
|
62
|
+
const debouncedSetSearchString = useMemo(
|
|
63
|
+
() => debounce((v) => setSearchString(v), 300),
|
|
64
|
+
[]
|
|
65
|
+
);
|
|
66
|
+
const [controlFields, setControlFields] = useState({
|
|
67
|
+
isActive: false,
|
|
68
|
+
isIndexActive: false,
|
|
69
|
+
isSlugActive: false
|
|
70
|
+
});
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
queueMicrotask(() => setPage(1));
|
|
73
|
+
}, [controlFields, setPage]);
|
|
74
|
+
const { data, isFetching } = useQuery(
|
|
75
|
+
() => postFindListCardsAction({
|
|
76
|
+
type: POST_TYPES.CATEGORY,
|
|
77
|
+
page,
|
|
78
|
+
pageSize,
|
|
79
|
+
searchString,
|
|
80
|
+
...topicId && { topicId },
|
|
81
|
+
...postIds && { postIds },
|
|
82
|
+
...controlFields
|
|
83
|
+
}),
|
|
84
|
+
[
|
|
85
|
+
CACHE_KEYS.findListCards("category"),
|
|
86
|
+
page,
|
|
87
|
+
pageSize,
|
|
88
|
+
searchString,
|
|
89
|
+
topicId,
|
|
90
|
+
JSON.stringify(postIds),
|
|
91
|
+
JSON.stringify(controlFields)
|
|
92
|
+
],
|
|
93
|
+
{ enabled: topicId !== DO_NOT_FETCH_KEY }
|
|
94
|
+
// Use in Post Topic Page
|
|
95
|
+
);
|
|
96
|
+
const categories = useMemo(() => ensureArray(data?.items), [data?.items]);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
setItemStates?.({
|
|
99
|
+
items: categories,
|
|
100
|
+
count: data?.total ?? 0,
|
|
101
|
+
isFetching
|
|
102
|
+
});
|
|
103
|
+
}, [categories, data?.total, isFetching, setItemStates]);
|
|
104
|
+
return /* @__PURE__ */ jsx(
|
|
105
|
+
ListCardsContainer,
|
|
106
|
+
{
|
|
107
|
+
page,
|
|
108
|
+
setPage,
|
|
109
|
+
pageSize,
|
|
110
|
+
setPageSize,
|
|
111
|
+
total: data?.total ?? 0,
|
|
112
|
+
searchString,
|
|
113
|
+
setSearchString: debouncedSetSearchString,
|
|
114
|
+
isFetching,
|
|
115
|
+
headerChildren: /* @__PURE__ */ jsx(
|
|
116
|
+
ControlFieldsButtons,
|
|
117
|
+
{
|
|
118
|
+
usableFields,
|
|
119
|
+
controlFields,
|
|
120
|
+
setControlFields
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
children: categories.map((category) => {
|
|
124
|
+
const isPicked = pickedItems?.some((item) => item.id === category.id);
|
|
125
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
CategoryCard,
|
|
128
|
+
{
|
|
129
|
+
category,
|
|
130
|
+
openNewTab,
|
|
131
|
+
className: cn(pickedItems && !isPicked && "opacity-50"),
|
|
132
|
+
anchorProps: handleClick && {
|
|
133
|
+
onClick: (e) => {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
handleClick(category);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
pickedItems && /* @__PURE__ */ jsx(
|
|
141
|
+
Tick,
|
|
142
|
+
{
|
|
143
|
+
isPicked: isPicked ?? false,
|
|
144
|
+
className: "absolute top-2 right-2"
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
] }, category.id);
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export { createCategoryList };
|
package/dist/src/client/interfaces/components/resources/category/category-relations-section.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslator } from 'intor/react';
|
|
4
|
+
import 'mime-types';
|
|
5
|
+
import { ensureArray } from '../../../../../shared/utils/ensure-array.js';
|
|
6
|
+
import 'lucide-react';
|
|
7
|
+
import 'react';
|
|
8
|
+
import 'ua-parser-js';
|
|
9
|
+
import 'clsx';
|
|
10
|
+
import 'tailwind-merge';
|
|
11
|
+
import 'next/navigation';
|
|
12
|
+
import '@radix-ui/react-avatar';
|
|
13
|
+
import '../../shadcn/badge.js';
|
|
14
|
+
import '../../shadcn/button.js';
|
|
15
|
+
import '@radix-ui/react-collapsible';
|
|
16
|
+
import '@radix-ui/react-dialog';
|
|
17
|
+
import '@radix-ui/react-dropdown-menu';
|
|
18
|
+
import '../../shadcn/input-group.js';
|
|
19
|
+
import '../../shadcn/item.js';
|
|
20
|
+
import '@radix-ui/react-label';
|
|
21
|
+
import '@radix-ui/react-select';
|
|
22
|
+
import '@radix-ui/react-separator';
|
|
23
|
+
import '../../shadcn/sidebar.js';
|
|
24
|
+
import 'next-themes';
|
|
25
|
+
import 'sonner';
|
|
26
|
+
import '@radix-ui/react-tabs';
|
|
27
|
+
import '@radix-ui/react-tooltip';
|
|
28
|
+
import 'next/link';
|
|
29
|
+
import '../../../../../constants/paths/auth.js';
|
|
30
|
+
import '../../../../../constants/paths/main.js';
|
|
31
|
+
import '../../../../../constants/paths/resources.js';
|
|
32
|
+
import '../../../../../constants/redirect-paths.js';
|
|
33
|
+
import { Accordion } from '../../ui/features/accordion/accordion.js';
|
|
34
|
+
import { AccordionContainer } from '../../ui/features/accordion/accordion-container.js';
|
|
35
|
+
import '../../../../../domain/resources/admin/constants.js';
|
|
36
|
+
import 'next/image';
|
|
37
|
+
|
|
38
|
+
function createCategoryRelationsSection({
|
|
39
|
+
PostList
|
|
40
|
+
}) {
|
|
41
|
+
return function CategoryRelationsSection({
|
|
42
|
+
category,
|
|
43
|
+
usableFields = [
|
|
44
|
+
"isActive",
|
|
45
|
+
"isIndexActive",
|
|
46
|
+
"isSlugActive",
|
|
47
|
+
"isFeatured",
|
|
48
|
+
"isShownOnHome"
|
|
49
|
+
]
|
|
50
|
+
}) {
|
|
51
|
+
const { t } = useTranslator();
|
|
52
|
+
const posts = ensureArray(category?.children);
|
|
53
|
+
return /* @__PURE__ */ jsx(AccordionContainer, { children: /* @__PURE__ */ jsx(
|
|
54
|
+
Accordion,
|
|
55
|
+
{
|
|
56
|
+
hasBorder: true,
|
|
57
|
+
accordionHeaderProps: {
|
|
58
|
+
count: posts.length,
|
|
59
|
+
isRelated: true,
|
|
60
|
+
children: t("resources.post.text")
|
|
61
|
+
},
|
|
62
|
+
children: /* @__PURE__ */ jsx(
|
|
63
|
+
PostList,
|
|
64
|
+
{
|
|
65
|
+
postIds: posts.map((p) => p.id),
|
|
66
|
+
openNewTab: true,
|
|
67
|
+
type: null,
|
|
68
|
+
usableFields
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
) });
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { createCategoryRelationsSection };
|
|
@@ -20,6 +20,7 @@ import '@radix-ui/react-collapsible';
|
|
|
20
20
|
import '@radix-ui/react-dialog';
|
|
21
21
|
import '@radix-ui/react-dropdown-menu';
|
|
22
22
|
import '../../shadcn/input-group.js';
|
|
23
|
+
import '../../shadcn/item.js';
|
|
23
24
|
import '@radix-ui/react-label';
|
|
24
25
|
import '@radix-ui/react-select';
|
|
25
26
|
import '@radix-ui/react-separator';
|
|
@@ -21,6 +21,7 @@ import '@radix-ui/react-dialog';
|
|
|
21
21
|
import 'lucide-react';
|
|
22
22
|
import '@radix-ui/react-dropdown-menu';
|
|
23
23
|
import '../../shadcn/input-group.js';
|
|
24
|
+
import '../../shadcn/item.js';
|
|
24
25
|
import '@radix-ui/react-label';
|
|
25
26
|
import '@radix-ui/react-select';
|
|
26
27
|
import { Separator } from '../../shadcn/separator.js';
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslator } from 'intor/react';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import 'lucide-react';
|
|
6
|
+
import 'ua-parser-js';
|
|
7
|
+
import 'clsx';
|
|
8
|
+
import 'tailwind-merge';
|
|
9
|
+
import 'next/navigation';
|
|
10
|
+
import '@radix-ui/react-avatar';
|
|
11
|
+
import '../../shadcn/badge.js';
|
|
12
|
+
import '../../shadcn/button.js';
|
|
13
|
+
import '@radix-ui/react-collapsible';
|
|
14
|
+
import '@radix-ui/react-dialog';
|
|
15
|
+
import '@radix-ui/react-dropdown-menu';
|
|
16
|
+
import '../../shadcn/input-group.js';
|
|
17
|
+
import '../../shadcn/item.js';
|
|
18
|
+
import '@radix-ui/react-label';
|
|
19
|
+
import '@radix-ui/react-select';
|
|
20
|
+
import '@radix-ui/react-separator';
|
|
21
|
+
import '../../shadcn/sidebar.js';
|
|
22
|
+
import 'next-themes';
|
|
23
|
+
import 'sonner';
|
|
24
|
+
import '@radix-ui/react-tabs';
|
|
25
|
+
import '@radix-ui/react-tooltip';
|
|
26
|
+
import 'next/link';
|
|
27
|
+
import '../../../../../constants/paths/auth.js';
|
|
28
|
+
import '../../../../../constants/paths/main.js';
|
|
29
|
+
import '../../../../../constants/paths/resources.js';
|
|
30
|
+
import '../../../../../constants/redirect-paths.js';
|
|
31
|
+
import 'mime-types';
|
|
32
|
+
import { Accordion } from '../../ui/features/accordion/accordion.js';
|
|
33
|
+
import { AccordionContainer } from '../../ui/features/accordion/accordion-container.js';
|
|
34
|
+
import '../../../../../domain/resources/admin/constants.js';
|
|
35
|
+
import 'next/image';
|
|
36
|
+
|
|
37
|
+
const postRelations = [
|
|
38
|
+
"postsAsContentImage",
|
|
39
|
+
"postsAsCoverImage",
|
|
40
|
+
"postsAsImages1",
|
|
41
|
+
"postsAsImages2",
|
|
42
|
+
"postsAsImage1",
|
|
43
|
+
"postsAsImage2",
|
|
44
|
+
"postsAsImage3",
|
|
45
|
+
"postsAsImage4"
|
|
46
|
+
];
|
|
47
|
+
function createFileRelationsSection({
|
|
48
|
+
adminEnabled,
|
|
49
|
+
AdminList,
|
|
50
|
+
PostList
|
|
51
|
+
}) {
|
|
52
|
+
return function FileRelationsSection({
|
|
53
|
+
file,
|
|
54
|
+
usableFields = [
|
|
55
|
+
"isActive",
|
|
56
|
+
"isIndexActive",
|
|
57
|
+
"isSlugActive",
|
|
58
|
+
"isFeatured",
|
|
59
|
+
"isShownOnHome"
|
|
60
|
+
]
|
|
61
|
+
}) {
|
|
62
|
+
const { t } = useTranslator();
|
|
63
|
+
const postIds = useMemo(() => {
|
|
64
|
+
if (!file) return [];
|
|
65
|
+
return [
|
|
66
|
+
...new Set(postRelations.flatMap((key) => file[key].map((p) => p.id)))
|
|
67
|
+
];
|
|
68
|
+
}, [file]);
|
|
69
|
+
console.log(postIds);
|
|
70
|
+
return /* @__PURE__ */ jsxs(AccordionContainer, { children: [
|
|
71
|
+
adminEnabled && file?.type === "IMAGE" && /* @__PURE__ */ jsx(
|
|
72
|
+
Accordion,
|
|
73
|
+
{
|
|
74
|
+
hasBorder: true,
|
|
75
|
+
accordionHeaderProps: {
|
|
76
|
+
count: file?.adminAsAvatarImage.length,
|
|
77
|
+
isRelated: true,
|
|
78
|
+
children: `${t("resources.admin.text")} ( ${t("resources.file.as-avatar-image.text")} )`
|
|
79
|
+
},
|
|
80
|
+
children: /* @__PURE__ */ jsx(
|
|
81
|
+
AdminList,
|
|
82
|
+
{
|
|
83
|
+
adminIds: file?.adminAsAvatarImage.map((p) => p.id),
|
|
84
|
+
openNewTab: true
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
Accordion,
|
|
91
|
+
{
|
|
92
|
+
hasBorder: true,
|
|
93
|
+
accordionHeaderProps: {
|
|
94
|
+
count: postIds.length,
|
|
95
|
+
isRelated: true
|
|
96
|
+
},
|
|
97
|
+
children: /* @__PURE__ */ jsx(
|
|
98
|
+
PostList,
|
|
99
|
+
{
|
|
100
|
+
postIds,
|
|
101
|
+
type: null,
|
|
102
|
+
openNewTab: true,
|
|
103
|
+
usableFields
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] });
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { createFileRelationsSection };
|
|
@@ -12,6 +12,7 @@ import '@radix-ui/react-collapsible';
|
|
|
12
12
|
import '@radix-ui/react-dialog';
|
|
13
13
|
import '@radix-ui/react-dropdown-menu';
|
|
14
14
|
import '../../shadcn/input-group.js';
|
|
15
|
+
import '../../shadcn/item.js';
|
|
15
16
|
import '@radix-ui/react-label';
|
|
16
17
|
import '@radix-ui/react-select';
|
|
17
18
|
import '@radix-ui/react-separator';
|
|
@@ -14,6 +14,7 @@ import '@radix-ui/react-collapsible';
|
|
|
14
14
|
import '@radix-ui/react-dialog';
|
|
15
15
|
import '@radix-ui/react-dropdown-menu';
|
|
16
16
|
import '../../shadcn/input-group.js';
|
|
17
|
+
import '../../shadcn/item.js';
|
|
17
18
|
import '@radix-ui/react-label';
|
|
18
19
|
import '@radix-ui/react-select';
|
|
19
20
|
import '@radix-ui/react-separator';
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useTranslator } from 'intor/react';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'ua-parser-js';
|
|
5
|
+
import { cn } from '../../../../applications/shadcn/utils.js';
|
|
6
|
+
import 'next/navigation';
|
|
7
|
+
import 'lucide-react';
|
|
8
|
+
import '@radix-ui/react-avatar';
|
|
9
|
+
import '../../shadcn/badge.js';
|
|
10
|
+
import '../../shadcn/button.js';
|
|
11
|
+
import '@radix-ui/react-collapsible';
|
|
12
|
+
import '@radix-ui/react-dialog';
|
|
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 '@radix-ui/react-tabs';
|
|
23
|
+
import '@radix-ui/react-tooltip';
|
|
24
|
+
import { Button } from '../../ui/buttons/button.js';
|
|
25
|
+
import 'next/link';
|
|
26
|
+
import '../../../../../constants/paths/auth.js';
|
|
27
|
+
import '../../../../../constants/paths/main.js';
|
|
28
|
+
import '../../../../../constants/paths/resources.js';
|
|
29
|
+
import '../../../../../constants/redirect-paths.js';
|
|
30
|
+
import 'mime-types';
|
|
31
|
+
import '../../../../../domain/resources/admin/constants.js';
|
|
32
|
+
import 'next/image';
|
|
33
|
+
|
|
34
|
+
function ControlFieldsButtons({
|
|
35
|
+
usableFields = [],
|
|
36
|
+
controlFields,
|
|
37
|
+
setControlFields
|
|
38
|
+
}) {
|
|
39
|
+
const { t } = useTranslator();
|
|
40
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-fit gap-3 rounded", children: [
|
|
41
|
+
usableFields.includes("isActive") && /* @__PURE__ */ jsx(
|
|
42
|
+
Button,
|
|
43
|
+
{
|
|
44
|
+
type: "button",
|
|
45
|
+
size: "sm",
|
|
46
|
+
variant: "secondary",
|
|
47
|
+
onClick: () => setControlFields((prev) => ({ ...prev, isActive: !prev.isActive })),
|
|
48
|
+
className: cn(!controlFields.isActive ? "opacity-35" : "shadow"),
|
|
49
|
+
children: t("ui.field.control-fields.is-active.text")
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
usableFields.includes("isIndexActive") && /* @__PURE__ */ jsx(
|
|
53
|
+
Button,
|
|
54
|
+
{
|
|
55
|
+
size: "sm",
|
|
56
|
+
type: "button",
|
|
57
|
+
variant: "secondary",
|
|
58
|
+
onClick: () => setControlFields((prev) => ({
|
|
59
|
+
...prev,
|
|
60
|
+
isIndexActive: !prev.isIndexActive
|
|
61
|
+
})),
|
|
62
|
+
className: cn(!controlFields.isIndexActive ? "opacity-35" : "shadow"),
|
|
63
|
+
children: t("ui.field.control-fields.is-index-active.text")
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
usableFields.includes("isSlugActive") && /* @__PURE__ */ jsx(
|
|
67
|
+
Button,
|
|
68
|
+
{
|
|
69
|
+
size: "sm",
|
|
70
|
+
type: "button",
|
|
71
|
+
variant: "secondary",
|
|
72
|
+
onClick: () => setControlFields((prev) => ({
|
|
73
|
+
...prev,
|
|
74
|
+
isSlugActive: !prev.isSlugActive
|
|
75
|
+
})),
|
|
76
|
+
className: cn(!controlFields.isSlugActive ? "opacity-35" : "shadow"),
|
|
77
|
+
children: t("ui.field.control-fields.is-slug-active.text")
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
usableFields.includes("isFeatured") && /* @__PURE__ */ jsx(
|
|
81
|
+
Button,
|
|
82
|
+
{
|
|
83
|
+
size: "sm",
|
|
84
|
+
type: "button",
|
|
85
|
+
variant: "secondary",
|
|
86
|
+
onClick: () => setControlFields((prev) => ({
|
|
87
|
+
...prev,
|
|
88
|
+
isFeatured: !prev.isFeatured
|
|
89
|
+
})),
|
|
90
|
+
className: cn(!controlFields.isFeatured ? "opacity-35" : "shadow"),
|
|
91
|
+
children: t("ui.field.control-fields.is-featured.text")
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
usableFields.includes("isShownOnHome") && /* @__PURE__ */ jsx(
|
|
95
|
+
Button,
|
|
96
|
+
{
|
|
97
|
+
size: "sm",
|
|
98
|
+
type: "button",
|
|
99
|
+
variant: "secondary",
|
|
100
|
+
onClick: () => setControlFields((prev) => ({
|
|
101
|
+
...prev,
|
|
102
|
+
isShownOnHome: !prev.isShownOnHome
|
|
103
|
+
})),
|
|
104
|
+
className: cn(!controlFields.isShownOnHome ? "opacity-35" : "shadow"),
|
|
105
|
+
children: t("ui.field.control-fields.is-shown-on-home.text")
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { ControlFieldsButtons };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslator } from 'intor/react';
|
|
4
|
+
import { PATHS } from '../../../../../constants/paths/index.js';
|
|
5
|
+
import '../../../../../constants/redirect-paths.js';
|
|
6
|
+
import 'mime-types';
|
|
7
|
+
import { findTranslation } from '../../../../../shared/translation/find-translation.js';
|
|
8
|
+
import 'react';
|
|
9
|
+
import 'ua-parser-js';
|
|
10
|
+
import { cn } from '../../../../applications/shadcn/utils.js';
|
|
11
|
+
import 'next/navigation';
|
|
12
|
+
import 'lucide-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 '../../../../../domain/resources/admin/constants.js';
|
|
32
|
+
import 'next/image';
|
|
33
|
+
import { PostStatusBarIcons } from './post-status-bar-icons.js';
|
|
34
|
+
|
|
35
|
+
function createPostCard({
|
|
36
|
+
SmartImage
|
|
37
|
+
}) {
|
|
38
|
+
return function PostCard({
|
|
39
|
+
post,
|
|
40
|
+
// Link Props
|
|
41
|
+
openNewTab = false,
|
|
42
|
+
anchorProps,
|
|
43
|
+
// Base
|
|
44
|
+
className = ""
|
|
45
|
+
}) {
|
|
46
|
+
const { locale } = useTranslator();
|
|
47
|
+
const topic = post.topic;
|
|
48
|
+
const topicTitle = findTranslation(topic?.translations, locale)?.title ?? "";
|
|
49
|
+
const translation = findTranslation(post.translations, locale);
|
|
50
|
+
const { isActive, isSlugActive, index, isFeatured, isShownOnHome } = post;
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
ResourceCard,
|
|
53
|
+
{
|
|
54
|
+
className: cn("size-72!", className),
|
|
55
|
+
href: `${PATHS.resources.post.path(topic?.slug)}/${post.id}`,
|
|
56
|
+
openNewTab,
|
|
57
|
+
anchorProps,
|
|
58
|
+
cardStatusBarProps: {
|
|
59
|
+
badge: topicTitle,
|
|
60
|
+
children: /* @__PURE__ */ jsx(
|
|
61
|
+
PostStatusBarIcons,
|
|
62
|
+
{
|
|
63
|
+
isActive,
|
|
64
|
+
index,
|
|
65
|
+
isSlugActive,
|
|
66
|
+
isFeatured,
|
|
67
|
+
isShownOnHome
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
},
|
|
71
|
+
cardTextContentProps: {
|
|
72
|
+
title: translation?.title,
|
|
73
|
+
children: /* @__PURE__ */ jsx(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: "line-clamp-2 h-10 text-sm whitespace-normal",
|
|
77
|
+
style: {
|
|
78
|
+
WebkitMaskImage: "linear-gradient(to top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 75%)",
|
|
79
|
+
maskImage: "linear-gradient(to top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 75%)"
|
|
80
|
+
},
|
|
81
|
+
children: translation?.summary
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
},
|
|
85
|
+
children: /* @__PURE__ */ jsx(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: cn(
|
|
89
|
+
"flex-center size-full",
|
|
90
|
+
"absolute z-0",
|
|
91
|
+
"overflow-hidden rounded-xl",
|
|
92
|
+
`${!post.isActive ? "opacity-50" : ""}`,
|
|
93
|
+
"transition"
|
|
94
|
+
),
|
|
95
|
+
children: post.coverImage && /* @__PURE__ */ jsx(
|
|
96
|
+
SmartImage,
|
|
97
|
+
{
|
|
98
|
+
fileKey: post.coverImage?.key,
|
|
99
|
+
width: 256,
|
|
100
|
+
height: 256,
|
|
101
|
+
fill: false,
|
|
102
|
+
className: "overflow-hidden rounded-xl"
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { createPostCard };
|