strapi-plugin-comments 2.0.11 → 2.1.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 +165 -119
- package/admin/src/components/ActionButton/styles.ts +11 -0
- package/admin/src/components/Avatar/index.tsx +31 -0
- package/admin/src/components/ConfirmationDialog/index.tsx +88 -0
- package/admin/src/components/DiscussionStatus/index.tsx +36 -0
- package/admin/src/components/DiscussionThread/index.tsx +97 -0
- package/admin/src/components/DiscussionThreadItem/index.tsx +71 -0
- package/admin/src/components/DiscussionThreadItem/{styles.js → styles.ts} +8 -6
- package/admin/src/components/DiscussionThreadItemActions/index.tsx +365 -0
- package/admin/src/components/DiscussionThreadItemActions/styles.ts +9 -0
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.tsx +99 -0
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.ts +8 -0
- package/admin/src/components/DiscussionThreadItemFooter/index.tsx +62 -0
- package/admin/src/components/DiscussionThreadItemFooter/styles.ts +15 -0
- package/admin/src/components/DiscussionThreadItemReviewAction/index.tsx +180 -0
- package/admin/src/components/FormSwitch/index.tsx +35 -0
- package/admin/src/components/FormSwitch/styles.ts +10 -0
- package/admin/src/components/IconButton/styles.ts +19 -0
- package/admin/src/components/Initializer/{index.js → index.tsx} +8 -6
- package/admin/src/components/LoadingIndicatorOverlay/index.tsx +19 -0
- package/admin/src/components/LoadingIndicatorOverlay/styles.ts +21 -0
- package/admin/src/components/Nav/index.tsx +61 -0
- package/admin/src/components/PluginIcon/{index.js → index.tsx} +4 -2
- package/admin/src/components/ReportsReviewModal/index.tsx +71 -0
- package/admin/src/components/ReportsReviewTable/index.tsx +233 -0
- package/admin/src/components/StatusBadge/index.tsx +21 -0
- package/admin/src/components/StatusBadge/styles.ts +19 -0
- package/admin/src/components/TableFilters/{index.js → index.tsx} +14 -9
- package/admin/src/components/TablePagination/{index.js → index.tsx} +8 -6
- package/admin/src/components/icons/comments.tsx +15 -0
- package/admin/src/components/icons/index.ts +6 -0
- package/admin/src/components/icons/{lock.js → lock.tsx} +17 -12
- package/admin/src/components/icons/review.tsx +25 -0
- package/admin/src/components/icons/unlock.tsx +25 -0
- package/admin/src/hooks/useConfig.ts +58 -0
- package/admin/src/{index.js → index.ts} +26 -22
- package/admin/src/pages/App/index.tsx +67 -0
- package/admin/src/pages/App/reducer/actions.ts +10 -0
- package/admin/src/pages/App/reducer/constants.ts +4 -0
- package/admin/src/pages/App/reducer/{index.js → index.ts} +8 -6
- package/admin/src/pages/App/reducer/init.ts +9 -0
- package/admin/src/pages/App/reducer/selectors.ts +32 -0
- package/admin/src/pages/App/utils/{api.js → api.ts} +3 -1
- package/admin/src/pages/ComingSoonPage/index.tsx +31 -0
- package/admin/src/pages/Details/components/DetailsEntity/index.tsx +106 -0
- package/admin/src/pages/Details/components/DetailsFilters/index.tsx +43 -0
- package/admin/src/pages/Details/components/DetailsFilters/styles.ts +9 -0
- package/admin/src/pages/Details/index.tsx +169 -0
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.tsx +252 -0
- package/admin/src/pages/Discover/components/DiscoverTableRow/styles.ts +9 -0
- package/admin/src/pages/Discover/index.tsx +230 -0
- package/admin/src/pages/Discover/utils/api.ts +22 -0
- package/admin/src/pages/Discover/utils/filtersSchema.ts +9 -0
- package/admin/src/pages/Settings/components/RestartAlert/styles.ts +10 -0
- package/admin/src/pages/Settings/index.tsx +602 -0
- package/admin/src/pages/Settings/utils/{api.js → api.ts} +16 -5
- package/admin/src/pages/utils/api.ts +70 -0
- package/admin/src/permissions.ts +30 -0
- package/admin/src/pluginId.ts +3 -0
- package/admin/src/reducers.ts +8 -0
- package/admin/src/translations/en.json +131 -131
- package/admin/src/translations/pt-BR.json +130 -130
- package/admin/src/utils/{axiosInstance.js → axiosInstance.ts} +12 -9
- package/admin/src/utils/constants.ts +25 -0
- package/admin/src/utils/getApiUrl.ts +5 -0
- package/admin/src/utils/getMessage.ts +29 -0
- package/admin/src/utils/getRelatedGroups.ts +6 -0
- package/admin/src/utils/getUrl.ts +5 -0
- package/admin/src/utils/handleAPIError.ts +21 -0
- package/admin/src/utils/index.ts +11 -0
- package/admin/src/utils/parseRegExp.ts +9 -0
- package/admin/src/utils/renderEntryTitle.ts +16 -0
- package/admin/src/utils/renderInitials.ts +10 -0
- package/admin/src/utils/resolveCommentStatus.ts +37 -0
- package/admin/src/utils/resolveCommentStatusColor.ts +22 -0
- package/build/README.md +41 -5
- package/build/admin/src/components/ActionButton/styles.d.ts +1 -1
- package/build/admin/src/components/ActionButton/styles.js +5 -7
- package/build/admin/src/components/Avatar/index.d.ts +12 -0
- package/build/admin/src/components/Avatar/index.js +26 -0
- package/build/admin/src/components/ConfirmationDialog/index.js +23 -90
- package/build/admin/src/components/DiscussionStatus/index.js +13 -27
- package/build/admin/src/components/DiscussionThread/index.js +29 -83
- package/build/admin/src/components/DiscussionThreadItem/index.js +20 -59
- package/build/admin/src/components/DiscussionThreadItem/styles.d.ts +1 -1
- package/build/admin/src/components/DiscussionThreadItem/styles.js +8 -17
- package/build/admin/src/components/DiscussionThreadItemActions/index.js +163 -383
- package/build/admin/src/components/DiscussionThreadItemActions/styles.d.ts +1 -1
- package/build/admin/src/components/DiscussionThreadItemActions/styles.js +5 -9
- package/build/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +52 -85
- package/build/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.d.ts +1 -1
- package/build/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.js +5 -8
- package/build/admin/src/components/DiscussionThreadItemFooter/index.js +27 -61
- package/build/admin/src/components/DiscussionThreadItemFooter/styles.d.ts +1 -1
- package/build/admin/src/components/DiscussionThreadItemFooter/styles.js +7 -14
- package/build/admin/src/components/DiscussionThreadItemReviewAction/index.js +91 -207
- package/build/admin/src/components/FormSwitch/index.d.ts +5 -9
- package/build/admin/src/components/FormSwitch/index.js +8 -32
- package/build/admin/src/components/FormSwitch/styles.d.ts +1 -1
- package/build/admin/src/components/FormSwitch/styles.js +5 -7
- package/build/admin/src/components/IconButton/styles.d.ts +1 -1
- package/build/admin/src/components/IconButton/styles.js +7 -13
- package/build/admin/src/components/Initializer/index.d.ts +4 -2
- package/build/admin/src/components/Initializer/index.js +7 -7
- package/build/admin/src/components/LoadingIndicatorOverlay/index.d.ts +1 -1
- package/build/admin/src/components/LoadingIndicatorOverlay/index.js +6 -12
- package/build/admin/src/components/LoadingIndicatorOverlay/styles.d.ts +1 -1
- package/build/admin/src/components/LoadingIndicatorOverlay/styles.js +7 -14
- package/build/admin/src/components/Nav/index.js +16 -62
- package/build/admin/src/components/PluginIcon/index.d.ts +1 -1
- package/build/admin/src/components/PluginIcon/index.js +5 -8
- package/build/admin/src/components/ReportsReviewModal/index.js +23 -62
- package/build/admin/src/components/ReportsReviewTable/index.js +112 -293
- package/build/admin/src/components/StatusBadge/index.d.ts +5 -9
- package/build/admin/src/components/StatusBadge/index.js +6 -16
- package/build/admin/src/components/StatusBadge/styles.d.ts +1 -1
- package/build/admin/src/components/StatusBadge/styles.js +5 -7
- package/build/admin/src/components/TableFilters/index.js +38 -91
- package/build/admin/src/components/TablePagination/index.d.ts +13 -11
- package/build/admin/src/components/TablePagination/index.js +19 -31
- package/build/admin/src/components/icons/comments.d.ts +4 -7
- package/build/admin/src/components/icons/comments.js +7 -18
- package/build/admin/src/components/icons/index.d.ts +1 -1
- package/build/admin/src/components/icons/index.js +5 -11
- package/build/admin/src/components/icons/lock.d.ts +5 -9
- package/build/admin/src/components/icons/lock.js +7 -24
- package/build/admin/src/components/icons/review.d.ts +5 -9
- package/build/admin/src/components/icons/review.js +7 -26
- package/build/admin/src/components/icons/unlock.d.ts +5 -9
- package/build/admin/src/components/icons/unlock.js +7 -24
- package/build/admin/src/hooks/useConfig.js +34 -42
- package/build/admin/src/index.js +84 -121
- package/build/admin/src/pages/App/index.js +23 -66
- package/build/admin/src/pages/App/reducer/actions.d.ts +4 -4
- package/build/admin/src/pages/App/reducer/actions.js +3 -3
- package/build/admin/src/pages/App/reducer/constants.d.ts +1 -1
- package/build/admin/src/pages/App/reducer/constants.js +1 -1
- package/build/admin/src/pages/App/reducer/index.d.ts +5 -10
- package/build/admin/src/pages/App/reducer/index.js +16 -19
- package/build/admin/src/pages/App/reducer/init.d.ts +1 -1
- package/build/admin/src/pages/App/reducer/init.js +4 -4
- package/build/admin/src/pages/App/reducer/selectors.d.ts +1 -1
- package/build/admin/src/pages/App/reducer/selectors.js +6 -8
- package/build/admin/src/pages/App/utils/api.js +8 -9
- package/build/admin/src/pages/ComingSoonPage/index.js +27 -62
- package/build/admin/src/pages/Details/components/DetailsEntity/index.js +39 -115
- package/build/admin/src/pages/Details/components/DetailsFilters/index.js +13 -33
- package/build/admin/src/pages/Details/components/DetailsFilters/styles.d.ts +1 -1
- package/build/admin/src/pages/Details/components/DetailsFilters/styles.js +5 -7
- package/build/admin/src/pages/Details/index.js +64 -183
- package/build/admin/src/pages/Discover/components/DiscoverTableRow/index.js +139 -314
- package/build/admin/src/pages/Discover/components/DiscoverTableRow/styles.d.ts +1 -1
- package/build/admin/src/pages/Discover/components/DiscoverTableRow/styles.js +5 -7
- package/build/admin/src/pages/Discover/index.js +98 -298
- package/build/admin/src/pages/Discover/utils/api.js +8 -15
- package/build/admin/src/pages/Discover/utils/filtersSchema.d.ts +8 -8
- package/build/admin/src/pages/Discover/utils/filtersSchema.js +6 -6
- package/build/admin/src/pages/Settings/components/RestartAlert/styles.d.ts +1 -1
- package/build/admin/src/pages/Settings/components/RestartAlert/styles.js +5 -7
- package/build/admin/src/pages/Settings/index.js +192 -678
- package/build/admin/src/pages/Settings/utils/api.js +44 -59
- package/build/admin/src/pages/utils/api.js +26 -51
- package/build/admin/src/permissions.d.ts +25 -25
- package/build/admin/src/permissions.js +28 -60
- package/build/admin/src/pluginId.d.ts +1 -1
- package/build/admin/src/pluginId.js +20 -41
- package/build/admin/src/reducers.d.ts +4 -9
- package/build/admin/src/reducers.js +5 -7
- package/build/admin/src/translations/fr.json +132 -1
- package/build/admin/src/utils/axiosInstance.js +15 -23
- package/build/admin/src/utils/constants.d.ts +17 -17
- package/build/admin/src/utils/constants.js +16 -20
- package/build/admin/src/utils/getApiUrl.d.ts +1 -1
- package/build/admin/src/utils/getApiUrl.js +1 -1
- package/build/admin/src/utils/getMessage.js +13 -17
- package/build/admin/src/utils/getRelatedGroups.js +2 -3
- package/build/admin/src/utils/getUrl.d.ts +1 -1
- package/build/admin/src/utils/getUrl.js +1 -1
- package/build/admin/src/utils/handleAPIError.js +12 -15
- package/build/admin/src/utils/index.js +16 -84
- package/build/admin/src/utils/parseRegExp.d.ts +3 -3
- package/build/admin/src/utils/parseRegExp.js +6 -6
- package/build/admin/src/utils/renderEntryTitle.js +7 -10
- package/build/admin/src/utils/renderInitials.d.ts +1 -1
- package/build/admin/src/utils/renderInitials.js +2 -3
- package/build/admin/src/utils/resolveCommentStatus.js +19 -25
- package/build/admin/src/utils/resolveCommentStatusColor.js +15 -15
- package/build/content-types/comment.d.ts +87 -87
- package/build/content-types/comment.js +87 -87
- package/build/content-types/index.d.ts +136 -136
- package/build/content-types/index.js +10 -12
- package/build/content-types/report.d.ts +41 -41
- package/build/content-types/report.js +41 -41
- package/build/package.json +5 -5
- package/build/permissions.d.ts +14 -14
- package/build/permissions.js +14 -14
- package/build/server/bootstrap.js +52 -58
- package/build/server/config/index.js +13 -13
- package/build/server/controllers/admin.js +128 -117
- package/build/server/controllers/client.js +15 -4
- package/build/server/controllers/index.js +6 -8
- package/build/server/controllers/utils/functions.d.ts +1 -1
- package/build/server/controllers/utils/parsers.d.ts +5 -10
- package/build/server/controllers/utils/parsers.js +46 -20
- package/build/server/destroy.d.ts +1 -1
- package/build/server/destroy.js +3 -2
- package/build/server/graphql/index.js +19 -29
- package/build/server/graphql/mutations/createAbuseReport.js +19 -23
- package/build/server/graphql/mutations/createComment.d.ts +1 -1
- package/build/server/graphql/mutations/createComment.js +19 -22
- package/build/server/graphql/mutations/index.js +19 -21
- package/build/server/graphql/mutations/removeComment.d.ts +1 -1
- package/build/server/graphql/mutations/removeComment.js +19 -23
- package/build/server/graphql/mutations/updateComment.d.ts +1 -1
- package/build/server/graphql/mutations/updateComment.js +19 -23
- package/build/server/graphql/queries/findAllFlat.d.ts +1 -1
- package/build/server/graphql/queries/findAllFlat.js +30 -40
- package/build/server/graphql/queries/findAllInHierarchy.d.ts +1 -2
- package/build/server/graphql/queries/findAllInHierarchy.js +25 -32
- package/build/server/graphql/queries/index.js +17 -19
- package/build/server/graphql/resolvers-config.js +10 -10
- package/build/server/graphql/types/comment-author.js +7 -8
- package/build/server/graphql/types/comment-nested.js +14 -15
- package/build/server/graphql/types/comment.js +13 -14
- package/build/server/graphql/types/create-comment-author.js +7 -8
- package/build/server/graphql/types/create-comment.js +7 -8
- package/build/server/graphql/types/create-report.js +7 -8
- package/build/server/graphql/types/id.js +13 -14
- package/build/server/graphql/types/identify-comment-author.js +4 -5
- package/build/server/graphql/types/index.js +21 -27
- package/build/server/graphql/types/remove-comment.js +6 -7
- package/build/server/graphql/types/report-reason.js +9 -9
- package/build/server/graphql/types/report.js +9 -10
- package/build/server/graphql/types/response-find-all.js +5 -6
- package/build/server/graphql/types/response-meta.js +4 -5
- package/build/server/graphql/types/response-pagination.js +9 -10
- package/build/server/graphql/types/update-comment.js +7 -8
- package/build/server/register.d.ts +1 -1
- package/build/server/register.js +3 -2
- package/build/server/routes/admin.d.ts +1 -1
- package/build/server/routes/admin.js +99 -99
- package/build/server/routes/client.d.ts +1 -1
- package/build/server/routes/client.js +79 -43
- package/build/server/routes/index.d.ts +4 -4
- package/build/server/routes/index.js +12 -14
- package/build/server/services/admin.js +257 -284
- package/build/server/services/client.js +54 -42
- package/build/server/services/common.js +33 -11
- package/build/server/services/graphql.js +113 -124
- package/build/server/services/utils/functions.d.ts +1 -1
- package/build/server/services/utils/functions.js +76 -109
- package/build/server/utils/constants.js +13 -14
- package/build/server/utils/error.d.ts +12 -16
- package/build/server/utils/error.js +23 -23
- package/build/server/utils/functions.d.ts +4 -12
- package/build/server/utils/functions.js +20 -34
- package/build/strapi-admin.js +4 -6
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/contentTypes.d.ts +7 -5
- package/content-types/comment.ts +93 -0
- package/content-types/index.ts +11 -0
- package/content-types/report.ts +50 -0
- package/jest.config.ts +22 -0
- package/package.json +45 -11
- package/permissions.ts +17 -0
- package/server/{bootstrap.js → bootstrap.ts} +12 -11
- package/server/config/index.ts +19 -0
- package/server/controllers/admin.ts +194 -0
- package/server/controllers/client.ts +220 -0
- package/server/controllers/index.ts +13 -0
- package/server/controllers/utils/functions.ts +27 -0
- package/server/controllers/utils/parsers.ts +59 -0
- package/server/destroy.ts +3 -0
- package/server/graphql/index.ts +27 -0
- package/server/graphql/mutations/createAbuseReport.ts +38 -0
- package/server/graphql/mutations/createComment.ts +41 -0
- package/server/graphql/mutations/index.ts +26 -0
- package/server/graphql/mutations/removeComment.ts +41 -0
- package/server/graphql/mutations/updateComment.ts +40 -0
- package/server/graphql/queries/findAllFlat.ts +58 -0
- package/server/graphql/queries/findAllInHierarchy.ts +47 -0
- package/server/graphql/queries/index.ts +22 -0
- package/server/graphql/resolvers-config.ts +13 -0
- package/server/graphql/types/comment-author.ts +12 -0
- package/server/graphql/types/comment-nested.ts +19 -0
- package/server/graphql/types/comment.ts +18 -0
- package/server/graphql/types/create-comment-author.ts +12 -0
- package/server/graphql/types/create-comment.ts +12 -0
- package/server/graphql/types/create-report.ts +12 -0
- package/server/graphql/types/id.ts +28 -0
- package/server/graphql/types/identify-comment-author.ts +9 -0
- package/server/graphql/types/index.ts +38 -0
- package/server/graphql/types/remove-comment.ts +11 -0
- package/server/graphql/types/report-reason.ts +12 -0
- package/server/graphql/types/report.ts +14 -0
- package/server/graphql/types/response-find-all.ts +10 -0
- package/server/graphql/types/response-meta.ts +9 -0
- package/server/graphql/types/response-pagination.ts +14 -0
- package/server/graphql/types/update-comment.ts +12 -0
- package/server/index.ts +20 -0
- package/server/register.ts +3 -0
- package/server/routes/admin.ts +118 -0
- package/server/routes/client.ts +95 -0
- package/server/routes/index.ts +25 -0
- package/server/services/admin.ts +406 -0
- package/server/services/client.ts +394 -0
- package/server/services/common.ts +503 -0
- package/server/services/{graphql.js → graphql.ts} +72 -43
- package/server/services/index.ts +13 -0
- package/server/services/utils/functions.ts +150 -0
- package/server/utils/constants.ts +23 -0
- package/server/utils/error.ts +44 -0
- package/server/utils/functions.ts +55 -0
- package/strapi-admin.ts +5 -0
- package/strapi-server.ts +77 -0
- package/tsconfig.json +38 -0
- package/types/common.d.ts +1 -0
- package/types/config.d.ts +35 -0
- package/types/constants.d.ts +3 -0
- package/types/contentTypes.ts +56 -0
- package/types/controllers.d.ts +125 -0
- package/types/graphql.d.ts +24 -0
- package/types/index.d.ts +7 -0
- package/types/services.d.ts +166 -0
- package/__mocks__/initSetup.js +0 -108
- package/admin/src/components/ActionButton/styles.js +0 -10
- package/admin/src/components/ConfirmationDialog/index.js +0 -56
- package/admin/src/components/DiscussionStatus/index.js +0 -33
- package/admin/src/components/DiscussionThread/index.js +0 -62
- package/admin/src/components/DiscussionThreadItem/index.js +0 -57
- package/admin/src/components/DiscussionThreadItemActions/index.js +0 -231
- package/admin/src/components/DiscussionThreadItemActions/styles.js +0 -7
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +0 -80
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.js +0 -6
- package/admin/src/components/DiscussionThreadItemFooter/index.js +0 -47
- package/admin/src/components/DiscussionThreadItemFooter/styles.js +0 -13
- package/admin/src/components/DiscussionThreadItemReviewAction/index.js +0 -131
- package/admin/src/components/FormSwitch/index.js +0 -18
- package/admin/src/components/FormSwitch/styles.js +0 -8
- package/admin/src/components/IconButton/styles.js +0 -14
- package/admin/src/components/LoadingIndicatorOverlay/index.js +0 -15
- package/admin/src/components/LoadingIndicatorOverlay/styles.js +0 -20
- package/admin/src/components/Nav/index.js +0 -49
- package/admin/src/components/ReportsReviewModal/index.js +0 -48
- package/admin/src/components/ReportsReviewTable/index.js +0 -160
- package/admin/src/components/StatusBadge/index.js +0 -17
- package/admin/src/components/StatusBadge/styles.js +0 -17
- package/admin/src/components/icons/comments.js +0 -9
- package/admin/src/components/icons/index.js +0 -6
- package/admin/src/components/icons/review.js +0 -18
- package/admin/src/components/icons/unlock.js +0 -20
- package/admin/src/hooks/useConfig.js +0 -49
- package/admin/src/pages/App/index.js +0 -71
- package/admin/src/pages/App/reducer/actions.js +0 -8
- package/admin/src/pages/App/reducer/constants.js +0 -4
- package/admin/src/pages/App/reducer/init.js +0 -7
- package/admin/src/pages/App/reducer/selectors.js +0 -35
- package/admin/src/pages/ComingSoonPage/index.js +0 -25
- package/admin/src/pages/Details/components/DetailsEntity/index.js +0 -84
- package/admin/src/pages/Details/components/DetailsFilters/index.js +0 -35
- package/admin/src/pages/Details/components/DetailsFilters/styles.js +0 -8
- package/admin/src/pages/Details/index.js +0 -136
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.js +0 -180
- package/admin/src/pages/Discover/components/DiscoverTableRow/styles.js +0 -8
- package/admin/src/pages/Discover/index.js +0 -173
- package/admin/src/pages/Discover/utils/api.js +0 -14
- package/admin/src/pages/Discover/utils/filtersSchema.js +0 -9
- package/admin/src/pages/Settings/components/RestartAlert/styles.js +0 -8
- package/admin/src/pages/Settings/index.js +0 -392
- package/admin/src/pages/utils/api.js +0 -53
- package/admin/src/permissions.js +0 -19
- package/admin/src/pluginId.js +0 -5
- package/admin/src/reducers.js +0 -8
- package/admin/src/utils/constants.js +0 -25
- package/admin/src/utils/getApiUrl.js +0 -5
- package/admin/src/utils/getMessage.js +0 -21
- package/admin/src/utils/getRelatedGroups.js +0 -3
- package/admin/src/utils/getUrl.js +0 -5
- package/admin/src/utils/handleAPIError.js +0 -16
- package/admin/src/utils/index.js +0 -11
- package/admin/src/utils/parseRegExp.js +0 -10
- package/admin/src/utils/renderEntryTitle.js +0 -14
- package/admin/src/utils/renderInitials.js +0 -5
- package/admin/src/utils/resolveCommentStatus.js +0 -30
- package/admin/src/utils/resolveCommentStatusColor.js +0 -22
- package/content-types/comment.js +0 -93
- package/content-types/index.js +0 -11
- package/content-types/report.js +0 -54
- package/jest.config.js +0 -7
- package/permissions.js +0 -19
- package/server/config/index.js +0 -17
- package/server/controllers/admin.js +0 -168
- package/server/controllers/client.js +0 -114
- package/server/controllers/index.js +0 -9
- package/server/controllers/utils/__tests__/functions.test.js +0 -43
- package/server/controllers/utils/__tests__/parsers.test.js +0 -94
- package/server/controllers/utils/functions.js +0 -19
- package/server/controllers/utils/parsers.js +0 -23
- package/server/destroy.js +0 -5
- package/server/graphql/index.js +0 -25
- package/server/graphql/mutations/createAbuseReport.js +0 -25
- package/server/graphql/mutations/createComment.js +0 -25
- package/server/graphql/mutations/index.js +0 -21
- package/server/graphql/mutations/removeComment.js +0 -25
- package/server/graphql/mutations/updateComment.js +0 -25
- package/server/graphql/queries/findAllFlat.js +0 -35
- package/server/graphql/queries/findAllInHierarchy.js +0 -31
- package/server/graphql/queries/index.js +0 -19
- package/server/graphql/resolvers-config.js +0 -13
- package/server/graphql/types/comment-author.js +0 -9
- package/server/graphql/types/comment-nested.js +0 -16
- package/server/graphql/types/comment.js +0 -15
- package/server/graphql/types/create-comment-author.js +0 -9
- package/server/graphql/types/create-comment.js +0 -9
- package/server/graphql/types/create-report.js +0 -9
- package/server/graphql/types/id.js +0 -24
- package/server/graphql/types/identify-comment-author.js +0 -6
- package/server/graphql/types/index.js +0 -19
- package/server/graphql/types/remove-comment.js +0 -8
- package/server/graphql/types/report-reason.js +0 -10
- package/server/graphql/types/report.js +0 -11
- package/server/graphql/types/response-find-all.js +0 -7
- package/server/graphql/types/response-meta.js +0 -6
- package/server/graphql/types/response-pagination.js +0 -11
- package/server/graphql/types/update-comment.js +0 -9
- package/server/index.js +0 -22
- package/server/register.js +0 -5
- package/server/routes/admin.js +0 -124
- package/server/routes/client.js +0 -52
- package/server/routes/index.js +0 -15
- package/server/services/__tests__/common.test.js +0 -399
- package/server/services/admin.js +0 -296
- package/server/services/client.js +0 -263
- package/server/services/common.js +0 -295
- package/server/services/index.js +0 -13
- package/server/services/utils/__tests__/functions.test.js +0 -53
- package/server/services/utils/functions.js +0 -112
- package/server/utils/__tests__/functions.test.js +0 -17
- package/server/utils/constants.js +0 -26
- package/server/utils/error.js +0 -24
- package/server/utils/functions.js +0 -19
- package/strapi-admin.js +0 -3
- package/strapi-server.js +0 -49
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Nav
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import {
|
|
9
|
-
SubNav,
|
|
10
|
-
SubNavHeader,
|
|
11
|
-
SubNavSection,
|
|
12
|
-
SubNavSections,
|
|
13
|
-
SubNavLink,
|
|
14
|
-
} from '@strapi/design-system/SubNav';
|
|
15
|
-
import { ExclamationMarkCircle, Apps } from '@strapi/icons';
|
|
16
|
-
import getMessage from '../../utils/getMessage';
|
|
17
|
-
|
|
18
|
-
// import PropTypes from 'prop-types';
|
|
19
|
-
import getUrl from '../../utils/getUrl';
|
|
20
|
-
|
|
21
|
-
const Nav = ({ visible = false, hasNewComments, hasNewReports }) => {
|
|
22
|
-
if (!visible) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return <SubNav ariaLabel="Comments sub nav">
|
|
27
|
-
<SubNavHeader label={getMessage('plugin.name')} />
|
|
28
|
-
<SubNavSections>
|
|
29
|
-
<SubNavLink to={ getUrl('dashboard') } withBullet={hasNewComments} icon={<Apps />}>
|
|
30
|
-
{ getMessage('nav.item.updates') }
|
|
31
|
-
</SubNavLink>
|
|
32
|
-
<SubNavSection label={getMessage('nav.header.moderation')}>
|
|
33
|
-
<SubNavLink to={ getUrl('discover') } icon={<Apps />}>
|
|
34
|
-
{ getMessage('nav.item.discover') }
|
|
35
|
-
</SubNavLink>
|
|
36
|
-
<SubNavLink to={ getUrl('reports') } withBullet={hasNewReports} icon={<Apps />}>
|
|
37
|
-
{ getMessage('nav.item.reports') }
|
|
38
|
-
</SubNavLink>
|
|
39
|
-
</SubNavSection>
|
|
40
|
-
<SubNavSection label={getMessage('nav.header.settings')}>
|
|
41
|
-
<SubNavLink to={ getUrl('settings') } icon={<Apps />}>
|
|
42
|
-
{ getMessage('nav.item.settings') }
|
|
43
|
-
</SubNavLink>
|
|
44
|
-
</SubNavSection>
|
|
45
|
-
</SubNavSections>
|
|
46
|
-
</SubNav>;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default Nav;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Entity Details
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
import { ModalLayout, ModalBody, ModalHeader, ModalFooter } from '@strapi/design-system/ModalLayout';
|
|
10
|
-
import { Typography } from '@strapi/design-system/Typography';
|
|
11
|
-
import { getMessage } from '../../utils';
|
|
12
|
-
import DiscussionThreadItem from '../DiscussionThreadItem';
|
|
13
|
-
|
|
14
|
-
const ReportsReviewModal = ({
|
|
15
|
-
isVisible = false,
|
|
16
|
-
item,
|
|
17
|
-
children,
|
|
18
|
-
onClose,
|
|
19
|
-
startActions,
|
|
20
|
-
endActions,
|
|
21
|
-
}) => ( isVisible &&
|
|
22
|
-
(<ModalLayout onClose={onClose}>
|
|
23
|
-
<ModalHeader>
|
|
24
|
-
<Typography fontWeight="bold" textColor="neutral800" as="h2" id="title">{ getMessage('page.details.panel.discussion.warnings.reports.dialog.header', 'Open reports') }</Typography>
|
|
25
|
-
</ModalHeader>
|
|
26
|
-
<ModalBody>
|
|
27
|
-
<DiscussionThreadItem as="div" {...item} root preview isSelected={true} />
|
|
28
|
-
{ children }
|
|
29
|
-
</ModalBody>
|
|
30
|
-
<ModalFooter variant="tertiary" startActions={startActions} endActions={endActions} />
|
|
31
|
-
</ModalLayout>)
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
ReportsReviewModal.propTypes = {
|
|
35
|
-
isVisible: PropTypes.bool,
|
|
36
|
-
startActions: PropTypes.array,
|
|
37
|
-
endActions: PropTypes.array,
|
|
38
|
-
item: PropTypes.object.isRequired,
|
|
39
|
-
children: PropTypes.array.isRequired,
|
|
40
|
-
allowedActions: PropTypes.shape({
|
|
41
|
-
canModerate: PropTypes.bool,
|
|
42
|
-
canAccessReports: PropTypes.bool,
|
|
43
|
-
canReviewReports: PropTypes.bool,
|
|
44
|
-
}),
|
|
45
|
-
onClose: PropTypes.func.isRequired,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default ReportsReviewModal;
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Entity Details
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { useState, useEffect } from 'react';
|
|
8
|
-
import { useIntl } from 'react-intl';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
import { isEmpty } from 'lodash';
|
|
11
|
-
import { BaseCheckbox } from '@strapi/design-system/BaseCheckbox';
|
|
12
|
-
import { Flex } from '@strapi/design-system/Flex';
|
|
13
|
-
import { Table, Thead, Tbody, TFooter, Tr, Th, Td } from '@strapi/design-system/Table';
|
|
14
|
-
import { Typography } from '@strapi/design-system/Typography';
|
|
15
|
-
import { VisuallyHidden } from '@strapi/design-system/VisuallyHidden';
|
|
16
|
-
import { Check } from '@strapi/icons';
|
|
17
|
-
import { useOverlayBlocker } from '@strapi/helper-plugin';
|
|
18
|
-
import { getMessage } from '../../utils';
|
|
19
|
-
import { REPORT_REASON, REPORT_STATUS } from '../../utils/constants';
|
|
20
|
-
import StatusBadge from '../StatusBadge';
|
|
21
|
-
import { ActionButton } from '../ActionButton/styles';
|
|
22
|
-
|
|
23
|
-
const ReportsReviewTable = ({
|
|
24
|
-
commentId,
|
|
25
|
-
items,
|
|
26
|
-
mutation,
|
|
27
|
-
allowedActions: { canAccessReports, canReviewReports },
|
|
28
|
-
onBlockButtonsStateChange,
|
|
29
|
-
}) => {
|
|
30
|
-
const [storedItems, setStoredItems] = useState([]);
|
|
31
|
-
|
|
32
|
-
const { formatDate } = useIntl();
|
|
33
|
-
|
|
34
|
-
const { lockApp } = useOverlayBlocker();
|
|
35
|
-
|
|
36
|
-
const renderStatus = resolved => {
|
|
37
|
-
const status = resolved ? REPORT_STATUS.RESOLVED : REPORT_STATUS.OPEN;
|
|
38
|
-
let color = 'alternative';
|
|
39
|
-
switch (status) {
|
|
40
|
-
case REPORT_STATUS.RESOLVED:
|
|
41
|
-
color = 'success';
|
|
42
|
-
break;
|
|
43
|
-
case REPORT_STATUS.OPEN:
|
|
44
|
-
color = 'danger';
|
|
45
|
-
};
|
|
46
|
-
return (<StatusBadge backgroundColor={`${color}100`} textColor={`${color}600`} color={color}>{ getMessage(`page.details.panel.discussion.warnings.reports.dialog.status.${status}`, status) }</StatusBadge>);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const renderReason = reason => {
|
|
50
|
-
let color = 'neutral';
|
|
51
|
-
switch (reason) {
|
|
52
|
-
case REPORT_REASON.DISCRIMINATION:
|
|
53
|
-
color = 'danger';
|
|
54
|
-
break;
|
|
55
|
-
case REPORT_REASON.BAD_LANGUAGE:
|
|
56
|
-
color = 'warning';
|
|
57
|
-
};
|
|
58
|
-
return (<StatusBadge backgroundColor={`${color}100`} textColor={`${color}600`} color={color}>{ getMessage(`page.details.panel.discussion.warnings.reports.dialog.reason.${reason}`, reason) }</StatusBadge>);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const handleClickResolve = async (reportId) => {
|
|
62
|
-
if (canReviewReports) {
|
|
63
|
-
lockApp();
|
|
64
|
-
const item = await mutation.mutateAsync({
|
|
65
|
-
id: commentId,
|
|
66
|
-
reportId,
|
|
67
|
-
});
|
|
68
|
-
if (item) {
|
|
69
|
-
const updatedItems = storedItems.map(_ => ({
|
|
70
|
-
..._,
|
|
71
|
-
resolved: reportId === _.id ? true : _.resolved,
|
|
72
|
-
}));
|
|
73
|
-
setStoredItems(updatedItems);
|
|
74
|
-
onBlockButtonsStateChange(updatedItems.filter(_ => !_.resolved).length === 0);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
useEffect(() => {
|
|
80
|
-
setStoredItems(items);
|
|
81
|
-
}, []);
|
|
82
|
-
|
|
83
|
-
if (isEmpty(storedItems)) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const COL_COUNT = 6;
|
|
88
|
-
|
|
89
|
-
if (canAccessReports) {
|
|
90
|
-
return (<Table colCount={COL_COUNT} rowCount={storedItems.length}>
|
|
91
|
-
<Thead>
|
|
92
|
-
<Tr>
|
|
93
|
-
<Th>
|
|
94
|
-
<BaseCheckbox aria-label="Select all entries" />
|
|
95
|
-
</Th>
|
|
96
|
-
<Th>
|
|
97
|
-
<Typography variant="sigma">{ getMessage('page.details.panel.discussion.warnings.reports.dialog.reason') }</Typography>
|
|
98
|
-
</Th>
|
|
99
|
-
<Th>
|
|
100
|
-
<Typography variant="sigma">{ getMessage('page.details.panel.discussion.warnings.reports.dialog.content') }</Typography>
|
|
101
|
-
</Th>
|
|
102
|
-
<Th>
|
|
103
|
-
<Typography variant="sigma">{ getMessage('page.details.panel.discussion.warnings.reports.dialog.createdAt') }</Typography>
|
|
104
|
-
</Th>
|
|
105
|
-
<Th>
|
|
106
|
-
<Typography variant="sigma">{ getMessage('page.details.panel.discussion.warnings.reports.dialog.status') }</Typography>
|
|
107
|
-
</Th>
|
|
108
|
-
{ canReviewReports && (<Th>
|
|
109
|
-
<VisuallyHidden>{ getMessage('page.details.panel.discussion.warnings.reports.dialog.actions') }</VisuallyHidden>
|
|
110
|
-
</Th>)}
|
|
111
|
-
</Tr>
|
|
112
|
-
</Thead>
|
|
113
|
-
<Tbody>
|
|
114
|
-
{storedItems.map(entry => <Tr key={entry.id}>
|
|
115
|
-
<Td>
|
|
116
|
-
<BaseCheckbox aria-label={`Select report`} />
|
|
117
|
-
</Td>
|
|
118
|
-
<Td>
|
|
119
|
-
<Typography textColor="neutral800">{renderReason(entry.reason)}</Typography>
|
|
120
|
-
</Td>
|
|
121
|
-
<Td>
|
|
122
|
-
<Typography textColor="neutral800">{entry.content}</Typography>
|
|
123
|
-
</Td>
|
|
124
|
-
<Td>
|
|
125
|
-
<Typography textColor="neutral800">{ formatDate(entry.createdAt, { dateStyle: 'short', timeStyle: 'short' }) }</Typography>
|
|
126
|
-
</Td>
|
|
127
|
-
<Td>
|
|
128
|
-
{ renderStatus(entry.resolved) }
|
|
129
|
-
</Td>
|
|
130
|
-
{ canReviewReports && (<Td>
|
|
131
|
-
{ !entry.resolved && (<Flex direction="column" alignItems="flex-end">
|
|
132
|
-
<ActionButton
|
|
133
|
-
isSingle
|
|
134
|
-
onClick={() => handleClickResolve(entry.id)}
|
|
135
|
-
startIcon={<Check />}
|
|
136
|
-
variant="success">
|
|
137
|
-
{ getMessage('page.details.panel.discussion.warnings.reports.dialog.actions.resolve', 'resolve') }
|
|
138
|
-
</ActionButton>
|
|
139
|
-
</Flex>) }
|
|
140
|
-
</Td>)}
|
|
141
|
-
</Tr>)}
|
|
142
|
-
</Tbody>
|
|
143
|
-
{/* <TFooter /> */}
|
|
144
|
-
</Table>);
|
|
145
|
-
}
|
|
146
|
-
return null;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
ReportsReviewTable.propTypes = {
|
|
150
|
-
commentId: PropTypes.oneOfType(PropTypes.string, PropTypes.number).isRequired,
|
|
151
|
-
items: PropTypes.array.isRequired,
|
|
152
|
-
mutation: PropTypes.func.isRequired,
|
|
153
|
-
allowedActions: PropTypes.shape({
|
|
154
|
-
canAccessReports: PropTypes.bool,
|
|
155
|
-
canReviewReports: PropTypes.bool,
|
|
156
|
-
}),
|
|
157
|
-
onBlockButtonsStateChange: PropTypes.func.isRequired,
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export default ReportsReviewTable;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Status badge
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { Typography } from '@strapi/design-system/Typography';
|
|
9
|
-
import { StatusBadge as StatusBadgeStyled } from './styles';
|
|
10
|
-
|
|
11
|
-
const StatusBadge = ({ children, textColor, ...rest }) => (<StatusBadgeStyled {...rest} >
|
|
12
|
-
<Typography variant="omega" fontWeight="semibold" textColor={textColor}>
|
|
13
|
-
{ children }
|
|
14
|
-
</Typography>
|
|
15
|
-
</StatusBadgeStyled>);
|
|
16
|
-
|
|
17
|
-
export default StatusBadge;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { Badge } from '@strapi/design-system/Badge';
|
|
3
|
-
|
|
4
|
-
export const StatusBadge = styled(Badge)`
|
|
5
|
-
padding: 5px 8px;
|
|
6
|
-
border: 1px ${ ({ theme, color }) => theme.colors[`${color}200`] } solid;
|
|
7
|
-
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
|
|
10
|
-
text-overflow: ellipsis;
|
|
11
|
-
|
|
12
|
-
cursor: default;
|
|
13
|
-
|
|
14
|
-
span {
|
|
15
|
-
text-transform: none;
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
const initSize = 576;
|
|
5
|
-
|
|
6
|
-
const CommentsIcon = ({ width = 24, height = 24 }) =>
|
|
7
|
-
<svg viewBox={`0 0 ${width} ${height}`} xmlns="http://www.w3.org/2000/svg"><g style={ {transform: `scale(${width/initSize})` } }><path d="M416 192c0-88.4-93.1-160-208-160S0 103.6 0 192c0 34.3 14.1 65.9 38 92-13.4 30.2-35.5 54.2-35.8 54.5-2.2 2.3-2.8 5.7-1.5 8.7S4.8 352 8 352c36.6 0 66.9-12.3 88.7-25 32.2 15.7 70.3 25 111.3 25 114.9 0 208-71.6 208-160zm122 220c23.9-26 38-57.7 38-92 0-66.9-53.5-124.2-129.3-148.1.9 6.6 1.3 13.3 1.3 20.1 0 105.9-107.7 192-240 192-10.8 0-21.3-.8-31.7-1.9C207.8 439.6 281.8 480 368 480c41 0 79.1-9.2 111.3-25 21.8 12.7 52.1 25 88.7 25 3.2 0 6.1-1.9 7.3-4.8 1.3-2.9.7-6.3-1.5-8.7-.3-.3-22.4-24.2-35.8-54.5z"/></g></svg>;
|
|
8
|
-
|
|
9
|
-
export default CommentsIcon;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
const initSize = 16;
|
|
5
|
-
|
|
6
|
-
const ReviewIcon = ({ width, height, size = 16 }) =>
|
|
7
|
-
<svg
|
|
8
|
-
width={width || size}
|
|
9
|
-
height={height || size}
|
|
10
|
-
viewBox={`0 0 ${width || size} ${height || size}`}
|
|
11
|
-
style={{ width: `${width || size}px`, height: `${height || size}px`, }}
|
|
12
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
13
|
-
<g style={ {transform: `scale(${(width || size)/initSize})` } }>
|
|
14
|
-
<path fillRule="evenodd" clipRule="evenodd" d="M0 4a4 4 0 014-4h8a4 4 0 014 4v8a4 4 0 01-4 4H4a4 4 0 01-4-4V4zm6.996.165a1.017 1.017 0 112.012 0L8 11 6.996 4.165zM8 11a1 1 0 110 2 1 1 0 010-2z" />
|
|
15
|
-
</g>
|
|
16
|
-
</svg>
|
|
17
|
-
|
|
18
|
-
export default ReviewIcon;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
const initSize = 330;
|
|
5
|
-
|
|
6
|
-
const UnlockIcon = ({ width, height, size = 16 }) =>
|
|
7
|
-
<svg
|
|
8
|
-
width={width || size}
|
|
9
|
-
height={height || size}
|
|
10
|
-
viewBox={`0 0 ${width || size} ${height || size}`}
|
|
11
|
-
style={{ width: `${width || size}px`, height: `${height || size}px`, }}
|
|
12
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
13
|
-
<g style={ { transform: `scale(${(width || size)/initSize})` } }>
|
|
14
|
-
<path d="M15,160c8.283,0,15-6.716,15-15V85c0-30.327,24.672-55,55-55c30.326,0,55,24.673,55,55v42.893
|
|
15
|
-
c-24.479,21.105-40,52.327-40,87.107c0,63.411,51.588,115,115,115c63.41,0,115-51.589,115-115s-51.59-115-115-115
|
|
16
|
-
c-15.961,0-31.172,3.271-45,9.174V85c0-46.869-38.131-85-85-85S0,38.131,0,85v60C0,153.284,6.715,160,15,160z"/>
|
|
17
|
-
</g>
|
|
18
|
-
</svg>
|
|
19
|
-
|
|
20
|
-
export default UnlockIcon;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { useQuery, useMutation, useQueryClient } from 'react-query';
|
|
2
|
-
import { fetchConfig, restartStrapi, restoreConfig, updateConfig } from '../pages/Settings/utils/api';
|
|
3
|
-
import pluginId from '../pluginId';
|
|
4
|
-
|
|
5
|
-
const useConfig = (toggleNotification) => {
|
|
6
|
-
const queryClient = useQueryClient();
|
|
7
|
-
|
|
8
|
-
const fetch = useQuery('get-config', () =>
|
|
9
|
-
fetchConfig(toggleNotification)
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
const handleError = (type, callback = () => {}) => {
|
|
13
|
-
toggleNotification({
|
|
14
|
-
type: 'warning',
|
|
15
|
-
message: `${pluginId}.page.settings.notification.${type}.error`,
|
|
16
|
-
});
|
|
17
|
-
callback();
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const handleSuccess = (type, callback = () => {}, invalidateQueries = true) => {
|
|
21
|
-
if (invalidateQueries) {
|
|
22
|
-
queryClient.invalidateQueries('get-config');
|
|
23
|
-
};
|
|
24
|
-
toggleNotification({
|
|
25
|
-
type: 'success',
|
|
26
|
-
message: `${pluginId}.page.settings.notification.${type}.success`,
|
|
27
|
-
});
|
|
28
|
-
callback();
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const submitMutation = useMutation(updateConfig, {
|
|
32
|
-
onSuccess: () => handleSuccess('submit'),
|
|
33
|
-
onError: () => handleError('submit'),
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const restoreMutation = useMutation(restoreConfig, {
|
|
37
|
-
onSuccess: () => handleSuccess('restore'),
|
|
38
|
-
onError: () => handleError('restore'),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const restartMutation = useMutation(restartStrapi, {
|
|
42
|
-
onSuccess: () => handleSuccess('restart', () => {}, false),
|
|
43
|
-
onError: () => handleError('restart'),
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return { fetch, restartMutation, submitMutation, restoreMutation };
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export default useConfig;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* This component is the skeleton around the actual pages, and should only
|
|
4
|
-
* contain code that should be seen on all pages. (e.g. navigation bar)
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import { connect } from 'react-redux';
|
|
10
|
-
import { bindActionCreators, compose } from 'redux';
|
|
11
|
-
import { Switch, Route } from 'react-router-dom';
|
|
12
|
-
import { useQuery } from 'react-query';
|
|
13
|
-
import {
|
|
14
|
-
NotFound,
|
|
15
|
-
LoadingIndicatorPage,
|
|
16
|
-
useNotification } from '@strapi/helper-plugin';
|
|
17
|
-
|
|
18
|
-
import ComingSoonPage from '../ComingSoonPage';
|
|
19
|
-
import getUrl from '../../utils/getUrl';
|
|
20
|
-
import Discover from '../Discover';
|
|
21
|
-
import Details from '../Details';
|
|
22
|
-
import { fetchConfig } from './utils/api';
|
|
23
|
-
import { setConfig } from './reducer/actions';
|
|
24
|
-
import makeAppView from './reducer/selectors';
|
|
25
|
-
|
|
26
|
-
const App = ({ setConfig }) => {
|
|
27
|
-
|
|
28
|
-
const toggleNotification = useNotification();
|
|
29
|
-
|
|
30
|
-
const { isLoading, isFetching } = useQuery(
|
|
31
|
-
'get-config', () => fetchConfig(toggleNotification),
|
|
32
|
-
{
|
|
33
|
-
initialData: { },
|
|
34
|
-
onSuccess: (response) => {
|
|
35
|
-
setConfig(response);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
if (isLoading || isFetching) {
|
|
41
|
-
return (<LoadingIndicatorPage />)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div>
|
|
46
|
-
<Switch>
|
|
47
|
-
<Route path={ getUrl('dashboard') } component={ComingSoonPage} exact />
|
|
48
|
-
<Route path={ getUrl('discover') } component={Discover} exact />
|
|
49
|
-
<Route path={ getUrl('discover/:id') } component={Details} exact />
|
|
50
|
-
<Route path={ getUrl('reports') } component={ComingSoonPage} exact />
|
|
51
|
-
<Route path={ getUrl('settings') } component={ComingSoonPage} exact />
|
|
52
|
-
<Route component={NotFound} />
|
|
53
|
-
</Switch>
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const mapStateToProps = makeAppView();
|
|
59
|
-
|
|
60
|
-
export function mapDispatchToProps(dispatch) {
|
|
61
|
-
return bindActionCreators(
|
|
62
|
-
{ setConfig },
|
|
63
|
-
dispatch
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
const withConnect = connect(
|
|
67
|
-
mapStateToProps,
|
|
68
|
-
mapDispatchToProps
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
export default compose(withConnect)(App);
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { createSelector } from 'reselect';
|
|
4
|
-
import { initialState } from './';
|
|
5
|
-
import { REDUCER_NAME } from './constants';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Direct selector to the listView state domain
|
|
9
|
-
*/
|
|
10
|
-
const appView = () => state => state[REDUCER_NAME] || initialState;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Other specific selectors
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Default selector used by listView
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
const makeAppView = () =>
|
|
21
|
-
createSelector(
|
|
22
|
-
appView(),
|
|
23
|
-
substate => {
|
|
24
|
-
return substate;
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const selectConfig = state => {
|
|
29
|
-
const { config } = state;
|
|
30
|
-
|
|
31
|
-
return config;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default makeAppView;
|
|
35
|
-
export { appView, selectConfig };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Coming soon page
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { memo } from 'react';
|
|
8
|
-
import { Box } from '@strapi/design-system/Box';
|
|
9
|
-
import { EmptyStateLayout } from '@strapi/design-system/EmptyStateLayout';
|
|
10
|
-
import { Layout } from '@strapi/design-system/Layout';
|
|
11
|
-
import { Illo } from '@strapi/icons';
|
|
12
|
-
import getMessage from '../../utils/getMessage';
|
|
13
|
-
import Nav from '../../components/Nav';
|
|
14
|
-
|
|
15
|
-
const ComingSoonPage = () => {
|
|
16
|
-
return (<Box background="neutral100">
|
|
17
|
-
<Layout sideNav={<Nav />}>
|
|
18
|
-
<Box padding={8} background="neutral100">
|
|
19
|
-
<EmptyStateLayout icon={<Illo />} content={getMessage('page.coming.soon')} />
|
|
20
|
-
</Box>
|
|
21
|
-
</Layout>
|
|
22
|
-
</Box>);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default memo(ComingSoonPage);
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Entity Details
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
import { capitalize, isNil, isEmpty, first, take } from 'lodash';
|
|
10
|
-
import { Box } from '@strapi/design-system/Box';
|
|
11
|
-
import { Divider } from '@strapi/design-system/Divider';
|
|
12
|
-
import { Flex } from '@strapi/design-system/Flex';
|
|
13
|
-
import { Stack } from '@strapi/design-system/Stack';
|
|
14
|
-
import { Typography } from '@strapi/design-system/Typography';
|
|
15
|
-
import { getMessage } from '../../../../utils';
|
|
16
|
-
import DetailsFilters from '../DetailsFilters';
|
|
17
|
-
|
|
18
|
-
const DetailsEntity = ({
|
|
19
|
-
data = {},
|
|
20
|
-
schema = {},
|
|
21
|
-
config = {},
|
|
22
|
-
filters,
|
|
23
|
-
onFiltersChange
|
|
24
|
-
}) => {
|
|
25
|
-
const { entryLabel = {} } = config;
|
|
26
|
-
const { attributes = {} } = schema;
|
|
27
|
-
const keys = Object.keys(attributes);
|
|
28
|
-
const entityLabelKey = first(entryLabel[data?.uid]);
|
|
29
|
-
|
|
30
|
-
const FIELDS_LIMIT = 5;
|
|
31
|
-
const itemKeys = take(
|
|
32
|
-
keys.filter(_ => (attributes[_].type === 'string') && !isNil(data[_]) && (_ !== entityLabelKey)),
|
|
33
|
-
FIELDS_LIMIT
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const formatLabel = (label = '') => label.split('_')
|
|
37
|
-
.map(_ => capitalize(_))
|
|
38
|
-
.join(' ');
|
|
39
|
-
|
|
40
|
-
const entityIsRenderable = data && !isEmpty(data) && !isEmpty(itemKeys);
|
|
41
|
-
|
|
42
|
-
return (<Box padding={4}>
|
|
43
|
-
{ entityIsRenderable && (<Box marginBottom={4}>
|
|
44
|
-
<Typography variant="sigma" textColor="neutral600" id="entity-details">
|
|
45
|
-
{ getMessage('page.details.panel.entity', 'Details') }
|
|
46
|
-
</Typography>
|
|
47
|
-
<Box paddingTop={2} paddingBottom={4}>
|
|
48
|
-
<Divider />
|
|
49
|
-
</Box>
|
|
50
|
-
<Stack size={itemKeys.length}>
|
|
51
|
-
<Flex direction="column" alignItems="flex-start">
|
|
52
|
-
<Typography fontWeight="bold">{ formatLabel(entityLabelKey) }</Typography>
|
|
53
|
-
<Typography>{ data[entityLabelKey] }</Typography>
|
|
54
|
-
</Flex>
|
|
55
|
-
{ itemKeys.map(_ =>
|
|
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>);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
DetailsEntity.propTypes = {
|
|
76
|
-
data: PropTypes.object.isRequired,
|
|
77
|
-
schema: PropTypes.object.isRequired,
|
|
78
|
-
config: PropTypes.object.isRequired,
|
|
79
|
-
filters: PropTypes.object.isRequired,
|
|
80
|
-
onFiltersChange: PropTypes.func.isRequired,
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export default DetailsEntity;
|
|
84
|
-
|