@drodil/backstage-plugin-qeta-react 3.24.1 → 3.24.3
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.
|
@@ -16,7 +16,7 @@ const AddToCollectionButton = (props) => {
|
|
|
16
16
|
const { post } = props;
|
|
17
17
|
const { t } = useTranslation();
|
|
18
18
|
const { value: response, retry } = useQetaApi((api) => {
|
|
19
|
-
return api.getCollections();
|
|
19
|
+
return api.getCollections({ checkAccess: true });
|
|
20
20
|
}, []);
|
|
21
21
|
const [open, setOpen] = React__default.useState(false);
|
|
22
22
|
const qetaApi = useApi(qetaApiRef);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddToCollectionButton.esm.js","sources":["../../../src/components/Buttons/AddToCollectionButton.tsx"],"sourcesContent":["import { Collection, PostResponse } from '@drodil/backstage-plugin-qeta-common';\nimport React from 'react';\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Grid,\n} from '@material-ui/core';\nimport AddCircle from '@material-ui/icons/AddCircle';\nimport RemoveCircle from '@material-ui/icons/RemoveCircle';\nimport PlayListAddIcon from '@material-ui/icons/PlaylistAdd';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { qetaApiRef } from '../../api';\nimport { useQetaApi, useTranslation } from '../../hooks';\n\nexport const AddToCollectionButton = (props: { post: PostResponse }) => {\n const { post } = props;\n const { t } = useTranslation();\n const { value: response, retry } = useQetaApi(api => {\n return api.getCollections();\n }, []);\n const [open, setOpen] = React.useState(false);\n const qetaApi = useApi(qetaApiRef);\n\n const handleClickOpen = () => {\n setOpen(true);\n };\n\n const handleClose = () => {\n setOpen(false);\n };\n\n const handleClick = (collection: Collection) => {\n if (collection.posts?.find(p => p.id === post.id)) {\n qetaApi.removePostFromCollection(collection.id, post.id).then(() => {\n retry();\n });\n } else {\n qetaApi.addPostToCollection(collection.id, post.id).then(() => {\n retry();\n });\n }\n };\n\n const collections = (response?.collections ?? []).filter(c => c.canEdit);\n if (!collections.length) {\n return null;\n }\n\n return (\n <>\n <Button\n variant=\"contained\"\n size=\"small\"\n onClick={handleClickOpen}\n startIcon={<PlayListAddIcon />}\n >\n {t('addToCollectionButton.title')}\n </Button>\n <Dialog open={open} onClose={handleClose} fullWidth>\n <DialogTitle>{t('addToCollectionButton.manage')}</DialogTitle>\n <DialogContent>\n <Grid container>\n {collections.map(collection => {\n const isInCollection = collection.posts?.find(\n p => p.id === post.id,\n );\n\n return (\n <Grid item key={collection.id}>\n <Button\n variant=\"outlined\"\n startIcon={\n isInCollection ? <RemoveCircle /> : <AddCircle />\n }\n color={isInCollection ? 'secondary' : 'primary'}\n onClick={() => handleClick(collection)}\n >\n {collection.title}\n </Button>\n </Grid>\n );\n })}\n </Grid>\n </DialogContent>\n <DialogActions>\n <Button onClick={handleClose} color=\"primary\">\n {t('addToCollectionButton.close')}\n </Button>\n </DialogActions>\n </Dialog>\n </>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;AAiBa,MAAA,qBAAA,GAAwB,CAAC,KAAkC,KAAA;AACtE,EAAM,MAAA,EAAE,MAAS,GAAA,KAAA;AACjB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,EAAE,KAAO,EAAA,QAAA,EAAU,KAAM,EAAA,GAAI,WAAW,CAAO,GAAA,KAAA;AACnD,IAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AddToCollectionButton.esm.js","sources":["../../../src/components/Buttons/AddToCollectionButton.tsx"],"sourcesContent":["import { Collection, PostResponse } from '@drodil/backstage-plugin-qeta-common';\nimport React from 'react';\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Grid,\n} from '@material-ui/core';\nimport AddCircle from '@material-ui/icons/AddCircle';\nimport RemoveCircle from '@material-ui/icons/RemoveCircle';\nimport PlayListAddIcon from '@material-ui/icons/PlaylistAdd';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { qetaApiRef } from '../../api';\nimport { useQetaApi, useTranslation } from '../../hooks';\n\nexport const AddToCollectionButton = (props: { post: PostResponse }) => {\n const { post } = props;\n const { t } = useTranslation();\n const { value: response, retry } = useQetaApi(api => {\n return api.getCollections({ checkAccess: true });\n }, []);\n const [open, setOpen] = React.useState(false);\n const qetaApi = useApi(qetaApiRef);\n\n const handleClickOpen = () => {\n setOpen(true);\n };\n\n const handleClose = () => {\n setOpen(false);\n };\n\n const handleClick = (collection: Collection) => {\n if (collection.posts?.find(p => p.id === post.id)) {\n qetaApi.removePostFromCollection(collection.id, post.id).then(() => {\n retry();\n });\n } else {\n qetaApi.addPostToCollection(collection.id, post.id).then(() => {\n retry();\n });\n }\n };\n\n const collections = (response?.collections ?? []).filter(c => c.canEdit);\n if (!collections.length) {\n return null;\n }\n\n return (\n <>\n <Button\n variant=\"contained\"\n size=\"small\"\n onClick={handleClickOpen}\n startIcon={<PlayListAddIcon />}\n >\n {t('addToCollectionButton.title')}\n </Button>\n <Dialog open={open} onClose={handleClose} fullWidth>\n <DialogTitle>{t('addToCollectionButton.manage')}</DialogTitle>\n <DialogContent>\n <Grid container>\n {collections.map(collection => {\n const isInCollection = collection.posts?.find(\n p => p.id === post.id,\n );\n\n return (\n <Grid item key={collection.id}>\n <Button\n variant=\"outlined\"\n startIcon={\n isInCollection ? <RemoveCircle /> : <AddCircle />\n }\n color={isInCollection ? 'secondary' : 'primary'}\n onClick={() => handleClick(collection)}\n >\n {collection.title}\n </Button>\n </Grid>\n );\n })}\n </Grid>\n </DialogContent>\n <DialogActions>\n <Button onClick={handleClose} color=\"primary\">\n {t('addToCollectionButton.close')}\n </Button>\n </DialogActions>\n </Dialog>\n </>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;AAiBa,MAAA,qBAAA,GAAwB,CAAC,KAAkC,KAAA;AACtE,EAAM,MAAA,EAAE,MAAS,GAAA,KAAA;AACjB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cA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WAAA,EAAa,OAAM,SACjC,EAAA,EAAA,CAAA,CAAE,6BAA6B,CAClC,CACF,CACF,CACF,CAAA;AAEJ;;;;"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"frontend",
|
|
8
8
|
"backstage.io"
|
|
9
9
|
],
|
|
10
|
-
"version": "3.24.
|
|
10
|
+
"version": "3.24.3",
|
|
11
11
|
"main": "dist/index.esm.js",
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
13
|
"prepublishOnly": "yarn tsc && yarn build",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@backstage/plugin-permission-common": "^0.8.4",
|
|
58
58
|
"@backstage/plugin-permission-react": "^0.4.32",
|
|
59
59
|
"@backstage/plugin-signals-react": "^0.0.11",
|
|
60
|
-
"@drodil/backstage-plugin-qeta-common": "^3.24.
|
|
60
|
+
"@drodil/backstage-plugin-qeta-common": "^3.24.3",
|
|
61
61
|
"@jsdevtools/rehype-toc": "^3.0.2",
|
|
62
62
|
"@material-ui/core": "^4.12.2",
|
|
63
63
|
"@material-ui/icons": "^4.11.3",
|