@drodil/backstage-plugin-qeta-react 3.25.1 → 3.27.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/components/AIAnswerCard/AIAnswerCard.esm.js +10 -7
- package/dist/components/AIAnswerCard/AIAnswerCard.esm.js.map +1 -1
- package/dist/components/AnswerCard/AnswerCard.esm.js +3 -12
- package/dist/components/AnswerCard/AnswerCard.esm.js.map +1 -1
- package/dist/components/AnswerForm/AnswerForm.esm.js +3 -9
- package/dist/components/AnswerForm/AnswerForm.esm.js.map +1 -1
- package/dist/components/AnswersContainer/AnswerList.esm.js +3 -12
- package/dist/components/AnswersContainer/AnswerList.esm.js.map +1 -1
- package/dist/components/AnswersContainer/AnswerListItem.esm.js +3 -8
- package/dist/components/AnswersContainer/AnswerListItem.esm.js.map +1 -1
- package/dist/components/AnswersContainer/AnswersContainer.esm.js +3 -2
- package/dist/components/AnswersContainer/AnswersContainer.esm.js.map +1 -1
- package/dist/components/ArticleContent/ArticleButtons.esm.js +3 -11
- package/dist/components/ArticleContent/ArticleButtons.esm.js.map +1 -1
- package/dist/components/ArticleContent/ArticleContent.esm.js +3 -9
- package/dist/components/ArticleContent/ArticleContent.esm.js.map +1 -1
- package/dist/components/AuthorBox/AuthorBox.esm.js +21 -23
- package/dist/components/AuthorBox/AuthorBox.esm.js.map +1 -1
- package/dist/components/Buttons/AddToCollectionButton.esm.js +3 -2
- package/dist/components/Buttons/AddToCollectionButton.esm.js.map +1 -1
- package/dist/components/Buttons/AskQuestionButton.esm.js +3 -11
- package/dist/components/Buttons/AskQuestionButton.esm.js.map +1 -1
- package/dist/components/Buttons/CollectionFollowButton.esm.js +3 -13
- package/dist/components/Buttons/CollectionFollowButton.esm.js.map +1 -1
- package/dist/components/Buttons/CreateCollectionButton.esm.js +3 -11
- package/dist/components/Buttons/CreateCollectionButton.esm.js.map +1 -1
- package/dist/components/Buttons/EntityFollowButton.esm.js +3 -2
- package/dist/components/Buttons/EntityFollowButton.esm.js.map +1 -1
- package/dist/components/Buttons/FavoriteButton.esm.js +3 -10
- package/dist/components/Buttons/FavoriteButton.esm.js.map +1 -1
- package/dist/components/Buttons/LinkButton.esm.js +4 -13
- package/dist/components/Buttons/LinkButton.esm.js.map +1 -1
- package/dist/components/Buttons/TagFollowButton.esm.js +3 -2
- package/dist/components/Buttons/TagFollowButton.esm.js.map +1 -1
- package/dist/components/Buttons/UserFollowButton.esm.js +3 -2
- package/dist/components/Buttons/UserFollowButton.esm.js.map +1 -1
- package/dist/components/Buttons/WriteArticleButton.esm.js +3 -11
- package/dist/components/Buttons/WriteArticleButton.esm.js.map +1 -1
- package/dist/components/CollectionCard/CollectionCard.esm.js +3 -11
- package/dist/components/CollectionCard/CollectionCard.esm.js.map +1 -1
- package/dist/components/CollectionForm/CollectionForm.esm.js +6 -10
- package/dist/components/CollectionForm/CollectionForm.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/CollectionsGrid.esm.js +3 -2
- package/dist/components/CollectionsGrid/CollectionsGrid.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/CollectionsGridContent.esm.js +3 -13
- package/dist/components/CollectionsGrid/CollectionsGridContent.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js +3 -11
- package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/NoCollectionsCard.esm.js +3 -13
- package/dist/components/CollectionsGrid/NoCollectionsCard.esm.js.map +1 -1
- package/dist/components/CommentSection/CommentListItem.esm.js +5 -10
- package/dist/components/CommentSection/CommentListItem.esm.js.map +1 -1
- package/dist/components/CommentSection/CommentSection.esm.js +3 -9
- package/dist/components/CommentSection/CommentSection.esm.js.map +1 -1
- package/dist/components/DeleteModal/DeleteModal.esm.js +3 -10
- package/dist/components/DeleteModal/DeleteModal.esm.js.map +1 -1
- package/dist/components/EntitiesGrid/EntitiesGrid.esm.js +3 -2
- package/dist/components/EntitiesGrid/EntitiesGrid.esm.js.map +1 -1
- package/dist/components/EntitiesGrid/EntitiesGridContent.esm.js +3 -13
- package/dist/components/EntitiesGrid/EntitiesGridContent.esm.js.map +1 -1
- package/dist/components/EntitiesGrid/EntitiesGridItem.esm.js +3 -2
- package/dist/components/EntitiesGrid/EntitiesGridItem.esm.js.map +1 -1
- package/dist/components/EntitiesGrid/NoEntitiesCard.esm.js +3 -13
- package/dist/components/EntitiesGrid/NoEntitiesCard.esm.js.map +1 -1
- package/dist/components/FilterPanel/DateRangeFilter.esm.js +3 -12
- package/dist/components/FilterPanel/DateRangeFilter.esm.js.map +1 -1
- package/dist/components/FilterPanel/FilterPanel.esm.js +5 -11
- package/dist/components/FilterPanel/FilterPanel.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedCollectionsList.esm.js +3 -13
- package/dist/components/FollowedLists/FollowedCollectionsList.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedEntitiesList.esm.js +3 -2
- package/dist/components/FollowedLists/FollowedEntitiesList.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedTagsList.esm.js +3 -2
- package/dist/components/FollowedLists/FollowedTagsList.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedUsersList.esm.js +3 -2
- package/dist/components/FollowedLists/FollowedUsersList.esm.js.map +1 -1
- package/dist/components/HeaderImageInput/HeaderImageInput.esm.js +7 -12
- package/dist/components/HeaderImageInput/HeaderImageInput.esm.js.map +1 -1
- package/dist/components/HomePageCards/ImpactCard.esm.js +3 -2
- package/dist/components/HomePageCards/ImpactCard.esm.js.map +1 -1
- package/dist/components/HomePageCards/PostsCard.esm.js +9 -9
- package/dist/components/Icons/ExpertIcon.esm.js +20 -0
- package/dist/components/Icons/ExpertIcon.esm.js.map +1 -0
- package/dist/components/LeftMenu/LeftMenu.esm.js +3 -2
- package/dist/components/LeftMenu/LeftMenu.esm.js.map +1 -1
- package/dist/components/LeftMenu/LeftMenuButton.esm.js +3 -12
- package/dist/components/LeftMenu/LeftMenuButton.esm.js.map +1 -1
- package/dist/components/Links/Links.esm.js +0 -2
- package/dist/components/Links/Links.esm.js.map +1 -1
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js +6 -12
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js.map +1 -1
- package/dist/components/PostAnonymouslyCheckbox/PostAnonymouslyCheckbox.esm.js +3 -13
- package/dist/components/PostAnonymouslyCheckbox/PostAnonymouslyCheckbox.esm.js.map +1 -1
- package/dist/components/PostForm/EntitiesInput.esm.js +59 -27
- package/dist/components/PostForm/EntitiesInput.esm.js.map +1 -1
- package/dist/components/PostForm/PostForm.esm.js +17 -19
- package/dist/components/PostForm/PostForm.esm.js.map +1 -1
- package/dist/components/PostForm/TagInput.esm.js +39 -15
- package/dist/components/PostForm/TagInput.esm.js.map +1 -1
- package/dist/components/PostHighlightList/PostHighlightList.esm.js +3 -2
- package/dist/components/PostHighlightList/PostHighlightList.esm.js.map +1 -1
- package/dist/components/PostsContainer/NoPostsCard.esm.js +3 -12
- package/dist/components/PostsContainer/NoPostsCard.esm.js.map +1 -1
- package/dist/components/PostsContainer/PostList.esm.js +3 -12
- package/dist/components/PostsContainer/PostList.esm.js.map +1 -1
- package/dist/components/PostsContainer/PostListItem.esm.js +71 -70
- package/dist/components/PostsContainer/PostListItem.esm.js.map +1 -1
- package/dist/components/PostsContainer/PostsContainer.esm.js +9 -8
- package/dist/components/PostsContainer/PostsContainer.esm.js.map +1 -1
- package/dist/components/PostsGrid/PostsGrid.esm.js +9 -8
- package/dist/components/PostsGrid/PostsGrid.esm.js.map +1 -1
- package/dist/components/PostsGrid/PostsGridContent.esm.js +3 -12
- package/dist/components/PostsGrid/PostsGridContent.esm.js.map +1 -1
- package/dist/components/PostsGrid/PostsGridItem.esm.js +23 -25
- package/dist/components/PostsGrid/PostsGridItem.esm.js.map +1 -1
- package/dist/components/PostsTable/PostsTable.esm.js +3 -2
- package/dist/components/PostsTable/PostsTable.esm.js.map +1 -1
- package/dist/components/QetaPagination/QetaPagination.esm.js +3 -13
- package/dist/components/QetaPagination/QetaPagination.esm.js.map +1 -1
- package/dist/components/QuestionCard/QuestionCard.esm.js +36 -46
- package/dist/components/QuestionCard/QuestionCard.esm.js.map +1 -1
- package/dist/components/SelectTemplateList/SelectTemplateList.esm.js +3 -13
- package/dist/components/SelectTemplateList/SelectTemplateList.esm.js.map +1 -1
- package/dist/components/StatsChart/StatsChart.esm.js +3 -12
- package/dist/components/StatsChart/StatsChart.esm.js.map +1 -1
- package/dist/components/SuggestionsCard/SuggestionsCard.esm.js +6 -5
- package/dist/components/SuggestionsCard/SuggestionsCard.esm.js.map +1 -1
- package/dist/components/SummaryStatsGrid/SummaryStatsGrid.esm.js +3 -13
- package/dist/components/SummaryStatsGrid/SummaryStatsGrid.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/CollectionChip.esm.js +3 -10
- package/dist/components/TagsAndEntities/CollectionChip.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/EntityChip.esm.js +16 -4
- package/dist/components/TagsAndEntities/EntityChip.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/TagChip.esm.js +27 -9
- package/dist/components/TagsAndEntities/TagChip.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/UserChip.esm.js +31 -17
- package/dist/components/TagsAndEntities/UserChip.esm.js.map +1 -1
- package/dist/components/TagsGrid/CreateTagModal.esm.js +25 -12
- package/dist/components/TagsGrid/CreateTagModal.esm.js.map +1 -1
- package/dist/components/TagsGrid/EditTagModal.esm.js +50 -25
- package/dist/components/TagsGrid/EditTagModal.esm.js.map +1 -1
- package/dist/components/TagsGrid/NoTagsCard.esm.js +3 -13
- package/dist/components/TagsGrid/NoTagsCard.esm.js.map +1 -1
- package/dist/components/TagsGrid/TagGridItem.esm.js +17 -6
- package/dist/components/TagsGrid/TagGridItem.esm.js.map +1 -1
- package/dist/components/TagsGrid/TagsGrid.esm.js +10 -7
- package/dist/components/TagsGrid/TagsGrid.esm.js.map +1 -1
- package/dist/components/TagsGrid/TagsGridContent.esm.js +13 -15
- package/dist/components/TagsGrid/TagsGridContent.esm.js.map +1 -1
- package/dist/components/TemplateList/TemplateForm.esm.js +12 -2
- package/dist/components/TemplateList/TemplateForm.esm.js.map +1 -1
- package/dist/components/TemplateList/TemplateList.esm.js +3 -2
- package/dist/components/TemplateList/TemplateList.esm.js.map +1 -1
- package/dist/components/TopRankingUsersCard/TopRankingUsersCard.esm.js +3 -2
- package/dist/components/TopRankingUsersCard/TopRankingUsersCard.esm.js.map +1 -1
- package/dist/components/UsersGrid/NoUsersCard.esm.js +3 -13
- package/dist/components/UsersGrid/NoUsersCard.esm.js.map +1 -1
- package/dist/components/UsersGrid/UsersGrid.esm.js +3 -2
- package/dist/components/UsersGrid/UsersGrid.esm.js.map +1 -1
- package/dist/components/UsersGrid/UsersGridContent.esm.js +3 -13
- package/dist/components/UsersGrid/UsersGridContent.esm.js.map +1 -1
- package/dist/components/UsersGrid/UsersGridItem.esm.js +3 -2
- package/dist/components/UsersGrid/UsersGridItem.esm.js.map +1 -1
- package/dist/hooks/useEntityAuthor.esm.js +3 -2
- package/dist/hooks/useEntityAuthor.esm.js.map +1 -1
- package/dist/hooks/useVoting.esm.js +3 -2
- package/dist/hooks/useVoting.esm.js.map +1 -1
- package/dist/index.d.ts +369 -363
- package/dist/index.esm.js +1 -1
- package/dist/translation.esm.js +10 -4
- package/dist/translation.esm.js.map +1 -1
- package/dist/utils/utils.esm.js +3 -11
- package/dist/utils/utils.esm.js.map +1 -1
- package/package.json +13 -13
- package/dist/hooks/useTranslation.esm.js +0 -9
- package/dist/hooks/useTranslation.esm.js.map +0 -1
|
@@ -3,10 +3,11 @@ import { useQetaApi } from '../../hooks/useQetaApi.esm.js';
|
|
|
3
3
|
import 'react';
|
|
4
4
|
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
5
5
|
import '../../api.esm.js';
|
|
6
|
-
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
7
6
|
import '@backstage/catalog-model';
|
|
8
7
|
import 'dataloader';
|
|
9
8
|
import '@backstage/plugin-catalog-react';
|
|
9
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
10
|
+
import { qetaTranslationRef } from '../../translation.esm.js';
|
|
10
11
|
import 'react-use/lib/useAsync';
|
|
11
12
|
import '@backstage/plugin-permission-react';
|
|
12
13
|
import '@drodil/backstage-plugin-qeta-common';
|
|
@@ -28,7 +29,7 @@ const SuggestionListItem = (props) => {
|
|
|
28
29
|
};
|
|
29
30
|
const NoCorrectAnswerSuggestionItem = (props) => {
|
|
30
31
|
const { suggestion } = props;
|
|
31
|
-
const { t } =
|
|
32
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
32
33
|
const questionRoute = useRouteRef(questionRouteRef);
|
|
33
34
|
return /* @__PURE__ */ jsx(
|
|
34
35
|
SuggestionListItem,
|
|
@@ -43,7 +44,7 @@ const NoCorrectAnswerSuggestionItem = (props) => {
|
|
|
43
44
|
};
|
|
44
45
|
const NewQuestionSuggestionItem = (props) => {
|
|
45
46
|
const { suggestion } = props;
|
|
46
|
-
const { t } =
|
|
47
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
47
48
|
const questionRoute = useRouteRef(questionRouteRef);
|
|
48
49
|
return /* @__PURE__ */ jsx(
|
|
49
50
|
SuggestionListItem,
|
|
@@ -58,7 +59,7 @@ const NewQuestionSuggestionItem = (props) => {
|
|
|
58
59
|
};
|
|
59
60
|
const NewArticleSuggestionItem = (props) => {
|
|
60
61
|
const { suggestion } = props;
|
|
61
|
-
const { t } =
|
|
62
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
62
63
|
const articleRoute = useRouteRef(articleRouteRef);
|
|
63
64
|
return /* @__PURE__ */ jsx(
|
|
64
65
|
SuggestionListItem,
|
|
@@ -77,7 +78,7 @@ const suggestionTypeMap = {
|
|
|
77
78
|
newArticle: NewArticleSuggestionItem
|
|
78
79
|
};
|
|
79
80
|
const SuggestionsCard = () => {
|
|
80
|
-
const { t } =
|
|
81
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
81
82
|
const { value: response } = useQetaApi((api) => api.getSuggestions(), []);
|
|
82
83
|
const suggestions = response?.suggestions ?? [];
|
|
83
84
|
if (suggestions.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuggestionsCard.esm.js","sources":["../../../src/components/SuggestionsCard/SuggestionsCard.tsx"],"sourcesContent":["import { useQetaApi
|
|
1
|
+
{"version":3,"file":"SuggestionsCard.esm.js","sources":["../../../src/components/SuggestionsCard/SuggestionsCard.tsx"],"sourcesContent":["import { useQetaApi } from '../../hooks';\nimport { ReactNode } from 'react';\nimport {\n NewArticleSuggestion,\n NewQuestionSuggestion,\n NoCorrectAnswerSuggestion,\n SuggestionType,\n} from '@drodil/backstage-plugin-qeta-common';\nimport AssistantIcon from '@material-ui/icons/Assistant';\nimport HelpOutlinedIcon from '@material-ui/icons/HelpOutlined';\nimport CheckIcon from '@material-ui/icons/Check';\nimport CollectionsBookmarkIcon from '@material-ui/icons/CollectionsBookmark';\nimport { useNavigate } from 'react-router-dom';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { articleRouteRef, questionRouteRef } from '../../routes';\nimport {\n Card,\n CardHeader,\n List,\n ListItem,\n ListItemIcon,\n} from '@material-ui/core';\nimport { qetaTranslationRef } from '../../translation.ts';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nconst SuggestionListItem = (props: {\n children: ReactNode;\n href: string;\n icon?: ReactNode;\n}) => {\n const navigate = useNavigate();\n return (\n <ListItem button onClick={() => navigate(props.href)}>\n {props.icon && <ListItemIcon>{props.icon}</ListItemIcon>}\n {props.children}\n </ListItem>\n );\n};\n\nconst NoCorrectAnswerSuggestionItem = (props: {\n suggestion: NoCorrectAnswerSuggestion;\n}) => {\n const { suggestion } = props;\n const { t } = useTranslationRef(qetaTranslationRef);\n const questionRoute = useRouteRef(questionRouteRef);\n return (\n <SuggestionListItem\n href={questionRoute({ id: suggestion.question.id.toString(10) })}\n icon={<CheckIcon />}\n >\n {t('suggestionsCard.noCorrectAnswer', {\n title: suggestion.question.title,\n })}\n </SuggestionListItem>\n );\n};\n\nconst NewQuestionSuggestionItem = (props: {\n suggestion: NewQuestionSuggestion;\n}) => {\n const { suggestion } = props;\n const { t } = useTranslationRef(qetaTranslationRef);\n const questionRoute = useRouteRef(questionRouteRef);\n return (\n <SuggestionListItem\n href={questionRoute({ id: suggestion.question.id.toString(10) })}\n icon={<HelpOutlinedIcon />}\n >\n {t('suggestionsCard.newQuestion', {\n title: suggestion.question.title,\n })}\n </SuggestionListItem>\n );\n};\n\nconst NewArticleSuggestionItem = (props: {\n suggestion: NewArticleSuggestion;\n}) => {\n const { suggestion } = props;\n const { t } = useTranslationRef(qetaTranslationRef);\n const articleRoute = useRouteRef(articleRouteRef);\n return (\n <SuggestionListItem\n href={articleRoute({ id: suggestion.article.id.toString(10) })}\n icon={<CollectionsBookmarkIcon />}\n >\n {t('suggestionsCard.newArticle', {\n title: suggestion.article.title,\n })}\n </SuggestionListItem>\n );\n};\n\nconst suggestionTypeMap: Record<SuggestionType, any> = {\n noCorrectAnswer: NoCorrectAnswerSuggestionItem,\n newQuestion: NewQuestionSuggestionItem,\n newArticle: NewArticleSuggestionItem,\n};\n\nexport const SuggestionsCard = () => {\n const { t } = useTranslationRef(qetaTranslationRef);\n const { value: response } = useQetaApi(api => api.getSuggestions(), []);\n\n const suggestions = response?.suggestions ?? [];\n if (suggestions.length === 0) {\n return null;\n }\n\n return (\n <Card>\n <CardHeader\n style={{ paddingBottom: '8px' }}\n title={t('suggestionsCard.title')}\n avatar={<AssistantIcon />}\n titleTypographyProps={{ variant: 'h5' }}\n />\n <List>\n {suggestions.map(suggestion => {\n const SuggestionComponent = suggestionTypeMap[suggestion.type];\n return (\n <SuggestionComponent key={suggestion.id} suggestion={suggestion} />\n );\n })}\n </List>\n </Card>\n );\n};\n"],"names":["CheckIcon","HelpOutlinedIc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A,WAAA,IAAe,EAAC;AAC9C,EAAI,IAAA,WAAA,CAAY,WAAW,CAAG,EAAA;AAC5B,IAAO,OAAA,IAAA;AAAA;AAGT,EAAA,4BACG,IACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,EAAE,aAAA,EAAe,KAAM,EAAA;AAAA,QAC9B,KAAA,EAAO,EAAE,uBAAuB,CAAA;AAAA,QAChC,MAAA,sBAAS,aAAc,EAAA,EAAA,CAAA;AAAA,QACvB,oBAAA,EAAsB,EAAE,OAAA,EAAS,IAAK;AAAA;AAAA,KACxC;AAAA,oBACC,GAAA,CAAA,IAAA,EAAA,EACE,QAAY,EAAA,WAAA,CAAA,GAAA,CAAI,CAAc,UAAA,KAAA;AAC7B,MAAM,MAAA,mBAAA,GAAsB,iBAAkB,CAAA,UAAA,CAAW,IAAI,CAAA;AAC7D,MAAA,uBACG,GAAA,CAAA,mBAAA,EAAA,EAAwC,UAAf,EAAA,EAAA,UAAA,CAAW,EAA4B,CAAA;AAAA,KAEpE,CACH,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import numeral from 'numeral';
|
|
3
|
-
import '@backstage/core-plugin-api';
|
|
4
|
-
import '../../
|
|
5
|
-
import 'react-use';
|
|
6
|
-
import 'react';
|
|
7
|
-
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
8
|
-
import '@backstage/catalog-model';
|
|
9
|
-
import 'dataloader';
|
|
10
|
-
import '@backstage/plugin-catalog-react';
|
|
11
|
-
import 'react-use/lib/useAsync';
|
|
12
|
-
import '@backstage/plugin-permission-react';
|
|
13
|
-
import '@drodil/backstage-plugin-qeta-common';
|
|
14
|
-
import '@backstage/plugin-permission-common';
|
|
3
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
4
|
+
import { qetaTranslationRef } from '../../translation.esm.js';
|
|
15
5
|
import { isGlobalStat, isUserStat } from '../StatsChart/util.esm.js';
|
|
16
6
|
import { Typography, Grid, Card, CardContent } from '@material-ui/core';
|
|
17
7
|
|
|
@@ -27,7 +17,7 @@ const SummaryCard = (props) => {
|
|
|
27
17
|
};
|
|
28
18
|
const SummaryStatsGrid = (props) => {
|
|
29
19
|
const { stats } = props;
|
|
30
|
-
const { t } =
|
|
20
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
31
21
|
if (!stats.summary) {
|
|
32
22
|
return /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", children: t("stats.noStats") });
|
|
33
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SummaryStatsGrid.esm.js","sources":["../../../src/components/SummaryStatsGrid/SummaryStatsGrid.tsx"],"sourcesContent":["import {\n GlobalStat,\n StatisticsResponse,\n UserStat,\n} from '@drodil/backstage-plugin-qeta-common';\nimport numeral from 'numeral';\nimport {
|
|
1
|
+
{"version":3,"file":"SummaryStatsGrid.esm.js","sources":["../../../src/components/SummaryStatsGrid/SummaryStatsGrid.tsx"],"sourcesContent":["import {\n GlobalStat,\n StatisticsResponse,\n UserStat,\n} from '@drodil/backstage-plugin-qeta-common';\nimport numeral from 'numeral';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { qetaTranslationRef } from '../../translation.ts';\nimport { isGlobalStat, isUserStat } from '../StatsChart/util';\nimport { Card, CardContent, Grid, Typography } from '@material-ui/core';\n\nconst SummaryCard = (props: { title: string; value?: number }) => {\n const { title, value } = props;\n if (value === undefined) {\n return null;\n }\n return (\n <Card>\n <CardContent>\n <Typography variant=\"h5\">\n {value >= 1000 ? numeral(value).format('0.0 a') : value}\n <Typography variant=\"caption\" style={{ marginLeft: '1em' }}>\n {title}\n </Typography>\n </Typography>\n </CardContent>\n </Card>\n );\n};\n\nexport const SummaryStatsGrid = (props: {\n stats: StatisticsResponse<UserStat | GlobalStat>;\n}) => {\n const { stats } = props;\n const { t } = useTranslationRef(qetaTranslationRef);\n if (!stats.summary) {\n return <Typography variant=\"subtitle1\">{t('stats.noStats')}</Typography>;\n }\n\n return (\n <Grid container>\n <Grid item xs={4}>\n <SummaryCard\n title={t('stats.questions')}\n value={stats.summary.totalQuestions}\n />\n </Grid>\n <Grid item xs={4}>\n <SummaryCard\n title={t('stats.answers')}\n value={stats.summary.totalAnswers}\n />\n </Grid>\n <Grid item xs={4}>\n <SummaryCard\n title={t('stats.articles')}\n value={stats.summary.totalArticles}\n />\n </Grid>\n <Grid item xs={4}>\n <SummaryCard\n title={t('stats.comments')}\n value={stats.summary.totalComments}\n />\n </Grid>\n <Grid item xs={4}>\n <SummaryCard\n title={t('stats.views')}\n value={stats.summary.totalViews}\n />\n </Grid>\n <Grid item xs={4}>\n <SummaryCard\n title={t('stats.votes')}\n value={stats.summary.totalVotes}\n />\n </Grid>\n {isGlobalStat(stats.summary) && (\n <Grid item xs={4}>\n <SummaryCard\n title={t('stats.users')}\n value={stats.summary!.totalUsers}\n />\n </Grid>\n )}\n {isGlobalStat(stats.summary) && (\n <Grid item xs={4}>\n <SummaryCard\n title={t('stats.tags')}\n value={stats.summary!.totalTags}\n />\n </Grid>\n )}\n {isUserStat(stats.summary) && (\n <Grid item xs={4}>\n <SummaryCard\n title={t('stats.followers')}\n value={stats.summary!.totalFollowers}\n />\n </Grid>\n )}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAWA,MAAM,WAAA,GAAc,CAAC,KAA6C,KAAA;AAChE,EAAM,MAAA,EAAE,KAAO,EAAA,KAAA,EAAU,GAAA,KAAA;AACzB,EAAA,IAAI,UAAU,KAAW,CAAA,EAAA;AACvB,IAAO,OAAA,IAAA;AAAA;AAET,EAAA,2BACG,IACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,eACC,QAAC,kBAAA,IAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,IACjB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A,CAAA;AAAA,IAED,YAAA,CAAa,MAAM,OAAO,CAAA,wBACxB,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,CACb,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,EAAE,YAAY,CAAA;AAAA,QACrB,KAAA,EAAO,MAAM,OAAS,CAAA;AAAA;AAAA,KAE1B,EAAA,CAAA;AAAA,IAED,UAAA,CAAW,MAAM,OAAO,CAAA,wBACtB,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,CACb,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,EAAE,iBAAiB,CAAA;AAAA,QAC1B,KAAA,EAAO,MAAM,OAAS,CAAA;AAAA;AAAA,KAE1B,EAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -5,23 +5,16 @@ import { collectionRouteRef } from '../../routes.esm.js';
|
|
|
5
5
|
import { qetaApiRef } from '../../api.esm.js';
|
|
6
6
|
import { useNavigate } from 'react-router-dom';
|
|
7
7
|
import { MarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer.esm.js';
|
|
8
|
-
import '
|
|
9
|
-
import {
|
|
10
|
-
import '@backstage/catalog-model';
|
|
11
|
-
import 'dataloader';
|
|
12
|
-
import '@backstage/plugin-catalog-react';
|
|
13
|
-
import 'react-use/lib/useAsync';
|
|
8
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
9
|
+
import { qetaTranslationRef } from '../../translation.esm.js';
|
|
14
10
|
import { useCollectionsFollow } from '../../hooks/useCollectionsFollow.esm.js';
|
|
15
|
-
import '@backstage/plugin-permission-react';
|
|
16
|
-
import '@drodil/backstage-plugin-qeta-common';
|
|
17
|
-
import '@backstage/plugin-permission-common';
|
|
18
11
|
import { Tooltip, Chip, Grid, Typography, Button } from '@material-ui/core';
|
|
19
12
|
|
|
20
13
|
const cache = /* @__PURE__ */ new Map();
|
|
21
14
|
const CollectionTooltip = (props) => {
|
|
22
15
|
const { collectionId } = props;
|
|
23
16
|
const qetaApi = useApi(qetaApiRef);
|
|
24
|
-
const { t } =
|
|
17
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
25
18
|
const collections = useCollectionsFollow();
|
|
26
19
|
const [resp, setResp] = useState();
|
|
27
20
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionChip.esm.js","sources":["../../../src/components/TagsAndEntities/CollectionChip.tsx"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { collectionRouteRef } from '../../routes';\nimport { qetaApiRef } from '../../api';\nimport { Collection } from '@drodil/backstage-plugin-qeta-common';\nimport { useNavigate } from 'react-router-dom';\nimport { MarkdownRenderer } from '../MarkdownRenderer';\nimport {
|
|
1
|
+
{"version":3,"file":"CollectionChip.esm.js","sources":["../../../src/components/TagsAndEntities/CollectionChip.tsx"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { collectionRouteRef } from '../../routes';\nimport { qetaApiRef } from '../../api';\nimport { Collection } from '@drodil/backstage-plugin-qeta-common';\nimport { useNavigate } from 'react-router-dom';\nimport { MarkdownRenderer } from '../MarkdownRenderer';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { qetaTranslationRef } from '../../translation.ts';\nimport { useCollectionsFollow } from '../../hooks/useCollectionsFollow';\nimport { Button, Chip, Grid, Tooltip, Typography } from '@material-ui/core';\n\nconst cache: Map<number, Collection> = new Map();\n\nconst CollectionTooltip = (props: { collectionId: number }) => {\n const { collectionId } = props;\n const qetaApi = useApi(qetaApiRef);\n const { t } = useTranslationRef(qetaTranslationRef);\n const collections = useCollectionsFollow();\n const [resp, setResp] = useState<undefined | Collection>();\n\n useEffect(() => {\n if (cache.has(collectionId)) {\n setResp(cache.get(collectionId));\n return;\n }\n\n qetaApi.getCollection(collectionId).then(res => {\n if (res) {\n cache.set(collectionId, res);\n setResp(res);\n }\n });\n }, [qetaApi, collectionId]);\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 <Typography variant=\"h6\">{resp.title}</Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n {t('common.posts', {\n count: resp.posts?.length ?? 0,\n itemType: 'post',\n })}\n {' · '}\n {t('common.followers', { count: resp.followers })}\n </Typography>\n </Grid>\n {resp.description && (\n <Grid item xs={12}>\n <MarkdownRenderer content={resp.description} />\n </Grid>\n )}\n {!collections.loading && (\n <Grid item xs={12}>\n <Button\n size=\"small\"\n variant=\"outlined\"\n color={\n collections.isFollowingCollection(resp) ? 'secondary' : 'primary'\n }\n onClick={() => {\n if (collections.isFollowingCollection(resp)) {\n collections.unfollowCollection(resp);\n } else {\n collections.followCollection(resp);\n }\n }}\n >\n {collections.isFollowingCollection(resp)\n ? t('collectionButton.unfollow')\n : t('collectionButton.follow')}\n </Button>\n </Grid>\n )}\n </Grid>\n );\n};\n\nexport const CollectionChip = (props: { collection: Collection }) => {\n const collectionRoute = useRouteRef(collectionRouteRef);\n const navigate = useNavigate();\n const { collection } = props;\n return (\n <Tooltip\n arrow\n title={<CollectionTooltip collectionId={collection.id} />}\n enterDelay={400}\n >\n <Chip\n label={collection.title}\n size=\"small\"\n className=\"qetaCollectionChip\"\n component=\"a\"\n onClick={() => {\n navigate(collectionRoute({ id: collection.id.toString(10) }));\n }}\n clickable\n />\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAYA,MAAM,KAAA,uBAAqC,GAAI,EAAA;AAE/C,MAAM,iBAAA,GAAoB,CAAC,KAAoC,KAAA;AAC7D,EAAM,MAAA,EAAE,cAAiB,GAAA,KAAA;AACzB,EAAM,MAA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B,YAAY,kBAAkB,CAAA;AACtD,EAAA,MAAM,WAAW,WAAY,EAAA;AAC7B,EAAM,MAAA,EAAE,YAAe,GAAA,KAAA;AACvB,EACE,uBAAA,GAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,KAAK,EAAA,IAAA;AAAA,MACL,KAAO,kBAAA,GAAA,CAAC,iBAAkB,EAAA,EAAA,YAAA,EAAc,WAAW,EAAI,EAAA,CAAA;AAAA,MACvD,UAAY,EAAA,GAAA;AAAA,MAEZ,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,OAAO,UAAW,CAAA,KAAA;AAAA,UAClB,IAAK,EAAA,OAAA;AAAA,UACL,SAAU,EAAA,oBAAA;AAAA,UACV,SAAU,EAAA,GAAA;AAAA,UACV,SAAS,MAAM;AACb,YAAS,QAAA,CAAA,eAAA,CAAgB,EAAE,EAAI,EAAA,UAAA,CAAW,GAAG,QAAS,CAAA,EAAE,CAAE,EAAC,CAAC,CAAA;AAAA,WAC9D;AAAA,UACA,SAAS,EAAA;AAAA;AAAA;AACX;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -6,9 +6,10 @@ import { useEntityPresentation } from '@backstage/plugin-catalog-react';
|
|
|
6
6
|
import { entityRouteRef } from '../../routes.esm.js';
|
|
7
7
|
import { qetaApiRef } from '../../api.esm.js';
|
|
8
8
|
import 'react-use';
|
|
9
|
-
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
10
9
|
import { useEntityFollow } from '../../hooks/useEntityFollow.esm.js';
|
|
11
10
|
import 'dataloader';
|
|
11
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
12
|
+
import { qetaTranslationRef } from '../../translation.esm.js';
|
|
12
13
|
import 'react-use/lib/useAsync';
|
|
13
14
|
import '@backstage/plugin-permission-react';
|
|
14
15
|
import '@drodil/backstage-plugin-qeta-common';
|
|
@@ -24,7 +25,7 @@ const EntityTooltip = (props) => {
|
|
|
24
25
|
const entityRef = typeof entity === "string" ? entity : stringifyEntityRef(entity);
|
|
25
26
|
const qetaApi = useApi(qetaApiRef);
|
|
26
27
|
const { primaryTitle, secondaryTitle, Icon } = useEntityPresentation(entity);
|
|
27
|
-
const { t } =
|
|
28
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
28
29
|
const entitiesFollow = useEntityFollow();
|
|
29
30
|
const [resp, setResp] = useState();
|
|
30
31
|
useEffect(() => {
|
|
@@ -46,9 +47,20 @@ const EntityTooltip = (props) => {
|
|
|
46
47
|
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
|
|
47
48
|
/* @__PURE__ */ jsxs(Box, { style: { display: "flex", alignItems: "center" }, children: [
|
|
48
49
|
Icon ? /* @__PURE__ */ jsx(Icon, { fontSize: "small" }) : null,
|
|
49
|
-
/* @__PURE__ */ jsx(
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
Typography,
|
|
52
|
+
{
|
|
53
|
+
variant: "subtitle1",
|
|
54
|
+
style: {
|
|
55
|
+
textOverflow: "ellipsis",
|
|
56
|
+
overflow: "hidden",
|
|
57
|
+
whiteSpace: "nowrap"
|
|
58
|
+
},
|
|
59
|
+
children: primaryTitle
|
|
60
|
+
}
|
|
61
|
+
)
|
|
50
62
|
] }),
|
|
51
|
-
/* @__PURE__ */ jsx(Typography, { variant: "
|
|
63
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: secondaryTitle })
|
|
52
64
|
] }),
|
|
53
65
|
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
|
|
54
66
|
t("common.posts", { count: resp.postsCount, itemType: "post" }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityChip.esm.js","sources":["../../../src/components/TagsAndEntities/EntityChip.tsx"],"sourcesContent":["import { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport {
|
|
1
|
+
{"version":3,"file":"EntityChip.esm.js","sources":["../../../src/components/TagsAndEntities/EntityChip.tsx"],"sourcesContent":["import { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useEffect, useState } 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 } 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';\nimport { qetaTranslationRef } from '../../translation.ts';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\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 } = useTranslationRef(qetaTranslationRef);\n const entitiesFollow = useEntityFollow();\n const [resp, setResp] = 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\n variant=\"subtitle1\"\n style={{\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n }}\n >\n {primaryTitle}\n </Typography>\n </Box>\n <Typography variant=\"subtitle2\">{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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,KAAA,uBAAyC,GAAI,EAAA;AAEnD,MAAM,aAAA,GAAgB,CAAC,KA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AA,EAAS,SAAQ,CAAK,GAAA,KAAA,CAAA;AAAA,UACzC,OAAQ,EAAA,UAAA;AAAA,UACR,SAAU,EAAA,gBAAA;AAAA,UACV,SAAU,EAAA,GAAA;AAAA,UACV,MAAM,KAAM,CAAA,OAAA,GAAU,YAAY,EAAE,SAAA,EAAW,CAAI,GAAA,KAAA,CAAA;AAAA,UACnD,MAAA,EAAQ,KAAM,CAAA,OAAA,GAAU,QAAW,GAAA,KAAA,CAAA;AAAA,UACnC,OACE,EAAA,CAAC,KAAM,CAAA,OAAA,GACH,MAAM;AACJ,YAAA,QAAA,CAAS,WAAY,CAAA,EAAE,SAAU,EAAC,CAAC,CAAA;AAAA,WAErC,GAAA,KAAA,CAAA;AAAA,UAEN,SAAS,EAAA;AAAA;AAAA;AACX;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -7,23 +7,25 @@ import { useNavigate } from 'react-router-dom';
|
|
|
7
7
|
import { MarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer.esm.js';
|
|
8
8
|
import 'react-use';
|
|
9
9
|
import { useTagsFollow } from '../../hooks/useTagsFollow.esm.js';
|
|
10
|
-
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
11
10
|
import '@backstage/catalog-model';
|
|
12
11
|
import 'dataloader';
|
|
13
12
|
import '@backstage/plugin-catalog-react';
|
|
13
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
14
|
+
import { qetaTranslationRef } from '../../translation.esm.js';
|
|
14
15
|
import 'react-use/lib/useAsync';
|
|
15
16
|
import '@backstage/plugin-permission-react';
|
|
16
17
|
import '@drodil/backstage-plugin-qeta-common';
|
|
17
18
|
import '@backstage/plugin-permission-common';
|
|
18
|
-
import { Tooltip, Chip, Grid, Typography, Button } from '@material-ui/core';
|
|
19
|
+
import { Tooltip, Chip, Grid, Box, Typography, Button } from '@material-ui/core';
|
|
19
20
|
import VisibilityOff from '@material-ui/icons/VisibilityOff';
|
|
20
21
|
import Visibility from '@material-ui/icons/Visibility';
|
|
22
|
+
import LoyaltyOutlined from '@material-ui/icons/LoyaltyOutlined';
|
|
21
23
|
|
|
22
24
|
const cache = /* @__PURE__ */ new Map();
|
|
23
25
|
const TagTooltip = (props) => {
|
|
24
26
|
const { tag } = props;
|
|
25
27
|
const qetaApi = useApi(qetaApiRef);
|
|
26
|
-
const { t } =
|
|
28
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
27
29
|
const tags = useTagsFollow();
|
|
28
30
|
const [resp, setResp] = useState();
|
|
29
31
|
useEffect(() => {
|
|
@@ -50,12 +52,28 @@ const TagTooltip = (props) => {
|
|
|
50
52
|
return null;
|
|
51
53
|
}
|
|
52
54
|
return /* @__PURE__ */ jsxs(Grid, { container: true, style: { padding: "0.5em" }, spacing: 1, children: [
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
|
|
56
|
+
/* @__PURE__ */ jsxs(Box, { style: { display: "flex", alignItems: "center" }, children: [
|
|
57
|
+
/* @__PURE__ */ jsx(LoyaltyOutlined, { fontSize: "small" }),
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
Typography,
|
|
60
|
+
{
|
|
61
|
+
variant: "subtitle1",
|
|
62
|
+
style: {
|
|
63
|
+
textOverflow: "ellipsis",
|
|
64
|
+
overflow: "hidden",
|
|
65
|
+
whiteSpace: "nowrap"
|
|
66
|
+
},
|
|
67
|
+
children: tag
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
] }),
|
|
71
|
+
resp.id > 0 && /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
|
|
72
|
+
t("common.posts", { count: resp.postsCount, itemType: "post" }),
|
|
73
|
+
" \xB7 ",
|
|
74
|
+
t("common.followers", { count: resp.followerCount })
|
|
75
|
+
] })
|
|
76
|
+
] }),
|
|
59
77
|
resp.description && /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(MarkdownRenderer, { content: resp.description }) }),
|
|
60
78
|
!tags.loading && resp.id !== 0 && /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
|
|
61
79
|
Button,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagChip.esm.js","sources":["../../../src/components/TagsAndEntities/TagChip.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"TagChip.esm.js","sources":["../../../src/components/TagsAndEntities/TagChip.tsx"],"sourcesContent":["import { CSSProperties, useEffect, useState } from 'react';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { tagRouteRef } from '../../routes';\nimport { qetaApiRef } from '../../api';\nimport { TagResponse } from '@drodil/backstage-plugin-qeta-common';\nimport { useNavigate } from 'react-router-dom';\nimport { MarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer';\nimport { useTagsFollow } 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 LoyaltyOutlined from '@material-ui/icons/LoyaltyOutlined';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { qetaTranslationRef } from '../../translation.ts';\n\nconst cache: Map<string, TagResponse> = new Map();\n\nconst TagTooltip = (props: { tag: string }) => {\n const { tag } = props;\n const qetaApi = useApi(qetaApiRef);\n const { t } = useTranslationRef(qetaTranslationRef);\n const tags = useTagsFollow();\n const [resp, setResp] = useState<undefined | TagResponse>();\n\n useEffect(() => {\n if (cache.has(tag)) {\n setResp(cache.get(tag));\n return;\n }\n\n qetaApi.getTag(tag).then(res => {\n if (res) {\n cache.set(tag, res);\n setResp(res);\n } else {\n setResp({\n id: 0,\n tag,\n postsCount: 0,\n followerCount: 0,\n description: t('tagChip.nonExistingTag'),\n });\n }\n });\n }, [qetaApi, tag, t]);\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 <LoyaltyOutlined fontSize=\"small\" />\n <Typography\n variant=\"subtitle1\"\n style={{\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n }}\n >\n {tag}\n </Typography>\n </Box>\n {resp.id > 0 && (\n <Typography variant=\"subtitle2\">\n {t('common.posts', { count: resp.postsCount, itemType: 'post' })}\n {' · '}\n {t('common.followers', { count: resp.followerCount })}\n </Typography>\n )}\n </Grid>\n {resp.description && (\n <Grid item xs={12}>\n <MarkdownRenderer content={resp.description} />\n </Grid>\n )}\n {!tags.loading && resp.id !== 0 && (\n <Grid item xs={12}>\n <Button\n size=\"small\"\n variant=\"outlined\"\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 startIcon={\n tags.isFollowingTag(tag) ? <VisibilityOff /> : <Visibility />\n }\n >\n {tags.isFollowingTag(tag)\n ? t('tagButton.unfollow')\n : t('tagButton.follow')}\n </Button>\n </Grid>\n )}\n </Grid>\n );\n};\n\nexport const TagChip = (props: {\n tag: string;\n style?: CSSProperties;\n useHref?: boolean;\n}) => {\n const tagRoute = useRouteRef(tagRouteRef);\n const navigate = useNavigate();\n const { tag } = props;\n return (\n <Tooltip\n arrow\n title={<TagTooltip tag={tag} />}\n enterDelay={400}\n interactive\n >\n <Chip\n label={tag}\n size=\"small\"\n className=\"qetaTagChip\"\n component=\"a\"\n style={props.style}\n href={props.useHref ? tagRoute({ tag }) : undefined}\n target={props.useHref ? '_blank' : undefined}\n onClick={\n !props.useHref\n ? () => {\n navigate(tagRoute({ tag }));\n }\n : undefined\n }\n clickable\n />\n </Tooltip>\n );\n};\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AAA;AAAA,UACL,SAAU,EAAA,aAAA;AAAA,UACV,SAAU,EAAA,GAAA;AAAA,UACV,OAAO,KAAM,CAAA,KAAA;AAAA,UACb,MAAM,KAAM,CAAA,OAAA,GAAU,SAAS,EAAE,GAAA,EAAK,CAAI,GAAA,KAAA,CAAA;AAAA,UAC1C,MAAA,EAAQ,KAAM,CAAA,OAAA,GAAU,QAAW,GAAA,KAAA,CAAA;AAAA,UACnC,OACE,EAAA,CAAC,KAAM,CAAA,OAAA,GACH,MAAM;AACJ,YAAA,QAAA,CAAS,QAAS,CAAA,EAAE,GAAI,EAAC,CAAC,CAAA;AAAA,WAE5B,GAAA,KAAA,CAAA;AAAA,UAEN,SAAS,EAAA;AAAA;AAAA;AACX;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -4,7 +4,6 @@ import { userRouteRef } from '../../routes.esm.js';
|
|
|
4
4
|
import '../../api.esm.js';
|
|
5
5
|
import 'react-use';
|
|
6
6
|
import 'react';
|
|
7
|
-
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
8
7
|
import { useUserInfo } from '../../hooks/useEntityAuthor.esm.js';
|
|
9
8
|
import { useUserFollow } from '../../hooks/useUserFollow.esm.js';
|
|
10
9
|
import { useIdentityApi } from '../../hooks/useIdentityApi.esm.js';
|
|
@@ -16,10 +15,12 @@ import { useNavigate } from 'react-router-dom';
|
|
|
16
15
|
import { Grid, Box, Avatar, Typography, Button, Tooltip, Chip } from '@material-ui/core';
|
|
17
16
|
import VisibilityOff from '@material-ui/icons/VisibilityOff';
|
|
18
17
|
import Visibility from '@material-ui/icons/Visibility';
|
|
18
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
19
|
+
import { qetaTranslationRef } from '../../translation.esm.js';
|
|
19
20
|
|
|
20
21
|
const UserTooltip = (props) => {
|
|
21
22
|
const { entityRef, anonymous } = props;
|
|
22
|
-
const { t } =
|
|
23
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
23
24
|
const { name, initials, user, secondaryTitle } = useUserInfo(
|
|
24
25
|
entityRef,
|
|
25
26
|
anonymous ?? entityRef === "anonymous"
|
|
@@ -30,20 +31,33 @@ const UserTooltip = (props) => {
|
|
|
30
31
|
);
|
|
31
32
|
const users = useUserFollow();
|
|
32
33
|
return /* @__PURE__ */ jsxs(Grid, { container: true, style: { padding: "0.5em" }, spacing: 1, children: [
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
|
|
35
|
+
/* @__PURE__ */ jsxs(Box, { style: { display: "flex", alignItems: "center" }, children: [
|
|
36
|
+
/* @__PURE__ */ jsx(Box, { style: { display: "inline-block", marginRight: "0.5em" }, children: /* @__PURE__ */ jsx(
|
|
37
|
+
Avatar,
|
|
38
|
+
{
|
|
39
|
+
src: user?.spec?.profile?.picture,
|
|
40
|
+
alt: name,
|
|
41
|
+
variant: "rounded",
|
|
42
|
+
style: { width: "0.9em", height: "0.9em" },
|
|
43
|
+
children: initials
|
|
44
|
+
}
|
|
45
|
+
) }),
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
Typography,
|
|
48
|
+
{
|
|
49
|
+
variant: "subtitle1",
|
|
50
|
+
style: {
|
|
51
|
+
textOverflow: "ellipsis",
|
|
52
|
+
overflow: "hidden",
|
|
53
|
+
whiteSpace: "nowrap"
|
|
54
|
+
},
|
|
55
|
+
children: name
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: secondaryTitle })
|
|
60
|
+
] }),
|
|
47
61
|
!users.loading && currentUser?.userEntityRef !== entityRef && /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
|
|
48
62
|
Button,
|
|
49
63
|
{
|
|
@@ -67,7 +81,7 @@ const UserChip = (props) => {
|
|
|
67
81
|
const navigate = useNavigate();
|
|
68
82
|
const { entityRef } = props;
|
|
69
83
|
const userRoute = useRouteRef(userRouteRef);
|
|
70
|
-
const { t } =
|
|
84
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
71
85
|
const { primaryTitle: userName } = useEntityPresentation(
|
|
72
86
|
entityRef.startsWith("user:") ? entityRef : `user:${entityRef}`
|
|
73
87
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserChip.esm.js","sources":["../../../src/components/TagsAndEntities/UserChip.tsx"],"sourcesContent":["import { useRouteRef } from '@backstage/core-plugin-api';\nimport { userRouteRef } from '../../routes';\nimport {
|
|
1
|
+
{"version":3,"file":"UserChip.esm.js","sources":["../../../src/components/TagsAndEntities/UserChip.tsx"],"sourcesContent":["import { useRouteRef } from '@backstage/core-plugin-api';\nimport { userRouteRef } from '../../routes';\nimport { useIdentityApi, useUserFollow, useUserInfo } from '../../hooks';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { useNavigate } from 'react-router-dom';\nimport {\n Avatar,\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 { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { qetaTranslationRef } from '../../translation.ts';\n\nexport const UserTooltip = (props: {\n entityRef: string;\n anonymous?: boolean;\n}) => {\n const { entityRef, anonymous } = props;\n const { t } = useTranslationRef(qetaTranslationRef);\n const { name, initials, user, secondaryTitle } = useUserInfo(\n entityRef,\n anonymous ?? entityRef === 'anonymous',\n );\n\n const { value: currentUser } = useIdentityApi(\n api => api.getBackstageIdentity(),\n [],\n );\n const users = useUserFollow();\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 <Box style={{ display: 'inline-block', marginRight: '0.5em' }}>\n <Avatar\n src={user?.spec?.profile?.picture}\n alt={name}\n variant=\"rounded\"\n style={{ width: '0.9em', height: '0.9em' }}\n >\n {initials}\n </Avatar>\n </Box>\n <Typography\n variant=\"subtitle1\"\n style={{\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n }}\n >\n {name}\n </Typography>\n </Box>\n <Typography variant=\"subtitle2\">{secondaryTitle}</Typography>\n </Grid>\n {!users.loading && currentUser?.userEntityRef !== entityRef && (\n <Grid item xs={12}>\n <Button\n size=\"small\"\n variant=\"outlined\"\n color={users.isFollowingUser(entityRef) ? 'secondary' : 'primary'}\n onClick={() => {\n if (users.isFollowingUser(entityRef)) {\n users.unfollowUser(entityRef);\n } else {\n users.followUser(entityRef);\n }\n }}\n startIcon={\n users.isFollowingUser(entityRef) ? (\n <VisibilityOff />\n ) : (\n <Visibility />\n )\n }\n >\n {users.isFollowingUser(entityRef)\n ? t('userButton.unfollow')\n : t('userButton.follow')}\n </Button>\n </Grid>\n )}\n </Grid>\n );\n};\n\nexport const UserChip = (props: { entityRef: string }) => {\n const navigate = useNavigate();\n const { entityRef } = props;\n const userRoute = useRouteRef(userRouteRef);\n const { t } = useTranslationRef(qetaTranslationRef);\n const { primaryTitle: userName } = useEntityPresentation(\n entityRef.startsWith('user:') ? entityRef : `user:${entityRef}`,\n );\n if (entityRef === 'anonymous') {\n return <>{t('userLink.anonymous')}</>;\n }\n return (\n <Tooltip\n arrow\n title={<UserTooltip entityRef={entityRef} />}\n enterDelay={400}\n interactive\n >\n <Chip\n label={userName}\n size=\"small\"\n className=\"qetaTagChip\"\n component=\"a\"\n onClick={() => {\n navigate(`${userRoute()}/${entityRef}`);\n }}\n clickable\n />\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;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in-api';
|
|
6
6
|
import { qetaApiRef } from '../../api.esm.js';
|
|
7
|
-
import '
|
|
8
|
-
import {
|
|
9
|
-
import '@backstage/catalog-model';
|
|
10
|
-
import 'dataloader';
|
|
11
|
-
import '@backstage/plugin-catalog-react';
|
|
12
|
-
import 'react-use/lib/useAsync';
|
|
13
|
-
import '@backstage/plugin-permission-react';
|
|
14
|
-
import '@drodil/backstage-plugin-qeta-common';
|
|
15
|
-
import '@backstage/plugin-permission-common';
|
|
7
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
8
|
+
import { qetaTranslationRef } from '../../translation.esm.js';
|
|
16
9
|
import { ModalContent } from '../Utility/ModalContent.esm.js';
|
|
10
|
+
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
11
|
+
import { EntitiesInput } from '../PostForm/EntitiesInput.esm.js';
|
|
17
12
|
|
|
18
13
|
const CreateTagModal = (props) => {
|
|
19
|
-
const { open, onClose } = props;
|
|
14
|
+
const { open, onClose, isModerator } = props;
|
|
20
15
|
const [tag, setTag] = useState("");
|
|
21
16
|
const [description, setDescription] = useState("");
|
|
22
|
-
const
|
|
17
|
+
const [experts, setExperts] = useState([]);
|
|
18
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
23
19
|
const [error, setError] = useState(false);
|
|
24
20
|
const qetaApi = useApi(qetaApiRef);
|
|
25
21
|
const handleCreate = () => {
|
|
26
|
-
qetaApi.createTag(
|
|
22
|
+
qetaApi.createTag(
|
|
23
|
+
tag,
|
|
24
|
+
description,
|
|
25
|
+
isModerator ? experts.map(stringifyEntityRef) : void 0
|
|
26
|
+
).then((ret) => {
|
|
27
27
|
if (ret) {
|
|
28
28
|
setTag("");
|
|
29
29
|
setDescription("");
|
|
30
|
+
setExperts([]);
|
|
30
31
|
onClose();
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
@@ -84,6 +85,18 @@ const CreateTagModal = (props) => {
|
|
|
84
85
|
value: description ?? "",
|
|
85
86
|
onChange: (e) => setDescription(e.target.value)
|
|
86
87
|
}
|
|
88
|
+
) }),
|
|
89
|
+
isModerator && /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
|
|
90
|
+
EntitiesInput,
|
|
91
|
+
{
|
|
92
|
+
value: experts,
|
|
93
|
+
onChange: setExperts,
|
|
94
|
+
maximum: null,
|
|
95
|
+
kind: ["User"],
|
|
96
|
+
hideHelpText: true,
|
|
97
|
+
label: t("editTagModal.expertsLabel"),
|
|
98
|
+
placeholder: t("editTagModal.expertsPlaceholder")
|
|
99
|
+
}
|
|
87
100
|
) })
|
|
88
101
|
] }),
|
|
89
102
|
/* @__PURE__ */ jsx(
|