@drodil/backstage-plugin-qeta-react 2.15.0 → 3.0.0
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/api.esm.js +8 -0
- package/dist/api.esm.js.map +1 -0
- package/dist/components/AnswerCard/AnswerCard.esm.js +113 -0
- package/dist/components/AnswerCard/AnswerCard.esm.js.map +1 -0
- package/dist/components/AnswerForm/AnswerForm.esm.js +153 -0
- package/dist/components/AnswerForm/AnswerForm.esm.js.map +1 -0
- package/dist/components/AnswersContainer/AnswerList.esm.js +100 -0
- package/dist/components/AnswersContainer/AnswerList.esm.js.map +1 -0
- package/dist/components/AnswersContainer/AnswerListItem.esm.js +90 -0
- package/dist/components/AnswersContainer/AnswerListItem.esm.js.map +1 -0
- package/dist/components/AnswersContainer/AnswersContainer.esm.js +210 -0
- package/dist/components/AnswersContainer/AnswersContainer.esm.js.map +1 -0
- package/dist/components/ArticleContent/ArticleButtons.esm.js +90 -0
- package/dist/components/ArticleContent/ArticleButtons.esm.js.map +1 -0
- package/dist/components/ArticleContent/ArticleContent.esm.js +78 -0
- package/dist/components/ArticleContent/ArticleContent.esm.js.map +1 -0
- package/dist/components/AuthorBox/AuthorBox.esm.js +25 -0
- package/dist/components/AuthorBox/AuthorBox.esm.js.map +1 -0
- package/dist/components/Buttons/AddToCollectionButton.esm.js +68 -0
- package/dist/components/Buttons/AddToCollectionButton.esm.js.map +1 -0
- package/dist/components/Buttons/AskQuestionButton.esm.js +40 -0
- package/dist/components/Buttons/AskQuestionButton.esm.js.map +1 -0
- package/dist/components/Buttons/BackToArticlesButton.esm.js +40 -0
- package/dist/components/Buttons/BackToArticlesButton.esm.js.map +1 -0
- package/dist/components/Buttons/BackToCollectionsButton.esm.js +25 -0
- package/dist/components/Buttons/BackToCollectionsButton.esm.js.map +1 -0
- package/dist/components/Buttons/BackToQuestionsButton.esm.js +40 -0
- package/dist/components/Buttons/BackToQuestionsButton.esm.js.map +1 -0
- package/dist/components/Buttons/CreateCollectionButton.esm.js +29 -0
- package/dist/components/Buttons/CreateCollectionButton.esm.js.map +1 -0
- package/dist/components/Buttons/EntityFollowButton.esm.js +34 -0
- package/dist/components/Buttons/EntityFollowButton.esm.js.map +1 -0
- package/dist/components/Buttons/FavoriteButton.esm.js +45 -0
- package/dist/components/Buttons/FavoriteButton.esm.js.map +1 -0
- package/dist/components/Buttons/LinkButton.esm.js +28 -0
- package/dist/components/Buttons/LinkButton.esm.js.map +1 -0
- package/dist/components/Buttons/TagFollowButton.esm.js +34 -0
- package/dist/components/Buttons/TagFollowButton.esm.js.map +1 -0
- package/dist/components/Buttons/VoteButtons.esm.js +75 -0
- package/dist/components/Buttons/VoteButtons.esm.js.map +1 -0
- package/dist/components/Buttons/WriteArticleButton.esm.js +40 -0
- package/dist/components/Buttons/WriteArticleButton.esm.js.map +1 -0
- package/dist/components/CollectionCard/CollectionCard.esm.js +63 -0
- package/dist/components/CollectionCard/CollectionCard.esm.js.map +1 -0
- package/dist/components/CollectionForm/CollectionForm.esm.js +251 -0
- package/dist/components/CollectionForm/CollectionForm.esm.js.map +1 -0
- package/dist/components/CollectionsGrid/CollectionsGrid.esm.js +40 -0
- package/dist/components/CollectionsGrid/CollectionsGrid.esm.js.map +1 -0
- package/dist/components/CollectionsGrid/CollectionsGridContent.esm.js +67 -0
- package/dist/components/CollectionsGrid/CollectionsGridContent.esm.js.map +1 -0
- package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js +48 -0
- package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js.map +1 -0
- package/dist/components/CommentSection/CommentList.esm.js +47 -0
- package/dist/components/CommentSection/CommentList.esm.js.map +1 -0
- package/dist/components/CommentSection/CommentSection.esm.js +126 -0
- package/dist/components/CommentSection/CommentSection.esm.js.map +1 -0
- package/dist/components/DeleteModal/DeleteModal.esm.js +88 -0
- package/dist/components/DeleteModal/DeleteModal.esm.js.map +1 -0
- package/dist/components/EntitiesGrid/EntitiesGrid.esm.js +45 -0
- package/dist/components/EntitiesGrid/EntitiesGrid.esm.js.map +1 -0
- package/dist/components/EntitiesGrid/EntitiesGridItem.esm.js +61 -0
- package/dist/components/EntitiesGrid/EntitiesGridItem.esm.js.map +1 -0
- package/dist/components/FilterPanel/DateRangeFilter.esm.js +110 -0
- package/dist/components/FilterPanel/DateRangeFilter.esm.js.map +1 -0
- package/dist/components/FilterPanel/FilterPanel.esm.js +238 -0
- package/dist/components/FilterPanel/FilterPanel.esm.js.map +1 -0
- package/dist/components/FollowedLists/FollowedEntitiesList.esm.js +43 -0
- package/dist/components/FollowedLists/FollowedEntitiesList.esm.js.map +1 -0
- package/dist/components/FollowedLists/FollowedTagsList.esm.js +43 -0
- package/dist/components/FollowedLists/FollowedTagsList.esm.js.map +1 -0
- package/dist/components/HomePageCards/ImpactCard.esm.js +22 -0
- package/dist/components/HomePageCards/ImpactCard.esm.js.map +1 -0
- package/dist/components/HomePageCards/PostsCard.esm.js +42 -0
- package/dist/components/HomePageCards/PostsCard.esm.js.map +1 -0
- package/dist/components/Links/Links.esm.js +33 -0
- package/dist/components/Links/Links.esm.js.map +1 -0
- package/dist/components/MarkdownEditor/MarkdownEditor.esm.js +63 -0
- package/dist/components/MarkdownEditor/MarkdownEditor.esm.js.map +1 -0
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js +97 -0
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js.map +1 -0
- package/dist/components/PostAnonymouslyCheckbox/PostAnonymouslyCheckbox.esm.js +34 -0
- package/dist/components/PostAnonymouslyCheckbox/PostAnonymouslyCheckbox.esm.js.map +1 -0
- package/dist/components/PostForm/EntitiesInput.esm.js +100 -0
- package/dist/components/PostForm/EntitiesInput.esm.js.map +1 -0
- package/dist/components/PostForm/PostForm.esm.js +283 -0
- package/dist/components/PostForm/PostForm.esm.js.map +1 -0
- package/dist/components/PostForm/TagInput.esm.js +81 -0
- package/dist/components/PostForm/TagInput.esm.js.map +1 -0
- package/dist/components/PostHighlightList/PostHighlightList.esm.js +72 -0
- package/dist/components/PostHighlightList/PostHighlightList.esm.js.map +1 -0
- package/dist/components/PostsContainer/NoPostsCard.esm.js +50 -0
- package/dist/components/PostsContainer/NoPostsCard.esm.js.map +1 -0
- package/dist/components/PostsContainer/PostList.esm.js +113 -0
- package/dist/components/PostsContainer/PostList.esm.js.map +1 -0
- package/dist/components/PostsContainer/PostListItem.esm.js +138 -0
- package/dist/components/PostsContainer/PostListItem.esm.js.map +1 -0
- package/dist/components/PostsContainer/PostsContainer.esm.js +152 -0
- package/dist/components/PostsContainer/PostsContainer.esm.js.map +1 -0
- package/dist/components/PostsGrid/PostsGrid.esm.js +146 -0
- package/dist/components/PostsGrid/PostsGrid.esm.js.map +1 -0
- package/dist/components/PostsGrid/PostsGridContent.esm.js +90 -0
- package/dist/components/PostsGrid/PostsGridContent.esm.js.map +1 -0
- package/dist/components/PostsGrid/PostsGridItem.esm.js +57 -0
- package/dist/components/PostsGrid/PostsGridItem.esm.js.map +1 -0
- package/dist/components/QuestionCard/QuestionCard.esm.js +107 -0
- package/dist/components/QuestionCard/QuestionCard.esm.js.map +1 -0
- package/dist/components/QuestionsTable/QuestionTableRow.esm.js +21 -0
- package/dist/components/QuestionsTable/QuestionTableRow.esm.js.map +1 -0
- package/dist/components/QuestionsTable/QuestionsTable.esm.js +131 -0
- package/dist/components/QuestionsTable/QuestionsTable.esm.js.map +1 -0
- package/dist/components/RelativeTimeWithTooltip/RelativeTimeWithTooltip.esm.js +22 -0
- package/dist/components/RelativeTimeWithTooltip/RelativeTimeWithTooltip.esm.js.map +1 -0
- package/dist/components/StatsChart/StatsChart.esm.js +245 -0
- package/dist/components/StatsChart/StatsChart.esm.js.map +1 -0
- package/dist/components/SummaryStatsGrid/SummaryStatsGrid.esm.js +53 -0
- package/dist/components/SummaryStatsGrid/SummaryStatsGrid.esm.js.map +1 -0
- package/dist/components/TagsAndEntities/EntityChip.esm.js +80 -0
- package/dist/components/TagsAndEntities/EntityChip.esm.js.map +1 -0
- package/dist/components/TagsAndEntities/TagChip.esm.js +78 -0
- package/dist/components/TagsAndEntities/TagChip.esm.js.map +1 -0
- package/dist/components/TagsAndEntities/TagsAndEntities.esm.js +32 -0
- package/dist/components/TagsAndEntities/TagsAndEntities.esm.js.map +1 -0
- package/dist/components/TagsGrid/EditTagModal.esm.js +73 -0
- package/dist/components/TagsGrid/EditTagModal.esm.js.map +1 -0
- package/dist/components/TagsGrid/TagGridItem.esm.js +56 -0
- package/dist/components/TagsGrid/TagGridItem.esm.js.map +1 -0
- package/dist/components/TagsGrid/TagsGrid.esm.js +45 -0
- package/dist/components/TagsGrid/TagsGrid.esm.js.map +1 -0
- package/dist/components/TopRankingUsersCard/TopRankingUsersCard.esm.js +161 -0
- package/dist/components/TopRankingUsersCard/TopRankingUsersCard.esm.js.map +1 -0
- package/dist/components/TopRankingUsersCard/TrophyIcon.esm.js +19 -0
- package/dist/components/TopRankingUsersCard/TrophyIcon.esm.js.map +1 -0
- package/dist/components/TopRankingUsersCard/styles.esm.js +23 -0
- package/dist/components/TopRankingUsersCard/styles.esm.js.map +1 -0
- package/dist/components/UsersGrid/UsersGrid.esm.js +43 -0
- package/dist/components/UsersGrid/UsersGrid.esm.js.map +1 -0
- package/dist/components/UsersGrid/UsersGridItem.esm.js +66 -0
- package/dist/components/UsersGrid/UsersGridItem.esm.js.map +1 -0
- package/dist/index.d.ts +568 -1
- package/dist/index.esm.js +45 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/routes.esm.js +56 -1
- package/dist/routes.esm.js.map +1 -1
- package/dist/translation.esm.js +470 -0
- package/dist/translation.esm.js.map +1 -0
- package/dist/utils/hooks.esm.js +734 -0
- package/dist/utils/hooks.esm.js.map +1 -0
- package/dist/utils/utils.esm.js +93 -0
- package/dist/utils/utils.esm.js.map +1 -0
- package/package.json +32 -5
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LinkButton } from '@backstage/core-components';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useStyles, useTranslation } from '../../utils/hooks.esm.js';
|
|
4
|
+
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
5
|
+
import { entityRouteRef } from '@backstage/plugin-catalog-react';
|
|
6
|
+
import { parseEntityRef } from '@backstage/catalog-model';
|
|
7
|
+
import { useSearchParams } from 'react-router-dom';
|
|
8
|
+
import ChevronLeft from '@material-ui/icons/ChevronLeft';
|
|
9
|
+
import { articlesRouteRef } from '../../routes.esm.js';
|
|
10
|
+
|
|
11
|
+
const BackToArticlesButton = (props) => {
|
|
12
|
+
const styles = useStyles();
|
|
13
|
+
const entityRoute = useRouteRef(entityRouteRef);
|
|
14
|
+
const articlesRoute = useRouteRef(articlesRouteRef);
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
let to = articlesRoute();
|
|
17
|
+
const [searchParams] = useSearchParams();
|
|
18
|
+
const entity = searchParams.get("entity");
|
|
19
|
+
if (entity) {
|
|
20
|
+
const entityRef = parseEntityRef(entity);
|
|
21
|
+
if (props.entityPage) {
|
|
22
|
+
to = `${entityRoute(entityRef)}/qeta`;
|
|
23
|
+
} else {
|
|
24
|
+
to = `${articlesRoute()}?entity=${entity}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ React.createElement(
|
|
28
|
+
LinkButton,
|
|
29
|
+
{
|
|
30
|
+
size: "small",
|
|
31
|
+
className: `${styles.marginLeft} qetaBackToArticlesBtn`,
|
|
32
|
+
to,
|
|
33
|
+
startIcon: /* @__PURE__ */ React.createElement(ChevronLeft, null)
|
|
34
|
+
},
|
|
35
|
+
t("backToQuestionsButton.title")
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { BackToArticlesButton };
|
|
40
|
+
//# sourceMappingURL=BackToArticlesButton.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackToArticlesButton.esm.js","sources":["../../../src/components/Buttons/BackToArticlesButton.tsx"],"sourcesContent":["import { LinkButton } from '@backstage/core-components';\nimport React from 'react';\nimport { useStyles, useTranslation } from '../../utils/hooks';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { useSearchParams } from 'react-router-dom';\nimport ChevronLeft from '@material-ui/icons/ChevronLeft';\nimport { articlesRouteRef } from '../../routes';\n\nexport const BackToArticlesButton = (props: { entityPage?: boolean }) => {\n const styles = useStyles();\n const entityRoute = useRouteRef(entityRouteRef);\n const articlesRoute = useRouteRef(articlesRouteRef);\n const { t } = useTranslation();\n\n let to = articlesRoute();\n const [searchParams] = useSearchParams();\n const entity = searchParams.get('entity');\n if (entity) {\n const entityRef = parseEntityRef(entity);\n if (props.entityPage) {\n to = `${entityRoute(entityRef)}/qeta`;\n } else {\n to = `${articlesRoute()}?entity=${entity}`;\n }\n }\n\n return (\n <LinkButton\n size=\"small\"\n className={`${styles.marginLeft} qetaBackToArticlesBtn`}\n to={to}\n startIcon={<ChevronLeft />}\n >\n {t('backToQuestionsButton.title')}\n </LinkButton>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAUa,MAAA,oBAAA,GAAuB,CAAC,KAAoC,KAAA;AACvE,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,WAAA,GAAc,YAAY,cAAc,CAAA,CAAA;AAC9C,EAAM,MAAA,aAAA,GAAgB,YAAY,gBAAgB,CAAA,CAAA;AAClD,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAA,IAAI,KAAK,aAAc,EAAA,CAAA;AACvB,EAAM,MAAA,CAAC,YAAY,CAAA,GAAI,eAAgB,EAAA,CAAA;AACvC,EAAM,MAAA,MAAA,GAAS,YAAa,CAAA,GAAA,CAAI,QAAQ,CAAA,CAAA;AACxC,EAAA,IAAI,MAAQ,EAAA;AACV,IAAM,MAAA,SAAA,GAAY,eAAe,MAAM,CAAA,CAAA;AACvC,IAAA,IAAI,MAAM,UAAY,EAAA;AACpB,MAAK,EAAA,GAAA,CAAA,EAAG,WAAY,CAAA,SAAS,CAAC,CAAA,KAAA,CAAA,CAAA;AAAA,KACzB,MAAA;AACL,MAAA,EAAA,GAAK,CAAG,EAAA,aAAA,EAAe,CAAA,QAAA,EAAW,MAAM,CAAA,CAAA,CAAA;AAAA,KAC1C;AAAA,GACF;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,SAAA,EAAW,CAAG,EAAA,MAAA,CAAO,UAAU,CAAA,sBAAA,CAAA;AAAA,MAC/B,EAAA;AAAA,MACA,SAAA,sCAAY,WAAY,EAAA,IAAA,CAAA;AAAA,KAAA;AAAA,IAEvB,EAAE,6BAA6B,CAAA;AAAA,GAClC,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LinkButton } from '@backstage/core-components';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useStyles, useTranslation } from '../../utils/hooks.esm.js';
|
|
4
|
+
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
5
|
+
import { collectionsRouteRef } from '../../routes.esm.js';
|
|
6
|
+
import ChevronLeft from '@material-ui/icons/ChevronLeft';
|
|
7
|
+
|
|
8
|
+
const BackToCollectionsButton = () => {
|
|
9
|
+
const styles = useStyles();
|
|
10
|
+
const collectionsRoute = useRouteRef(collectionsRouteRef);
|
|
11
|
+
const { t } = useTranslation();
|
|
12
|
+
return /* @__PURE__ */ React.createElement(
|
|
13
|
+
LinkButton,
|
|
14
|
+
{
|
|
15
|
+
size: "small",
|
|
16
|
+
className: `${styles.marginLeft} qetaBackToQuestionsBtn`,
|
|
17
|
+
to: collectionsRoute(),
|
|
18
|
+
startIcon: /* @__PURE__ */ React.createElement(ChevronLeft, null)
|
|
19
|
+
},
|
|
20
|
+
t("backToCollectionsButton.title")
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { BackToCollectionsButton };
|
|
25
|
+
//# sourceMappingURL=BackToCollectionsButton.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackToCollectionsButton.esm.js","sources":["../../../src/components/Buttons/BackToCollectionsButton.tsx"],"sourcesContent":["import { LinkButton } from '@backstage/core-components';\nimport React from 'react';\nimport { useStyles, useTranslation } from '../../utils/hooks';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { collectionsRouteRef } from '../../routes';\nimport ChevronLeft from '@material-ui/icons/ChevronLeft';\n\nexport const BackToCollectionsButton = () => {\n const styles = useStyles();\n const collectionsRoute = useRouteRef(collectionsRouteRef);\n const { t } = useTranslation();\n\n return (\n <LinkButton\n size=\"small\"\n className={`${styles.marginLeft} qetaBackToQuestionsBtn`}\n to={collectionsRoute()}\n startIcon={<ChevronLeft />}\n >\n {t('backToCollectionsButton.title')}\n </LinkButton>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAOO,MAAM,0BAA0B,MAAM;AAC3C,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,gBAAA,GAAmB,YAAY,mBAAmB,CAAA,CAAA;AACxD,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,SAAA,EAAW,CAAG,EAAA,MAAA,CAAO,UAAU,CAAA,uBAAA,CAAA;AAAA,MAC/B,IAAI,gBAAiB,EAAA;AAAA,MACrB,SAAA,sCAAY,WAAY,EAAA,IAAA,CAAA;AAAA,KAAA;AAAA,IAEvB,EAAE,+BAA+B,CAAA;AAAA,GACpC,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LinkButton } from '@backstage/core-components';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useStyles, useTranslation } from '../../utils/hooks.esm.js';
|
|
4
|
+
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
5
|
+
import { entityRouteRef } from '@backstage/plugin-catalog-react';
|
|
6
|
+
import { parseEntityRef } from '@backstage/catalog-model';
|
|
7
|
+
import { useSearchParams } from 'react-router-dom';
|
|
8
|
+
import { questionsRouteRef } from '../../routes.esm.js';
|
|
9
|
+
import ChevronLeft from '@material-ui/icons/ChevronLeft';
|
|
10
|
+
|
|
11
|
+
const BackToQuestionsButton = (props) => {
|
|
12
|
+
const styles = useStyles();
|
|
13
|
+
const entityRoute = useRouteRef(entityRouteRef);
|
|
14
|
+
const questionsRoute = useRouteRef(questionsRouteRef);
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
let to = questionsRoute();
|
|
17
|
+
const [searchParams] = useSearchParams();
|
|
18
|
+
const entity = searchParams.get("entity");
|
|
19
|
+
if (entity) {
|
|
20
|
+
const entityRef = parseEntityRef(entity);
|
|
21
|
+
if (props.entityPage) {
|
|
22
|
+
to = `${entityRoute(entityRef)}/qeta`;
|
|
23
|
+
} else {
|
|
24
|
+
to = `${questionsRoute()}?entity=${entity}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ React.createElement(
|
|
28
|
+
LinkButton,
|
|
29
|
+
{
|
|
30
|
+
size: "small",
|
|
31
|
+
className: `${styles.marginLeft} qetaBackToQuestionsBtn`,
|
|
32
|
+
to,
|
|
33
|
+
startIcon: /* @__PURE__ */ React.createElement(ChevronLeft, null)
|
|
34
|
+
},
|
|
35
|
+
t("backToQuestionsButton.title")
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { BackToQuestionsButton };
|
|
40
|
+
//# sourceMappingURL=BackToQuestionsButton.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackToQuestionsButton.esm.js","sources":["../../../src/components/Buttons/BackToQuestionsButton.tsx"],"sourcesContent":["import { LinkButton } from '@backstage/core-components';\nimport React from 'react';\nimport { useStyles, useTranslation } from '../../utils/hooks';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { useSearchParams } from 'react-router-dom';\nimport { questionsRouteRef } from '../../routes';\nimport ChevronLeft from '@material-ui/icons/ChevronLeft';\n\nexport const BackToQuestionsButton = (props: { entityPage?: boolean }) => {\n const styles = useStyles();\n const entityRoute = useRouteRef(entityRouteRef);\n const questionsRoute = useRouteRef(questionsRouteRef);\n const { t } = useTranslation();\n\n let to = questionsRoute();\n const [searchParams] = useSearchParams();\n const entity = searchParams.get('entity');\n if (entity) {\n const entityRef = parseEntityRef(entity);\n if (props.entityPage) {\n to = `${entityRoute(entityRef)}/qeta`;\n } else {\n to = `${questionsRoute()}?entity=${entity}`;\n }\n }\n\n return (\n <LinkButton\n size=\"small\"\n className={`${styles.marginLeft} qetaBackToQuestionsBtn`}\n to={to}\n startIcon={<ChevronLeft />}\n >\n {t('backToQuestionsButton.title')}\n </LinkButton>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAUa,MAAA,qBAAA,GAAwB,CAAC,KAAoC,KAAA;AACxE,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,WAAA,GAAc,YAAY,cAAc,CAAA,CAAA;AAC9C,EAAM,MAAA,cAAA,GAAiB,YAAY,iBAAiB,CAAA,CAAA;AACpD,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAA,IAAI,KAAK,cAAe,EAAA,CAAA;AACxB,EAAM,MAAA,CAAC,YAAY,CAAA,GAAI,eAAgB,EAAA,CAAA;AACvC,EAAM,MAAA,MAAA,GAAS,YAAa,CAAA,GAAA,CAAI,QAAQ,CAAA,CAAA;AACxC,EAAA,IAAI,MAAQ,EAAA;AACV,IAAM,MAAA,SAAA,GAAY,eAAe,MAAM,CAAA,CAAA;AACvC,IAAA,IAAI,MAAM,UAAY,EAAA;AACpB,MAAK,EAAA,GAAA,CAAA,EAAG,WAAY,CAAA,SAAS,CAAC,CAAA,KAAA,CAAA,CAAA;AAAA,KACzB,MAAA;AACL,MAAA,EAAA,GAAK,CAAG,EAAA,cAAA,EAAgB,CAAA,QAAA,EAAW,MAAM,CAAA,CAAA,CAAA;AAAA,KAC3C;AAAA,GACF;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,SAAA,EAAW,CAAG,EAAA,MAAA,CAAO,UAAU,CAAA,uBAAA,CAAA;AAAA,MAC/B,EAAA;AAAA,MACA,SAAA,sCAAY,WAAY,EAAA,IAAA,CAAA;AAAA,KAAA;AAAA,IAEvB,EAAE,6BAA6B,CAAA;AAAA,GAClC,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import PlayListAddIcon from '@material-ui/icons/PlaylistAdd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
4
|
+
import { qetaCreatePostPermission } from '@drodil/backstage-plugin-qeta-common';
|
|
5
|
+
import { LinkButton } from '@backstage/core-components';
|
|
6
|
+
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
7
|
+
import { collectionCreateRouteRef } from '../../routes.esm.js';
|
|
8
|
+
import { useTranslation, useStyles } from '../../utils/hooks.esm.js';
|
|
9
|
+
|
|
10
|
+
const CreateCollectionButton = () => {
|
|
11
|
+
const createRoute = useRouteRef(collectionCreateRouteRef);
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const styles = useStyles();
|
|
14
|
+
return /* @__PURE__ */ React.createElement(RequirePermission, { permission: qetaCreatePostPermission, errorPage: /* @__PURE__ */ React.createElement(React.Fragment, null) }, /* @__PURE__ */ React.createElement(
|
|
15
|
+
LinkButton,
|
|
16
|
+
{
|
|
17
|
+
size: "small",
|
|
18
|
+
variant: "contained",
|
|
19
|
+
to: createRoute(),
|
|
20
|
+
color: "primary",
|
|
21
|
+
className: `${styles.marginLeft} qetaCreateCollectionBtn`,
|
|
22
|
+
startIcon: /* @__PURE__ */ React.createElement(PlayListAddIcon, null)
|
|
23
|
+
},
|
|
24
|
+
t("createCollectionButton.title")
|
|
25
|
+
));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { CreateCollectionButton };
|
|
29
|
+
//# sourceMappingURL=CreateCollectionButton.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateCollectionButton.esm.js","sources":["../../../src/components/Buttons/CreateCollectionButton.tsx"],"sourcesContent":["import PlayListAddIcon from '@material-ui/icons/PlaylistAdd';\nimport React from 'react';\nimport { RequirePermission } from '@backstage/plugin-permission-react';\nimport { qetaCreatePostPermission } from '@drodil/backstage-plugin-qeta-common';\nimport { LinkButton } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { collectionCreateRouteRef } from '../../routes';\nimport { useStyles, useTranslation } from '../../utils/hooks';\n\nexport const CreateCollectionButton = () => {\n const createRoute = useRouteRef(collectionCreateRouteRef);\n const { t } = useTranslation();\n const styles = useStyles();\n\n return (\n <RequirePermission permission={qetaCreatePostPermission} errorPage={<></>}>\n <LinkButton\n size=\"small\"\n variant=\"contained\"\n to={createRoute()}\n color=\"primary\"\n className={`${styles.marginLeft} qetaCreateCollectionBtn`}\n startIcon={<PlayListAddIcon />}\n >\n {t('createCollectionButton.title')}\n </LinkButton>\n </RequirePermission>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AASO,MAAM,yBAAyB,MAAM;AAC1C,EAAM,MAAA,WAAA,GAAc,YAAY,wBAAwB,CAAA,CAAA;AACxD,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AAEzB,EAAA,2CACG,iBAAkB,EAAA,EAAA,UAAA,EAAY,wBAA0B,EAAA,SAAA,0DAAa,CACpE,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,OAAQ,EAAA,WAAA;AAAA,MACR,IAAI,WAAY,EAAA;AAAA,MAChB,KAAM,EAAA,SAAA;AAAA,MACN,SAAA,EAAW,CAAG,EAAA,MAAA,CAAO,UAAU,CAAA,wBAAA,CAAA;AAAA,MAC/B,SAAA,sCAAY,eAAgB,EAAA,IAAA,CAAA;AAAA,KAAA;AAAA,IAE3B,EAAE,8BAA8B,CAAA;AAAA,GAErC,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useStyles, useTranslation, useEntityFollow } from '../../utils/hooks.esm.js';
|
|
3
|
+
import { Tooltip, Button } from '@material-ui/core';
|
|
4
|
+
import Visibility from '@material-ui/icons/Visibility';
|
|
5
|
+
import VisibilityOff from '@material-ui/icons/VisibilityOff';
|
|
6
|
+
|
|
7
|
+
const EntityFollowButton = (props) => {
|
|
8
|
+
const { entityRef } = props;
|
|
9
|
+
const styles = useStyles();
|
|
10
|
+
const { t } = useTranslation();
|
|
11
|
+
const entities = useEntityFollow();
|
|
12
|
+
if (entities.loading) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ React.createElement(Tooltip, { title: t("entityButton.tooltip") }, /* @__PURE__ */ React.createElement(
|
|
16
|
+
Button,
|
|
17
|
+
{
|
|
18
|
+
size: "small",
|
|
19
|
+
className: `${styles.marginLeft} qetaFollowEntityBtn`,
|
|
20
|
+
color: entities.isFollowingEntity(entityRef) ? "secondary" : "primary",
|
|
21
|
+
onClick: () => {
|
|
22
|
+
if (entities.isFollowingEntity(entityRef)) {
|
|
23
|
+
entities.unfollowEntity(entityRef);
|
|
24
|
+
} else {
|
|
25
|
+
entities.followEntity(entityRef);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
entities.isFollowingEntity(entityRef) ? /* @__PURE__ */ React.createElement(VisibilityOff, null) : /* @__PURE__ */ React.createElement(Visibility, null)
|
|
30
|
+
));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { EntityFollowButton };
|
|
34
|
+
//# sourceMappingURL=EntityFollowButton.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityFollowButton.esm.js","sources":["../../../src/components/Buttons/EntityFollowButton.tsx"],"sourcesContent":["import React from 'react';\nimport { useEntityFollow, useStyles, useTranslation } from '../../utils/hooks';\nimport { Button, Tooltip } from '@material-ui/core';\nimport Visibility from '@material-ui/icons/Visibility';\nimport VisibilityOff from '@material-ui/icons/VisibilityOff';\n\nexport const EntityFollowButton = (props: { entityRef: string }) => {\n const { entityRef } = props;\n const styles = useStyles();\n const { t } = useTranslation();\n const entities = useEntityFollow();\n if (entities.loading) {\n return null;\n }\n\n return (\n <Tooltip title={t('entityButton.tooltip')}>\n <Button\n size=\"small\"\n className={`${styles.marginLeft} qetaFollowEntityBtn`}\n color={entities.isFollowingEntity(entityRef) ? 'secondary' : 'primary'}\n onClick={() => {\n if (entities.isFollowingEntity(entityRef)) {\n entities.unfollowEntity(entityRef);\n } else {\n entities.followEntity(entityRef);\n }\n }}\n >\n {entities.isFollowingEntity(entityRef) ? (\n <VisibilityOff />\n ) : (\n <Visibility />\n )}\n </Button>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;AAMa,MAAA,kBAAA,GAAqB,CAAC,KAAiC,KAAA;AAClE,EAAM,MAAA,EAAE,WAAc,GAAA,KAAA,CAAA;AACtB,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,MAAM,WAAW,eAAgB,EAAA,CAAA;AACjC,EAAA,IAAI,SAAS,OAAS,EAAA;AACpB,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAEA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,KAAO,EAAA,CAAA,CAAE,sBAAsB,CACtC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,SAAA,EAAW,CAAG,EAAA,MAAA,CAAO,UAAU,CAAA,oBAAA,CAAA;AAAA,MAC/B,KAAO,EAAA,QAAA,CAAS,iBAAkB,CAAA,SAAS,IAAI,WAAc,GAAA,SAAA;AAAA,MAC7D,SAAS,MAAM;AACb,QAAI,IAAA,QAAA,CAAS,iBAAkB,CAAA,SAAS,CAAG,EAAA;AACzC,UAAA,QAAA,CAAS,eAAe,SAAS,CAAA,CAAA;AAAA,SAC5B,MAAA;AACL,UAAA,QAAA,CAAS,aAAa,SAAS,CAAA,CAAA;AAAA,SACjC;AAAA,OACF;AAAA,KAAA;AAAA,IAEC,QAAA,CAAS,kBAAkB,SAAS,CAAA,uCAClC,aAAc,EAAA,IAAA,CAAA,uCAEd,UAAW,EAAA,IAAA,CAAA;AAAA,GAGlB,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Tooltip, IconButton } from '@material-ui/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
4
|
+
import StarIcon from '@material-ui/icons/Star';
|
|
5
|
+
import StarOutlineIcon from '@material-ui/icons/StarOutline';
|
|
6
|
+
import { qetaApiRef } from '../../api.esm.js';
|
|
7
|
+
import { useTranslation } from '../../utils/hooks.esm.js';
|
|
8
|
+
|
|
9
|
+
const FavoriteButton = (props) => {
|
|
10
|
+
const [entity, setEntity] = React.useState(props.entity);
|
|
11
|
+
const qetaApi = useApi(qetaApiRef);
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const favoriteQuestion = () => {
|
|
14
|
+
qetaApi.favoritePost(entity.id).then((response) => {
|
|
15
|
+
setEntity(response);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const unfavoriteQuestion = () => {
|
|
19
|
+
qetaApi.unfavoritePost(entity.id).then((response) => {
|
|
20
|
+
setEntity(response);
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, entity.favorite ? /* @__PURE__ */ React.createElement(Tooltip, { title: t("favorite.remove") }, /* @__PURE__ */ React.createElement(
|
|
24
|
+
IconButton,
|
|
25
|
+
{
|
|
26
|
+
"aria-label": "unfavorite",
|
|
27
|
+
size: "small",
|
|
28
|
+
onClick: unfavoriteQuestion,
|
|
29
|
+
className: "qetaUnfavoriteBtn"
|
|
30
|
+
},
|
|
31
|
+
/* @__PURE__ */ React.createElement(StarIcon, null)
|
|
32
|
+
)) : /* @__PURE__ */ React.createElement(Tooltip, { title: t("favorite.add") }, /* @__PURE__ */ React.createElement(
|
|
33
|
+
IconButton,
|
|
34
|
+
{
|
|
35
|
+
"aria-label": "favorite",
|
|
36
|
+
size: "small",
|
|
37
|
+
onClick: favoriteQuestion,
|
|
38
|
+
className: "qetaFavoriteBtn"
|
|
39
|
+
},
|
|
40
|
+
/* @__PURE__ */ React.createElement(StarOutlineIcon, null)
|
|
41
|
+
)));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { FavoriteButton };
|
|
45
|
+
//# sourceMappingURL=FavoriteButton.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FavoriteButton.esm.js","sources":["../../../src/components/Buttons/FavoriteButton.tsx"],"sourcesContent":["import { PostResponse } from '@drodil/backstage-plugin-qeta-common';\nimport { IconButton, Tooltip } from '@material-ui/core';\nimport React from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport StarIcon from '@material-ui/icons/Star';\nimport StarOutlineIcon from '@material-ui/icons/StarOutline';\nimport { qetaApiRef } from '../../api';\nimport { useTranslation } from '../../utils';\n\nexport const FavoriteButton = (props: { entity: PostResponse }) => {\n const [entity, setEntity] = React.useState<PostResponse>(props.entity);\n const qetaApi = useApi(qetaApiRef);\n const { t } = useTranslation();\n\n const favoriteQuestion = () => {\n qetaApi.favoritePost(entity.id).then(response => {\n setEntity(response);\n });\n };\n\n const unfavoriteQuestion = () => {\n qetaApi.unfavoritePost(entity.id).then(response => {\n setEntity(response);\n });\n };\n\n return (\n <React.Fragment>\n {entity.favorite ? (\n <Tooltip title={t('favorite.remove')}>\n <IconButton\n aria-label=\"unfavorite\"\n size=\"small\"\n onClick={unfavoriteQuestion}\n className=\"qetaUnfavoriteBtn\"\n >\n <StarIcon />\n </IconButton>\n </Tooltip>\n ) : (\n <Tooltip title={t('favorite.add')}>\n <IconButton\n aria-label=\"favorite\"\n size=\"small\"\n onClick={favoriteQuestion}\n className=\"qetaFavoriteBtn\"\n >\n <StarOutlineIcon />\n </IconButton>\n </Tooltip>\n )}\n </React.Fragment>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AASa,MAAA,cAAA,GAAiB,CAAC,KAAoC,KAAA;AACjE,EAAA,MAAM,CAAC,MAAQ,EAAA,SAAS,IAAI,KAAM,CAAA,QAAA,CAAuB,MAAM,MAAM,CAAA,CAAA;AACrE,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA,CAAA;AACjC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAA,MAAM,mBAAmB,MAAM;AAC7B,IAAA,OAAA,CAAQ,YAAa,CAAA,MAAA,CAAO,EAAE,CAAA,CAAE,KAAK,CAAY,QAAA,KAAA;AAC/C,MAAA,SAAA,CAAU,QAAQ,CAAA,CAAA;AAAA,KACnB,CAAA,CAAA;AAAA,GACH,CAAA;AAEA,EAAA,MAAM,qBAAqB,MAAM;AAC/B,IAAA,OAAA,CAAQ,cAAe,CAAA,MAAA,CAAO,EAAE,CAAA,CAAE,KAAK,CAAY,QAAA,KAAA;AACjD,MAAA,SAAA,CAAU,QAAQ,CAAA,CAAA;AAAA,KACnB,CAAA,CAAA;AAAA,GACH,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,CAAA,QAAA,EAAN,IACE,EAAA,MAAA,CAAO,QACN,mBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,KAAA,EAAO,CAAE,CAAA,iBAAiB,CACjC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAW,EAAA,YAAA;AAAA,MACX,IAAK,EAAA,OAAA;AAAA,MACL,OAAS,EAAA,kBAAA;AAAA,MACT,SAAU,EAAA,mBAAA;AAAA,KAAA;AAAA,wCAET,QAAS,EAAA,IAAA,CAAA;AAAA,GAEd,CAEA,mBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,KAAO,EAAA,CAAA,CAAE,cAAc,CAC9B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAW,EAAA,UAAA;AAAA,MACX,IAAK,EAAA,OAAA;AAAA,MACL,OAAS,EAAA,gBAAA;AAAA,MACT,SAAU,EAAA,iBAAA;AAAA,KAAA;AAAA,wCAET,eAAgB,EAAA,IAAA,CAAA;AAAA,GAErB,CAEJ,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Tooltip, IconButton } from '@material-ui/core';
|
|
2
|
+
import Link from '@material-ui/icons/Link';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useTranslation } from '../../utils/hooks.esm.js';
|
|
5
|
+
|
|
6
|
+
const LinkButton = (props) => {
|
|
7
|
+
const isQuestion = "title" in props.entity;
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const copyToClipboard = () => {
|
|
10
|
+
const url = new URL(window.location.href);
|
|
11
|
+
if (!isQuestion) {
|
|
12
|
+
url.hash = `#answer_${props.entity.id}`;
|
|
13
|
+
}
|
|
14
|
+
window.navigator.clipboard.writeText(url.toString());
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ React.createElement(Tooltip, { title: isQuestion ? t("link.post") : t("link.answer") }, /* @__PURE__ */ React.createElement(
|
|
17
|
+
IconButton,
|
|
18
|
+
{
|
|
19
|
+
"aria-label": t("link.aria"),
|
|
20
|
+
size: "small",
|
|
21
|
+
onClick: copyToClipboard
|
|
22
|
+
},
|
|
23
|
+
/* @__PURE__ */ React.createElement(Link, null)
|
|
24
|
+
));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { LinkButton };
|
|
28
|
+
//# sourceMappingURL=LinkButton.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkButton.esm.js","sources":["../../../src/components/Buttons/LinkButton.tsx"],"sourcesContent":["import { IconButton, Tooltip } from '@material-ui/core';\nimport Link from '@material-ui/icons/Link';\nimport React from 'react';\nimport {\n AnswerResponse,\n PostResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { useTranslation } from '../../utils';\n\nexport const LinkButton = (props: {\n entity: PostResponse | AnswerResponse;\n}) => {\n const isQuestion = 'title' in props.entity;\n const { t } = useTranslation();\n const copyToClipboard = () => {\n const url = new URL(window.location.href);\n if (!isQuestion) {\n url.hash = `#answer_${props.entity.id}`;\n }\n window.navigator.clipboard.writeText(url.toString());\n };\n\n return (\n <Tooltip title={isQuestion ? t('link.post') : t('link.answer')}>\n <IconButton\n aria-label={t('link.aria')}\n size=\"small\"\n onClick={copyToClipboard}\n >\n <Link />\n </IconButton>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;AASa,MAAA,UAAA,GAAa,CAAC,KAErB,KAAA;AACJ,EAAM,MAAA,UAAA,GAAa,WAAW,KAAM,CAAA,MAAA,CAAA;AACpC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,MAAM,kBAAkB,MAAM;AAC5B,IAAA,MAAM,GAAM,GAAA,IAAI,GAAI,CAAA,MAAA,CAAO,SAAS,IAAI,CAAA,CAAA;AACxC,IAAA,IAAI,CAAC,UAAY,EAAA;AACf,MAAA,GAAA,CAAI,IAAO,GAAA,CAAA,QAAA,EAAW,KAAM,CAAA,MAAA,CAAO,EAAE,CAAA,CAAA,CAAA;AAAA,KACvC;AACA,IAAA,MAAA,CAAO,SAAU,CAAA,SAAA,CAAU,SAAU,CAAA,GAAA,CAAI,UAAU,CAAA,CAAA;AAAA,GACrD,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,KAAO,EAAA,UAAA,GAAa,EAAE,WAAW,CAAA,GAAI,CAAE,CAAA,aAAa,CAC3D,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAA,EAAY,EAAE,WAAW,CAAA;AAAA,MACzB,IAAK,EAAA,OAAA;AAAA,MACL,OAAS,EAAA,eAAA;AAAA,KAAA;AAAA,wCAER,IAAK,EAAA,IAAA,CAAA;AAAA,GAEV,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useStyles, useTranslation, useTagsFollow } from '../../utils/hooks.esm.js';
|
|
3
|
+
import { Tooltip, IconButton } from '@material-ui/core';
|
|
4
|
+
import Visibility from '@material-ui/icons/Visibility';
|
|
5
|
+
import VisibilityOff from '@material-ui/icons/VisibilityOff';
|
|
6
|
+
|
|
7
|
+
const TagFollowButton = (props) => {
|
|
8
|
+
const { tag } = props;
|
|
9
|
+
const styles = useStyles();
|
|
10
|
+
const { t } = useTranslation();
|
|
11
|
+
const tags = useTagsFollow();
|
|
12
|
+
if (tags.loading) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ React.createElement(Tooltip, { title: t("tagButton.tooltip") }, /* @__PURE__ */ React.createElement(
|
|
16
|
+
IconButton,
|
|
17
|
+
{
|
|
18
|
+
size: "small",
|
|
19
|
+
className: `${styles.marginLeft} qetaFollowTagBtn`,
|
|
20
|
+
color: tags.isFollowingTag(tag) ? "secondary" : "primary",
|
|
21
|
+
onClick: () => {
|
|
22
|
+
if (tags.isFollowingTag(tag)) {
|
|
23
|
+
tags.unfollowTag(tag);
|
|
24
|
+
} else {
|
|
25
|
+
tags.followTag(tag);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
tags.isFollowingTag(tag) ? /* @__PURE__ */ React.createElement(VisibilityOff, null) : /* @__PURE__ */ React.createElement(Visibility, null)
|
|
30
|
+
));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { TagFollowButton };
|
|
34
|
+
//# sourceMappingURL=TagFollowButton.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TagFollowButton.esm.js","sources":["../../../src/components/Buttons/TagFollowButton.tsx"],"sourcesContent":["import React from 'react';\nimport { useStyles, useTagsFollow, useTranslation } from '../../utils/hooks';\nimport { IconButton, Tooltip } from '@material-ui/core';\nimport Visibility from '@material-ui/icons/Visibility';\nimport VisibilityOff from '@material-ui/icons/VisibilityOff';\n\nexport const TagFollowButton = (props: { tag: string }) => {\n const { tag } = props;\n const styles = useStyles();\n const { t } = useTranslation();\n const tags = useTagsFollow();\n if (tags.loading) {\n return null;\n }\n return (\n <Tooltip title={t('tagButton.tooltip')}>\n <IconButton\n size=\"small\"\n className={`${styles.marginLeft} qetaFollowTagBtn`}\n color={tags.isFollowingTag(tag) ? 'secondary' : 'primary'}\n onClick={() => {\n if (tags.isFollowingTag(tag)) {\n tags.unfollowTag(tag);\n } else {\n tags.followTag(tag);\n }\n }}\n >\n {tags.isFollowingTag(tag) ? <VisibilityOff /> : <Visibility />}\n </IconButton>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;AAMa,MAAA,eAAA,GAAkB,CAAC,KAA2B,KAAA;AACzD,EAAM,MAAA,EAAE,KAAQ,GAAA,KAAA,CAAA;AAChB,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,MAAM,OAAO,aAAc,EAAA,CAAA;AAC3B,EAAA,IAAI,KAAK,OAAS,EAAA;AAChB,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AACA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,KAAO,EAAA,CAAA,CAAE,mBAAmB,CACnC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,SAAA,EAAW,CAAG,EAAA,MAAA,CAAO,UAAU,CAAA,iBAAA,CAAA;AAAA,MAC/B,KAAO,EAAA,IAAA,CAAK,cAAe,CAAA,GAAG,IAAI,WAAc,GAAA,SAAA;AAAA,MAChD,SAAS,MAAM;AACb,QAAI,IAAA,IAAA,CAAK,cAAe,CAAA,GAAG,CAAG,EAAA;AAC5B,UAAA,IAAA,CAAK,YAAY,GAAG,CAAA,CAAA;AAAA,SACf,MAAA;AACL,UAAA,IAAA,CAAK,UAAU,GAAG,CAAA,CAAA;AAAA,SACpB;AAAA,OACF;AAAA,KAAA;AAAA,IAEC,IAAA,CAAK,eAAe,GAAG,CAAA,uCAAK,aAAc,EAAA,IAAA,CAAA,uCAAM,UAAW,EAAA,IAAA,CAAA;AAAA,GAEhE,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { makeStyles, createStyles, Tooltip, IconButton, Typography, Box } from '@material-ui/core';
|
|
2
|
+
import ArrowDownward from '@material-ui/icons/ArrowDownward';
|
|
3
|
+
import ArrowUpward from '@material-ui/icons/ArrowUpward';
|
|
4
|
+
import Check from '@material-ui/icons/Check';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { useVoting } from '../../utils/hooks.esm.js';
|
|
7
|
+
|
|
8
|
+
const useStyles = makeStyles(
|
|
9
|
+
(theme) => createStyles({
|
|
10
|
+
qetaCorrectAnswerSelected: {
|
|
11
|
+
color: theme.palette.success.main
|
|
12
|
+
},
|
|
13
|
+
qetaCorrectAnswer: {
|
|
14
|
+
color: theme.palette.grey[500]
|
|
15
|
+
},
|
|
16
|
+
voteButtonContainer: {
|
|
17
|
+
borderWidth: "1px",
|
|
18
|
+
borderColor: "white"
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
const VoteButtons = (props) => {
|
|
23
|
+
const {
|
|
24
|
+
voteUpTooltip,
|
|
25
|
+
ownVote,
|
|
26
|
+
voteUp,
|
|
27
|
+
score,
|
|
28
|
+
voteDownTooltip,
|
|
29
|
+
voteDown,
|
|
30
|
+
correctAnswer,
|
|
31
|
+
correctTooltip,
|
|
32
|
+
toggleCorrectAnswer
|
|
33
|
+
} = useVoting(props.entity);
|
|
34
|
+
const own = props.entity.own ?? false;
|
|
35
|
+
const classes = useStyles();
|
|
36
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Tooltip, { title: voteUpTooltip }, /* @__PURE__ */ React.createElement("span", { className: classes.voteButtonContainer }, /* @__PURE__ */ React.createElement(
|
|
37
|
+
IconButton,
|
|
38
|
+
{
|
|
39
|
+
"aria-label": "vote up",
|
|
40
|
+
color: ownVote > 0 ? "primary" : "default",
|
|
41
|
+
className: ownVote > 0 ? "qetaVoteUpSelected" : "qetaVoteUp",
|
|
42
|
+
disabled: own,
|
|
43
|
+
size: "small",
|
|
44
|
+
onClick: voteUp
|
|
45
|
+
},
|
|
46
|
+
/* @__PURE__ */ React.createElement(ArrowUpward, null)
|
|
47
|
+
))), /* @__PURE__ */ React.createElement(Typography, { variant: "h6" }, score), /* @__PURE__ */ React.createElement(Tooltip, { title: voteDownTooltip }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
|
|
48
|
+
IconButton,
|
|
49
|
+
{
|
|
50
|
+
"aria-label": "vote down",
|
|
51
|
+
color: ownVote < 0 ? "primary" : "default",
|
|
52
|
+
className: ownVote < 0 ? "qetaVoteDownSelected" : "qetaVoteDown",
|
|
53
|
+
disabled: own,
|
|
54
|
+
size: "small",
|
|
55
|
+
onClick: voteDown
|
|
56
|
+
},
|
|
57
|
+
/* @__PURE__ */ React.createElement(ArrowDownward, null)
|
|
58
|
+
))), "correct" in props.entity && (props.post?.own || props.post?.canEdit || correctAnswer) && /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Tooltip, { title: correctTooltip }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
|
|
59
|
+
IconButton,
|
|
60
|
+
{
|
|
61
|
+
"aria-label": "mark correct",
|
|
62
|
+
size: "small",
|
|
63
|
+
onClick: props.post?.own || props.post?.canEdit ? toggleCorrectAnswer : void 0
|
|
64
|
+
},
|
|
65
|
+
/* @__PURE__ */ React.createElement(
|
|
66
|
+
Check,
|
|
67
|
+
{
|
|
68
|
+
className: correctAnswer ? classes.qetaCorrectAnswerSelected : classes.qetaCorrectAnswer
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
)))));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { VoteButtons };
|
|
75
|
+
//# sourceMappingURL=VoteButtons.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VoteButtons.esm.js","sources":["../../../src/components/Buttons/VoteButtons.tsx"],"sourcesContent":["import {\n AnswerResponse,\n PostResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport {\n Box,\n createStyles,\n IconButton,\n makeStyles,\n Theme,\n Tooltip,\n Typography,\n} from '@material-ui/core';\nimport ArrowDownward from '@material-ui/icons/ArrowDownward';\nimport ArrowUpward from '@material-ui/icons/ArrowUpward';\nimport Check from '@material-ui/icons/Check';\nimport React from 'react';\nimport { useVoting } from '../../utils/hooks';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n qetaCorrectAnswerSelected: {\n color: theme.palette.success.main,\n },\n qetaCorrectAnswer: {\n color: theme.palette.grey[500],\n },\n voteButtonContainer: {\n borderWidth: '1px',\n borderColor: 'white',\n },\n }),\n);\n\nexport const VoteButtons = (props: {\n entity: PostResponse | AnswerResponse;\n post?: PostResponse;\n}) => {\n const {\n voteUpTooltip,\n ownVote,\n voteUp,\n score,\n voteDownTooltip,\n voteDown,\n correctAnswer,\n correctTooltip,\n toggleCorrectAnswer,\n } = useVoting(props.entity);\n const own = props.entity.own ?? false;\n const classes = useStyles();\n\n return (\n <React.Fragment>\n <Tooltip title={voteUpTooltip}>\n <span className={classes.voteButtonContainer}>\n <IconButton\n aria-label=\"vote up\"\n color={ownVote > 0 ? 'primary' : 'default'}\n className={ownVote > 0 ? 'qetaVoteUpSelected' : 'qetaVoteUp'}\n disabled={own}\n size=\"small\"\n onClick={voteUp}\n >\n <ArrowUpward />\n </IconButton>\n </span>\n </Tooltip>\n <Typography variant=\"h6\">{score}</Typography>\n <Tooltip title={voteDownTooltip}>\n <span>\n <IconButton\n aria-label=\"vote down\"\n color={ownVote < 0 ? 'primary' : 'default'}\n className={ownVote < 0 ? 'qetaVoteDownSelected' : 'qetaVoteDown'}\n disabled={own}\n size=\"small\"\n onClick={voteDown}\n >\n <ArrowDownward />\n </IconButton>\n </span>\n </Tooltip>\n {'correct' in props.entity &&\n (props.post?.own || props.post?.canEdit || correctAnswer) && (\n <Box>\n <Tooltip title={correctTooltip}>\n <span>\n <IconButton\n aria-label=\"mark correct\"\n size=\"small\"\n onClick={\n props.post?.own || props.post?.canEdit\n ? toggleCorrectAnswer\n : undefined\n }\n >\n <Check\n className={\n correctAnswer\n ? classes.qetaCorrectAnswerSelected\n : classes.qetaCorrectAnswer\n }\n />\n </IconButton>\n </span>\n </Tooltip>\n </Box>\n )}\n </React.Fragment>\n );\n};\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import CreateIcon from '@material-ui/icons/Create';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
4
|
+
import { qetaCreatePostPermission } from '@drodil/backstage-plugin-qeta-common';
|
|
5
|
+
import { LinkButton } from '@backstage/core-components';
|
|
6
|
+
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
7
|
+
import { writeRouteRef } from '../../routes.esm.js';
|
|
8
|
+
import { useTranslation, useStyles } from '../../utils/hooks.esm.js';
|
|
9
|
+
|
|
10
|
+
const WriteArticleButton = (props) => {
|
|
11
|
+
const { entity, entityPage, tags } = props;
|
|
12
|
+
const writeRoute = useRouteRef(writeRouteRef);
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const styles = useStyles();
|
|
15
|
+
const params = new URLSearchParams();
|
|
16
|
+
if (entity) {
|
|
17
|
+
params.set("entity", entity);
|
|
18
|
+
}
|
|
19
|
+
if (entityPage) {
|
|
20
|
+
params.set("entityPage", "true");
|
|
21
|
+
}
|
|
22
|
+
if (tags && tags.length > 0) {
|
|
23
|
+
params.set("tags", tags.join(","));
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ React.createElement(RequirePermission, { permission: qetaCreatePostPermission, errorPage: /* @__PURE__ */ React.createElement(React.Fragment, null) }, /* @__PURE__ */ React.createElement(
|
|
26
|
+
LinkButton,
|
|
27
|
+
{
|
|
28
|
+
size: "small",
|
|
29
|
+
variant: "contained",
|
|
30
|
+
to: entity || tags ? `${writeRoute()}?${params.toString()}` : writeRoute(),
|
|
31
|
+
color: "primary",
|
|
32
|
+
className: `${styles.marginLeft} qetaWriteArticleBtn`,
|
|
33
|
+
startIcon: /* @__PURE__ */ React.createElement(CreateIcon, null)
|
|
34
|
+
},
|
|
35
|
+
t("writeArticleButton.title")
|
|
36
|
+
));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { WriteArticleButton };
|
|
40
|
+
//# sourceMappingURL=WriteArticleButton.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WriteArticleButton.esm.js","sources":["../../../src/components/Buttons/WriteArticleButton.tsx"],"sourcesContent":["import CreateIcon from '@material-ui/icons/Create';\nimport React from 'react';\nimport { RequirePermission } from '@backstage/plugin-permission-react';\nimport { qetaCreatePostPermission } from '@drodil/backstage-plugin-qeta-common';\nimport { LinkButton } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { writeRouteRef } from '../../routes';\nimport { useStyles, useTranslation } from '../../utils/hooks';\n\nexport const WriteArticleButton = (props: {\n entity?: string;\n tags?: string[];\n entityPage?: boolean;\n}) => {\n const { entity, entityPage, tags } = props;\n const writeRoute = useRouteRef(writeRouteRef);\n const { t } = useTranslation();\n const styles = useStyles();\n\n const params = new URLSearchParams();\n if (entity) {\n params.set('entity', entity);\n }\n if (entityPage) {\n params.set('entityPage', 'true');\n }\n if (tags && tags.length > 0) {\n params.set('tags', tags.join(','));\n }\n\n return (\n <RequirePermission permission={qetaCreatePostPermission} errorPage={<></>}>\n <LinkButton\n size=\"small\"\n variant=\"contained\"\n to={\n entity || tags ? `${writeRoute()}?${params.toString()}` : writeRoute()\n }\n color=\"primary\"\n className={`${styles.marginLeft} qetaWriteArticleBtn`}\n startIcon={<CreateIcon />}\n >\n {t('writeArticleButton.title')}\n </LinkButton>\n </RequirePermission>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AASa,MAAA,kBAAA,GAAqB,CAAC,KAI7B,KAAA;AACJ,EAAA,MAAM,EAAE,MAAA,EAAQ,UAAY,EAAA,IAAA,EAAS,GAAA,KAAA,CAAA;AACrC,EAAM,MAAA,UAAA,GAAa,YAAY,aAAa,CAAA,CAAA;AAC5C,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AAEzB,EAAM,MAAA,MAAA,GAAS,IAAI,eAAgB,EAAA,CAAA;AACnC,EAAA,IAAI,MAAQ,EAAA;AACV,IAAO,MAAA,CAAA,GAAA,CAAI,UAAU,MAAM,CAAA,CAAA;AAAA,GAC7B;AACA,EAAA,IAAI,UAAY,EAAA;AACd,IAAO,MAAA,CAAA,GAAA,CAAI,cAAc,MAAM,CAAA,CAAA;AAAA,GACjC;AACA,EAAI,IAAA,IAAA,IAAQ,IAAK,CAAA,MAAA,GAAS,CAAG,EAAA;AAC3B,IAAA,MAAA,CAAO,GAAI,CAAA,MAAA,EAAQ,IAAK,CAAA,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AAAA,GACnC;AAEA,EAAA,2CACG,iBAAkB,EAAA,EAAA,UAAA,EAAY,wBAA0B,EAAA,SAAA,0DAAa,CACpE,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,OAAQ,EAAA,WAAA;AAAA,MACR,EAAA,EACE,MAAU,IAAA,IAAA,GAAO,CAAG,EAAA,UAAA,EAAY,CAAA,CAAA,EAAI,MAAO,CAAA,QAAA,EAAU,CAAA,CAAA,GAAK,UAAW,EAAA;AAAA,MAEvE,KAAM,EAAA,SAAA;AAAA,MACN,SAAA,EAAW,CAAG,EAAA,MAAA,CAAO,UAAU,CAAA,oBAAA,CAAA;AAAA,MAC/B,SAAA,sCAAY,UAAW,EAAA,IAAA,CAAA;AAAA,KAAA;AAAA,IAEtB,EAAE,0BAA0B,CAAA;AAAA,GAEjC,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { InfoCard } from '@backstage/core-components';
|
|
2
|
+
import { CardMedia, CardContent, Grid, Typography, Box, Button } from '@material-ui/core';
|
|
3
|
+
import { MarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer.esm.js';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useStyles, useTranslation } from '../../utils/hooks.esm.js';
|
|
6
|
+
import { TagsAndEntities } from '../TagsAndEntities/TagsAndEntities.esm.js';
|
|
7
|
+
import DeleteIcon from '@material-ui/icons/Delete';
|
|
8
|
+
import { DeleteModal } from '../DeleteModal/DeleteModal.esm.js';
|
|
9
|
+
import EditIcon from '@material-ui/icons/Edit';
|
|
10
|
+
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
11
|
+
import { collectionEditRouteRef } from '../../routes.esm.js';
|
|
12
|
+
|
|
13
|
+
const CollectionCard = (props) => {
|
|
14
|
+
const { collection } = props;
|
|
15
|
+
const styles = useStyles();
|
|
16
|
+
const editCollectionRoute = useRouteRef(collectionEditRouteRef);
|
|
17
|
+
const [deleteModalOpen, setDeleteModalOpen] = React.useState(false);
|
|
18
|
+
const handleDeleteModalOpen = () => setDeleteModalOpen(true);
|
|
19
|
+
const handleDeleteModalClose = () => setDeleteModalOpen(false);
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
return /* @__PURE__ */ React.createElement(InfoCard, null, collection.headerImage && /* @__PURE__ */ React.createElement(
|
|
22
|
+
CardMedia,
|
|
23
|
+
{
|
|
24
|
+
component: "img",
|
|
25
|
+
height: "200",
|
|
26
|
+
src: collection.headerImage,
|
|
27
|
+
alt: collection.title
|
|
28
|
+
}
|
|
29
|
+
), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, collection.description && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, t("collectionPage.description")), /* @__PURE__ */ React.createElement(MarkdownRenderer, { content: collection.description }))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(TagsAndEntities, { entity: collection })), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, collection.canDelete && /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(
|
|
30
|
+
Button,
|
|
31
|
+
{
|
|
32
|
+
variant: "outlined",
|
|
33
|
+
size: "small",
|
|
34
|
+
color: "secondary",
|
|
35
|
+
onClick: handleDeleteModalOpen,
|
|
36
|
+
className: `${styles.marginRight} qetaCollectionCardDeleteBtn`,
|
|
37
|
+
startIcon: /* @__PURE__ */ React.createElement(DeleteIcon, null)
|
|
38
|
+
},
|
|
39
|
+
t("deleteModal.deleteButton")
|
|
40
|
+
), /* @__PURE__ */ React.createElement(
|
|
41
|
+
DeleteModal,
|
|
42
|
+
{
|
|
43
|
+
open: deleteModalOpen,
|
|
44
|
+
onClose: handleDeleteModalClose,
|
|
45
|
+
entity: collection
|
|
46
|
+
}
|
|
47
|
+
)), collection.canEdit && /* @__PURE__ */ React.createElement(
|
|
48
|
+
Button,
|
|
49
|
+
{
|
|
50
|
+
variant: "outlined",
|
|
51
|
+
size: "small",
|
|
52
|
+
startIcon: /* @__PURE__ */ React.createElement(EditIcon, null),
|
|
53
|
+
href: editCollectionRoute({
|
|
54
|
+
id: collection.id.toString(10)
|
|
55
|
+
}),
|
|
56
|
+
className: "qetaCollectionCardEditBtn"
|
|
57
|
+
},
|
|
58
|
+
t("questionPage.editButton")
|
|
59
|
+
)))));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { CollectionCard };
|
|
63
|
+
//# sourceMappingURL=CollectionCard.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectionCard.esm.js","sources":["../../../src/components/CollectionCard/CollectionCard.tsx"],"sourcesContent":["import { Collection } from '@drodil/backstage-plugin-qeta-common';\nimport { InfoCard } from '@backstage/core-components';\nimport {\n Box,\n Button,\n CardContent,\n CardMedia,\n Grid,\n Typography,\n} from '@material-ui/core';\nimport { MarkdownRenderer } from '../MarkdownRenderer';\nimport React from 'react';\nimport { useStyles, useTranslation } from '../../utils';\nimport { TagsAndEntities } from '../TagsAndEntities/TagsAndEntities';\nimport DeleteIcon from '@material-ui/icons/Delete';\nimport { DeleteModal } from '../DeleteModal';\nimport EditIcon from '@material-ui/icons/Edit';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { collectionEditRouteRef } from '../../routes';\n\nexport const CollectionCard = (props: { collection: Collection }) => {\n const { collection } = props;\n const styles = useStyles();\n const editCollectionRoute = useRouteRef(collectionEditRouteRef);\n const [deleteModalOpen, setDeleteModalOpen] = React.useState(false);\n const handleDeleteModalOpen = () => setDeleteModalOpen(true);\n const handleDeleteModalClose = () => setDeleteModalOpen(false);\n const { t } = useTranslation();\n return (\n <InfoCard>\n {collection.headerImage && (\n <CardMedia\n component=\"img\"\n height=\"200\"\n src={collection.headerImage}\n alt={collection.title}\n />\n )}\n <CardContent>\n <Grid container>\n <Grid item xs={12}>\n {collection.description && (\n <>\n <Typography variant=\"h5\">\n {t('collectionPage.description')}\n </Typography>\n <MarkdownRenderer content={collection.description} />\n </>\n )}\n </Grid>\n <Grid item xs={12}>\n <TagsAndEntities entity={collection} />\n </Grid>\n <Grid item xs={12}>\n {collection.canDelete && (\n <Box>\n <Button\n variant=\"outlined\"\n size=\"small\"\n color=\"secondary\"\n onClick={handleDeleteModalOpen}\n className={`${styles.marginRight} qetaCollectionCardDeleteBtn`}\n startIcon={<DeleteIcon />}\n >\n {t('deleteModal.deleteButton')}\n </Button>\n <DeleteModal\n open={deleteModalOpen}\n onClose={handleDeleteModalClose}\n entity={collection}\n />\n </Box>\n )}\n {collection.canEdit && (\n <Button\n variant=\"outlined\"\n size=\"small\"\n startIcon={<EditIcon />}\n href={editCollectionRoute({\n id: collection.id.toString(10),\n })}\n className=\"qetaCollectionCardEditBtn\"\n >\n {t('questionPage.editButton')}\n </Button>\n )}\n </Grid>\n </Grid>\n </CardContent>\n </InfoCard>\n );\n};\n"],"names":[],"mappings":"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"}
|