@drodil/backstage-plugin-qeta-react 3.24.5 → 3.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/dist/components/AIAnswerCard/AIAnswerCard.esm.js +54 -41
  2. package/dist/components/AIAnswerCard/AIAnswerCard.esm.js.map +1 -1
  3. package/dist/components/AnswerCard/AnswerCard.esm.js +96 -73
  4. package/dist/components/AnswerCard/AnswerCard.esm.js.map +1 -1
  5. package/dist/components/AnswerForm/AnswerForm.esm.js +52 -47
  6. package/dist/components/AnswerForm/AnswerForm.esm.js.map +1 -1
  7. package/dist/components/AnswersContainer/AnswerList.esm.js +31 -21
  8. package/dist/components/AnswersContainer/AnswerList.esm.js.map +1 -1
  9. package/dist/components/AnswersContainer/AnswerListItem.esm.js +74 -57
  10. package/dist/components/AnswersContainer/AnswerListItem.esm.js.map +1 -1
  11. package/dist/components/AnswersContainer/AnswersContainer.esm.js +70 -56
  12. package/dist/components/AnswersContainer/AnswersContainer.esm.js.map +1 -1
  13. package/dist/components/ArticleContent/ArticleButtons.esm.js +73 -52
  14. package/dist/components/ArticleContent/ArticleButtons.esm.js.map +1 -1
  15. package/dist/components/ArticleContent/ArticleContent.esm.js +60 -34
  16. package/dist/components/ArticleContent/ArticleContent.esm.js.map +1 -1
  17. package/dist/components/AuthorBox/AuthorBox.esm.js +49 -31
  18. package/dist/components/AuthorBox/AuthorBox.esm.js.map +1 -1
  19. package/dist/components/Buttons/AddToCollectionButton.esm.js +35 -24
  20. package/dist/components/Buttons/AddToCollectionButton.esm.js.map +1 -1
  21. package/dist/components/Buttons/AskQuestionButton.esm.js +18 -15
  22. package/dist/components/Buttons/AskQuestionButton.esm.js.map +1 -1
  23. package/dist/components/Buttons/ButtonContainer.esm.js +2 -2
  24. package/dist/components/Buttons/ButtonContainer.esm.js.map +1 -1
  25. package/dist/components/Buttons/CollectionFollowButton.esm.js +10 -6
  26. package/dist/components/Buttons/CollectionFollowButton.esm.js.map +1 -1
  27. package/dist/components/Buttons/CreateCollectionButton.esm.js +18 -15
  28. package/dist/components/Buttons/CreateCollectionButton.esm.js.map +1 -1
  29. package/dist/components/Buttons/EntityFollowButton.esm.js +10 -6
  30. package/dist/components/Buttons/EntityFollowButton.esm.js.map +1 -1
  31. package/dist/components/Buttons/FavoriteButton.esm.js +15 -11
  32. package/dist/components/Buttons/FavoriteButton.esm.js.map +1 -1
  33. package/dist/components/Buttons/LinkButton.esm.js +10 -6
  34. package/dist/components/Buttons/LinkButton.esm.js.map +1 -1
  35. package/dist/components/Buttons/TagFollowButton.esm.js +10 -6
  36. package/dist/components/Buttons/TagFollowButton.esm.js.map +1 -1
  37. package/dist/components/Buttons/UserFollowButton.esm.js +10 -6
  38. package/dist/components/Buttons/UserFollowButton.esm.js.map +1 -1
  39. package/dist/components/Buttons/VoteButtons.esm.js +41 -35
  40. package/dist/components/Buttons/VoteButtons.esm.js.map +1 -1
  41. package/dist/components/Buttons/WriteArticleButton.esm.js +18 -15
  42. package/dist/components/Buttons/WriteArticleButton.esm.js.map +1 -1
  43. package/dist/components/CollectionCard/CollectionCard.esm.js +59 -42
  44. package/dist/components/CollectionCard/CollectionCard.esm.js.map +1 -1
  45. package/dist/components/CollectionForm/CollectionForm.esm.js +73 -67
  46. package/dist/components/CollectionForm/CollectionForm.esm.js.map +1 -1
  47. package/dist/components/CollectionsGrid/CollectionsGrid.esm.js +61 -49
  48. package/dist/components/CollectionsGrid/CollectionsGrid.esm.js.map +1 -1
  49. package/dist/components/CollectionsGrid/CollectionsGridContent.esm.js +18 -14
  50. package/dist/components/CollectionsGrid/CollectionsGridContent.esm.js.map +1 -1
  51. package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js +52 -32
  52. package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js.map +1 -1
  53. package/dist/components/CollectionsGrid/NoCollectionsCard.esm.js +10 -6
  54. package/dist/components/CollectionsGrid/NoCollectionsCard.esm.js.map +1 -1
  55. package/dist/components/CommentSection/CommentForm.esm.js +42 -38
  56. package/dist/components/CommentSection/CommentForm.esm.js.map +1 -1
  57. package/dist/components/CommentSection/CommentList.esm.js +15 -12
  58. package/dist/components/CommentSection/CommentList.esm.js.map +1 -1
  59. package/dist/components/CommentSection/CommentListItem.esm.js +49 -28
  60. package/dist/components/CommentSection/CommentListItem.esm.js.map +1 -1
  61. package/dist/components/CommentSection/CommentSection.esm.js +46 -38
  62. package/dist/components/CommentSection/CommentSection.esm.js.map +1 -1
  63. package/dist/components/DeleteModal/DeleteModal.esm.js +32 -23
  64. package/dist/components/DeleteModal/DeleteModal.esm.js.map +1 -1
  65. package/dist/components/EntitiesGrid/EntitiesGrid.esm.js +39 -30
  66. package/dist/components/EntitiesGrid/EntitiesGrid.esm.js.map +1 -1
  67. package/dist/components/EntitiesGrid/EntitiesGridContent.esm.js +9 -5
  68. package/dist/components/EntitiesGrid/EntitiesGridContent.esm.js.map +1 -1
  69. package/dist/components/EntitiesGrid/EntitiesGridItem.esm.js +50 -38
  70. package/dist/components/EntitiesGrid/EntitiesGridItem.esm.js.map +1 -1
  71. package/dist/components/EntitiesGrid/NoEntitiesCard.esm.js +10 -6
  72. package/dist/components/EntitiesGrid/NoEntitiesCard.esm.js.map +1 -1
  73. package/dist/components/FilterPanel/DateRangeFilter.esm.js +71 -58
  74. package/dist/components/FilterPanel/DateRangeFilter.esm.js.map +1 -1
  75. package/dist/components/FilterPanel/FilterPanel.esm.js +262 -217
  76. package/dist/components/FilterPanel/FilterPanel.esm.js.map +1 -1
  77. package/dist/components/FollowedLists/FollowedCollectionsList.esm.js +6 -2
  78. package/dist/components/FollowedLists/FollowedCollectionsList.esm.js.map +1 -1
  79. package/dist/components/FollowedLists/FollowedEntitiesList.esm.js +6 -2
  80. package/dist/components/FollowedLists/FollowedEntitiesList.esm.js.map +1 -1
  81. package/dist/components/FollowedLists/FollowedTagsList.esm.js +6 -2
  82. package/dist/components/FollowedLists/FollowedTagsList.esm.js.map +1 -1
  83. package/dist/components/FollowedLists/FollowedUsersList.esm.js +6 -2
  84. package/dist/components/FollowedLists/FollowedUsersList.esm.js.map +1 -1
  85. package/dist/components/HeaderImageInput/HeaderImageInput.esm.js +51 -37
  86. package/dist/components/HeaderImageInput/HeaderImageInput.esm.js.map +1 -1
  87. package/dist/components/HomePageCards/ImpactCard.esm.js +15 -4
  88. package/dist/components/HomePageCards/ImpactCard.esm.js.map +1 -1
  89. package/dist/components/HomePageCards/PostsCard.esm.js +14 -7
  90. package/dist/components/HomePageCards/PostsCard.esm.js.map +1 -1
  91. package/dist/components/LeftMenu/LeftMenu.esm.js +68 -28
  92. package/dist/components/LeftMenu/LeftMenu.esm.js.map +1 -1
  93. package/dist/components/LeftMenu/LeftMenuButton.esm.js +52 -45
  94. package/dist/components/LeftMenu/LeftMenuButton.esm.js.map +1 -1
  95. package/dist/components/Links/Links.esm.js +12 -8
  96. package/dist/components/Links/Links.esm.js.map +1 -1
  97. package/dist/components/LoadingGrid/LoadingGrid.esm.js +5 -5
  98. package/dist/components/LoadingGrid/LoadingGrid.esm.js.map +1 -1
  99. package/dist/components/MarkdownEditor/MarkdownEditor.esm.js +5 -6
  100. package/dist/components/MarkdownEditor/MarkdownEditor.esm.js.map +1 -1
  101. package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js +42 -33
  102. package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js.map +1 -1
  103. package/dist/components/PostAnonymouslyCheckbox/PostAnonymouslyCheckbox.esm.js +10 -6
  104. package/dist/components/PostAnonymouslyCheckbox/PostAnonymouslyCheckbox.esm.js.map +1 -1
  105. package/dist/components/PostForm/AutocompleteListComponent.esm.js +18 -17
  106. package/dist/components/PostForm/AutocompleteListComponent.esm.js.map +1 -1
  107. package/dist/components/PostForm/EntitiesInput.esm.js +19 -9
  108. package/dist/components/PostForm/EntitiesInput.esm.js.map +1 -1
  109. package/dist/components/PostForm/PostForm.esm.js +109 -103
  110. package/dist/components/PostForm/PostForm.esm.js.map +1 -1
  111. package/dist/components/PostForm/TagInput.esm.js +13 -12
  112. package/dist/components/PostForm/TagInput.esm.js.map +1 -1
  113. package/dist/components/PostHighlightList/PostHighlightList.esm.js +26 -14
  114. package/dist/components/PostHighlightList/PostHighlightList.esm.js.map +1 -1
  115. package/dist/components/PostsContainer/NoPostsCard.esm.js +24 -18
  116. package/dist/components/PostsContainer/NoPostsCard.esm.js.map +1 -1
  117. package/dist/components/PostsContainer/PostList.esm.js +30 -20
  118. package/dist/components/PostsContainer/PostList.esm.js.map +1 -1
  119. package/dist/components/PostsContainer/PostListItem.esm.js +108 -86
  120. package/dist/components/PostsContainer/PostListItem.esm.js.map +1 -1
  121. package/dist/components/PostsContainer/PostsContainer.esm.js +100 -84
  122. package/dist/components/PostsContainer/PostsContainer.esm.js.map +1 -1
  123. package/dist/components/PostsGrid/PostsGrid.esm.js +100 -84
  124. package/dist/components/PostsGrid/PostsGrid.esm.js.map +1 -1
  125. package/dist/components/PostsGrid/PostsGridContent.esm.js +46 -39
  126. package/dist/components/PostsGrid/PostsGridContent.esm.js.map +1 -1
  127. package/dist/components/PostsGrid/PostsGridItem.esm.js +59 -34
  128. package/dist/components/PostsGrid/PostsGridItem.esm.js.map +1 -1
  129. package/dist/components/PostsTable/PostsTable.esm.js +96 -67
  130. package/dist/components/PostsTable/PostsTable.esm.js.map +1 -1
  131. package/dist/components/PostsTable/PostsTableRow.esm.js +21 -15
  132. package/dist/components/PostsTable/PostsTableRow.esm.js.map +1 -1
  133. package/dist/components/QetaPagination/QetaPagination.esm.js +39 -31
  134. package/dist/components/QetaPagination/QetaPagination.esm.js.map +1 -1
  135. package/dist/components/QuestionCard/QuestionCard.esm.js +90 -64
  136. package/dist/components/QuestionCard/QuestionCard.esm.js.map +1 -1
  137. package/dist/components/RelativeTimeWithTooltip/RelativeTimeWithTooltip.esm.js +4 -3
  138. package/dist/components/RelativeTimeWithTooltip/RelativeTimeWithTooltip.esm.js.map +1 -1
  139. package/dist/components/SearchBar/SearchBar.esm.js +44 -41
  140. package/dist/components/SearchBar/SearchBar.esm.js.map +1 -1
  141. package/dist/components/SelectTemplateList/SelectTemplateList.esm.js +46 -30
  142. package/dist/components/SelectTemplateList/SelectTemplateList.esm.js.map +1 -1
  143. package/dist/components/StatsChart/StatsChart.esm.js +149 -135
  144. package/dist/components/StatsChart/StatsChart.esm.js.map +1 -1
  145. package/dist/components/SuggestionsCard/SuggestionsCard.esm.js +42 -32
  146. package/dist/components/SuggestionsCard/SuggestionsCard.esm.js.map +1 -1
  147. package/dist/components/SummaryStatsGrid/SummaryStatsGrid.esm.js +75 -58
  148. package/dist/components/SummaryStatsGrid/SummaryStatsGrid.esm.js.map +1 -1
  149. package/dist/components/TagsAndEntities/CollectionChip.esm.js +50 -37
  150. package/dist/components/TagsAndEntities/CollectionChip.esm.js.map +1 -1
  151. package/dist/components/TagsAndEntities/EntityChip.esm.js +58 -40
  152. package/dist/components/TagsAndEntities/EntityChip.esm.js.map +1 -1
  153. package/dist/components/TagsAndEntities/TagChip.esm.js +52 -39
  154. package/dist/components/TagsAndEntities/TagChip.esm.js.map +1 -1
  155. package/dist/components/TagsAndEntities/TagsAndEntities.esm.js +5 -2
  156. package/dist/components/TagsAndEntities/TagsAndEntities.esm.js.map +1 -1
  157. package/dist/components/TagsAndEntities/UserChip.esm.js +55 -44
  158. package/dist/components/TagsAndEntities/UserChip.esm.js.map +1 -1
  159. package/dist/components/TagsGrid/CreateTagModal.esm.js +59 -46
  160. package/dist/components/TagsGrid/CreateTagModal.esm.js.map +1 -1
  161. package/dist/components/TagsGrid/EditTagModal.esm.js +45 -35
  162. package/dist/components/TagsGrid/EditTagModal.esm.js.map +1 -1
  163. package/dist/components/TagsGrid/NoTagsCard.esm.js +10 -6
  164. package/dist/components/TagsGrid/NoTagsCard.esm.js.map +1 -1
  165. package/dist/components/TagsGrid/TagGridItem.esm.js +87 -59
  166. package/dist/components/TagsGrid/TagGridItem.esm.js.map +1 -1
  167. package/dist/components/TagsGrid/TagsGrid.esm.js +68 -54
  168. package/dist/components/TagsGrid/TagsGrid.esm.js.map +1 -1
  169. package/dist/components/TagsGrid/TagsGridContent.esm.js +9 -5
  170. package/dist/components/TagsGrid/TagsGridContent.esm.js.map +1 -1
  171. package/dist/components/TemplateList/TemplateForm.esm.js +104 -94
  172. package/dist/components/TemplateList/TemplateForm.esm.js.map +1 -1
  173. package/dist/components/TemplateList/TemplateList.esm.js +50 -37
  174. package/dist/components/TemplateList/TemplateList.esm.js.map +1 -1
  175. package/dist/components/TopRankingUsersCard/TopRankingUsersCard.esm.js +75 -51
  176. package/dist/components/TopRankingUsersCard/TopRankingUsersCard.esm.js.map +1 -1
  177. package/dist/components/TopRankingUsersCard/TrophyIcon.esm.js +17 -14
  178. package/dist/components/TopRankingUsersCard/TrophyIcon.esm.js.map +1 -1
  179. package/dist/components/UsersGrid/NoUsersCard.esm.js +10 -6
  180. package/dist/components/UsersGrid/NoUsersCard.esm.js.map +1 -1
  181. package/dist/components/UsersGrid/UsersGrid.esm.js +34 -23
  182. package/dist/components/UsersGrid/UsersGrid.esm.js.map +1 -1
  183. package/dist/components/UsersGrid/UsersGridContent.esm.js +9 -5
  184. package/dist/components/UsersGrid/UsersGridContent.esm.js.map +1 -1
  185. package/dist/components/UsersGrid/UsersGridItem.esm.js +78 -58
  186. package/dist/components/UsersGrid/UsersGridItem.esm.js.map +1 -1
  187. package/dist/components/Utility/ModalContent.esm.js +4 -3
  188. package/dist/components/Utility/ModalContent.esm.js.map +1 -1
  189. package/dist/components/Utility/OptionalRequirePermission.esm.js +4 -4
  190. package/dist/components/Utility/OptionalRequirePermission.esm.js.map +1 -1
  191. package/dist/components/Utility/RightList.esm.js +13 -11
  192. package/dist/components/Utility/RightList.esm.js.map +1 -1
  193. package/dist/components/Utility/SmallAvatar.esm.js +2 -2
  194. package/dist/components/Utility/SmallAvatar.esm.js.map +1 -1
  195. package/dist/components/Utility/VoteButtonContainer.esm.js +2 -2
  196. package/dist/components/Utility/VoteButtonContainer.esm.js.map +1 -1
  197. package/dist/hooks/useAI.esm.js +7 -5
  198. package/dist/hooks/useAI.esm.js.map +1 -1
  199. package/dist/hooks/useCollectionsFollow.esm.js +3 -5
  200. package/dist/hooks/useCollectionsFollow.esm.js.map +1 -1
  201. package/dist/hooks/useEntityAuthor.esm.js +5 -5
  202. package/dist/hooks/useEntityAuthor.esm.js.map +1 -1
  203. package/dist/hooks/useEntityFollow.esm.js +3 -5
  204. package/dist/hooks/useEntityFollow.esm.js.map +1 -1
  205. package/dist/hooks/useEntityQueryParameter.esm.js +2 -2
  206. package/dist/hooks/useEntityQueryParameter.esm.js.map +1 -1
  207. package/dist/hooks/useIsModerator.esm.js +19 -4
  208. package/dist/hooks/useIsModerator.esm.js.map +1 -1
  209. package/dist/hooks/usePaginatedPosts.esm.js +7 -7
  210. package/dist/hooks/usePaginatedPosts.esm.js.map +1 -1
  211. package/dist/hooks/useTagsFollow.esm.js +3 -3
  212. package/dist/hooks/useTagsFollow.esm.js.map +1 -1
  213. package/dist/hooks/useUserFollow.esm.js +3 -3
  214. package/dist/hooks/useUserFollow.esm.js.map +1 -1
  215. package/dist/hooks/useVoting.esm.js +4 -3
  216. package/dist/hooks/useVoting.esm.js.map +1 -1
  217. package/dist/index.d.ts +64 -63
  218. package/dist/routes.esm.js +3 -3
  219. package/dist/routes.esm.js.map +1 -1
  220. package/dist/utils/utils.esm.js +3 -0
  221. package/dist/utils/utils.esm.js.map +1 -1
  222. package/package.json +16 -9
@@ -1,5 +1,6 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
1
2
  import { stringifyEntityRef } from '@backstage/catalog-model';
2
- import React__default, { useEffect } from 'react';
3
+ import { useState, useEffect } from 'react';
3
4
  import { useRouteRef, useApi } from '@backstage/core-plugin-api';
4
5
  import { useEntityPresentation } from '@backstage/plugin-catalog-react';
5
6
  import { entityRouteRef } from '../../routes.esm.js';
@@ -9,6 +10,9 @@ import { useTranslation } from '../../hooks/useTranslation.esm.js';
9
10
  import { useEntityFollow } from '../../hooks/useEntityFollow.esm.js';
10
11
  import 'dataloader';
11
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';
12
16
  import { Tooltip, Chip, Grid, Box, Typography, Button } from '@material-ui/core';
13
17
  import VisibilityOff from '@material-ui/icons/VisibilityOff';
14
18
  import Visibility from '@material-ui/icons/Visibility';
@@ -22,7 +26,7 @@ const EntityTooltip = (props) => {
22
26
  const { primaryTitle, secondaryTitle, Icon } = useEntityPresentation(entity);
23
27
  const { t } = useTranslation();
24
28
  const entitiesFollow = useEntityFollow();
25
- const [resp, setResp] = React__default.useState();
29
+ const [resp, setResp] = useState();
26
30
  useEffect(() => {
27
31
  if (cache.has(entityRef)) {
28
32
  setResp(cache.get(entityRef));
@@ -38,23 +42,37 @@ const EntityTooltip = (props) => {
38
42
  if (!resp) {
39
43
  return null;
40
44
  }
41
- return /* @__PURE__ */ React__default.createElement(Grid, { container: true, style: { padding: "0.5em" }, spacing: 1 }, /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(Box, { style: { display: "flex", alignItems: "center" } }, Icon ? /* @__PURE__ */ React__default.createElement(Icon, { fontSize: "small" }) : null, /* @__PURE__ */ React__default.createElement(Typography, { variant: "h6" }, primaryTitle)), /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle1" }, secondaryTitle)), /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, t("common.posts", { count: resp.postsCount, itemType: "post" }), " \xB7 ", t("common.followers", { count: resp.followerCount }))), !entitiesFollow.loading && /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(
42
- Button,
43
- {
44
- size: "small",
45
- variant: "outlined",
46
- color: entitiesFollow.isFollowingEntity(entityRef) ? "secondary" : "primary",
47
- onClick: () => {
48
- if (entitiesFollow.isFollowingEntity(entityRef)) {
49
- entitiesFollow.unfollowEntity(entityRef);
50
- } else {
51
- entitiesFollow.followEntity(entityRef);
52
- }
53
- },
54
- startIcon: entitiesFollow.isFollowingEntity(entityRef) ? /* @__PURE__ */ React__default.createElement(VisibilityOff, null) : /* @__PURE__ */ React__default.createElement(Visibility, null)
55
- },
56
- entitiesFollow.isFollowingEntity(entityRef) ? t("entityButton.unfollow") : t("entityButton.follow")
57
- )));
45
+ return /* @__PURE__ */ jsxs(Grid, { container: true, style: { padding: "0.5em" }, spacing: 1, children: [
46
+ /* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
47
+ /* @__PURE__ */ jsxs(Box, { style: { display: "flex", alignItems: "center" }, children: [
48
+ Icon ? /* @__PURE__ */ jsx(Icon, { fontSize: "small" }) : null,
49
+ /* @__PURE__ */ jsx(Typography, { variant: "h6", children: primaryTitle })
50
+ ] }),
51
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", children: secondaryTitle })
52
+ ] }),
53
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
54
+ t("common.posts", { count: resp.postsCount, itemType: "post" }),
55
+ " \xB7 ",
56
+ t("common.followers", { count: resp.followerCount })
57
+ ] }) }),
58
+ !entitiesFollow.loading && /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
59
+ Button,
60
+ {
61
+ size: "small",
62
+ variant: "outlined",
63
+ color: entitiesFollow.isFollowingEntity(entityRef) ? "secondary" : "primary",
64
+ onClick: () => {
65
+ if (entitiesFollow.isFollowingEntity(entityRef)) {
66
+ entitiesFollow.unfollowEntity(entityRef);
67
+ } else {
68
+ entitiesFollow.followEntity(entityRef);
69
+ }
70
+ },
71
+ startIcon: entitiesFollow.isFollowingEntity(entityRef) ? /* @__PURE__ */ jsx(VisibilityOff, {}) : /* @__PURE__ */ jsx(Visibility, {}),
72
+ children: entitiesFollow.isFollowingEntity(entityRef) ? t("entityButton.unfollow") : t("entityButton.follow")
73
+ }
74
+ ) })
75
+ ] });
58
76
  };
59
77
  const EntityChip = (props) => {
60
78
  const { entity } = props;
@@ -62,31 +80,31 @@ const EntityChip = (props) => {
62
80
  const { primaryTitle, Icon } = useEntityPresentation(entity);
63
81
  const navigate = useNavigate();
64
82
  const entityRef = typeof entity === "string" ? entity : stringifyEntityRef(entity);
65
- return /* @__PURE__ */ React__default.createElement(
83
+ return /* @__PURE__ */ jsx(
66
84
  Tooltip,
67
85
  {
68
- title: /* @__PURE__ */ React__default.createElement(EntityTooltip, { entity }),
86
+ title: /* @__PURE__ */ jsx(EntityTooltip, { entity }),
69
87
  arrow: true,
70
88
  enterDelay: 400,
71
- interactive: true
72
- },
73
- /* @__PURE__ */ React__default.createElement(
74
- Chip,
75
- {
76
- label: primaryTitle,
77
- size: "small",
78
- icon: Icon ? /* @__PURE__ */ React__default.createElement(Icon, { fontSize: "small" }) : void 0,
79
- variant: "outlined",
80
- className: "qetaEntityChip",
81
- component: "a",
82
- href: props.useHref ? entityRoute({ entityRef }) : void 0,
83
- target: props.useHref ? "_blank" : void 0,
84
- onClick: !props.useHref ? () => {
85
- navigate(entityRoute({ entityRef }));
86
- } : void 0,
87
- clickable: true
88
- }
89
- )
89
+ interactive: true,
90
+ children: /* @__PURE__ */ jsx(
91
+ Chip,
92
+ {
93
+ label: primaryTitle,
94
+ size: "small",
95
+ icon: Icon ? /* @__PURE__ */ jsx(Icon, { fontSize: "small" }) : void 0,
96
+ variant: "outlined",
97
+ className: "qetaEntityChip",
98
+ component: "a",
99
+ href: props.useHref ? entityRoute({ entityRef }) : void 0,
100
+ target: props.useHref ? "_blank" : void 0,
101
+ onClick: !props.useHref ? () => {
102
+ navigate(entityRoute({ entityRef }));
103
+ } : void 0,
104
+ clickable: true
105
+ }
106
+ )
107
+ }
90
108
  );
91
109
  };
92
110
 
@@ -1 +1 @@
1
- {"version":3,"file":"EntityChip.esm.js","sources":["../../../src/components/TagsAndEntities/EntityChip.tsx"],"sourcesContent":["import { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport React, { useEffect } from 'react';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { entityRouteRef } from '../../routes';\nimport { qetaApiRef } from '../../api';\nimport { EntityResponse } from '@drodil/backstage-plugin-qeta-common';\nimport { useEntityFollow, useTranslation } from '../../hooks';\nimport {\n Box,\n Button,\n Chip,\n Grid,\n Tooltip,\n Typography,\n} from '@material-ui/core';\nimport VisibilityOff from '@material-ui/icons/VisibilityOff';\nimport Visibility from '@material-ui/icons/Visibility';\nimport { useNavigate } from 'react-router-dom';\n\nconst cache: Map<string, EntityResponse> = new Map();\n\nconst EntityTooltip = (props: { entity: Entity | string }) => {\n const { entity } = props;\n const entityRef =\n typeof entity === 'string' ? entity : stringifyEntityRef(entity);\n const qetaApi = useApi(qetaApiRef);\n const { primaryTitle, secondaryTitle, Icon } = useEntityPresentation(entity);\n const { t } = useTranslation();\n const entitiesFollow = useEntityFollow();\n const [resp, setResp] = React.useState<undefined | EntityResponse>();\n\n useEffect(() => {\n if (cache.has(entityRef)) {\n setResp(cache.get(entityRef));\n return;\n }\n\n qetaApi.getEntity(entityRef).then(res => {\n if (res) {\n cache.set(entityRef, res);\n setResp(res);\n }\n });\n }, [qetaApi, entityRef]);\n\n if (!resp) {\n return null;\n }\n\n return (\n <Grid container style={{ padding: '0.5em' }} spacing={1}>\n <Grid item xs={12}>\n <Box style={{ display: 'flex', alignItems: 'center' }}>\n {Icon ? <Icon fontSize=\"small\" /> : null}\n <Typography variant=\"h6\">{primaryTitle}</Typography>\n </Box>\n <Typography variant=\"subtitle1\">{secondaryTitle}</Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n {t('common.posts', { count: resp.postsCount, itemType: 'post' })}\n {' · '}\n {t('common.followers', { count: resp.followerCount })}\n </Typography>\n </Grid>\n {!entitiesFollow.loading && (\n <Grid item xs={12}>\n <Button\n size=\"small\"\n variant=\"outlined\"\n color={\n entitiesFollow.isFollowingEntity(entityRef)\n ? 'secondary'\n : 'primary'\n }\n onClick={() => {\n if (entitiesFollow.isFollowingEntity(entityRef)) {\n entitiesFollow.unfollowEntity(entityRef);\n } else {\n entitiesFollow.followEntity(entityRef);\n }\n }}\n startIcon={\n entitiesFollow.isFollowingEntity(entityRef) ? (\n <VisibilityOff />\n ) : (\n <Visibility />\n )\n }\n >\n {entitiesFollow.isFollowingEntity(entityRef)\n ? t('entityButton.unfollow')\n : t('entityButton.follow')}\n </Button>\n </Grid>\n )}\n </Grid>\n );\n};\n\nexport const EntityChip = (props: {\n entity: Entity | string;\n useHref?: boolean;\n}) => {\n const { entity } = props;\n const entityRoute = useRouteRef(entityRouteRef);\n const { primaryTitle, Icon } = useEntityPresentation(entity);\n const navigate = useNavigate();\n const entityRef =\n typeof entity === 'string' ? entity : stringifyEntityRef(entity);\n return (\n <Tooltip\n title={<EntityTooltip entity={entity} />}\n arrow\n enterDelay={400}\n interactive\n >\n <Chip\n label={primaryTitle}\n size=\"small\"\n icon={Icon ? <Icon fontSize=\"small\" /> : undefined}\n variant=\"outlined\"\n className=\"qetaEntityChip\"\n component=\"a\"\n href={props.useHref ? entityRoute({ entityRef }) : undefined}\n target={props.useHref ? '_blank' : undefined}\n onClick={\n !props.useHref\n ? () => {\n navigate(entityRoute({ entityRef }));\n }\n : undefined\n }\n clickable\n />\n </Tooltip>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;AAoBA,MAAM,KAAA,uBAAyC,GAAI,EAAA;AAEnD,MAAM,aAAA,GAAgB,CAAC,KAAuC,KAAA;AAC5D,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAA,MAAM,YACJ,OAAO,MAAA,KAAW,QAAW,GAAA,MAAA,GAAS,mBAAmB,MAAM,CAAA;AACjE,EAAM,MAAA,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N,SAAS,EAAA;AAAA;AAAA;AACX,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"EntityChip.esm.js","sources":["../../../src/components/TagsAndEntities/EntityChip.tsx"],"sourcesContent":["import { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useState, useEffect } from 'react';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { entityRouteRef } from '../../routes';\nimport { qetaApiRef } from '../../api';\nimport { EntityResponse } from '@drodil/backstage-plugin-qeta-common';\nimport { useEntityFollow, useTranslation } from '../../hooks';\nimport {\n Box,\n Button,\n Chip,\n Grid,\n Tooltip,\n Typography,\n} from '@material-ui/core';\nimport VisibilityOff from '@material-ui/icons/VisibilityOff';\nimport Visibility from '@material-ui/icons/Visibility';\nimport { useNavigate } from 'react-router-dom';\n\nconst cache: Map<string, EntityResponse> = new Map();\n\nconst EntityTooltip = (props: { entity: Entity | string }) => {\n const { entity } = props;\n const entityRef =\n typeof entity === 'string' ? entity : stringifyEntityRef(entity);\n const qetaApi = useApi(qetaApiRef);\n const { primaryTitle, secondaryTitle, Icon } = useEntityPresentation(entity);\n const { t } = useTranslation();\n const entitiesFollow = useEntityFollow();\n const [resp, setResp] = useState<undefined | EntityResponse>();\n\n useEffect(() => {\n if (cache.has(entityRef)) {\n setResp(cache.get(entityRef));\n return;\n }\n\n qetaApi.getEntity(entityRef).then(res => {\n if (res) {\n cache.set(entityRef, res);\n setResp(res);\n }\n });\n }, [qetaApi, entityRef]);\n\n if (!resp) {\n return null;\n }\n\n return (\n <Grid container style={{ padding: '0.5em' }} spacing={1}>\n <Grid item xs={12}>\n <Box style={{ display: 'flex', alignItems: 'center' }}>\n {Icon ? <Icon fontSize=\"small\" /> : null}\n <Typography variant=\"h6\">{primaryTitle}</Typography>\n </Box>\n <Typography variant=\"subtitle1\">{secondaryTitle}</Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n {t('common.posts', { count: resp.postsCount, itemType: 'post' })}\n {' · '}\n {t('common.followers', { count: resp.followerCount })}\n </Typography>\n </Grid>\n {!entitiesFollow.loading && (\n <Grid item xs={12}>\n <Button\n size=\"small\"\n variant=\"outlined\"\n color={\n entitiesFollow.isFollowingEntity(entityRef)\n ? 'secondary'\n : 'primary'\n }\n onClick={() => {\n if (entitiesFollow.isFollowingEntity(entityRef)) {\n entitiesFollow.unfollowEntity(entityRef);\n } else {\n entitiesFollow.followEntity(entityRef);\n }\n }}\n startIcon={\n entitiesFollow.isFollowingEntity(entityRef) ? (\n <VisibilityOff />\n ) : (\n <Visibility />\n )\n }\n >\n {entitiesFollow.isFollowingEntity(entityRef)\n ? t('entityButton.unfollow')\n : t('entityButton.follow')}\n </Button>\n </Grid>\n )}\n </Grid>\n );\n};\n\nexport const EntityChip = (props: {\n entity: Entity | string;\n useHref?: boolean;\n}) => {\n const { entity } = props;\n const entityRoute = useRouteRef(entityRouteRef);\n const { primaryTitle, Icon } = useEntityPresentation(entity);\n const navigate = useNavigate();\n const entityRef =\n typeof entity === 'string' ? entity : stringifyEntityRef(entity);\n return (\n <Tooltip\n title={<EntityTooltip entity={entity} />}\n arrow\n enterDelay={400}\n interactive\n >\n <Chip\n label={primaryTitle}\n size=\"small\"\n icon={Icon ? <Icon fontSize=\"small\" /> : undefined}\n variant=\"outlined\"\n className=\"qetaEntityChip\"\n component=\"a\"\n href={props.useHref ? entityRoute({ entityRef }) : undefined}\n target={props.useHref ? '_blank' : undefined}\n onClick={\n !props.useHref\n ? () => {\n navigate(entityRoute({ entityRef }));\n }\n : undefined\n }\n clickable\n />\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,KAAA,uBAAyC,GAAI,EAAA;AAEnD,MAAM,aAAA,GAAgB,CAAC,KAAuC,KAAA;AAC5D,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAA,MAAM,YACJ,OAAO,MAAA,KAAW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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;;;;"}
@@ -1,4 +1,5 @@
1
- import React__default, { useEffect } from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { useState, useEffect } from 'react';
2
3
  import { useRouteRef, useApi } from '@backstage/core-plugin-api';
3
4
  import { tagRouteRef } from '../../routes.esm.js';
4
5
  import { qetaApiRef } from '../../api.esm.js';
@@ -11,6 +12,9 @@ import '@backstage/catalog-model';
11
12
  import 'dataloader';
12
13
  import '@backstage/plugin-catalog-react';
13
14
  import 'react-use/lib/useAsync';
15
+ import '@backstage/plugin-permission-react';
16
+ import '@drodil/backstage-plugin-qeta-common';
17
+ import '@backstage/plugin-permission-common';
14
18
  import { Tooltip, Chip, Grid, Typography, Button } from '@material-ui/core';
15
19
  import VisibilityOff from '@material-ui/icons/VisibilityOff';
16
20
  import Visibility from '@material-ui/icons/Visibility';
@@ -21,7 +25,7 @@ const TagTooltip = (props) => {
21
25
  const qetaApi = useApi(qetaApiRef);
22
26
  const { t } = useTranslation();
23
27
  const tags = useTagsFollow();
24
- const [resp, setResp] = React__default.useState();
28
+ const [resp, setResp] = useState();
25
29
  useEffect(() => {
26
30
  if (cache.has(tag)) {
27
31
  setResp(cache.get(tag));
@@ -45,52 +49,61 @@ const TagTooltip = (props) => {
45
49
  if (!resp) {
46
50
  return null;
47
51
  }
48
- return /* @__PURE__ */ React__default.createElement(Grid, { container: true, style: { padding: "0.5em" }, spacing: 1 }, /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "h6" }, tag)), resp.id > 0 && /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, t("common.posts", { count: resp.postsCount, itemType: "post" }), " \xB7 ", t("common.followers", { count: resp.followerCount }))), resp.description && /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(MarkdownRenderer, { content: resp.description })), !tags.loading && resp.id !== 0 && /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(
49
- Button,
50
- {
51
- size: "small",
52
- variant: "outlined",
53
- color: tags.isFollowingTag(tag) ? "secondary" : "primary",
54
- onClick: () => {
55
- if (tags.isFollowingTag(tag)) {
56
- tags.unfollowTag(tag);
57
- } else {
58
- tags.followTag(tag);
59
- }
60
- },
61
- startIcon: tags.isFollowingTag(tag) ? /* @__PURE__ */ React__default.createElement(VisibilityOff, null) : /* @__PURE__ */ React__default.createElement(Visibility, null)
62
- },
63
- tags.isFollowingTag(tag) ? t("tagButton.unfollow") : t("tagButton.follow")
64
- )));
52
+ return /* @__PURE__ */ jsxs(Grid, { container: true, style: { padding: "0.5em" }, spacing: 1, children: [
53
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: tag }) }),
54
+ resp.id > 0 && /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
55
+ t("common.posts", { count: resp.postsCount, itemType: "post" }),
56
+ " \xB7 ",
57
+ t("common.followers", { count: resp.followerCount })
58
+ ] }) }),
59
+ resp.description && /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(MarkdownRenderer, { content: resp.description }) }),
60
+ !tags.loading && resp.id !== 0 && /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
61
+ Button,
62
+ {
63
+ size: "small",
64
+ variant: "outlined",
65
+ color: tags.isFollowingTag(tag) ? "secondary" : "primary",
66
+ onClick: () => {
67
+ if (tags.isFollowingTag(tag)) {
68
+ tags.unfollowTag(tag);
69
+ } else {
70
+ tags.followTag(tag);
71
+ }
72
+ },
73
+ startIcon: tags.isFollowingTag(tag) ? /* @__PURE__ */ jsx(VisibilityOff, {}) : /* @__PURE__ */ jsx(Visibility, {}),
74
+ children: tags.isFollowingTag(tag) ? t("tagButton.unfollow") : t("tagButton.follow")
75
+ }
76
+ ) })
77
+ ] });
65
78
  };
66
79
  const TagChip = (props) => {
67
80
  const tagRoute = useRouteRef(tagRouteRef);
68
81
  const navigate = useNavigate();
69
82
  const { tag } = props;
70
- return /* @__PURE__ */ React__default.createElement(
83
+ return /* @__PURE__ */ jsx(
71
84
  Tooltip,
72
85
  {
73
86
  arrow: true,
74
- title: /* @__PURE__ */ React__default.createElement(TagTooltip, { tag }),
87
+ title: /* @__PURE__ */ jsx(TagTooltip, { tag }),
75
88
  enterDelay: 400,
76
- interactive: true
77
- },
78
- /* @__PURE__ */ React__default.createElement(
79
- Chip,
80
- {
81
- label: tag,
82
- size: "small",
83
- className: "qetaTagChip",
84
- component: "a",
85
- style: props.style,
86
- href: props.useHref ? tagRoute({ tag }) : void 0,
87
- target: props.useHref ? "_blank" : void 0,
88
- onClick: !props.useHref ? () => {
89
- navigate(tagRoute({ tag }));
90
- } : void 0,
91
- clickable: true
92
- }
93
- )
89
+ interactive: true,
90
+ children: /* @__PURE__ */ jsx(
91
+ Chip,
92
+ {
93
+ label: tag,
94
+ size: "small",
95
+ className: "qetaTagChip",
96
+ component: "a",
97
+ style: props.style,
98
+ href: props.useHref ? tagRoute({ tag }) : void 0,
99
+ target: props.useHref ? "_blank" : void 0,
100
+ onClick: !props.useHref ? () => {
101
+ navigate(tagRoute({ tag }));
102
+ } : void 0,
103
+ clickable: true
104
+ }
105
+ )
106
+ }
94
107
  );
95
108
  };
96
109
 
@@ -1 +1 @@
1
- {"version":3,"file":"TagChip.esm.js","sources":["../../../src/components/TagsAndEntities/TagChip.tsx"],"sourcesContent":["import React, { CSSProperties, useEffect } 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, useTranslation } from '../../hooks';\nimport { Button, Chip, Grid, Tooltip, Typography } from '@material-ui/core';\nimport VisibilityOff from '@material-ui/icons/VisibilityOff';\nimport Visibility from '@material-ui/icons/Visibility';\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 } = useTranslation();\n const tags = useTagsFollow();\n const [resp, setResp] = React.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 <Typography variant=\"h6\">{tag}</Typography>\n </Grid>\n {resp.id > 0 && (\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 )}\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};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAM,KAAA,uBAAsC,GAAI,EAAA;AAEhD,MAAM,UAAA,GAAa,CAAC,KAA2B,KAAA;AAC7C,EAAM,MAAA,EAAE,KAAQ,GAAA,KAAA;AAChB,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA;AACjC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,OAAO,aAAc,EAAA;AAC3B,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAIA,eAAM,QAAkC,EAAA;AAEhE,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,KAAA,CAAM,GAAI,CAAA,GAAG,CAAG,EAAA;AAClB,MAAQ,OAAA,CAAA,KAAA,CAAM,GAAI,CAAA,GAAG,CAAC,CAAA;AACtB,MAAA;AAAA;AAGF,IAAA,OAAA,CAAQ,MAAO,CAA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,EAAW,GAAU,EAAA,CAAA;AAAA,MAC7B,UAAY,EAAA,GAAA;AAAA,MACZ,WAAW,EAAA;AAAA,KAAA;AAAA,oBAEXA,cAAA,CAAA,aAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA,GAAA;AAAA,QACP,IAAK,EAAA,OAAA;AAAA,QACL,SAAU,EAAA,aAAA;AAAA,QACV,SAAU,EAAA,GAAA;AAAA,QACV,OAAO,KAAM,CAAA,KAAA;AAAA,QACb,MAAM,KAAM,CAAA,OAAA,GAAU,SAAS,EAAE,GAAA,EAAK,CAAI,GAAA,KAAA,CAAA;AAAA,QAC1C,MAAA,EAAQ,KAAM,CAAA,OAAA,GAAU,QAAW,GAAA,KAAA,CAAA;AAAA,QACnC,OACE,EAAA,CAAC,KAAM,CAAA,OAAA,GACH,MAAM;AACJ,UAAA,QAAA,CAAS,QAAS,CAAA,EAAE,GAAI,EAAC,CAAC,CAAA;AAAA,SAE5B,GAAA,KAAA,CAAA;AAAA,QAEN,SAAS,EAAA;AAAA;AAAA;AACX,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"TagChip.esm.js","sources":["../../../src/components/TagsAndEntities/TagChip.tsx"],"sourcesContent":["import { useState, CSSProperties, useEffect } 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, useTranslation } from '../../hooks';\nimport { Button, Chip, Grid, Tooltip, Typography } from '@material-ui/core';\nimport VisibilityOff from '@material-ui/icons/VisibilityOff';\nimport Visibility from '@material-ui/icons/Visibility';\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 } = useTranslation();\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 <Typography variant=\"h6\">{tag}</Typography>\n </Grid>\n {resp.id > 0 && (\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 )}\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};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,KAAA,uBAAsC,GAAI,EAAA;AAEhD,MAAM,UAAA,GAAa,CAAC,KAA2B,KAAA;AAC7C,EAAM,MAAA,EAAE,KAAQ,GAAA,KAAA;AAChB,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA;AACjC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,OAAO,aAAc,EAAA;AAC3B,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,QAAkC,EAAA;AAE1D,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,KAAA,CAAM,GAAI,CAAA,GAAG,CAAG,EAAA;AAClB,MAAQ,OAAA,CAAA,KAAA,CAAM,GAAI,CAAA,GAAG,CAAC,CAAA;AACtB,MAAA;AAAA;AAGF,IAAA,OAAA,CAAQ,MAAO,CAAA,GAAG,CAAE,CAAA,IAAA,CAAK,CAAO,GAAA,KAAA;AAC9B,MAAA,IAAI,GAAK,EAAA;AACP,QAAM,KAAA,CAAA,GAAA,CAAI,KAAK,GAAG,CAAA;AAClB,QAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,OACN,MAAA;AACL,QAAQ,OAAA,CAAA;AAAA,UACN,EAAI,EAAA,CAAA;AAAA,UACJ,GAAA;AAAA,UACA,UAAY,EAAA,CAAA;AAAA,UACZ,aAAe,EAAA,CAAA;AAAA,UACf,WAAA,EAAa,EAAE,wBAAwB;AAAA,SACxC,CAAA;AAAA;AACH,KACD,CAAA;AAAA,GACA,EAAA,CAAC,OAAS,EAAA,GAAA,EAAK,CAAC,CAAC,CAAA;AAEpB,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAO,OAAA,IAAA;AAAA;AAGT,EAC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,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;;;;"}
@@ -1,4 +1,4 @@
1
- import React__default from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { EntityChip } from './EntityChip.esm.js';
3
3
  import { TagChip } from './TagChip.esm.js';
4
4
 
@@ -7,7 +7,10 @@ const TagsAndEntities = (props) => {
7
7
  if ((!entity.tags || entity.tags.length === 0) && (!entity.entities || entity.entities.length === 0)) {
8
8
  return null;
9
9
  }
10
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, entity.tags && entity.tags.map((tag) => /* @__PURE__ */ React__default.createElement(TagChip, { key: tag, tag })), entity.entities && entity.entities.map((component) => /* @__PURE__ */ React__default.createElement(EntityChip, { entity: component, key: component })));
10
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
11
+ entity.tags && entity.tags.map((tag) => /* @__PURE__ */ jsx(TagChip, { tag }, tag)),
12
+ entity.entities && entity.entities.map((component) => /* @__PURE__ */ jsx(EntityChip, { entity: component }, component))
13
+ ] });
11
14
  };
12
15
 
13
16
  export { TagsAndEntities };
@@ -1 +1 @@
1
- {"version":3,"file":"TagsAndEntities.esm.js","sources":["../../../src/components/TagsAndEntities/TagsAndEntities.tsx"],"sourcesContent":["import {\n CollectionResponse,\n PostResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport React from 'react';\nimport { EntityChip } from './EntityChip';\nimport { TagChip } from './TagChip';\n\nexport const TagsAndEntities = (props: {\n entity: PostResponse | CollectionResponse;\n}) => {\n const { entity } = props;\n\n if (\n (!entity.tags || entity.tags.length === 0) &&\n (!entity.entities || entity.entities.length === 0)\n ) {\n return null;\n }\n\n return (\n <>\n {entity.tags && entity.tags.map(tag => <TagChip key={tag} tag={tag} />)}\n {entity.entities &&\n entity.entities.map(component => (\n <EntityChip entity={component} key={component} />\n ))}\n </>\n );\n};\n"],"names":["React"],"mappings":";;;;AAQa,MAAA,eAAA,GAAkB,CAAC,KAE1B,KAAA;AACJ,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AAEnB,EAAA,IAAA,CACG,CAAC,MAAA,CAAO,IAAQ,IAAA,MAAA,CAAO,IAAK,CAAA,MAAA,KAAW,CACvC,MAAA,CAAC,MAAO,CAAA,QAAA,IAAY,MAAO,CAAA,QAAA,CAAS,WAAW,CAChD,CAAA,EAAA;AACA,IAAO,OAAA,IAAA;AAAA;AAGT,EACE,uBAAAA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA,EACG,MAAO,CAAA,IAAA,IAAQ,MAAO,CAAA,IAAA,CAAK,GAAI,CAAA,CAAA,GAAA,qBAAQA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,GAAK,EAAA,GAAA,EAAK,GAAU,EAAA,CAAE,CACrE,EAAA,MAAA,CAAO,QACN,IAAA,MAAA,CAAO,QAAS,CAAA,GAAA,CAAI,CAClB,SAAA,qBAAAA,cAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,MAAA,EAAQ,SAAW,EAAA,GAAA,EAAK,SAAW,EAAA,CAChD,CACL,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TagsAndEntities.esm.js","sources":["../../../src/components/TagsAndEntities/TagsAndEntities.tsx"],"sourcesContent":["import {\n CollectionResponse,\n PostResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { EntityChip } from './EntityChip';\nimport { TagChip } from './TagChip';\n\nexport const TagsAndEntities = (props: {\n entity: PostResponse | CollectionResponse;\n}) => {\n const { entity } = props;\n\n if (\n (!entity.tags || entity.tags.length === 0) &&\n (!entity.entities || entity.entities.length === 0)\n ) {\n return null;\n }\n\n return (\n <>\n {entity.tags && entity.tags.map(tag => <TagChip key={tag} tag={tag} />)}\n {entity.entities &&\n entity.entities.map(component => (\n <EntityChip entity={component} key={component} />\n ))}\n </>\n );\n};\n"],"names":[],"mappings":";;;;AAOa,MAAA,eAAA,GAAkB,CAAC,KAE1B,KAAA;AACJ,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AAEnB,EAAA,IAAA,CACG,CAAC,MAAA,CAAO,IAAQ,IAAA,MAAA,CAAO,IAAK,CAAA,MAAA,KAAW,CACvC,MAAA,CAAC,MAAO,CAAA,QAAA,IAAY,MAAO,CAAA,QAAA,CAAS,WAAW,CAChD,CAAA,EAAA;AACA,IAAO,OAAA,IAAA;AAAA;AAGT,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IAAO,MAAA,CAAA,IAAA,IAAQ,OAAO,IAAK,CAAA,GAAA,CAAI,yBAAQ,GAAA,CAAA,OAAA,EAAA,EAAkB,GAAL,EAAA,EAAA,GAAe,CAAE,CAAA;AAAA,IACrE,MAAA,CAAO,QACN,IAAA,MAAA,CAAO,QAAS,CAAA,GAAA,CAAI,CAClB,SAAA,qBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,MAAA,EAAQ,SAAgB,EAAA,EAAA,SAAW,CAChD;AAAA,GACL,EAAA,CAAA;AAEJ;;;;"}
@@ -1,12 +1,16 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
1
2
  import { useRouteRef } from '@backstage/core-plugin-api';
2
3
  import { userRouteRef } from '../../routes.esm.js';
3
4
  import '../../api.esm.js';
4
5
  import 'react-use';
5
- import React__default from 'react';
6
+ import 'react';
6
7
  import { useTranslation } from '../../hooks/useTranslation.esm.js';
7
8
  import { useUserInfo } from '../../hooks/useEntityAuthor.esm.js';
8
9
  import { useUserFollow } from '../../hooks/useUserFollow.esm.js';
9
10
  import { useIdentityApi } from '../../hooks/useIdentityApi.esm.js';
11
+ import '@backstage/plugin-permission-react';
12
+ import '@drodil/backstage-plugin-qeta-common';
13
+ import '@backstage/plugin-permission-common';
10
14
  import { useEntityPresentation } from '@backstage/plugin-catalog-react';
11
15
  import { useNavigate } from 'react-router-dom';
12
16
  import { Grid, Box, Avatar, Typography, Button, Tooltip, Chip } from '@material-ui/core';
@@ -25,32 +29,39 @@ const UserTooltip = (props) => {
25
29
  []
26
30
  );
27
31
  const users = useUserFollow();
28
- return /* @__PURE__ */ React__default.createElement(Grid, { container: true, style: { padding: "0.5em" }, spacing: 1 }, /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(Box, { style: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ React__default.createElement(Box, { style: { display: "inline-block", marginRight: "1em" } }, /* @__PURE__ */ React__default.createElement(
29
- Avatar,
30
- {
31
- src: user?.spec?.profile?.picture,
32
- alt: name,
33
- variant: "rounded",
34
- style: { width: "1em", height: "1em" }
35
- },
36
- initials
37
- )), /* @__PURE__ */ React__default.createElement(Typography, { variant: "h6", style: { display: "inline" } }, name))), /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, secondaryTitle)), !users.loading && currentUser?.userEntityRef !== entityRef && /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(
38
- Button,
39
- {
40
- size: "small",
41
- variant: "outlined",
42
- color: users.isFollowingUser(entityRef) ? "secondary" : "primary",
43
- onClick: () => {
44
- if (users.isFollowingUser(entityRef)) {
45
- users.unfollowUser(entityRef);
46
- } else {
47
- users.followUser(entityRef);
32
+ return /* @__PURE__ */ jsxs(Grid, { container: true, style: { padding: "0.5em" }, spacing: 1, children: [
33
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(Box, { style: { display: "flex", alignItems: "center" }, children: [
34
+ /* @__PURE__ */ jsx(Box, { style: { display: "inline-block", marginRight: "1em" }, children: /* @__PURE__ */ jsx(
35
+ Avatar,
36
+ {
37
+ src: user?.spec?.profile?.picture,
38
+ alt: name,
39
+ variant: "rounded",
40
+ style: { width: "1em", height: "1em" },
41
+ children: initials
48
42
  }
49
- },
50
- startIcon: users.isFollowingUser(entityRef) ? /* @__PURE__ */ React__default.createElement(VisibilityOff, null) : /* @__PURE__ */ React__default.createElement(Visibility, null)
51
- },
52
- users.isFollowingUser(entityRef) ? t("userButton.unfollow") : t("userButton.follow")
53
- )));
43
+ ) }),
44
+ /* @__PURE__ */ jsx(Typography, { variant: "h6", style: { display: "inline" }, children: name })
45
+ ] }) }),
46
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: secondaryTitle }) }),
47
+ !users.loading && currentUser?.userEntityRef !== entityRef && /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
48
+ Button,
49
+ {
50
+ size: "small",
51
+ variant: "outlined",
52
+ color: users.isFollowingUser(entityRef) ? "secondary" : "primary",
53
+ onClick: () => {
54
+ if (users.isFollowingUser(entityRef)) {
55
+ users.unfollowUser(entityRef);
56
+ } else {
57
+ users.followUser(entityRef);
58
+ }
59
+ },
60
+ startIcon: users.isFollowingUser(entityRef) ? /* @__PURE__ */ jsx(VisibilityOff, {}) : /* @__PURE__ */ jsx(Visibility, {}),
61
+ children: users.isFollowingUser(entityRef) ? t("userButton.unfollow") : t("userButton.follow")
62
+ }
63
+ ) })
64
+ ] });
54
65
  };
55
66
  const UserChip = (props) => {
56
67
  const navigate = useNavigate();
@@ -61,29 +72,29 @@ const UserChip = (props) => {
61
72
  entityRef.startsWith("user:") ? entityRef : `user:${entityRef}`
62
73
  );
63
74
  if (entityRef === "anonymous") {
64
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, t("userLink.anonymous"));
75
+ return /* @__PURE__ */ jsx(Fragment, { children: t("userLink.anonymous") });
65
76
  }
66
- return /* @__PURE__ */ React__default.createElement(
77
+ return /* @__PURE__ */ jsx(
67
78
  Tooltip,
68
79
  {
69
80
  arrow: true,
70
- title: /* @__PURE__ */ React__default.createElement(UserTooltip, { entityRef }),
81
+ title: /* @__PURE__ */ jsx(UserTooltip, { entityRef }),
71
82
  enterDelay: 400,
72
- interactive: true
73
- },
74
- /* @__PURE__ */ React__default.createElement(
75
- Chip,
76
- {
77
- label: userName,
78
- size: "small",
79
- className: "qetaTagChip",
80
- component: "a",
81
- onClick: () => {
82
- navigate(`${userRoute()}/${entityRef}`);
83
- },
84
- clickable: true
85
- }
86
- )
83
+ interactive: true,
84
+ children: /* @__PURE__ */ jsx(
85
+ Chip,
86
+ {
87
+ label: userName,
88
+ size: "small",
89
+ className: "qetaTagChip",
90
+ component: "a",
91
+ onClick: () => {
92
+ navigate(`${userRoute()}/${entityRef}`);
93
+ },
94
+ clickable: true
95
+ }
96
+ )
97
+ }
87
98
  );
88
99
  };
89
100
 
@@ -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 {\n useIdentityApi,\n useTranslation,\n useUserFollow,\n useUserInfo,\n} from '../../hooks';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport React from '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';\n\nexport const UserTooltip = (props: {\n entityRef: string;\n anonymous?: boolean;\n}) => {\n const { entityRef, anonymous } = props;\n const { t } = useTranslation();\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: '1em' }}>\n <Avatar\n src={user?.spec?.profile?.picture}\n alt={name}\n variant=\"rounded\"\n style={{ width: '1em', height: '1em' }}\n >\n {initials}\n </Avatar>\n </Box>\n <Typography variant=\"h6\" style={{ display: 'inline' }}>\n {name}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={12}>\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 } = useTranslation();\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\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,WAAY,EAAA;AAC7B,EAAM,MAAA,EAAE,WAAc,GAAA,KAAA;AACtB,EAAM,MAAA,SAAA,GAAY,YAAY,YAAY,CAAA;AAC1C,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAM,MAAA,EAAE,YAAc,EAAA,QAAA,EAAa,GAAA,qBAAA;AAAA,IACjC,UAAU,UAAW,CAAA,OAAO,CAAI,GAAA,SAAA,GAAY,QAAQ,SAAS,CAAA;AAAA,GAC/D;AACA,EAAA,IAAI,cAAc,WAAa,EAAA;AAC7B,IAAO,uBAAAA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA,EAAG,CAAE,CAAA,oBAAoB,CAAE,CAAA;AAAA;AAEpC,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,KAAK,EAAA,IAAA;AAAA,MACL,KAAA,kBAAQA,cAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,SAAsB,EAAA,CAAA;AAAA,MAC1C,UAAY,EAAA,GAAA;AAAA,MACZ,WAAW,EAAA;AAAA,KAAA;AAAA,oBAEXA,cAAA,CAAA,aAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA,QAAA;AAAA,QACP,IAAK,EAAA,OAAA;AAAA,QACL,SAAU,EAAA,aAAA;AAAA,QACV,SAAU,EAAA,GAAA;AAAA,QACV,SAAS,MAAM;AACb,UAAA,QAAA,CAAS,CAAG,EAAA,SAAA,EAAW,CAAA,CAAA,EAAI,SAAS,CAAE,CAAA,CAAA;AAAA,SACxC;AAAA,QACA,SAAS,EAAA;AAAA;AAAA;AACX,GACF;AAEJ;;;;"}
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 {\n useIdentityApi,\n useTranslation,\n useUserFollow,\n useUserInfo,\n} 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';\n\nexport const UserTooltip = (props: {\n entityRef: string;\n anonymous?: boolean;\n}) => {\n const { entityRef, anonymous } = props;\n const { t } = useTranslation();\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: '1em' }}>\n <Avatar\n src={user?.spec?.profile?.picture}\n alt={name}\n variant=\"rounded\"\n style={{ width: '1em', height: '1em' }}\n >\n {initials}\n </Avatar>\n </Box>\n <Typography variant=\"h6\" style={{ display: 'inline' }}>\n {name}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={12}>\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 } = useTranslation();\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":";;;;;;;;;;;;;;;;;;;AAsBa,MAAA,WAAA,GAAc,CAAC,KAGtB,KAAA;AACJ,EAAM,MAAA,EAAE,SAAW,EAAA,SAAA,EAAc,GAAA,KAAA;AACjC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,EAAE,IAAA,EAAM,QAAU,EAAA,IAAA,EAAM,gBAAmB,GAAA,WAAA;AAAA,IAC/C,SAAA;AAAA,IACA,aAAa,SAAc,KAAA;AAAA,GAC7B;AAEA,EAAM,MAAA,EAAE,KAAO,EAAA,WAAA,EAAgB,GAAA,cAAA;AAAA,IAC7B,CAAA,GAAA,KAAO,IAAI,oBAAqB,EAAA;AAAA,IAChC;AAAC,GACH;AACA,EAAA,MAAM,QAAQ,aAAc,EAAA;AAE5B,EACE,uBAAA,IAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAS,IAAC,EAAA,KAAA,EAAO,EAAE,OAAS,EAAA,OAAA,EAAW,EAAA,OAAA,EAAS,CACpD,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,EACb,EAAA,QAAA,kBAAA,IAAA,CAAC,GAAI,EAAA,EAAA,KAAA,EAAO,EAAE,OAAA,EAAS,MA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