@drodil/backstage-plugin-qeta-react 3.18.2 → 3.20.2
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/components/AnswerForm/AnswerForm.esm.js +2 -2
- package/dist/components/AnswerForm/AnswerForm.esm.js.map +1 -1
- package/dist/components/AnswersContainer/AnswerList.esm.js +3 -9
- package/dist/components/AnswersContainer/AnswerList.esm.js.map +1 -1
- package/dist/components/AnswersContainer/AnswersContainer.esm.js +2 -1
- package/dist/components/AnswersContainer/AnswersContainer.esm.js.map +1 -1
- package/dist/components/ArticleContent/ArticleButtons.esm.js +7 -3
- package/dist/components/ArticleContent/ArticleButtons.esm.js.map +1 -1
- package/dist/components/Buttons/AskQuestionButton.esm.js +17 -10
- package/dist/components/Buttons/AskQuestionButton.esm.js.map +1 -1
- package/dist/components/Buttons/CreateCollectionButton.esm.js +18 -11
- package/dist/components/Buttons/CreateCollectionButton.esm.js.map +1 -1
- package/dist/components/Buttons/WriteArticleButton.esm.js +17 -10
- package/dist/components/Buttons/WriteArticleButton.esm.js.map +1 -1
- package/dist/components/CollectionCard/CollectionCard.esm.js +7 -3
- package/dist/components/CollectionCard/CollectionCard.esm.js.map +1 -1
- package/dist/components/CollectionForm/CollectionForm.esm.js +1 -24
- package/dist/components/CollectionForm/CollectionForm.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/CollectionsGrid.esm.js +3 -1
- package/dist/components/CollectionsGrid/CollectionsGrid.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/CollectionsGridContent.esm.js +2 -8
- package/dist/components/CollectionsGrid/CollectionsGridContent.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js +1 -1
- package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js.map +1 -1
- package/dist/components/CommentSection/CommentSection.esm.js +2 -2
- package/dist/components/CommentSection/CommentSection.esm.js.map +1 -1
- package/dist/components/EntitiesGrid/EntitiesGrid.esm.js +5 -4
- package/dist/components/EntitiesGrid/EntitiesGrid.esm.js.map +1 -1
- package/dist/components/HomePageCards/PostsCard.esm.js +2 -2
- package/dist/components/HomePageCards/PostsCard.esm.js.map +1 -1
- package/dist/components/LoadingGrid/LoadingGrid.esm.js +3 -3
- package/dist/components/LoadingGrid/LoadingGrid.esm.js.map +1 -1
- package/dist/components/PostForm/PostForm.esm.js +1 -1
- package/dist/components/PostForm/PostForm.esm.js.map +1 -1
- package/dist/components/PostForm/TagInput.esm.js +27 -5
- package/dist/components/PostForm/TagInput.esm.js.map +1 -1
- package/dist/components/PostHighlightList/PostHighlightList.esm.js +7 -1
- package/dist/components/PostHighlightList/PostHighlightList.esm.js.map +1 -1
- package/dist/components/PostsContainer/PostsContainer.esm.js +4 -2
- package/dist/components/PostsContainer/PostsContainer.esm.js.map +1 -1
- package/dist/components/PostsGrid/PostsGrid.esm.js +4 -2
- package/dist/components/PostsGrid/PostsGrid.esm.js.map +1 -1
- package/dist/components/PostsGrid/PostsGridContent.esm.js +2 -11
- package/dist/components/PostsGrid/PostsGridContent.esm.js.map +1 -1
- package/dist/components/{QuestionsTable/QuestionsTable.esm.js → PostsTable/PostsTable.esm.js} +19 -11
- package/dist/components/PostsTable/PostsTable.esm.js.map +1 -0
- package/dist/components/PostsTable/PostsTableRow.esm.js +34 -0
- package/dist/components/PostsTable/PostsTableRow.esm.js.map +1 -0
- package/dist/components/SearchBar/SearchBar.esm.js +3 -3
- package/dist/components/SearchBar/SearchBar.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/EntityChip.esm.js +7 -1
- package/dist/components/TagsAndEntities/EntityChip.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/TagsAndEntities.esm.js +3 -24
- package/dist/components/TagsAndEntities/TagsAndEntities.esm.js.map +1 -1
- package/dist/components/TagsGrid/TagGridItem.esm.js +2 -4
- package/dist/components/TagsGrid/TagGridItem.esm.js.map +1 -1
- package/dist/components/TagsGrid/TagsGrid.esm.js +25 -16
- package/dist/components/TagsGrid/TagsGrid.esm.js.map +1 -1
- package/dist/components/UsersGrid/UsersGrid.esm.js +2 -1
- package/dist/components/UsersGrid/UsersGrid.esm.js.map +1 -1
- package/dist/components/Utility/OptionalRequirePermission.esm.js +19 -0
- package/dist/components/Utility/OptionalRequirePermission.esm.js.map +1 -0
- package/dist/hooks/usePaginatedPosts.esm.js +3 -0
- package/dist/hooks/usePaginatedPosts.esm.js.map +1 -1
- package/dist/index.d.ts +27 -12
- package/dist/index.esm.js +1 -1
- package/dist/translation.esm.js +9 -1
- package/dist/translation.esm.js.map +1 -1
- package/package.json +4 -3
- package/dist/components/QuestionsTable/QuestionTableRow.esm.js +0 -21
- package/dist/components/QuestionsTable/QuestionTableRow.esm.js.map +0 -1
- package/dist/components/QuestionsTable/QuestionsTable.esm.js.map +0 -1
|
@@ -12,6 +12,7 @@ import 'react-use/lib/useAsync';
|
|
|
12
12
|
import { Tooltip, Chip, Grid, Box, Typography, Button } from '@material-ui/core';
|
|
13
13
|
import VisibilityOff from '@material-ui/icons/VisibilityOff';
|
|
14
14
|
import Visibility from '@material-ui/icons/Visibility';
|
|
15
|
+
import { useNavigate } from 'react-router-dom';
|
|
15
16
|
|
|
16
17
|
const cache = /* @__PURE__ */ new Map();
|
|
17
18
|
const EntityTooltip = (props) => {
|
|
@@ -59,6 +60,7 @@ const EntityChip = (props) => {
|
|
|
59
60
|
const { entity } = props;
|
|
60
61
|
const entityRoute = useRouteRef(entityRouteRef);
|
|
61
62
|
const { primaryTitle, Icon } = useEntityPresentation(entity);
|
|
63
|
+
const navigate = useNavigate();
|
|
62
64
|
const entityRef = typeof entity === "string" ? entity : stringifyEntityRef(entity);
|
|
63
65
|
return /* @__PURE__ */ React__default.createElement(
|
|
64
66
|
Tooltip,
|
|
@@ -77,7 +79,11 @@ const EntityChip = (props) => {
|
|
|
77
79
|
variant: "outlined",
|
|
78
80
|
className: "qetaEntityChip",
|
|
79
81
|
component: "a",
|
|
80
|
-
href: entityRoute({ entityRef }),
|
|
82
|
+
href: props.useHref ? entityRoute({ entityRef }) : void 0,
|
|
83
|
+
target: props.useHref ? "_blank" : void 0,
|
|
84
|
+
onClick: !props.useHref ? () => {
|
|
85
|
+
navigate(entityRoute({ entityRef }));
|
|
86
|
+
} : void 0,
|
|
81
87
|
clickable: true
|
|
82
88
|
}
|
|
83
89
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityChip.esm.js","sources":["../../../src/components/TagsAndEntities/EntityChip.tsx"],"sourcesContent":["import { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport React, { useEffect } from 'react';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { entityRouteRef } from '../../routes';\nimport { qetaApiRef } from '../../api';\nimport { EntityResponse } from '@drodil/backstage-plugin-qeta-common';\nimport { useEntityFollow, useTranslation } from '../../hooks';\nimport {\n Box,\n Button,\n Chip,\n Grid,\n Tooltip,\n Typography,\n} from '@material-ui/core';\nimport VisibilityOff from '@material-ui/icons/VisibilityOff';\nimport Visibility from '@material-ui/icons/Visibility';\n\nconst cache: Map<string, EntityResponse> = new Map();\n\nconst EntityTooltip = (props: { entity: Entity | string }) => {\n const { entity } = props;\n const entityRef =\n typeof entity === 'string' ? entity : stringifyEntityRef(entity);\n const qetaApi = useApi(qetaApiRef);\n const { primaryTitle, secondaryTitle, Icon } = useEntityPresentation(entity);\n const { t } = useTranslation();\n const entitiesFollow = useEntityFollow();\n const [resp, setResp] = React.useState<undefined | EntityResponse>();\n\n useEffect(() => {\n if (cache.has(entityRef)) {\n setResp(cache.get(entityRef));\n return;\n }\n\n qetaApi.getEntity(entityRef).then(res => {\n if (res) {\n cache.set(entityRef, res);\n setResp(res);\n }\n });\n }, [qetaApi, entityRef]);\n\n if (!resp) {\n return null;\n }\n\n return (\n <Grid container style={{ padding: '0.5em' }} spacing={1}>\n <Grid item xs={12}>\n <Box style={{ display: 'flex', alignItems: 'center' }}>\n {Icon ? <Icon fontSize=\"small\" /> : null}\n <Typography variant=\"h6\">{primaryTitle}</Typography>\n </Box>\n <Typography variant=\"subtitle1\">{secondaryTitle}</Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n {t('common.posts', { count: resp.postsCount, itemType: 'post' })}\n {' · '}\n {t('common.followers', { count: resp.followerCount })}\n </Typography>\n </Grid>\n {!entitiesFollow.loading && (\n <Grid item xs={12}>\n <Button\n size=\"small\"\n variant=\"outlined\"\n color={\n entitiesFollow.isFollowingEntity(entityRef)\n ? 'secondary'\n : 'primary'\n }\n onClick={() => {\n if (entitiesFollow.isFollowingEntity(entityRef)) {\n entitiesFollow.unfollowEntity(entityRef);\n } else {\n entitiesFollow.followEntity(entityRef);\n }\n }}\n startIcon={\n entitiesFollow.isFollowingEntity(entityRef) ? (\n <VisibilityOff />\n ) : (\n <Visibility />\n )\n }\n >\n {entitiesFollow.isFollowingEntity(entityRef)\n ? t('entityButton.unfollow')\n : t('entityButton.follow')}\n </Button>\n </Grid>\n )}\n </Grid>\n );\n};\n\nexport const EntityChip = (props: {
|
|
1
|
+
{"version":3,"file":"EntityChip.esm.js","sources":["../../../src/components/TagsAndEntities/EntityChip.tsx"],"sourcesContent":["import { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport React, { useEffect } from 'react';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { entityRouteRef } from '../../routes';\nimport { qetaApiRef } from '../../api';\nimport { EntityResponse } from '@drodil/backstage-plugin-qeta-common';\nimport { useEntityFollow, useTranslation } from '../../hooks';\nimport {\n Box,\n Button,\n Chip,\n Grid,\n Tooltip,\n Typography,\n} from '@material-ui/core';\nimport VisibilityOff from '@material-ui/icons/VisibilityOff';\nimport Visibility from '@material-ui/icons/Visibility';\nimport { useNavigate } from 'react-router-dom';\n\nconst cache: Map<string, EntityResponse> = new Map();\n\nconst EntityTooltip = (props: { entity: Entity | string }) => {\n const { entity } = props;\n const entityRef =\n typeof entity === 'string' ? entity : stringifyEntityRef(entity);\n const qetaApi = useApi(qetaApiRef);\n const { primaryTitle, secondaryTitle, Icon } = useEntityPresentation(entity);\n const { t } = useTranslation();\n const entitiesFollow = useEntityFollow();\n const [resp, setResp] = React.useState<undefined | EntityResponse>();\n\n useEffect(() => {\n if (cache.has(entityRef)) {\n setResp(cache.get(entityRef));\n return;\n }\n\n qetaApi.getEntity(entityRef).then(res => {\n if (res) {\n cache.set(entityRef, res);\n setResp(res);\n }\n });\n }, [qetaApi, entityRef]);\n\n if (!resp) {\n return null;\n }\n\n return (\n <Grid container style={{ padding: '0.5em' }} spacing={1}>\n <Grid item xs={12}>\n <Box style={{ display: 'flex', alignItems: 'center' }}>\n {Icon ? <Icon fontSize=\"small\" /> : null}\n <Typography variant=\"h6\">{primaryTitle}</Typography>\n </Box>\n <Typography variant=\"subtitle1\">{secondaryTitle}</Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n {t('common.posts', { count: resp.postsCount, itemType: 'post' })}\n {' · '}\n {t('common.followers', { count: resp.followerCount })}\n </Typography>\n </Grid>\n {!entitiesFollow.loading && (\n <Grid item xs={12}>\n <Button\n size=\"small\"\n variant=\"outlined\"\n color={\n entitiesFollow.isFollowingEntity(entityRef)\n ? 'secondary'\n : 'primary'\n }\n onClick={() => {\n if (entitiesFollow.isFollowingEntity(entityRef)) {\n entitiesFollow.unfollowEntity(entityRef);\n } else {\n entitiesFollow.followEntity(entityRef);\n }\n }}\n startIcon={\n entitiesFollow.isFollowingEntity(entityRef) ? (\n <VisibilityOff />\n ) : (\n <Visibility />\n )\n }\n >\n {entitiesFollow.isFollowingEntity(entityRef)\n ? t('entityButton.unfollow')\n : t('entityButton.follow')}\n </Button>\n </Grid>\n )}\n </Grid>\n );\n};\n\nexport const EntityChip = (props: {\n entity: Entity | string;\n useHref?: boolean;\n}) => {\n const { entity } = props;\n const entityRoute = useRouteRef(entityRouteRef);\n const { primaryTitle, Icon } = useEntityPresentation(entity);\n const navigate = useNavigate();\n const entityRef =\n typeof entity === 'string' ? entity : stringifyEntityRef(entity);\n return (\n <Tooltip\n title={<EntityTooltip entity={entity} />}\n arrow\n enterDelay={400}\n interactive\n >\n <Chip\n label={primaryTitle}\n size=\"small\"\n icon={Icon ? <Icon fontSize=\"small\" /> : undefined}\n variant=\"outlined\"\n className=\"qetaEntityChip\"\n component=\"a\"\n href={props.useHref ? entityRoute({ entityRef }) : undefined}\n target={props.useHref ? '_blank' : undefined}\n onClick={\n !props.useHref\n ? () => {\n navigate(entityRoute({ entityRef }));\n }\n : undefined\n }\n clickable\n />\n </Tooltip>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;AAoBA,MAAM,KAAA,uBAAyC,GAAI,EAAA;AAEnD,MAAM,aAAA,GAAgB,CAAC,KAAuC,KAAA;AAC5D,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAA,MAAM,YACJ,OAAO,MAAA,KAAW,QAAW,GAAA,MAAA,GAAS,mBAAmB,MAAM,CAAA;AACjE,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA;AACjC,EAAA,MAAM,EAAE,YAAc,EAAA,cAAA,EAAgB,IAAK,EAAA,GAAI,sBAAsB,MAAM,CAAA;AAC3E,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,iBAAiB,eAAgB,EAAA;AACvC,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAIA,eAAM,QAAqC,EAAA;AAEnE,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,KAAA,CAAM,GAAI,CAAA,SAAS,CAAG,EAAA;AACxB,MAAQ,OAAA,CAAA,KAAA,CAAM,GAAI,CAAA,SAAS,CAAC,CAAA;AAC5B,MAAA;AAAA;AAGF,IAAA,OAAA,CAAQ,SAAU,CAAA,SAAS,CAAE,CAAA,IA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,UAAY,EAAA,GAAA;AAAA,MACZ,WAAW,EAAA;AAAA,KAAA;AAAA,oBAEXA,cAAA,CAAA,aAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA,YAAA;AAAA,QACP,IAAK,EAAA,OAAA;AAAA,QACL,MAAM,IAAO,mBAAAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,QAAA,EAAS,SAAQ,CAAK,GAAA,KAAA,CAAA;AAAA,QACzC,OAAQ,EAAA,UAAA;AAAA,QACR,SAAU,EAAA,gBAAA;AAAA,QACV,SAAU,EAAA,GAAA;AAAA,QACV,MAAM,KAAM,CAAA,OAAA,GAAU,YAAY,EAAE,SAAA,EAAW,CAAI,GAAA,KAAA,CAAA;AAAA,QACnD,MAAA,EAAQ,KAAM,CAAA,OAAA,GAAU,QAAW,GAAA,KAAA,CAAA;AAAA,QACnC,OACE,EAAA,CAAC,KAAM,CAAA,OAAA,GACH,MAAM;AACJ,UAAA,QAAA,CAAS,WAAY,CAAA,EAAE,SAAU,EAAC,CAAC,CAAA;AAAA,SAErC,GAAA,KAAA,CAAA;AAAA,QAEN,SAAS,EAAA;AAAA;AAAA;AACX,GACF;AAEJ;;;;"}
|
|
@@ -1,34 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
3
|
-
import React__default, { useEffect } from 'react';
|
|
4
|
-
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
5
|
-
import { compact } from 'lodash';
|
|
1
|
+
import React__default from 'react';
|
|
6
2
|
import { EntityChip } from './EntityChip.esm.js';
|
|
7
3
|
import { TagChip } from './TagChip.esm.js';
|
|
8
4
|
|
|
9
5
|
const TagsAndEntities = (props) => {
|
|
10
6
|
const { entity } = props;
|
|
11
|
-
|
|
12
|
-
const [entities, setEntities] = React__default.useState([]);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (entity.entities && entity.entities.length > 0) {
|
|
15
|
-
catalogApi.getEntitiesByRefs({
|
|
16
|
-
entityRefs: entity.entities,
|
|
17
|
-
fields: [
|
|
18
|
-
"kind",
|
|
19
|
-
"metadata.name",
|
|
20
|
-
"metadata.namespace",
|
|
21
|
-
"metadata.title"
|
|
22
|
-
]
|
|
23
|
-
}).catch((_) => setEntities([])).then(
|
|
24
|
-
(data) => data ? setEntities(compact(data.items)) : setEntities([])
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}, [catalogApi, entity]);
|
|
28
|
-
if ((!entity.tags || entity.tags.length === 0) && (!entities || entities.length === 0)) {
|
|
7
|
+
if ((!entity.tags || entity.tags.length === 0) && (!entity.entities || entity.entities.length === 0)) {
|
|
29
8
|
return null;
|
|
30
9
|
}
|
|
31
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, entity.tags && entity.tags.map((tag) => /* @__PURE__ */ React__default.createElement(TagChip, { key: tag, tag })), entities && entities.map((component) => /* @__PURE__ */ React__default.createElement(EntityChip, { entity: component, key:
|
|
10
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, entity.tags && entity.tags.map((tag) => /* @__PURE__ */ React__default.createElement(TagChip, { key: tag, tag })), entity.entities && entity.entities.map((component) => /* @__PURE__ */ React__default.createElement(EntityChip, { entity: component, key: component })));
|
|
32
11
|
};
|
|
33
12
|
|
|
34
13
|
export { TagsAndEntities };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagsAndEntities.esm.js","sources":["../../../src/components/TagsAndEntities/TagsAndEntities.tsx"],"sourcesContent":["import {\n CollectionResponse,\n PostResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport
|
|
1
|
+
{"version":3,"file":"TagsAndEntities.esm.js","sources":["../../../src/components/TagsAndEntities/TagsAndEntities.tsx"],"sourcesContent":["import {\n CollectionResponse,\n PostResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport React from 'react';\nimport { EntityChip } from './EntityChip';\nimport { TagChip } from './TagChip';\n\nexport const TagsAndEntities = (props: {\n entity: PostResponse | CollectionResponse;\n}) => {\n const { entity } = props;\n\n if (\n (!entity.tags || entity.tags.length === 0) &&\n (!entity.entities || entity.entities.length === 0)\n ) {\n return null;\n }\n\n return (\n <>\n {entity.tags && entity.tags.map(tag => <TagChip key={tag} tag={tag} />)}\n {entity.entities &&\n entity.entities.map(component => (\n <EntityChip entity={component} key={component} />\n ))}\n </>\n );\n};\n"],"names":["React"],"mappings":";;;;AAQa,MAAA,eAAA,GAAkB,CAAC,KAE1B,KAAA;AACJ,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AAEnB,EAAA,IAAA,CACG,CAAC,MAAA,CAAO,IAAQ,IAAA,MAAA,CAAO,IAAK,CAAA,MAAA,KAAW,CACvC,MAAA,CAAC,MAAO,CAAA,QAAA,IAAY,MAAO,CAAA,QAAA,CAAS,WAAW,CAChD,CAAA,EAAA;AACA,IAAO,OAAA,IAAA;AAAA;AAGT,EACE,uBAAAA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA,EACG,MAAO,CAAA,IAAA,IAAQ,MAAO,CAAA,IAAA,CAAK,GAAI,CAAA,CAAA,GAAA,qBAAQA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,GAAK,EAAA,GAAA,EAAK,GAAU,EAAA,CAAE,CACrE,EAAA,MAAA,CAAO,QACN,IAAA,MAAA,CAAO,QAAS,CAAA,GAAA,CAAI,CAClB,SAAA,qBAAAA,cAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,MAAA,EAAQ,SAAW,EAAA,GAAA,EAAK,SAAW,EAAA,CAChD,CACL,CAAA;AAEJ;;;;"}
|
|
@@ -14,7 +14,6 @@ import '@backstage/catalog-model';
|
|
|
14
14
|
import 'dataloader';
|
|
15
15
|
import '@backstage/plugin-catalog-react';
|
|
16
16
|
import 'react-use/lib/useAsync';
|
|
17
|
-
import { useIsModerator } from '../../hooks/useIsModerator.esm.js';
|
|
18
17
|
import { DeleteModal } from '../DeleteModal/DeleteModal.esm.js';
|
|
19
18
|
import DeleteIcon from '@material-ui/icons/Delete';
|
|
20
19
|
import EditIcon from '@material-ui/icons/Edit';
|
|
@@ -27,7 +26,6 @@ const TagGridItem = (props) => {
|
|
|
27
26
|
const navigate = useNavigate();
|
|
28
27
|
const { t } = useTranslation();
|
|
29
28
|
const tags = useTagsFollow();
|
|
30
|
-
const { isModerator } = useIsModerator();
|
|
31
29
|
const [editModalOpen, setEditModalOpen] = React__default.useState(false);
|
|
32
30
|
const handleEditModalOpen = () => setEditModalOpen(true);
|
|
33
31
|
const handleEditModalClose = () => {
|
|
@@ -65,7 +63,7 @@ const TagGridItem = (props) => {
|
|
|
65
63
|
startIcon: tags.isFollowingTag(tag.tag) ? /* @__PURE__ */ React__default.createElement(VisibilityOff, null) : /* @__PURE__ */ React__default.createElement(Visibility, null)
|
|
66
64
|
},
|
|
67
65
|
tags.isFollowingTag(tag.tag) ? t("tagButton.unfollow") : t("tagButton.follow")
|
|
68
|
-
))), /* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(
|
|
66
|
+
))), tag.canEdit && /* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(
|
|
69
67
|
Button,
|
|
70
68
|
{
|
|
71
69
|
size: "small",
|
|
@@ -74,7 +72,7 @@ const TagGridItem = (props) => {
|
|
|
74
72
|
startIcon: /* @__PURE__ */ React__default.createElement(EditIcon, null)
|
|
75
73
|
},
|
|
76
74
|
t("tagButton.edit")
|
|
77
|
-
)),
|
|
75
|
+
)), tag.canDelete && /* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(
|
|
78
76
|
Button,
|
|
79
77
|
{
|
|
80
78
|
size: "small",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagGridItem.esm.js","sources":["../../../src/components/TagsGrid/TagGridItem.tsx"],"sourcesContent":["import {\n removeMarkdownFormatting,\n TagResponse,\n truncate,\n} from '@drodil/backstage-plugin-qeta-common';\nimport {\n Button,\n Card,\n CardActionArea,\n CardActions,\n CardContent,\n CardHeader,\n Grid,\n Tooltip,\n Typography,\n} from '@material-ui/core';\nimport React from 'react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { tagRouteRef } from '../../routes';\nimport { useNavigate } from 'react-router-dom';\nimport { EditTagModal } from './EditTagModal';\nimport DOMPurify from 'dompurify';\nimport {
|
|
1
|
+
{"version":3,"file":"TagGridItem.esm.js","sources":["../../../src/components/TagsGrid/TagGridItem.tsx"],"sourcesContent":["import {\n removeMarkdownFormatting,\n TagResponse,\n truncate,\n} from '@drodil/backstage-plugin-qeta-common';\nimport {\n Button,\n Card,\n CardActionArea,\n CardActions,\n CardContent,\n CardHeader,\n Grid,\n Tooltip,\n Typography,\n} from '@material-ui/core';\nimport React from 'react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { tagRouteRef } from '../../routes';\nimport { useNavigate } from 'react-router-dom';\nimport { EditTagModal } from './EditTagModal';\nimport DOMPurify from 'dompurify';\nimport { useTagsFollow, useTranslation } from '../../hooks';\nimport { DeleteModal } from '../DeleteModal';\nimport DeleteIcon from '@material-ui/icons/Delete';\nimport EditIcon from '@material-ui/icons/Edit';\nimport Visibility from '@material-ui/icons/Visibility';\nimport VisibilityOff from '@material-ui/icons/VisibilityOff';\n\nexport const TagGridItem = (props: {\n tag: TagResponse;\n onTagEdit: () => void;\n}) => {\n const { tag, onTagEdit } = props;\n const tagRoute = useRouteRef(tagRouteRef);\n const navigate = useNavigate();\n const { t } = useTranslation();\n const tags = useTagsFollow();\n\n const [editModalOpen, setEditModalOpen] = React.useState(false);\n const handleEditModalOpen = () => setEditModalOpen(true);\n const handleEditModalClose = () => {\n setEditModalOpen(false);\n onTagEdit();\n };\n\n const [deleteModalOpen, setDeleteModalOpen] = React.useState(false);\n const handleDeleteModalOpen = () => setDeleteModalOpen(true);\n const handleDeleteModalClose = () => {\n setDeleteModalOpen(false);\n onTagEdit();\n };\n\n return (\n <Grid item xs={4}>\n <Card\n variant=\"outlined\"\n style={{ height: '100%', display: 'flex', flexDirection: 'column' }}\n >\n <CardActionArea onClick={() => navigate(tagRoute({ tag: tag.tag }))}>\n <CardHeader title={tag.tag} />\n <CardContent>\n <Typography variant=\"caption\">\n {t('common.posts', { count: tag.postsCount, itemType: 'post' })}\n {' · '}\n {t('common.followers', { count: tag.followerCount })}\n </Typography>\n <Typography variant=\"body2\">\n {' '}\n {DOMPurify.sanitize(\n truncate(removeMarkdownFormatting(tag.description ?? ''), 150),\n )}\n </Typography>\n </CardContent>\n </CardActionArea>\n <CardActions style={{ marginTop: 'auto' }}>\n <Grid container justifyContent=\"center\">\n <Grid item>\n <Tooltip title={t('tagButton.tooltip')}>\n <Button\n size=\"small\"\n variant=\"outlined\"\n color={tags.isFollowingTag(tag.tag) ? 'secondary' : 'primary'}\n onClick={() => {\n if (tags.isFollowingTag(tag.tag)) {\n tags.unfollowTag(tag.tag);\n } else {\n tags.followTag(tag.tag);\n }\n }}\n startIcon={\n tags.isFollowingTag(tag.tag) ? (\n <VisibilityOff />\n ) : (\n <Visibility />\n )\n }\n >\n {tags.isFollowingTag(tag.tag)\n ? t('tagButton.unfollow')\n : t('tagButton.follow')}\n </Button>\n </Tooltip>\n </Grid>\n {tag.canEdit && (\n <Grid item>\n <Button\n size=\"small\"\n onClick={handleEditModalOpen}\n variant=\"outlined\"\n startIcon={<EditIcon />}\n >\n {t('tagButton.edit')}\n </Button>\n </Grid>\n )}\n {tag.canDelete && (\n <Grid item>\n <Button\n size=\"small\"\n onClick={handleDeleteModalOpen}\n variant=\"contained\"\n color=\"secondary\"\n startIcon={<DeleteIcon />}\n >\n {t('tagButton.delete')}\n </Button>\n <DeleteModal\n open={deleteModalOpen}\n onClose={handleDeleteModalClose}\n entity={tag}\n />\n </Grid>\n )}\n </Grid>\n </CardActions>\n </Card>\n <EditTagModal\n tag={tag}\n open={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AAAA,MAAA;AAAA,QACC,IAAM,EAAA,eAAA;AAAA,QACN,OAAS,EAAA,sBAAA;AAAA,QACT,MAAQ,EAAA;AAAA;AAAA,KAEZ,CAEJ,CACF;AAAA,GAEF,kBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,IAAM,EAAA,aAAA;AAAA,MACN,OAAS,EAAA;AAAA;AAAA,GAEb,CAAA;AAEJ;;;;"}
|
|
@@ -7,20 +7,20 @@ import '@backstage/catalog-model';
|
|
|
7
7
|
import 'dataloader';
|
|
8
8
|
import '@backstage/plugin-catalog-react';
|
|
9
9
|
import 'react-use/lib/useAsync';
|
|
10
|
-
import { useIsModerator } from '../../hooks/useIsModerator.esm.js';
|
|
11
10
|
import { QetaPagination } from '../QetaPagination/QetaPagination.esm.js';
|
|
12
11
|
import useDebounce from 'react-use/lib/useDebounce';
|
|
13
12
|
import { TagsGridContent } from './TagsGridContent.esm.js';
|
|
14
13
|
import { SearchBar } from '../SearchBar/SearchBar.esm.js';
|
|
15
14
|
import { Grid, Typography, Button } from '@material-ui/core';
|
|
16
15
|
import { CreateTagModal } from './CreateTagModal.esm.js';
|
|
16
|
+
import { qetaCreateTagPermission } from '@drodil/backstage-plugin-qeta-common';
|
|
17
|
+
import { OptionalRequirePermission } from '../Utility/OptionalRequirePermission.esm.js';
|
|
17
18
|
|
|
18
19
|
const TagsGrid = () => {
|
|
19
20
|
const [page, setPage] = React__default.useState(1);
|
|
20
21
|
const [pageCount, setPageCount] = React__default.useState(1);
|
|
21
22
|
const [tagsPerPage, setTagsPerPage] = React__default.useState(25);
|
|
22
23
|
const [searchQuery, setSearchQuery] = React__default.useState("");
|
|
23
|
-
const { isModerator } = useIsModerator();
|
|
24
24
|
const { t } = useTranslation();
|
|
25
25
|
const [filters, setFilters] = React__default.useState({
|
|
26
26
|
order: "desc",
|
|
@@ -71,23 +71,32 @@ const TagsGrid = () => {
|
|
|
71
71
|
SearchBar,
|
|
72
72
|
{
|
|
73
73
|
onSearch: onSearchQueryChange,
|
|
74
|
-
label: t("tagPage.search.label")
|
|
74
|
+
label: t("tagPage.search.label"),
|
|
75
|
+
loading
|
|
75
76
|
}
|
|
76
|
-
))), /* @__PURE__ */ React__default.createElement(Grid, { container: true, justifyContent: "space-between" }, response && /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs:
|
|
77
|
-
|
|
77
|
+
))), /* @__PURE__ */ React__default.createElement(Grid, { container: true, justifyContent: "space-between" }, response && /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 8 }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "h6", className: "qetaTagsContainerTitle" }, t("tagPage.tags", { count: response.total }))), response && /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 4 }, /* @__PURE__ */ React__default.createElement(
|
|
78
|
+
OptionalRequirePermission,
|
|
78
79
|
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
onClick: handleCreateModalOpen,
|
|
82
|
-
style: { float: "right" }
|
|
80
|
+
permission: qetaCreateTagPermission,
|
|
81
|
+
errorPage: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null)
|
|
83
82
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
/* @__PURE__ */ React__default.createElement(
|
|
84
|
+
Button,
|
|
85
|
+
{
|
|
86
|
+
variant: "contained",
|
|
87
|
+
color: "primary",
|
|
88
|
+
onClick: handleCreateModalOpen,
|
|
89
|
+
style: { float: "right" }
|
|
90
|
+
},
|
|
91
|
+
t("tagPage.createTag")
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ React__default.createElement(
|
|
94
|
+
CreateTagModal,
|
|
95
|
+
{
|
|
96
|
+
open: createModalOpen,
|
|
97
|
+
onClose: handleCreateModalClose
|
|
98
|
+
}
|
|
99
|
+
)
|
|
91
100
|
)), /* @__PURE__ */ React__default.createElement(
|
|
92
101
|
TagsGridContent,
|
|
93
102
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagsGrid.esm.js","sources":["../../../src/components/TagsGrid/TagsGrid.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"TagsGrid.esm.js","sources":["../../../src/components/TagsGrid/TagsGrid.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useQetaApi, useTranslation } from '../../hooks';\nimport { QetaPagination } from '../QetaPagination/QetaPagination';\nimport useDebounce from 'react-use/lib/useDebounce';\nimport { TagsGridContent } from './TagsGridContent';\nimport { SearchBar } from '../SearchBar/SearchBar';\nimport { Button, Grid, Typography } from '@material-ui/core';\nimport { CreateTagModal } from './CreateTagModal';\nimport { qetaCreateTagPermission } from '@drodil/backstage-plugin-qeta-common';\nimport { OptionalRequirePermission } from '../Utility/OptionalRequirePermission';\n\ntype TagFilters = {\n order: 'asc' | 'desc';\n orderBy: 'tag' | 'followersCount' | 'postsCount';\n searchQuery: string;\n};\n\nexport const TagsGrid = () => {\n const [page, setPage] = React.useState(1);\n const [pageCount, setPageCount] = React.useState(1);\n const [tagsPerPage, setTagsPerPage] = React.useState(25);\n const [searchQuery, setSearchQuery] = React.useState('');\n const { t } = useTranslation();\n const [filters, setFilters] = React.useState<TagFilters>({\n order: 'desc',\n orderBy: 'tag',\n searchQuery: '',\n });\n\n const onSearchQueryChange = (val: string) => {\n setPage(1);\n setSearchQuery(val);\n };\n\n const {\n value: response,\n loading,\n error,\n retry,\n } = useQetaApi(\n api =>\n api.getTags({\n limit: tagsPerPage,\n offset: (page - 1) * tagsPerPage,\n ...filters,\n }),\n [page, tagsPerPage, filters],\n );\n\n useDebounce(\n () => {\n if (filters.searchQuery !== searchQuery) {\n setFilters({ ...filters, searchQuery: searchQuery });\n }\n },\n 400,\n [searchQuery],\n );\n\n useEffect(() => {\n if (response) {\n setPageCount(Math.ceil(response.total / tagsPerPage));\n }\n }, [response, tagsPerPage]);\n\n const onTagsModify = () => {\n retry();\n };\n\n const [createModalOpen, setCreateModalOpen] = React.useState(false);\n const handleCreateModalOpen = () => setCreateModalOpen(true);\n const handleCreateModalClose = () => {\n setCreateModalOpen(false);\n onTagsModify();\n };\n\n return (\n <>\n <Grid container className=\"qetaTagsContainer\">\n <Grid item xs={12} md={4}>\n <SearchBar\n onSearch={onSearchQueryChange}\n label={t('tagPage.search.label')}\n loading={loading}\n />\n </Grid>\n </Grid>\n <Grid container justifyContent=\"space-between\">\n {response && (\n <Grid item xs={8}>\n <Typography variant=\"h6\" className=\"qetaTagsContainerTitle\">\n {t('tagPage.tags', { count: response.total })}\n </Typography>\n </Grid>\n )}\n {response && (\n <Grid item xs={4}>\n <OptionalRequirePermission\n permission={qetaCreateTagPermission}\n errorPage={<></>}\n >\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={handleCreateModalOpen}\n style={{ float: 'right' }}\n >\n {t('tagPage.createTag')}\n </Button>\n <CreateTagModal\n open={createModalOpen}\n onClose={handleCreateModalClose}\n />\n </OptionalRequirePermission>\n </Grid>\n )}\n <TagsGridContent\n response={response}\n onTagEdit={onTagsModify}\n loading={loading}\n error={error}\n />\n {response && response?.total > 0 && (\n <QetaPagination\n pageSize={tagsPerPage}\n handlePageChange={(_e, p) => setPage(p)}\n handlePageSizeChange={e => setTagsPerPage(Number(e.target.value))}\n page={page}\n pageCount={pageCount}\n />\n )}\n </Grid>\n </>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;AAiBO,MAAM,WAAW,MAAM;AAC5B,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAAA,cAAA,CAAM,SAAS,CAAC,CAAA;AACxC,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAAA,cAAA,CAAM,SAAS,CAAC,CAAA;AAClD,EAAA,MAAM,CAAC,WAAa,EAAA,cAAc,CAAI,GAAAA,cAAA,CAAM,SAAS,EAAE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AAAA,IAAA;AAAA,MACC,UAAY,EAAA,uBAAA;AAAA,MACZ,2BAAaA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA;AAAA,KAAA;AAAA,oBAEbA,cAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,WAAA;AAAA,QACR,KAAM,EAAA,SAAA;AAAA,QACN,OAAS,EAAA,qBAAA;AAAA,QACT,KAAA,EAAO,EAAE,KAAA,EAAO,OAAQ;AAAA,OAAA;AAAA,MAEvB,EAAE,mBAAmB;AAAA,KACxB;AAAA,oBACAA,cAAA,CAAA,aAAA;AAAA,MAAC,cAAA;AAAA,MAAA;AAAA,QACC,IAAM,EAAA,eAAA;AAAA,QACN,OAAS,EAAA;AAAA;AAAA;AACX,GAEJ,CAEF,kBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,QAAA;AAAA,MACA,SAAW,EAAA,YAAA;AAAA,MACX,OAAA;AAAA,MACA;AAAA;AAAA,GAED,EAAA,QAAA,IAAY,QAAU,EAAA,KAAA,GAAQ,CAC7B,oBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,QAAU,EAAA,WAAA;AAAA,MACV,gBAAkB,EAAA,CAAC,EAAI,EAAA,CAAA,KAAM,QAAQ,CAAC,CAAA;AAAA,MACtC,sBAAsB,CAAK,CAAA,KAAA,cAAA,CAAe,OAAO,CAAE,CAAA,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,MAChE,IAAA;AAAA,MACA;AAAA;AAAA,GAGN,CACF,CAAA;AAEJ;;;;"}
|
|
@@ -53,7 +53,8 @@ const UsersGrid = () => {
|
|
|
53
53
|
SearchBar,
|
|
54
54
|
{
|
|
55
55
|
onSearch: setSearchQuery,
|
|
56
|
-
label: t("usersPage.search.label")
|
|
56
|
+
label: t("usersPage.search.label"),
|
|
57
|
+
loading
|
|
57
58
|
}
|
|
58
59
|
))), /* @__PURE__ */ React__default.createElement(Grid, { container: true }, response && /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "h6", className: "qetaUsersContainerTitle" }, t("usersPage.users", { count: response.total }))), /* @__PURE__ */ React__default.createElement(UsersGridContent, { response, loading, error }), response && response?.total > 0 && /* @__PURE__ */ React__default.createElement(
|
|
59
60
|
QetaPagination,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UsersGrid.esm.js","sources":["../../../src/components/UsersGrid/UsersGrid.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useQetaApi, useTranslation } from '../../hooks';\nimport { QetaPagination } from '../QetaPagination/QetaPagination';\nimport { UsersGridContent } from './UsersGridContent';\nimport useDebounce from 'react-use/lib/useDebounce';\nimport { SearchBar } from '../SearchBar/SearchBar';\nimport { Grid, Typography } from '@material-ui/core';\n\ntype EntityFilters = {\n order: 'asc' | 'desc';\n orderBy?: 'userRef';\n searchQuery: string;\n};\n\nexport const UsersGrid = () => {\n const [page, setPage] = React.useState(1);\n const [pageCount, setPageCount] = React.useState(1);\n const [entitiesPerPage, setEntitiesPerPage] = React.useState(25);\n const [searchQuery, setSearchQuery] = React.useState('');\n const [filters, setFilters] = React.useState<EntityFilters>({\n order: 'desc',\n searchQuery: '',\n });\n const { t } = useTranslation();\n\n const {\n value: response,\n loading,\n error,\n } = useQetaApi(\n api =>\n api.getUsers({\n limit: entitiesPerPage,\n offset: (page - 1) * entitiesPerPage,\n ...filters,\n }),\n [entitiesPerPage, page, filters],\n );\n\n useDebounce(\n () => {\n if (filters.searchQuery !== searchQuery) {\n setFilters({ ...filters, searchQuery: searchQuery });\n }\n },\n 400,\n [searchQuery],\n );\n\n useEffect(() => {\n if (response) {\n setPageCount(Math.ceil(response.total / entitiesPerPage));\n }\n }, [response, entitiesPerPage]);\n\n return (\n <>\n <Grid container className=\"qetaUsersContainer\">\n <Grid item xs={12} md={4}>\n <SearchBar\n onSearch={setSearchQuery}\n label={t('usersPage.search.label')}\n />\n </Grid>\n </Grid>\n <Grid container>\n {response && (\n <Grid item xs={12}>\n <Typography variant=\"h6\" className=\"qetaUsersContainerTitle\">\n {t('usersPage.users', { count: response.total })}\n </Typography>\n </Grid>\n )}\n <UsersGridContent response={response} loading={loading} error={error} />\n {response && response?.total > 0 && (\n <QetaPagination\n pageSize={entitiesPerPage}\n handlePageChange={(_e, p) => setPage(p)}\n handlePageSizeChange={e =>\n setEntitiesPerPage(Number(e.target.value))\n }\n page={page}\n pageCount={pageCount}\n />\n )}\n </Grid>\n </>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;AAcO,MAAM,YAAY,MAAM;AAC7B,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAAA,cAAA,CAAM,SAAS,CAAC,CAAA;AACxC,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAAA,cAAA,CAAM,SAAS,CAAC,CAAA;AAClD,EAAA,MAAM,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAAA,cAAA,CAAM,SAAS,EAAE,CAAA;AAC/D,EAAA,MAAM,CAAC,WAAa,EAAA,cAAc,CAAI,GAAAA,cAAA,CAAM,SAAS,EAAE,CAAA;AACvD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAIA,eAAM,QAAwB,CAAA;AAAA,IAC1D,KAAO,EAAA,MAAA;AAAA,IACP,WAAa,EAAA;AAAA,GACd,CAAA;AACD,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,QAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACE,GAAA,UAAA;AAAA,IACF,CAAA,GAAA,KACE,IAAI,QAAS,CAAA;AAAA,MACX,KAAO,EAAA,eAAA;AAAA,MACP,MAAA,EAAA,CAAS,OAAO,CAAK,IAAA,eAAA;AAAA,MACrB,GAAG;AAAA,KACJ,CAAA;AAAA,IACH,CAAC,eAAiB,EAAA,IAAA,EAAM,OAAO;AAAA,GACjC;AAEA,EAAA,WAAA;AAAA,IACE,MAAM;AACJ,MAAI,IAAA,OAAA,CAAQ,gBAAgB,WAAa,EAAA;AACvC,QAAA,UAAA,CAAW,EAAE,GAAG,OAAS,EAAA,WAAA,EAA0B,CAAA;AAAA;AACrD,KACF;AAAA,IACA,GAAA;AAAA,IACA,CAAC,WAAW;AAAA,GACd;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,QAAU,EAAA;AACZ,MAAA,YAAA,CAAa,IAAK,CAAA,IAAA,CAAK,QAAS,CAAA,KAAA,GAAQ,eAAe,CAAC,CAAA;AAAA;AAC1D,GACC,EAAA,CAAC,QAAU,EAAA,eAAe,CAAC,CAAA;AAE9B,EAAA,uBAEIA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,SAAU,EAAA,oBAAA,EAAA,kBACvBA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EAAI,IAAI,CACrB,EAAA,kBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,QAAU,EAAA,cAAA;AAAA,MACV,KAAA,EAAO,EAAE,wBAAwB;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"UsersGrid.esm.js","sources":["../../../src/components/UsersGrid/UsersGrid.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useQetaApi, useTranslation } from '../../hooks';\nimport { QetaPagination } from '../QetaPagination/QetaPagination';\nimport { UsersGridContent } from './UsersGridContent';\nimport useDebounce from 'react-use/lib/useDebounce';\nimport { SearchBar } from '../SearchBar/SearchBar';\nimport { Grid, Typography } from '@material-ui/core';\n\ntype EntityFilters = {\n order: 'asc' | 'desc';\n orderBy?: 'userRef';\n searchQuery: string;\n};\n\nexport const UsersGrid = () => {\n const [page, setPage] = React.useState(1);\n const [pageCount, setPageCount] = React.useState(1);\n const [entitiesPerPage, setEntitiesPerPage] = React.useState(25);\n const [searchQuery, setSearchQuery] = React.useState('');\n const [filters, setFilters] = React.useState<EntityFilters>({\n order: 'desc',\n searchQuery: '',\n });\n const { t } = useTranslation();\n\n const {\n value: response,\n loading,\n error,\n } = useQetaApi(\n api =>\n api.getUsers({\n limit: entitiesPerPage,\n offset: (page - 1) * entitiesPerPage,\n ...filters,\n }),\n [entitiesPerPage, page, filters],\n );\n\n useDebounce(\n () => {\n if (filters.searchQuery !== searchQuery) {\n setFilters({ ...filters, searchQuery: searchQuery });\n }\n },\n 400,\n [searchQuery],\n );\n\n useEffect(() => {\n if (response) {\n setPageCount(Math.ceil(response.total / entitiesPerPage));\n }\n }, [response, entitiesPerPage]);\n\n return (\n <>\n <Grid container className=\"qetaUsersContainer\">\n <Grid item xs={12} md={4}>\n <SearchBar\n onSearch={setSearchQuery}\n label={t('usersPage.search.label')}\n loading={loading}\n />\n </Grid>\n </Grid>\n <Grid container>\n {response && (\n <Grid item xs={12}>\n <Typography variant=\"h6\" className=\"qetaUsersContainerTitle\">\n {t('usersPage.users', { count: response.total })}\n </Typography>\n </Grid>\n )}\n <UsersGridContent response={response} loading={loading} error={error} />\n {response && response?.total > 0 && (\n <QetaPagination\n pageSize={entitiesPerPage}\n handlePageChange={(_e, p) => setPage(p)}\n handlePageSizeChange={e =>\n setEntitiesPerPage(Number(e.target.value))\n }\n page={page}\n pageCount={pageCount}\n />\n )}\n </Grid>\n </>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;AAcO,MAAM,YAAY,MAAM;AAC7B,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAAA,cAAA,CAAM,SAAS,CAAC,CAAA;AACxC,EAAA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@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
2
|
+
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { isPermission } from '@backstage/plugin-permission-common';
|
|
5
|
+
import { qetaCreateTagPermission } from '@drodil/backstage-plugin-qeta-common';
|
|
6
|
+
|
|
7
|
+
const OptionalRequirePermission = (props) => {
|
|
8
|
+
const config = useApi(configApiRef);
|
|
9
|
+
if (config.getOptionalBoolean("qeta.permissions") !== true) {
|
|
10
|
+
if (isPermission(props.permission, qetaCreateTagPermission)) {
|
|
11
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, config.getOptionalBoolean("qeta.tags.allowCreation") ?? true ? props.children : null);
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, props.children);
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ React__default.createElement(RequirePermission, { ...props });
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { OptionalRequirePermission };
|
|
19
|
+
//# sourceMappingURL=OptionalRequirePermission.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptionalRequirePermission.esm.js","sources":["../../../src/components/Utility/OptionalRequirePermission.tsx"],"sourcesContent":["import {\n RequirePermission,\n RequirePermissionProps,\n} from '@backstage/plugin-permission-react';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport React from 'react';\nimport { isPermission } from '@backstage/plugin-permission-common';\nimport { qetaCreateTagPermission } from '@drodil/backstage-plugin-qeta-common';\n\nexport const OptionalRequirePermission = (props: RequirePermissionProps) => {\n const config = useApi(configApiRef);\n if (config.getOptionalBoolean('qeta.permissions') !== true) {\n if (isPermission(props.permission, qetaCreateTagPermission)) {\n return (\n <>\n {config.getOptionalBoolean('qeta.tags.allowCreation') ?? true\n ? props.children\n : null}\n </>\n );\n }\n return <>{props.children}</>;\n }\n\n return <RequirePermission {...props} />;\n};\n"],"names":["React"],"mappings":";;;;;;AASa,MAAA,yBAAA,GAA4B,CAAC,KAAkC,KAAA;AAC1E,EAAM,MAAA,MAAA,GAAS,OAAO,YAAY,CAAA;AAClC,EAAA,IAAI,MAAO,CAAA,kBAAA,CAAmB,kBAAkB,CAAA,KAAM,IAAM,EAAA;AAC1D,IAAA,IAAI,YAAa,CAAA,KAAA,CAAM,UAAY,EAAA,uBAAuB,CAAG,EAAA;AAC3D,MACE,uBAAAA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA,EACG,OAAO,kBAAmB,CAAA,yBAAyB,KAAK,IACrD,GAAA,KAAA,CAAM,WACN,IACN,CAAA;AAAA;AAGJ,IAAO,uBAAAA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA,EAAG,MAAM,QAAS,CAAA;AAAA;AAG3B,EAAO,uBAAAA,cAAA,CAAA,aAAA,CAAC,iBAAmB,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AACvC;;;;"}
|
|
@@ -142,6 +142,9 @@ function usePaginatedPosts(props) {
|
|
|
142
142
|
limit: postsPerPage,
|
|
143
143
|
offset: (page - 1) * postsPerPage,
|
|
144
144
|
includeEntities: true,
|
|
145
|
+
includeAnswers: false,
|
|
146
|
+
includeComments: false,
|
|
147
|
+
includeAttachments: false,
|
|
145
148
|
author,
|
|
146
149
|
favorite,
|
|
147
150
|
...getFiltersWithDateRange(filters)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaginatedPosts.esm.js","sources":["../../src/hooks/usePaginatedPosts.ts"],"sourcesContent":["import { useAnalytics } from '@backstage/core-plugin-api';\nimport React, { useEffect } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport {\n FilterKey,\n filterKeys,\n PostFilters,\n} from '../components/FilterPanel/FilterPanel';\nimport useDebounce from 'react-use/lib/useDebounce';\nimport { getFiltersWithDateRange } from '../utils';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\nimport { useQetaApi } from './useQetaApi';\n\nexport type PaginatedPostsProps = PostFilters & {\n author?: string;\n showFilters?: boolean;\n showTitle?: boolean;\n title?: string;\n favorite?: boolean;\n showAskButton?: boolean;\n showWriteButton?: boolean;\n showNoQuestionsBtn?: boolean;\n initialPageSize?: number;\n collectionId?: number;\n};\n\nexport type PostFilterChange = {\n key: keyof PostFilters;\n value?: PostFilters[keyof PostFilters];\n};\n\nconst EXPANDED_LOCAL_STORAGE_KEY = 'qeta-post-filters-expanded';\n\nexport function usePaginatedPosts(props: PaginatedPostsProps) {\n const { type, tags, author, entities, entity, favorite, initialPageSize } =\n props;\n const analytics = useAnalytics();\n const [page, setPage] = React.useState(1);\n const [pageCount, setPageCount] = React.useState(1);\n const [postsPerPage, setPostsPerPage] = React.useState(initialPageSize ?? 10);\n const [showFilterPanel, setShowFilterPanel] = React.useState(\n localStorage.getItem(EXPANDED_LOCAL_STORAGE_KEY) === 'true',\n );\n const [searchParams, setSearchParams] = useSearchParams();\n const [searchQuery, setSearchQuery] = React.useState('');\n const [filters, setFilters] = React.useState<PostFilters>({\n order: props.order ?? 'desc',\n orderBy: props.orderBy ?? 'created',\n noAnswers: props.noAnswers ?? 'false',\n noCorrectAnswer: props.noCorrectAnswer ?? 'false',\n noVotes: props.noVotes ?? 'false',\n searchQuery: props.searchQuery ?? '',\n entities: entities ?? (entity ? [entity] : undefined),\n tags: tags,\n dateRange: '',\n collectionId: props.collectionId,\n type,\n });\n\n useEffect(() => {\n localStorage.setItem(\n EXPANDED_LOCAL_STORAGE_KEY,\n showFilterPanel ? 'true' : 'false',\n );\n }, [showFilterPanel]);\n\n const onPageChange = (value: number) => {\n setPage(value);\n setSearchParams(prev => {\n const newValue = prev;\n newValue.set('page', String(value));\n return newValue;\n });\n };\n\n const loadNextPage = () => {\n setPage(prev => prev + 1);\n };\n\n const onFilterChange = (changes: PostFilterChange | PostFilterChange[]) => {\n const changesArray = Array.isArray(changes) ? changes : [changes];\n setPage(1);\n setFilters(prev => {\n const newValue = { ...prev };\n for (const { key, value } of changesArray) {\n (newValue as any)[key] = value;\n }\n return newValue;\n });\n setSearchParams(prev => {\n const newValue = prev;\n for (const { key, value } of changesArray) {\n if (!filterKeys.includes(key as FilterKey)) {\n continue;\n }\n if (!value || value === 'false') {\n newValue.delete(key);\n } else if (Array.isArray(value)) {\n if (value.length === 0) {\n newValue.delete(key);\n } else {\n newValue.set(key, value.join(','));\n }\n } else if (typeof value === 'number') {\n newValue.set(key, String(value));\n } else if (value.length > 0) {\n newValue.set(key, value);\n } else {\n newValue.delete(key);\n }\n }\n return newValue;\n });\n };\n\n const onSearchQueryChange = (query: string) => {\n onPageChange(1);\n if (query) {\n analytics.captureEvent('qeta_search', query);\n }\n setSearchQuery(query);\n };\n\n useDebounce(\n () => {\n if (filters.searchQuery !== searchQuery) {\n setFilters({ ...filters, searchQuery: searchQuery });\n }\n },\n 400,\n [searchQuery],\n );\n\n useEffect(() => {\n let filtersApplied = false;\n searchParams.forEach((value, key) => {\n try {\n if (key === 'page') {\n const pv = Number.parseInt(value, 10);\n if (pv > 0) {\n setPage(pv);\n } else {\n setPage(1);\n }\n } else if (key === 'postsPerPage') {\n const qpp = Number.parseInt(value, 10);\n if (qpp > 0) setPostsPerPage(qpp);\n } else if (filterKeys.includes(key as FilterKey)) {\n filtersApplied = true;\n if (key === 'tags') {\n filters.tags = filterTags(value) ?? [];\n } else {\n (filters as any)[key] = value;\n }\n }\n } catch (_e) {\n // NOOP\n }\n });\n setFilters(filters);\n if (filtersApplied) {\n setShowFilterPanel(true);\n }\n }, [searchParams, filters]);\n\n const {\n value: response,\n loading,\n error,\n retry,\n } = useQetaApi(\n api => {\n return api.getPosts({\n type,\n limit: postsPerPage,\n offset: (page - 1) * postsPerPage,\n includeEntities: true,\n author,\n favorite,\n ...(getFiltersWithDateRange(filters) as any),\n });\n },\n [type, page, filters, postsPerPage],\n );\n\n useEffect(() => {\n if (response) {\n setPageCount(Math.ceil(response.total / postsPerPage));\n }\n }, [response, postsPerPage]);\n\n const onPageSizeChange = (value: number) => {\n if (response) {\n let newPage = page;\n while (newPage * value > response.total) {\n newPage -= 1;\n }\n onPageChange(Math.max(1, newPage));\n }\n setPostsPerPage(value);\n setSearchParams(prev => {\n const newValue = prev;\n newValue.set('postsPerPage', String(value));\n return newValue;\n });\n };\n\n return {\n page,\n setPage,\n postsPerPage,\n setPostsPerPage,\n showFilterPanel,\n setShowFilterPanel,\n searchParams,\n setSearchParams,\n searchQuery,\n setSearchQuery,\n filters,\n setFilters,\n onPageChange,\n onPageSizeChange,\n onFilterChange,\n onSearchQueryChange,\n response,\n loading,\n error,\n loadNextPage,\n pageCount,\n retry,\n };\n}\n"],"names":["React"],"mappings":";;;;;;;;;AA+BA,MAAM,0BAA6B,GAAA,4BAAA;AAE5B,SAAS,kBAAkB,KAA4B,EAAA;AAC5D,EAAM,MAAA,EAAE,MAAM,IAAM,EAAA,MAAA,EAAQ,UAAU,MAAQ,EAAA,QAAA,EAAU,iBACtD,GAAA,KAAA;AACF,EAAA,MAAM,YAAY,YAAa,EAAA;AAC/B,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAAA,cAAA,CAAM,SAAS,CAAC,CAAA;AACxC,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAAA,cAAA,CAAM,SAAS,CAAC,CAAA;AAClD,EAAA,MAAM,CAAC,YAAc,EAAA,eAAe,IAAIA,cAAM,CAAA,QAAA,CAAS,mBAAmB,EAAE,CAAA;AAC5E,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAIA,cAAM,CAAA,QAAA;AAAA,IAClD,YAAA,CAAa,OAAQ,CAAA,0BAA0B,CAAM,KAAA;AAAA,GACvD;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,eAAgB,EAAA;AACxD,EAAA,MAAM,CAAC,WAAa,EAAA,cAAc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AA,IAAI,OAAU,GAAA,IAAA;AACd,MAAO,OAAA,OAAA,GAAU,KAAQ,GAAA,QAAA,CAAS,KAAO,EAAA;AACvC,QAAW,OAAA,IAAA,CAAA;AAAA;AAEb,MAAA,YAAA,CAAa,IAAK,CAAA,GAAA,CAAI,CAAG,EAAA,OAAO,CAAC,CAAA;AAAA;AAEnC,IAAA,eAAA,CAAgB,KAAK,CAAA;AACrB,IAAA,eAAA,CAAgB,CAAQ,IAAA,KAAA;AACtB,MAAA,MAAM,QAAW,GAAA,IAAA;AACjB,MAAA,QAAA,CAAS,GAAI,CAAA,cAAA,EAAgB,MAAO,CAAA,KAAK,CAAC,CAAA;AAC1C,MAAO,OAAA,QAAA;AAAA,KACR,CAAA;AAAA,GACH;AAEA,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,eAAA;AAAA,IACA,kBAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,gBAAA;AAAA,IACA,cAAA;AAAA,IACA,mBAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA,YAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"usePaginatedPosts.esm.js","sources":["../../src/hooks/usePaginatedPosts.ts"],"sourcesContent":["import { useAnalytics } from '@backstage/core-plugin-api';\nimport React, { useEffect } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport {\n FilterKey,\n filterKeys,\n PostFilters,\n} from '../components/FilterPanel/FilterPanel';\nimport useDebounce from 'react-use/lib/useDebounce';\nimport { getFiltersWithDateRange } from '../utils';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\nimport { useQetaApi } from './useQetaApi';\n\nexport type PaginatedPostsProps = PostFilters & {\n author?: string;\n showFilters?: boolean;\n showTitle?: boolean;\n title?: string;\n favorite?: boolean;\n showAskButton?: boolean;\n showWriteButton?: boolean;\n showNoQuestionsBtn?: boolean;\n initialPageSize?: number;\n collectionId?: number;\n};\n\nexport type PostFilterChange = {\n key: keyof PostFilters;\n value?: PostFilters[keyof PostFilters];\n};\n\nconst EXPANDED_LOCAL_STORAGE_KEY = 'qeta-post-filters-expanded';\n\nexport function usePaginatedPosts(props: PaginatedPostsProps) {\n const { type, tags, author, entities, entity, favorite, initialPageSize } =\n props;\n const analytics = useAnalytics();\n const [page, setPage] = React.useState(1);\n const [pageCount, setPageCount] = React.useState(1);\n const [postsPerPage, setPostsPerPage] = React.useState(initialPageSize ?? 10);\n const [showFilterPanel, setShowFilterPanel] = React.useState(\n localStorage.getItem(EXPANDED_LOCAL_STORAGE_KEY) === 'true',\n );\n const [searchParams, setSearchParams] = useSearchParams();\n const [searchQuery, setSearchQuery] = React.useState('');\n const [filters, setFilters] = React.useState<PostFilters>({\n order: props.order ?? 'desc',\n orderBy: props.orderBy ?? 'created',\n noAnswers: props.noAnswers ?? 'false',\n noCorrectAnswer: props.noCorrectAnswer ?? 'false',\n noVotes: props.noVotes ?? 'false',\n searchQuery: props.searchQuery ?? '',\n entities: entities ?? (entity ? [entity] : undefined),\n tags: tags,\n dateRange: '',\n collectionId: props.collectionId,\n type,\n });\n\n useEffect(() => {\n localStorage.setItem(\n EXPANDED_LOCAL_STORAGE_KEY,\n showFilterPanel ? 'true' : 'false',\n );\n }, [showFilterPanel]);\n\n const onPageChange = (value: number) => {\n setPage(value);\n setSearchParams(prev => {\n const newValue = prev;\n newValue.set('page', String(value));\n return newValue;\n });\n };\n\n const loadNextPage = () => {\n setPage(prev => prev + 1);\n };\n\n const onFilterChange = (changes: PostFilterChange | PostFilterChange[]) => {\n const changesArray = Array.isArray(changes) ? changes : [changes];\n setPage(1);\n setFilters(prev => {\n const newValue = { ...prev };\n for (const { key, value } of changesArray) {\n (newValue as any)[key] = value;\n }\n return newValue;\n });\n setSearchParams(prev => {\n const newValue = prev;\n for (const { key, value } of changesArray) {\n if (!filterKeys.includes(key as FilterKey)) {\n continue;\n }\n if (!value || value === 'false') {\n newValue.delete(key);\n } else if (Array.isArray(value)) {\n if (value.length === 0) {\n newValue.delete(key);\n } else {\n newValue.set(key, value.join(','));\n }\n } else if (typeof value === 'number') {\n newValue.set(key, String(value));\n } else if (value.length > 0) {\n newValue.set(key, value);\n } else {\n newValue.delete(key);\n }\n }\n return newValue;\n });\n };\n\n const onSearchQueryChange = (query: string) => {\n onPageChange(1);\n if (query) {\n analytics.captureEvent('qeta_search', query);\n }\n setSearchQuery(query);\n };\n\n useDebounce(\n () => {\n if (filters.searchQuery !== searchQuery) {\n setFilters({ ...filters, searchQuery: searchQuery });\n }\n },\n 400,\n [searchQuery],\n );\n\n useEffect(() => {\n let filtersApplied = false;\n searchParams.forEach((value, key) => {\n try {\n if (key === 'page') {\n const pv = Number.parseInt(value, 10);\n if (pv > 0) {\n setPage(pv);\n } else {\n setPage(1);\n }\n } else if (key === 'postsPerPage') {\n const qpp = Number.parseInt(value, 10);\n if (qpp > 0) setPostsPerPage(qpp);\n } else if (filterKeys.includes(key as FilterKey)) {\n filtersApplied = true;\n if (key === 'tags') {\n filters.tags = filterTags(value) ?? [];\n } else {\n (filters as any)[key] = value;\n }\n }\n } catch (_e) {\n // NOOP\n }\n });\n setFilters(filters);\n if (filtersApplied) {\n setShowFilterPanel(true);\n }\n }, [searchParams, filters]);\n\n const {\n value: response,\n loading,\n error,\n retry,\n } = useQetaApi(\n api => {\n return api.getPosts({\n type,\n limit: postsPerPage,\n offset: (page - 1) * postsPerPage,\n includeEntities: true,\n includeAnswers: false,\n includeComments: false,\n includeAttachments: false,\n author,\n favorite,\n ...(getFiltersWithDateRange(filters) as any),\n });\n },\n [type, page, filters, postsPerPage],\n );\n\n useEffect(() => {\n if (response) {\n setPageCount(Math.ceil(response.total / postsPerPage));\n }\n }, [response, postsPerPage]);\n\n const onPageSizeChange = (value: number) => {\n if (response) {\n let newPage = page;\n while (newPage * value > response.total) {\n newPage -= 1;\n }\n onPageChange(Math.max(1, newPage));\n }\n setPostsPerPage(value);\n setSearchParams(prev => {\n const newValue = prev;\n newValue.set('postsPerPage', String(value));\n return newValue;\n });\n };\n\n return {\n page,\n setPage,\n postsPerPage,\n setPostsPerPage,\n showFilterPanel,\n setShowFilterPanel,\n searchParams,\n setSearchParams,\n searchQuery,\n setSearchQuery,\n filters,\n setFilters,\n onPageChange,\n onPageSizeChange,\n onFilterChange,\n onSearchQueryChange,\n response,\n loading,\n error,\n loadNextPage,\n pageCount,\n retry,\n };\n}\n"],"names":["React"],"mappings":";;;;;;;;;AA+BA,MAAM,0BAA6B,GAAA,4BAAA;AAE5B,SAAS,kBAAkB,KAA4B,EAAA;AAC5D,EAAM,MAAA,EAAE,MAAM,IAAM,EAAA,MAAA,EAAQ,UAAU,MAAQ,EAAA,QAAA,EAAU,iBACtD,GAAA,KAAA;AACF,EAAA,MAAM,YAAY,YAAa,EAAA;AAC/B,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAAA,cAAA,CAAM,SAAS,CAAC,CAAA;AACxC,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAAA,cAAA,CAAM,SAAS,CAAC,CAAA;AAClD,EAAA,MAAM,CAAC,YAAc,EAAA,eAAe,IAAIA,cAAM,CAAA,QAAA,CAAS,mBAAmB,EAAE,CAAA;AAC5E,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAIA,cAAM,CAAA,QAAA;AAAA,IAClD,YAAA,CAAa,OAAQ,CAAA,0BAA0B,CAAM,KAAA;AAAA,GACvD;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,eAAgB,EAAA;AACxD,EAAA,MAAM,CAAC,WAAa,EAAA,cAAc,CAAI,GAAAA,cAAA,CAAM,SAAS,EAAE,CAAA;AACvD,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AAA;AAC1C,IAAA,IAAI,QAAU,EAAA;AACZ,MAAA,IAAI,OAAU,GAAA,IAAA;AACd,MAAO,OAAA,OAAA,GAAU,KAAQ,GAAA,QAAA,CAAS,KAAO,EAAA;AACvC,QAAW,OAAA,IAAA,CAAA;AAAA;AAEb,MAAA,YAAA,CAAa,IAAK,CAAA,GAAA,CAAI,CAAG,EAAA,OAAO,CAAC,CAAA;AAAA;AAEnC,IAAA,eAAA,CAAgB,KAAK,CAAA;AACrB,IAAA,eAAA,CAAgB,CAAQ,IAAA,KAAA;AACtB,MAAA,MAAM,QAAW,GAAA,IAAA;AACjB,MAAA,QAAA,CAAS,GAAI,CAAA,cAAA,EAAgB,MAAO,CAAA,KAAK,CAAC,CAAA;AAC1C,MAAO,OAAA,QAAA;AAAA,KACR,CAAA;AAAA,GACH;AAEA,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,eAAA;AAAA,IACA,kBAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,gBAAA;AAAA,IACA,cAAA;AAAA,IACA,mBAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA,YAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -242,7 +242,6 @@ declare const QuestionCard: (props: {
|
|
|
242
242
|
}) => React.JSX.Element;
|
|
243
243
|
|
|
244
244
|
declare const PostsCard: (props: {
|
|
245
|
-
type: string;
|
|
246
245
|
title: string;
|
|
247
246
|
options?: PostsQuery;
|
|
248
247
|
icon?: React.ReactNode;
|
|
@@ -284,10 +283,20 @@ declare const UpdatedByLink: (props: {
|
|
|
284
283
|
}) => React.JSX.Element | null;
|
|
285
284
|
|
|
286
285
|
type QuickFilterType = 'latest' | 'favorites' | 'most_viewed';
|
|
286
|
+
declare const PostsTable: (props: {
|
|
287
|
+
hideTitle?: boolean;
|
|
288
|
+
rowsPerPage?: number;
|
|
289
|
+
quickFilter?: QuickFilterType;
|
|
290
|
+
postType?: PostType;
|
|
291
|
+
}) => React.JSX.Element;
|
|
292
|
+
/**
|
|
293
|
+
* @deprecated Use `PostsTable` instead
|
|
294
|
+
*/
|
|
287
295
|
declare const QuestionsTable: (props: {
|
|
288
296
|
hideTitle?: boolean;
|
|
289
297
|
rowsPerPage?: number;
|
|
290
298
|
quickFilter?: QuickFilterType;
|
|
299
|
+
postType?: PostType;
|
|
291
300
|
}) => React.JSX.Element;
|
|
292
301
|
|
|
293
302
|
type QetaStatsChartClassKey = 'tooltipLabel' | 'tooltipWrapper' | 'xAxis' | 'lineChart' | 'barChart';
|
|
@@ -430,6 +439,7 @@ declare const useTranslation: () => {
|
|
|
430
439
|
readonly "answerList.errorLoading": "Could not load answers";
|
|
431
440
|
readonly "answerList.limitSelect": "Answers per page";
|
|
432
441
|
readonly "common.post": "post";
|
|
442
|
+
readonly "common.collection": "collection";
|
|
433
443
|
readonly "common.question": "question";
|
|
434
444
|
readonly "common.article": "article";
|
|
435
445
|
readonly "common.score": "{{score}} score";
|
|
@@ -453,6 +463,9 @@ declare const useTranslation: () => {
|
|
|
453
463
|
readonly "common.collections_zero": "No collections";
|
|
454
464
|
readonly "common.collections_one": "{{count}} collection";
|
|
455
465
|
readonly "common.collections_other": "{{count}} collections";
|
|
466
|
+
readonly "common.entities_zero": "No entities";
|
|
467
|
+
readonly "common.entities_one": "{{count}} entity";
|
|
468
|
+
readonly "common.entities_other": "{{count}} entities";
|
|
456
469
|
readonly "common.followers_zero": "No followers";
|
|
457
470
|
readonly "common.followers_one": "{{count}} follower";
|
|
458
471
|
readonly "common.followers_other": "{{count}} followers";
|
|
@@ -524,8 +537,8 @@ declare const useTranslation: () => {
|
|
|
524
537
|
readonly "createTagModal.createButton": "Create";
|
|
525
538
|
readonly "deleteModal.title.tag": "Are you sure you want to delete this tag?";
|
|
526
539
|
readonly "deleteModal.title.answer": "Are you sure you want to delete this answer?";
|
|
527
|
-
readonly "deleteModal.title.question": "Are you sure you want to delete this post?";
|
|
528
540
|
readonly "deleteModal.title.collection": "Are you sure you want to delete this collection?";
|
|
541
|
+
readonly "deleteModal.title.question": "Are you sure you want to delete this post?";
|
|
529
542
|
readonly "deleteModal.cancelButton": "Cancel";
|
|
530
543
|
readonly "deleteModal.errorDeleting": "Failed to delete";
|
|
531
544
|
readonly "deleteModal.deleteButton": "Delete";
|
|
@@ -606,6 +619,7 @@ declare const useTranslation: () => {
|
|
|
606
619
|
readonly "collectionsPage.title": "Collections";
|
|
607
620
|
readonly "collectionPage.description": "Description";
|
|
608
621
|
readonly "collectionPage.info": "You can add questions and articles to the collection from question and article pages";
|
|
622
|
+
readonly "searchResult.created": "Created";
|
|
609
623
|
readonly "questionPage.errorLoading": "Could not load question";
|
|
610
624
|
readonly "questionPage.notFound": "Could not find the question";
|
|
611
625
|
readonly "questionPage.editButton": "Edit";
|
|
@@ -684,14 +698,15 @@ declare const useTranslation: () => {
|
|
|
684
698
|
readonly "postsContainer.title.tagged": "{{itemType}} tagged with {{tags}}";
|
|
685
699
|
readonly "postsContainer.createButton": "Go ahead and create one!";
|
|
686
700
|
readonly "postsContainer.noItems": "No {{itemType}}s";
|
|
687
|
-
readonly "
|
|
688
|
-
readonly "
|
|
689
|
-
readonly "
|
|
690
|
-
readonly "
|
|
691
|
-
readonly "
|
|
692
|
-
readonly "
|
|
693
|
-
readonly "
|
|
694
|
-
readonly "
|
|
701
|
+
readonly "postsTable.errorLoading": "Could not load questions";
|
|
702
|
+
readonly "postsTable.latest": "Latest";
|
|
703
|
+
readonly "postsTable.mostViewed": "Most viewed";
|
|
704
|
+
readonly "postsTable.favorites": "Favorites";
|
|
705
|
+
readonly "postsTable.cells.author": "Author";
|
|
706
|
+
readonly "postsTable.cells.type": "Type";
|
|
707
|
+
readonly "postsTable.cells.updated": "Last updated";
|
|
708
|
+
readonly "postsTable.cells.title": "Title";
|
|
709
|
+
readonly "postsTable.cells.asked": "Asked";
|
|
695
710
|
readonly "tagPage.search.label": "Search tag";
|
|
696
711
|
readonly "tagPage.search.placeholder": "Search...";
|
|
697
712
|
readonly "tagPage.errorLoading": "Could not load tags";
|
|
@@ -703,10 +718,10 @@ declare const useTranslation: () => {
|
|
|
703
718
|
readonly "entitiesPage.search.label": "Search entity";
|
|
704
719
|
readonly "entitiesPage.search.placeholder": "Search...";
|
|
705
720
|
readonly "entitiesPage.errorLoading": "Could not load entities";
|
|
706
|
-
readonly "entitiesPage.defaultTitle": "Entities";
|
|
707
721
|
readonly "entitiesPage.entities_zero": "No entities";
|
|
708
722
|
readonly "entitiesPage.entities_one": "{{count}} entity";
|
|
709
723
|
readonly "entitiesPage.entities_other": "{{count}} entities";
|
|
724
|
+
readonly "entitiesPage.defaultTitle": "Entities";
|
|
710
725
|
readonly "aiAnswerCard.answer": "Answer from {{name}}";
|
|
711
726
|
readonly "aiAnswerCard.summary": "Summary by {{name}}";
|
|
712
727
|
readonly "aiAnswerCard.loading": "Thinking...";
|
|
@@ -844,4 +859,4 @@ type QetaOverrides = Overrides & {
|
|
|
844
859
|
[Name in keyof QetaComponentsNameToClassKey]?: Partial<StyleRules<QetaComponentsNameToClassKey[Name]>>;
|
|
845
860
|
};
|
|
846
861
|
|
|
847
|
-
export { AIAnswerCard, AddToCollectionButton, AnswerCard, AnswerForm, AnswerList, AnswerListItem, AnswersContainer, ArticleContent, AskQuestionButton, AuthorLink, ButtonContainer, CollectionCard, CollectionFollowButton, CollectionForm, CollectionsGrid, CreateCollectionButton, DeleteModal, EntitiesGrid, EntityFollowButton, FilterPanel, FollowedCollectionsList, FollowedEntitiesList, FollowedTagsList, FollowedUsersList, ImpactCard, LeftMenu, LeftMenuButton, MarkdownRenderer, PostForm, PostHighlightList, PostList, PostListItem, PostsCard, PostsContainer, PostsGrid, type QetaOverrides, QuestionCard, QuestionsTable, RelativeTimeWithTooltip, SelectTemplateList, StatsChart, SuggestionsCard, SummaryStatsGrid, TagFollowButton, TagsGrid, TemplateList, TopRankingUsers, TrophyIcon, UpdatedByLink, UserFollowButton, UserLink, UsersGrid, WriteArticleButton, articleRouteRef, articlesRouteRef, askRouteRef, collectionCreateRouteRef, collectionEditRouteRef, collectionRouteRef, collectionsRouteRef, editArticleRouteRef, editQuestionRouteRef, entitiesRouteRef, entityRouteRef, favoriteQuestionsRouteRef, moderatorRouteRef, qetaApiRef, qetaRouteRef, questionRouteRef, questionsRouteRef, statisticsRouteRef, tagRouteRef, tagsRouteRef, useAI, useCollectionsFollow, useEntityAuthor, useEntityFollow, useIdentityApi, useIsModerator, useQetaApi, useTagsFollow, useTranslation, useUserFollow, useUserInfo, userRouteRef, usersRouteRef, writeRouteRef };
|
|
862
|
+
export { AIAnswerCard, AddToCollectionButton, AnswerCard, AnswerForm, AnswerList, AnswerListItem, AnswersContainer, ArticleContent, AskQuestionButton, AuthorLink, ButtonContainer, CollectionCard, CollectionFollowButton, CollectionForm, CollectionsGrid, CreateCollectionButton, DeleteModal, EntitiesGrid, EntityFollowButton, FilterPanel, FollowedCollectionsList, FollowedEntitiesList, FollowedTagsList, FollowedUsersList, ImpactCard, LeftMenu, LeftMenuButton, MarkdownRenderer, PostForm, PostHighlightList, PostList, PostListItem, PostsCard, PostsContainer, PostsGrid, PostsTable, type QetaOverrides, QuestionCard, QuestionsTable, RelativeTimeWithTooltip, SelectTemplateList, StatsChart, SuggestionsCard, SummaryStatsGrid, TagFollowButton, TagsGrid, TemplateList, TopRankingUsers, TrophyIcon, UpdatedByLink, UserFollowButton, UserLink, UsersGrid, WriteArticleButton, articleRouteRef, articlesRouteRef, askRouteRef, collectionCreateRouteRef, collectionEditRouteRef, collectionRouteRef, collectionsRouteRef, editArticleRouteRef, editQuestionRouteRef, entitiesRouteRef, entityRouteRef, favoriteQuestionsRouteRef, moderatorRouteRef, qetaApiRef, qetaRouteRef, questionRouteRef, questionsRouteRef, statisticsRouteRef, tagRouteRef, tagsRouteRef, useAI, useCollectionsFollow, useEntityAuthor, useEntityFollow, useIdentityApi, useIsModerator, useQetaApi, useTagsFollow, useTranslation, useUserFollow, useUserInfo, userRouteRef, usersRouteRef, writeRouteRef };
|
package/dist/index.esm.js
CHANGED
|
@@ -31,7 +31,7 @@ export { FollowedUsersList } from './components/FollowedLists/FollowedUsersList.
|
|
|
31
31
|
export { AnswerForm } from './components/AnswerForm/AnswerForm.esm.js';
|
|
32
32
|
export { RelativeTimeWithTooltip } from './components/RelativeTimeWithTooltip/RelativeTimeWithTooltip.esm.js';
|
|
33
33
|
export { AuthorLink, UpdatedByLink, UserLink } from './components/Links/Links.esm.js';
|
|
34
|
-
export { QuestionsTable } from './components/
|
|
34
|
+
export { PostsTable, QuestionsTable } from './components/PostsTable/PostsTable.esm.js';
|
|
35
35
|
export { StatsChart } from './components/StatsChart/StatsChart.esm.js';
|
|
36
36
|
export { SummaryStatsGrid } from './components/SummaryStatsGrid/SummaryStatsGrid.esm.js';
|
|
37
37
|
export { TopRankingUsers } from './components/TopRankingUsersCard/TopRankingUsersCard.esm.js';
|