strapi-plugin-comments 2.0.10 → 2.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +164 -120
- package/admin/src/components/ActionButton/styles.d.ts +2 -0
- package/admin/src/components/ActionButton/styles.js +13 -8
- package/admin/src/components/ConfirmationDialog/index.d.ts +26 -0
- package/admin/src/components/ConfirmationDialog/index.js +36 -55
- package/admin/src/components/DiscussionStatus/index.d.ts +9 -0
- package/admin/src/components/DiscussionStatus/index.js +22 -31
- package/admin/src/components/DiscussionThread/index.d.ts +16 -0
- package/admin/src/components/DiscussionThread/index.js +39 -56
- package/admin/src/components/DiscussionThreadItem/index.d.ts +9 -0
- package/admin/src/components/DiscussionThreadItem/index.js +28 -52
- package/admin/src/components/DiscussionThreadItem/styles.d.ts +4 -0
- package/admin/src/components/DiscussionThreadItem/styles.js +16 -11
- package/admin/src/components/DiscussionThreadItemActions/index.d.ts +19 -0
- package/admin/src/components/DiscussionThreadItemActions/index.js +121 -158
- package/admin/src/components/DiscussionThreadItemActions/styles.d.ts +2 -0
- package/admin/src/components/DiscussionThreadItemActions/styles.js +13 -7
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.d.ts +17 -0
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +38 -48
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.d.ts +2 -0
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.js +12 -6
- package/admin/src/components/DiscussionThreadItemFooter/index.d.ts +16 -0
- package/admin/src/components/DiscussionThreadItemFooter/index.js +35 -42
- package/admin/src/components/DiscussionThreadItemFooter/styles.d.ts +3 -0
- package/admin/src/components/DiscussionThreadItemFooter/styles.js +17 -12
- package/admin/src/components/DiscussionThreadItemReviewAction/index.d.ts +30 -0
- package/admin/src/components/DiscussionThreadItemReviewAction/index.js +77 -91
- package/admin/src/components/FormSwitch/index.d.ts +7 -0
- package/admin/src/components/FormSwitch/index.js +15 -18
- package/admin/src/components/FormSwitch/styles.d.ts +2 -0
- package/admin/src/components/FormSwitch/styles.js +14 -8
- package/admin/src/components/IconButton/styles.d.ts +2 -0
- package/admin/src/components/IconButton/styles.js +16 -9
- package/admin/src/components/Initializer/index.d.ts +5 -0
- package/admin/src/components/Initializer/index.js +12 -24
- package/admin/src/components/LoadingIndicatorOverlay/index.d.ts +3 -0
- package/admin/src/components/LoadingIndicatorOverlay/index.js +12 -15
- package/admin/src/components/LoadingIndicatorOverlay/styles.d.ts +3 -0
- package/admin/src/components/LoadingIndicatorOverlay/styles.js +22 -17
- package/admin/src/components/Nav/index.d.ts +7 -0
- package/admin/src/components/Nav/index.js +25 -48
- package/admin/src/components/PluginIcon/index.d.ts +3 -0
- package/admin/src/components/PluginIcon/index.js +10 -12
- package/admin/src/components/ReportsReviewModal/index.d.ts +21 -0
- package/admin/src/components/ReportsReviewModal/index.js +31 -46
- package/admin/src/components/ReportsReviewTable/index.d.ts +21 -0
- package/admin/src/components/ReportsReviewTable/index.js +120 -140
- package/admin/src/components/StatusBadge/index.d.ts +7 -0
- package/admin/src/components/StatusBadge/index.js +12 -17
- package/admin/src/components/StatusBadge/styles.d.ts +2 -0
- package/admin/src/components/StatusBadge/styles.js +19 -13
- package/admin/src/components/TableFilters/index.d.ts +10 -0
- package/admin/src/components/TableFilters/index.js +52 -49
- package/admin/src/components/TablePagination/index.d.ts +17 -0
- package/admin/src/components/TablePagination/index.js +27 -29
- package/admin/src/components/icons/comments.d.ts +6 -0
- package/admin/src/components/icons/comments.js +11 -8
- package/admin/src/components/icons/index.d.ts +6 -0
- package/admin/src/components/icons/index.js +15 -6
- package/admin/src/components/icons/lock.d.ts +7 -0
- package/admin/src/components/icons/lock.js +11 -21
- package/admin/src/components/icons/review.d.ts +7 -0
- package/admin/src/components/icons/review.js +11 -17
- package/admin/src/components/icons/unlock.d.ts +7 -0
- package/admin/src/components/icons/unlock.js +11 -19
- package/admin/src/hooks/useConfig.d.ts +8 -0
- package/admin/src/hooks/useConfig.js +40 -45
- package/admin/src/index.d.ts +7 -0
- package/admin/src/index.js +98 -92
- package/admin/src/pages/App/index.d.ts +4 -0
- package/admin/src/pages/App/index.js +43 -67
- package/admin/src/pages/App/reducer/actions.d.ts +8 -0
- package/admin/src/pages/App/reducer/actions.js +11 -7
- package/admin/src/pages/App/reducer/constants.d.ts +4 -0
- package/admin/src/pages/App/reducer/constants.js +7 -4
- package/admin/src/pages/App/reducer/index.d.ts +9 -0
- package/admin/src/pages/App/reducer/index.js +24 -22
- package/admin/src/pages/App/reducer/init.d.ts +3 -0
- package/admin/src/pages/App/reducer/init.js +6 -4
- package/admin/src/pages/App/reducer/selectors.d.ts +6 -0
- package/admin/src/pages/App/reducer/selectors.js +17 -34
- package/admin/src/pages/App/utils/api.d.ts +2 -0
- package/admin/src/pages/App/utils/api.js +14 -11
- package/admin/src/pages/ComingSoonPage/index.d.ts +3 -0
- package/admin/src/pages/ComingSoonPage/index.js +42 -24
- package/admin/src/pages/Details/components/DetailsEntity/index.d.ts +18 -0
- package/admin/src/pages/Details/components/DetailsEntity/index.js +49 -77
- package/admin/src/pages/Details/components/DetailsFilters/index.d.ts +12 -0
- package/admin/src/pages/Details/components/DetailsFilters/index.js +19 -26
- package/admin/src/pages/Details/components/DetailsFilters/styles.d.ts +2 -0
- package/admin/src/pages/Details/components/DetailsFilters/styles.js +14 -8
- package/admin/src/pages/Details/index.d.ts +4 -0
- package/admin/src/pages/Details/index.js +94 -133
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.d.ts +20 -0
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.js +128 -139
- package/admin/src/pages/Discover/components/DiscoverTableRow/styles.d.ts +2 -0
- package/admin/src/pages/Discover/components/DiscoverTableRow/styles.js +14 -8
- package/admin/src/pages/Discover/index.d.ts +4 -0
- package/admin/src/pages/Discover/index.js +129 -170
- package/admin/src/pages/Discover/utils/api.d.ts +2 -0
- package/admin/src/pages/Discover/utils/api.js +15 -13
- package/admin/src/pages/Discover/utils/filtersSchema.d.ts +11 -0
- package/admin/src/pages/Discover/utils/filtersSchema.js +8 -6
- package/admin/src/pages/Settings/components/RestartAlert/styles.d.ts +2 -0
- package/admin/src/pages/Settings/components/RestartAlert/styles.js +14 -8
- package/admin/src/pages/Settings/index.d.ts +3 -0
- package/admin/src/pages/Settings/index.js +225 -391
- package/admin/src/pages/Settings/utils/api.d.ts +7 -0
- package/admin/src/pages/Settings/utils/api.js +60 -55
- package/admin/src/pages/utils/api.d.ts +12 -0
- package/admin/src/pages/utils/api.js +58 -53
- package/admin/src/permissions.d.ts +28 -0
- package/admin/src/permissions.js +31 -17
- package/admin/src/pluginId.d.ts +2 -0
- package/admin/src/pluginId.js +29 -5
- package/admin/src/reducers.d.ts +7 -0
- package/admin/src/reducers.js +10 -6
- package/admin/src/translations/en.json +131 -131
- package/admin/src/translations/fr.json +1 -1
- package/admin/src/utils/axiosInstance.d.ts +3 -0
- package/admin/src/utils/axiosInstance.js +21 -27
- package/admin/src/utils/constants.d.ts +25 -0
- package/admin/src/utils/constants.js +23 -22
- package/admin/src/utils/getApiUrl.d.ts +3 -0
- package/admin/src/utils/getApiUrl.js +6 -5
- package/admin/src/utils/getMessage.d.ts +4 -0
- package/admin/src/utils/getMessage.js +15 -15
- package/admin/src/utils/getRelatedGroups.d.ts +4 -0
- package/admin/src/utils/getRelatedGroups.js +5 -3
- package/admin/src/utils/getUrl.d.ts +3 -0
- package/admin/src/utils/getUrl.js +6 -5
- package/admin/src/utils/handleAPIError.d.ts +4 -0
- package/admin/src/utils/handleAPIError.js +12 -11
- package/admin/src/utils/index.d.ts +12 -0
- package/admin/src/utils/index.js +29 -11
- package/admin/src/utils/parseRegExp.d.ts +6 -0
- package/admin/src/utils/parseRegExp.js +6 -5
- package/admin/src/utils/renderEntryTitle.d.ts +4 -0
- package/admin/src/utils/renderEntryTitle.js +11 -12
- package/admin/src/utils/renderInitials.d.ts +3 -0
- package/admin/src/utils/renderInitials.js +10 -5
- package/admin/src/utils/resolveCommentStatus.d.ts +4 -0
- package/admin/src/utils/resolveCommentStatus.js +17 -21
- package/admin/src/utils/resolveCommentStatusColor.d.ts +4 -0
- package/admin/src/utils/resolveCommentStatusColor.js +19 -19
- package/content-types/comment.d.ts +91 -0
- package/content-types/comment.js +87 -88
- package/content-types/index.d.ts +143 -0
- package/content-types/index.js +15 -10
- package/content-types/report.d.ts +48 -0
- package/content-types/report.js +44 -49
- package/package.json +24 -19
- package/permissions.d.ts +18 -0
- package/permissions.js +12 -13
- package/server/bootstrap.d.ts +4 -0
- package/server/bootstrap.js +56 -62
- package/server/config/index.d.ts +4 -0
- package/server/config/index.js +17 -15
- package/server/controllers/admin.d.ts +4 -0
- package/server/controllers/admin.js +134 -167
- package/server/controllers/client.d.ts +4 -0
- package/server/controllers/client.js +104 -112
- package/server/controllers/index.d.ts +6 -0
- package/server/controllers/index.js +12 -8
- package/server/controllers/utils/functions.d.ts +7 -0
- package/server/controllers/utils/functions.js +22 -17
- package/server/controllers/utils/parsers.d.ts +15 -0
- package/server/controllers/utils/parsers.js +17 -17
- package/server/destroy.d.ts +3 -0
- package/server/destroy.js +3 -4
- package/server/graphql/index.d.ts +4 -0
- package/server/graphql/index.js +27 -25
- package/server/graphql/mutations/createAbuseReport.d.ts +11 -0
- package/server/graphql/mutations/createAbuseReport.js +22 -24
- package/server/graphql/mutations/createComment.d.ts +14 -0
- package/server/graphql/mutations/createComment.js +22 -24
- package/server/graphql/mutations/index.d.ts +4 -0
- package/server/graphql/mutations/index.js +24 -19
- package/server/graphql/mutations/removeComment.d.ts +11 -0
- package/server/graphql/mutations/removeComment.js +22 -24
- package/server/graphql/mutations/updateComment.d.ts +11 -0
- package/server/graphql/mutations/updateComment.js +22 -24
- package/server/graphql/queries/findAllFlat.d.ts +19 -0
- package/server/graphql/queries/findAllFlat.js +31 -34
- package/server/graphql/queries/findAllInHierarchy.d.ts +18 -0
- package/server/graphql/queries/findAllInHierarchy.js +26 -30
- package/server/graphql/queries/index.d.ts +4 -0
- package/server/graphql/queries/index.js +20 -17
- package/server/graphql/resolvers-config.d.ts +23 -0
- package/server/graphql/resolvers-config.js +11 -11
- package/server/graphql/types/comment-author.d.ts +4 -0
- package/server/graphql/types/comment-author.js +10 -8
- package/server/graphql/types/comment-nested.d.ts +4 -0
- package/server/graphql/types/comment-nested.js +17 -15
- package/server/graphql/types/comment.d.ts +4 -0
- package/server/graphql/types/comment.js +16 -14
- package/server/graphql/types/create-comment-author.d.ts +4 -0
- package/server/graphql/types/create-comment-author.js +10 -8
- package/server/graphql/types/create-comment.d.ts +4 -0
- package/server/graphql/types/create-comment.js +10 -8
- package/server/graphql/types/create-report.d.ts +4 -0
- package/server/graphql/types/create-report.js +10 -8
- package/server/graphql/types/id.d.ts +4 -0
- package/server/graphql/types/id.js +24 -23
- package/server/graphql/types/identify-comment-author.d.ts +4 -0
- package/server/graphql/types/identify-comment-author.js +7 -5
- package/server/graphql/types/index.d.ts +4 -0
- package/server/graphql/types/index.js +36 -17
- package/server/graphql/types/remove-comment.d.ts +4 -0
- package/server/graphql/types/remove-comment.js +9 -7
- package/server/graphql/types/report-reason.d.ts +4 -0
- package/server/graphql/types/report-reason.js +10 -8
- package/server/graphql/types/report.d.ts +4 -0
- package/server/graphql/types/report.js +12 -10
- package/server/graphql/types/response-find-all.d.ts +4 -0
- package/server/graphql/types/response-find-all.js +8 -6
- package/server/graphql/types/response-meta.d.ts +4 -0
- package/server/graphql/types/response-meta.js +7 -5
- package/server/graphql/types/response-pagination.d.ts +4 -0
- package/server/graphql/types/response-pagination.js +12 -10
- package/server/graphql/types/update-comment.d.ts +4 -0
- package/server/graphql/types/update-comment.js +10 -8
- package/server/index.d.ts +26 -0
- package/server/index.js +24 -21
- package/server/register.d.ts +3 -0
- package/server/register.js +3 -4
- package/server/routes/admin.d.ts +4 -0
- package/server/routes/admin.js +103 -109
- package/server/routes/client.d.ts +4 -0
- package/server/routes/client.js +48 -46
- package/server/routes/index.d.ts +11 -0
- package/server/routes/index.js +18 -14
- package/server/services/admin.d.ts +5 -0
- package/server/services/admin.js +126 -158
- package/server/services/client.d.ts +5 -0
- package/server/services/client.js +135 -151
- package/server/services/common.d.ts +5 -0
- package/server/services/common.js +165 -194
- package/server/services/graphql.d.ts +5 -0
- package/server/services/graphql.js +117 -182
- package/server/services/index.d.ts +8 -0
- package/server/services/index.js +15 -12
- package/server/services/utils/functions.d.ts +13 -0
- package/server/services/utils/functions.js +100 -109
- package/server/utils/constants.d.ts +9 -0
- package/server/utils/constants.js +19 -23
- package/server/utils/error.d.ts +19 -0
- package/server/utils/error.js +23 -18
- package/server/utils/functions.d.ts +6 -0
- package/server/utils/functions.js +35 -18
- package/strapi-admin.d.ts +3 -0
- package/strapi-admin.js +8 -3
- package/strapi-server.d.ts +177 -0
- package/strapi-server.js +43 -46
- package/tsconfig.tsbuildinfo +1 -0
- package/types/contentTypes.d.ts +44 -0
- package/types/contentTypes.js +3 -0
- package/.husky/pre-commit +0 -4
- package/LICENSE.md +0 -7
- package/__mocks__/initSetup.js +0 -108
- package/jest.config.js +0 -7
- package/server/controllers/utils/__tests__/functions.test.js +0 -43
- package/server/controllers/utils/__tests__/parsers.test.js +0 -94
- package/server/services/__tests__/common.test.js +0 -399
- package/server/services/utils/__tests__/functions.test.js +0 -53
- package/server/utils/__tests__/functions.test.js +0 -17
|
@@ -1,84 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const DetailsEntity = ({
|
|
19
|
-
data = {},
|
|
20
|
-
schema = {},
|
|
21
|
-
config = {},
|
|
22
|
-
filters,
|
|
23
|
-
onFiltersChange
|
|
24
|
-
}) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const prop_types_1 = __importDefault(require("prop-types"));
|
|
8
|
+
const lodash_1 = require("lodash");
|
|
9
|
+
const Box_1 = require("@strapi/design-system/Box");
|
|
10
|
+
const Divider_1 = require("@strapi/design-system/Divider");
|
|
11
|
+
const Flex_1 = require("@strapi/design-system/Flex");
|
|
12
|
+
const Stack_1 = require("@strapi/design-system/Stack");
|
|
13
|
+
const Typography_1 = require("@strapi/design-system/Typography");
|
|
14
|
+
const utils_1 = require("../../../../utils");
|
|
15
|
+
const DetailsFilters_1 = __importDefault(require("../DetailsFilters"));
|
|
16
|
+
const DetailsEntity = ({ data = {}, schema = {}, config = {}, filters, onFiltersChange, }) => {
|
|
25
17
|
const { entryLabel = {} } = config;
|
|
26
18
|
const { attributes = {} } = schema;
|
|
27
19
|
const keys = Object.keys(attributes);
|
|
28
|
-
const entityLabelKey = first(entryLabel[data?.uid]);
|
|
29
|
-
|
|
20
|
+
const entityLabelKey = (0, lodash_1.first)(entryLabel[data?.uid]);
|
|
30
21
|
const FIELDS_LIMIT = 5;
|
|
31
|
-
const itemKeys = take(
|
|
32
|
-
|
|
33
|
-
FIELDS_LIMIT
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
(<Flex key={`prop_${_}`} direction="column" alignItems="flex-start">
|
|
57
|
-
<Typography fontWeight="bold">{ formatLabel(_) }</Typography>
|
|
58
|
-
<Typography>{ data[_] }</Typography>
|
|
59
|
-
</Flex>))
|
|
60
|
-
}
|
|
61
|
-
</Stack>
|
|
62
|
-
</Box>) }
|
|
63
|
-
<Box>
|
|
64
|
-
<Typography variant="sigma" textColor="neutral600" id="view-filters">
|
|
65
|
-
{ getMessage('page.details.filters.label', 'View') }
|
|
66
|
-
</Typography>
|
|
67
|
-
<Box paddingTop={2} paddingBottom={4}>
|
|
68
|
-
<Divider />
|
|
69
|
-
</Box>
|
|
70
|
-
<DetailsFilters data={filters} onChange={onFiltersChange} />
|
|
71
|
-
</Box>
|
|
72
|
-
</Box>);
|
|
22
|
+
const itemKeys = (0, lodash_1.take)(keys.filter((_) => attributes[_].type === "string" &&
|
|
23
|
+
!(0, lodash_1.isNil)(data[_]) &&
|
|
24
|
+
_ !== entityLabelKey), FIELDS_LIMIT);
|
|
25
|
+
const formatLabel = (label = "") => label
|
|
26
|
+
.split("_")
|
|
27
|
+
.map((_) => (0, lodash_1.capitalize)(_))
|
|
28
|
+
.join(" ");
|
|
29
|
+
const entityIsRenderable = data && !(0, lodash_1.isEmpty)(data) && (!(0, lodash_1.isEmpty)(itemKeys) || data[entityLabelKey]);
|
|
30
|
+
return (react_1.default.createElement(Box_1.Box, { padding: 4 },
|
|
31
|
+
entityIsRenderable && (react_1.default.createElement(Box_1.Box, { marginBottom: 4 },
|
|
32
|
+
react_1.default.createElement(Typography_1.Typography, { variant: "sigma", textColor: "neutral600", id: "entity-details" }, (0, utils_1.getMessage)("page.details.panel.entity", "Details")),
|
|
33
|
+
react_1.default.createElement(Box_1.Box, { paddingTop: 2, paddingBottom: 4 },
|
|
34
|
+
react_1.default.createElement(Divider_1.Divider, null)),
|
|
35
|
+
react_1.default.createElement(Stack_1.Stack, { size: itemKeys.length },
|
|
36
|
+
react_1.default.createElement(Flex_1.Flex, { direction: "column", alignItems: "flex-start" },
|
|
37
|
+
react_1.default.createElement(Typography_1.Typography, { fontWeight: "bold" }, formatLabel(entityLabelKey)),
|
|
38
|
+
react_1.default.createElement(Typography_1.Typography, null, data[entityLabelKey])),
|
|
39
|
+
itemKeys.map((_) => (react_1.default.createElement(Flex_1.Flex, { key: `prop_${_}`, direction: "column", alignItems: "flex-start" },
|
|
40
|
+
react_1.default.createElement(Typography_1.Typography, { fontWeight: "bold" }, formatLabel(_)),
|
|
41
|
+
react_1.default.createElement(Typography_1.Typography, null, data[_]))))))),
|
|
42
|
+
react_1.default.createElement(Box_1.Box, null,
|
|
43
|
+
react_1.default.createElement(Typography_1.Typography, { variant: "sigma", textColor: "neutral600", id: "view-filters" }, (0, utils_1.getMessage)("page.details.filters.label", "View")),
|
|
44
|
+
react_1.default.createElement(Box_1.Box, { paddingTop: 2, paddingBottom: 4 },
|
|
45
|
+
react_1.default.createElement(Divider_1.Divider, null)),
|
|
46
|
+
react_1.default.createElement(DetailsFilters_1.default, { data: filters, onChange: onFiltersChange }))));
|
|
73
47
|
};
|
|
74
|
-
|
|
75
48
|
DetailsEntity.propTypes = {
|
|
76
|
-
data:
|
|
77
|
-
schema:
|
|
78
|
-
config:
|
|
79
|
-
filters:
|
|
80
|
-
onFiltersChange:
|
|
49
|
+
data: prop_types_1.default.object.isRequired,
|
|
50
|
+
schema: prop_types_1.default.object.isRequired,
|
|
51
|
+
config: prop_types_1.default.object.isRequired,
|
|
52
|
+
filters: prop_types_1.default.object.isRequired,
|
|
53
|
+
onFiltersChange: prop_types_1.default.func.isRequired,
|
|
81
54
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
55
|
+
exports.default = DetailsEntity;
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,35 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const prop_types_1 = __importDefault(require("prop-types"));
|
|
8
|
+
const Box_1 = require("@strapi/design-system/Box");
|
|
9
|
+
const Flex_1 = require("@strapi/design-system/Flex");
|
|
10
|
+
const Stack_1 = require("@strapi/design-system/Stack");
|
|
11
|
+
const Checkbox_1 = require("@strapi/design-system/Checkbox");
|
|
12
|
+
const utils_1 = require("../../../../utils");
|
|
9
13
|
const DetailsFilters = ({ data, onChange }) => {
|
|
10
|
-
|
|
11
14
|
const { removed = false } = data;
|
|
12
|
-
|
|
13
15
|
const handleOnChange = (prop, value) => onChange({
|
|
14
16
|
...data,
|
|
15
17
|
[prop]: !value ? undefined : value,
|
|
16
18
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<Checkbox
|
|
21
|
-
checked={removed}
|
|
22
|
-
onChange={() => handleOnChange('removed', !removed)}
|
|
23
|
-
visibleLabels>
|
|
24
|
-
{ getMessage('page.details.filters.removed.label', 'Show removed comments') }
|
|
25
|
-
</Checkbox>
|
|
26
|
-
</Stack>
|
|
27
|
-
</Box>);
|
|
19
|
+
return (react_1.default.createElement(Box_1.Box, { as: Flex_1.Flex },
|
|
20
|
+
react_1.default.createElement(Stack_1.Stack, { size: 2, vertical: true },
|
|
21
|
+
react_1.default.createElement(Checkbox_1.Checkbox, { checked: removed, onChange: () => handleOnChange("removed", !removed), visibleLabels: true }, (0, utils_1.getMessage)("page.details.filters.removed.label", "Show removed comments")))));
|
|
28
22
|
};
|
|
29
|
-
|
|
30
23
|
DetailsFilters.propTypes = {
|
|
31
|
-
data:
|
|
32
|
-
onChange:
|
|
24
|
+
data: prop_types_1.default.object.isRequired,
|
|
25
|
+
onChange: prop_types_1.default.func.isRequired,
|
|
33
26
|
};
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
exports.default = DetailsFilters;
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TableLink = void 0;
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
const Link_1 = require("@strapi/design-system/Link");
|
|
9
|
+
exports.TableLink = (0, styled_components_1.default)(Link_1.Link) `
|
|
10
|
+
display: block;
|
|
11
|
+
text-overflow: ellipsis;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
`;
|
|
14
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -1,136 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import React, { memo, useRef, useMemo, useState } from 'react';
|
|
8
|
-
import { connect } from 'react-redux';
|
|
9
|
-
import { bindActionCreators, compose } from 'redux';
|
|
10
|
-
import isEqual from 'react-fast-compare';
|
|
11
|
-
import { useQuery } from 'react-query';
|
|
12
|
-
import { useRouteMatch } from 'react-router-dom';
|
|
13
|
-
import { Layout, HeaderLayout, TwoColsLayout, ContentLayout } from '@strapi/design-system/Layout';
|
|
14
|
-
import { Box } from '@strapi/design-system/Box';
|
|
15
|
-
import { Link } from '@strapi/design-system/Link';
|
|
16
|
-
import { Loader } from '@strapi/design-system/Loader';
|
|
17
|
-
import { useNotifyAT } from '@strapi/design-system/LiveRegions';
|
|
18
|
-
import { ArrowLeft } from '@strapi/icons';
|
|
19
|
-
|
|
20
|
-
import { isEmpty } from 'lodash';
|
|
21
|
-
import {
|
|
22
|
-
LoadingIndicatorPage,
|
|
23
|
-
useTracking,
|
|
24
|
-
useNotification,
|
|
25
|
-
useRBAC,
|
|
26
|
-
useFocusWhenNavigate,
|
|
27
|
-
} from '@strapi/helper-plugin';
|
|
28
|
-
import getMessage from '../../utils/getMessage';
|
|
29
|
-
import { fetchDetailsData, fetchContentTypeData } from '../utils/api';
|
|
30
|
-
import pluginPermissions from '../../permissions';
|
|
31
|
-
import { getUrl, parseRegExp } from '../../utils';
|
|
32
|
-
import Nav from '../../components/Nav';
|
|
33
|
-
import DetailsEntity from './components/DetailsEntity';
|
|
34
|
-
import DiscussionThread from '../../components/DiscussionThread';
|
|
35
|
-
import makeAppView from '../App/reducer/selectors';
|
|
36
|
-
|
|
37
|
-
const Details = ({ config }) => {
|
|
38
|
-
useFocusWhenNavigate();
|
|
39
|
-
|
|
40
|
-
const {
|
|
41
|
-
params: { id },
|
|
42
|
-
} = useRouteMatch(getUrl(`discover/:id`));
|
|
43
|
-
|
|
44
|
-
const { notifyStatus } = useNotifyAT();
|
|
45
|
-
const { trackUsage } = useTracking();
|
|
46
|
-
const trackUsageRef = useRef(trackUsage);
|
|
47
|
-
const toggleNotification = useNotification();
|
|
48
|
-
|
|
49
|
-
const viewPermissions = useMemo(() => ({
|
|
50
|
-
access: pluginPermissions.access,
|
|
51
|
-
moderate: pluginPermissions.moderate,
|
|
52
|
-
accessReports: pluginPermissions.reports,
|
|
53
|
-
reviewReports: pluginPermissions.reportsReview,
|
|
54
|
-
}), []);
|
|
55
|
-
|
|
56
|
-
const {
|
|
57
|
-
isLoading: isLoadingForPermissions,
|
|
58
|
-
allowedActions: { canAccess, canModerate, canAccessReports, canReviewReports },
|
|
59
|
-
} = useRBAC(viewPermissions);
|
|
60
|
-
|
|
61
|
-
const [filters, setFilters] = useState({});
|
|
62
|
-
|
|
63
|
-
const regexUID = new RegExp(
|
|
64
|
-
parseRegExp(config.regex.uid).value,
|
|
65
|
-
parseRegExp(config.regex.uid).flags
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const { isLoading: isLoadingForData, data, isFetching } = useQuery(
|
|
69
|
-
['get-details-data', id, filters, canAccess],
|
|
70
|
-
() => fetchDetailsData(id, filters, toggleNotification),
|
|
71
|
-
{
|
|
72
|
-
initialData: { },
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
73
7
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.mapDispatchToProps = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const react_redux_1 = require("react-redux");
|
|
32
|
+
const redux_1 = require("redux");
|
|
33
|
+
const react_fast_compare_1 = __importDefault(require("react-fast-compare"));
|
|
34
|
+
const react_query_1 = require("react-query");
|
|
35
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
36
|
+
const Layout_1 = require("@strapi/design-system/Layout");
|
|
37
|
+
const Box_1 = require("@strapi/design-system/Box");
|
|
38
|
+
const Link_1 = require("@strapi/design-system/Link");
|
|
39
|
+
const LiveRegions_1 = require("@strapi/design-system/LiveRegions");
|
|
40
|
+
const icons_1 = require("@strapi/icons");
|
|
41
|
+
const lodash_1 = require("lodash");
|
|
42
|
+
const helper_plugin_1 = require("@strapi/helper-plugin");
|
|
43
|
+
const getMessage_1 = __importDefault(require("../../utils/getMessage"));
|
|
44
|
+
const api_1 = require("../utils/api");
|
|
45
|
+
const permissions_1 = __importDefault(require("../../permissions"));
|
|
46
|
+
const utils_1 = require("../../utils");
|
|
47
|
+
const DetailsEntity_1 = __importDefault(require("./components/DetailsEntity"));
|
|
48
|
+
const DiscussionThread_1 = __importDefault(require("../../components/DiscussionThread"));
|
|
49
|
+
const selectors_1 = __importDefault(require("../App/reducer/selectors"));
|
|
50
|
+
const Details = ({ config }) => {
|
|
51
|
+
(0, helper_plugin_1.useFocusWhenNavigate)();
|
|
52
|
+
const { params: { id }, } = (0, react_router_dom_1.useRouteMatch)((0, utils_1.getUrl)(`discover/:id`));
|
|
53
|
+
const { notifyStatus } = (0, LiveRegions_1.useNotifyAT)();
|
|
54
|
+
const { trackUsage } = (0, helper_plugin_1.useTracking)();
|
|
55
|
+
const trackUsageRef = (0, react_1.useRef)(trackUsage);
|
|
56
|
+
const toggleNotification = (0, helper_plugin_1.useNotification)();
|
|
57
|
+
const viewPermissions = (0, react_1.useMemo)(() => ({
|
|
58
|
+
access: permissions_1.default.access,
|
|
59
|
+
moderate: permissions_1.default.moderate,
|
|
60
|
+
accessReports: permissions_1.default.reports,
|
|
61
|
+
reviewReports: permissions_1.default.reportsReview,
|
|
62
|
+
}), []);
|
|
63
|
+
const { isLoading: isLoadingForPermissions, allowedActions: { canAccess, canModerate, canAccessReports, canReviewReports, }, } = (0, helper_plugin_1.useRBAC)(viewPermissions);
|
|
64
|
+
const [filters, setFilters] = (0, react_1.useState)({});
|
|
65
|
+
const regexUID = new RegExp((0, utils_1.parseRegExp)(config.regex.uid).value, (0, utils_1.parseRegExp)(config.regex.uid).flags);
|
|
66
|
+
const { isLoading: isLoadingForData, data, isFetching, } = (0, react_query_1.useQuery)(["get-details-data", id, filters, canAccess], () => (0, api_1.fetchDetailsData)(id, filters, toggleNotification), {
|
|
67
|
+
initialData: {},
|
|
68
|
+
});
|
|
69
|
+
const { entity, level, selected } = data;
|
|
70
|
+
const entityUidValid = entity?.uid && regexUID.test(entity.uid);
|
|
71
|
+
const { data: contentTypeData } = (0, react_query_1.useQuery)(["get-additional-data", entity?.uid, canAccess], () => (0, api_1.fetchContentTypeData)(entity?.uid, toggleNotification), {
|
|
72
|
+
enabled: !!entity?.uid,
|
|
73
|
+
suspense: !entityUidValid,
|
|
74
|
+
});
|
|
75
|
+
const handleChangeFilters = (props) => setFilters(props);
|
|
76
|
+
const isLoading = isLoadingForData || isFetching;
|
|
77
|
+
if (canAccess) {
|
|
78
|
+
return (react_1.default.createElement(Box_1.Box, { background: "neutral100" },
|
|
79
|
+
react_1.default.createElement(Layout_1.Layout, null, (isLoading || isLoadingForPermissions) && (0, lodash_1.isEmpty)(data) ? (react_1.default.createElement(helper_plugin_1.LoadingIndicatorPage, null)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
80
|
+
react_1.default.createElement(Layout_1.HeaderLayout, { navigationAction: react_1.default.createElement(Link_1.Link, { startIcon: react_1.default.createElement(icons_1.ArrowLeft, null), to: (0, utils_1.getUrl)(`discover`) }, (0, getMessage_1.default)("HeaderLayout.link.go-back", "Back", false)), title: (0, getMessage_1.default)("page.details.header"), subtitle: (0, getMessage_1.default)("page.details.header.description"), as: "h2" }),
|
|
81
|
+
react_1.default.createElement(Layout_1.ContentLayout, null,
|
|
82
|
+
react_1.default.createElement(Layout_1.TwoColsLayout, { startCol: react_1.default.createElement(DiscussionThread_1.default, { level: level, selected: selected, isReloading: isLoading, allowedActions: {
|
|
83
|
+
canModerate,
|
|
84
|
+
canAccessReports,
|
|
85
|
+
canReviewReports,
|
|
86
|
+
} }), endCol: react_1.default.createElement(DetailsEntity_1.default, { data: entity, schema: contentTypeData?.schema, config: config, filters: filters, onFiltersChange: handleChangeFilters }) })))))));
|
|
85
87
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (canAccess) {
|
|
93
|
-
return <Box background="neutral100">
|
|
94
|
-
<Layout>
|
|
95
|
-
{(isLoading || isLoadingForPermissions) && isEmpty(data) ? (<LoadingIndicatorPage />) : (
|
|
96
|
-
<>
|
|
97
|
-
<HeaderLayout
|
|
98
|
-
navigationAction={
|
|
99
|
-
<Link startIcon={<ArrowLeft />} to={getUrl(`discover`)}>
|
|
100
|
-
{ getMessage('HeaderLayout.link.go-back', 'Back', false) }
|
|
101
|
-
</Link>}
|
|
102
|
-
title={ getMessage('page.details.header') }
|
|
103
|
-
subtitle={ getMessage('page.details.header.description') }
|
|
104
|
-
as="h2" />
|
|
105
|
-
<ContentLayout>
|
|
106
|
-
<TwoColsLayout
|
|
107
|
-
startCol={<DiscussionThread level={level} selected={selected} isReloading={isLoading} allowedActions={{ canModerate, canAccessReports, canReviewReports }} />}
|
|
108
|
-
endCol={<DetailsEntity
|
|
109
|
-
data={entity}
|
|
110
|
-
schema={contentTypeData?.schema}
|
|
111
|
-
config={config}
|
|
112
|
-
filters={filters}
|
|
113
|
-
onFiltersChange={handleChangeFilters} />}
|
|
114
|
-
/>
|
|
115
|
-
</ContentLayout>
|
|
116
|
-
</>) }
|
|
117
|
-
</Layout>
|
|
118
|
-
</Box>;
|
|
119
|
-
}
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const mapStateToProps = makeAppView();
|
|
124
|
-
|
|
125
|
-
export function mapDispatchToProps(dispatch) {
|
|
126
|
-
return bindActionCreators(
|
|
127
|
-
{ },
|
|
128
|
-
dispatch
|
|
129
|
-
);
|
|
88
|
+
return null;
|
|
89
|
+
};
|
|
90
|
+
const mapStateToProps = (0, selectors_1.default)();
|
|
91
|
+
function mapDispatchToProps(dispatch) {
|
|
92
|
+
return (0, redux_1.bindActionCreators)({}, dispatch);
|
|
130
93
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
export default compose(withConnect)(memo(Details, isEqual));
|
|
94
|
+
exports.mapDispatchToProps = mapDispatchToProps;
|
|
95
|
+
const withConnect = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps);
|
|
96
|
+
exports.default = (0, redux_1.compose)(withConnect)((0, react_1.memo)(Details, react_fast_compare_1.default));
|
|
97
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const DiscoverTableRow: {
|
|
2
|
+
({ config, item, allowedActions: { canModerate, canAccessReports, canReviewReports }, onClick, }: {
|
|
3
|
+
config: any;
|
|
4
|
+
item: any;
|
|
5
|
+
allowedActions: {
|
|
6
|
+
canModerate: any;
|
|
7
|
+
canAccessReports: any;
|
|
8
|
+
canReviewReports: any;
|
|
9
|
+
};
|
|
10
|
+
onClick: any;
|
|
11
|
+
}): any;
|
|
12
|
+
propTypes: {
|
|
13
|
+
config: any;
|
|
14
|
+
item: any;
|
|
15
|
+
allowedActions: any;
|
|
16
|
+
onClick: any;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default DiscoverTableRow;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|