@drodil/backstage-plugin-qeta-react 3.49.1 → 3.51.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.
Files changed (83) hide show
  1. package/dist/components/AIAnswerCard/AIAnswerCard.esm.js +2 -2
  2. package/dist/components/AIAnswerCard/AIAnswerCard.esm.js.map +1 -1
  3. package/dist/components/AnswerCard/AnswerCard.esm.js +9 -3
  4. package/dist/components/AnswerCard/AnswerCard.esm.js.map +1 -1
  5. package/dist/components/AnswerForm/AnswerForm.esm.js +6 -1
  6. package/dist/components/AnswerForm/AnswerForm.esm.js.map +1 -1
  7. package/dist/components/ArticleContent/ArticleButtons.esm.js +45 -40
  8. package/dist/components/ArticleContent/ArticleButtons.esm.js.map +1 -1
  9. package/dist/components/ArticleContent/ArticleContent.esm.js +2 -0
  10. package/dist/components/ArticleContent/ArticleContent.esm.js.map +1 -1
  11. package/dist/components/AuthorBox/AuthorBox.esm.js +18 -3
  12. package/dist/components/AuthorBox/AuthorBox.esm.js.map +1 -1
  13. package/dist/components/AuthorBox/AuthorBoxes.esm.js +1 -3
  14. package/dist/components/AuthorBox/AuthorBoxes.esm.js.map +1 -1
  15. package/dist/components/Badges/BadgeChip.esm.js +231 -0
  16. package/dist/components/Badges/BadgeChip.esm.js.map +1 -0
  17. package/dist/components/Badges/UserBadges.esm.js +79 -0
  18. package/dist/components/Badges/UserBadges.esm.js.map +1 -0
  19. package/dist/components/Buttons/FavoriteButton.esm.js +2 -2
  20. package/dist/components/Buttons/FavoriteButton.esm.js.map +1 -1
  21. package/dist/components/Buttons/LinkButton.esm.js +4 -3
  22. package/dist/components/Buttons/LinkButton.esm.js.map +1 -1
  23. package/dist/components/Buttons/VoteButtons.esm.js +6 -3
  24. package/dist/components/Buttons/VoteButtons.esm.js.map +1 -1
  25. package/dist/components/CommentSection/CommentListItem.esm.js +2 -2
  26. package/dist/components/CommentSection/CommentListItem.esm.js.map +1 -1
  27. package/dist/components/CommentSection/CommentSection.esm.js +3 -2
  28. package/dist/components/CommentSection/CommentSection.esm.js.map +1 -1
  29. package/dist/components/FilterPanel/FilterPanel.esm.js +2 -1
  30. package/dist/components/FilterPanel/FilterPanel.esm.js.map +1 -1
  31. package/dist/components/HomePageCards/ImpactCard.esm.js +25 -1
  32. package/dist/components/HomePageCards/ImpactCard.esm.js.map +1 -1
  33. package/dist/components/LeftMenu/LeftMenu.esm.js +7 -2
  34. package/dist/components/LeftMenu/LeftMenu.esm.js.map +1 -1
  35. package/dist/components/LinkCard/LinkCard.esm.js +43 -38
  36. package/dist/components/LinkCard/LinkCard.esm.js.map +1 -1
  37. package/dist/components/Links/Links.esm.js +17 -1
  38. package/dist/components/Links/Links.esm.js.map +1 -1
  39. package/dist/components/{DeleteModal → Modals}/DeleteModal.esm.js +10 -10
  40. package/dist/components/Modals/DeleteModal.esm.js.map +1 -0
  41. package/dist/components/Modals/ObsoleteModal.esm.js +94 -0
  42. package/dist/components/Modals/ObsoleteModal.esm.js.map +1 -0
  43. package/dist/components/Modals/ValidReviewModal.esm.js +94 -0
  44. package/dist/components/Modals/ValidReviewModal.esm.js.map +1 -0
  45. package/dist/components/PostAnonymouslyCheckbox/PostAnonymouslyCheckbox.esm.js +2 -1
  46. package/dist/components/PostAnonymouslyCheckbox/PostAnonymouslyCheckbox.esm.js.map +1 -1
  47. package/dist/components/PostForm/PostForm.esm.js +2 -0
  48. package/dist/components/PostForm/PostForm.esm.js.map +1 -1
  49. package/dist/components/PostsContainer/PostListItem.esm.js +51 -14
  50. package/dist/components/PostsContainer/PostListItem.esm.js.map +1 -1
  51. package/dist/components/PostsGrid/PostsGridItem.esm.js +15 -4
  52. package/dist/components/PostsGrid/PostsGridItem.esm.js.map +1 -1
  53. package/dist/components/QuestionCard/QuestionCard.esm.js +42 -37
  54. package/dist/components/QuestionCard/QuestionCard.esm.js.map +1 -1
  55. package/dist/components/StatsChart/StatsChart.esm.js +36 -0
  56. package/dist/components/StatsChart/StatsChart.esm.js.map +1 -1
  57. package/dist/components/SuggestionsCard/SuggestionsCard.esm.js +2 -2
  58. package/dist/components/SuggestionsCard/SuggestionsCard.esm.js.map +1 -1
  59. package/dist/components/TagsGrid/TagGridItem.esm.js +8 -3
  60. package/dist/components/TagsGrid/TagGridItem.esm.js.map +1 -1
  61. package/dist/components/TagsGrid/TagsGrid.esm.js +3 -1
  62. package/dist/components/TagsGrid/TagsGrid.esm.js.map +1 -1
  63. package/dist/components/TemplateList/TemplateForm.esm.js +3 -0
  64. package/dist/components/TemplateList/TemplateForm.esm.js.map +1 -1
  65. package/dist/components/TemplateList/TemplateList.esm.js +3 -0
  66. package/dist/components/TemplateList/TemplateList.esm.js.map +1 -1
  67. package/dist/components/UsersGrid/UsersGridItem.esm.js +38 -19
  68. package/dist/components/UsersGrid/UsersGridItem.esm.js.map +1 -1
  69. package/dist/components/Utility/ObsoleteBanner.esm.js +31 -0
  70. package/dist/components/Utility/ObsoleteBanner.esm.js.map +1 -0
  71. package/dist/hooks/useCanReview.esm.js +36 -0
  72. package/dist/hooks/useCanReview.esm.js.map +1 -0
  73. package/dist/hooks/useEntityAuthor.esm.js +9 -5
  74. package/dist/hooks/useEntityAuthor.esm.js.map +1 -1
  75. package/dist/index.d.ts +86 -2
  76. package/dist/index.esm.js +8 -2
  77. package/dist/index.esm.js.map +1 -1
  78. package/dist/routes.esm.js +6 -1
  79. package/dist/routes.esm.js.map +1 -1
  80. package/dist/translation.esm.js +71 -3
  81. package/dist/translation.esm.js.map +1 -1
  82. package/package.json +2 -2
  83. package/dist/components/DeleteModal/DeleteModal.esm.js.map +0 -1
@@ -18,10 +18,12 @@ import ThumbUp from '@material-ui/icons/ThumbUp';
18
18
  import CheckCircle from '@material-ui/icons/CheckCircle';
19
19
  import DescriptionIcon from '@material-ui/icons/Description';
20
20
  import LinkIcon from '@material-ui/icons/Link';
21
+ import EmojiEvents from '@material-ui/icons/EmojiEvents';
21
22
  import { qetaTranslationRef } from '../../translation.esm.js';
22
23
  import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
23
24
  import useGridItemStyles from '../GridItemStyles/useGridItemStyles.esm.js';
24
25
  import { ClickableLink } from '../Utility/ClickableLink.esm.js';
26
+ import { stringifyEntityRef, parseEntityRef } from '@backstage/catalog-model';
25
27
 
26
28
  const useStyles = makeStyles((theme) => ({
27
29
  statsGrid: {
@@ -45,7 +47,10 @@ const UsersGridItem = (props) => {
45
47
  const localClasses = useStyles();
46
48
  const userRoute = useRouteRef(userRouteRef);
47
49
  const { t } = useTranslationRef(qetaTranslationRef);
48
- const { primaryTitle, Icon } = useEntityPresentation(user.userRef);
50
+ const entityRef = stringifyEntityRef(
51
+ parseEntityRef(user.userRef, { defaultKind: "user" })
52
+ );
53
+ const { primaryTitle, Icon } = useEntityPresentation(entityRef);
49
54
  const {
50
55
  name,
51
56
  initials,
@@ -97,7 +102,21 @@ const UsersGridItem = (props) => {
97
102
  {
98
103
  className: `${classes.cardContent} ${localClasses.flexColumn}`,
99
104
  children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 1, className: localClasses.statsGrid, children: [
100
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsxs(
105
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsxs(
106
+ Box,
107
+ {
108
+ display: "flex",
109
+ flexDirection: "column",
110
+ alignItems: "center",
111
+ className: localClasses.statItem,
112
+ children: [
113
+ /* @__PURE__ */ jsx(EmojiEvents, { fontSize: "small", color: "disabled" }),
114
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.reputation }),
115
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("impactCard.reputation") })
116
+ ]
117
+ }
118
+ ) }),
119
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsxs(
101
120
  Box,
102
121
  {
103
122
  display: "flex",
@@ -111,7 +130,7 @@ const UsersGridItem = (props) => {
111
130
  ]
112
131
  }
113
132
  ) }),
114
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsxs(
133
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsxs(
115
134
  Box,
116
135
  {
117
136
  display: "flex",
@@ -119,13 +138,13 @@ const UsersGridItem = (props) => {
119
138
  alignItems: "center",
120
139
  className: localClasses.statItem,
121
140
  children: [
122
- /* @__PURE__ */ jsx(CheckCircle, { fontSize: "small", color: "disabled" }),
123
- /* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.totalAnswers }),
124
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("common.answers") })
141
+ /* @__PURE__ */ jsx(DescriptionIcon, { fontSize: "small", color: "disabled" }),
142
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.totalArticles }),
143
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("common.articles") })
125
144
  ]
126
145
  }
127
146
  ) }),
128
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsxs(
147
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsxs(
129
148
  Box,
130
149
  {
131
150
  display: "flex",
@@ -133,9 +152,9 @@ const UsersGridItem = (props) => {
133
152
  alignItems: "center",
134
153
  className: localClasses.statItem,
135
154
  children: [
136
- /* @__PURE__ */ jsx(ThumbUp, { fontSize: "small", color: "disabled" }),
137
- /* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.totalVotes }),
138
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("common.votes") })
155
+ /* @__PURE__ */ jsx(LinkIcon, { fontSize: "small", color: "disabled" }),
156
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.totalLinks }),
157
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("common.links") })
139
158
  ]
140
159
  }
141
160
  ) }),
@@ -147,9 +166,9 @@ const UsersGridItem = (props) => {
147
166
  alignItems: "center",
148
167
  className: localClasses.statItem,
149
168
  children: [
150
- /* @__PURE__ */ jsx(DescriptionIcon, { fontSize: "small", color: "disabled" }),
151
- /* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.totalArticles }),
152
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("common.articles") })
169
+ /* @__PURE__ */ jsx(CheckCircle, { fontSize: "small", color: "disabled" }),
170
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.totalAnswers }),
171
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("common.answers") })
153
172
  ]
154
173
  }
155
174
  ) }),
@@ -161,9 +180,9 @@ const UsersGridItem = (props) => {
161
180
  alignItems: "center",
162
181
  className: localClasses.statItem,
163
182
  children: [
164
- /* @__PURE__ */ jsx(Visibility, { fontSize: "small", color: "disabled" }),
165
- /* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.totalViews }),
166
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("common.views") })
183
+ /* @__PURE__ */ jsx(ThumbUp, { fontSize: "small", color: "disabled" }),
184
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.totalVotes }),
185
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("common.votes") })
167
186
  ]
168
187
  }
169
188
  ) }),
@@ -175,9 +194,9 @@ const UsersGridItem = (props) => {
175
194
  alignItems: "center",
176
195
  className: localClasses.statItem,
177
196
  children: [
178
- /* @__PURE__ */ jsx(LinkIcon, { fontSize: "small", color: "disabled" }),
179
- /* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.totalLinks }),
180
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("common.links") })
197
+ /* @__PURE__ */ jsx(Visibility, { fontSize: "small", color: "disabled" }),
198
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.totalViews }),
199
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("common.views") })
181
200
  ]
182
201
  }
183
202
  ) })
@@ -1 +1 @@
1
- {"version":3,"file":"UsersGridItem.esm.js","sources":["../../../src/components/UsersGrid/UsersGridItem.tsx"],"sourcesContent":["import { UserResponse } from '@drodil/backstage-plugin-qeta-common';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { userRouteRef } from '../../routes';\nimport { useIdentityApi } from '../../hooks';\nimport { useEntityAuthor } from '../../hooks/useEntityAuthor';\nimport {\n Avatar,\n Box,\n Card,\n CardContent,\n Grid,\n makeStyles,\n Tooltip,\n Typography,\n} from '@material-ui/core';\nimport { UserFollowButton } from '../Buttons/UserFollowButton';\nimport Visibility from '@material-ui/icons/Visibility';\nimport QuestionAnswerIcon from '@material-ui/icons/QuestionAnswer';\nimport ThumbUpIcon from '@material-ui/icons/ThumbUp';\nimport CheckCircleIcon from '@material-ui/icons/CheckCircle';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport LinkIcon from '@material-ui/icons/Link';\nimport { qetaTranslationRef } from '../../translation.ts';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport useGridItemStyles from '../GridItemStyles/useGridItemStyles';\nimport { ClickableLink } from '../Utility/ClickableLink';\n\nconst useStyles = makeStyles(theme => ({\n statsGrid: {\n marginTop: 'auto',\n },\n statItem: {\n padding: theme.spacing(1),\n borderRadius: theme.shape.borderRadius,\n width: '100%',\n height: '100%',\n justifyContent: 'center',\n },\n flexColumn: {\n display: 'flex',\n flexDirection: 'column',\n },\n}));\n\nexport const UsersGridItem = (props: { user: UserResponse }) => {\n const { user } = props;\n const classes = useGridItemStyles();\n const localClasses = useStyles();\n const userRoute = useRouteRef(userRouteRef);\n const { t } = useTranslationRef(qetaTranslationRef);\n const { primaryTitle, Icon } = useEntityPresentation(user.userRef);\n const {\n name,\n initials,\n user: userEntity,\n secondaryTitle,\n } = useEntityAuthor(user);\n const {\n value: currentUser,\n loading: loadingUser,\n error: userError,\n } = useIdentityApi(api => api.getBackstageIdentity(), []);\n\n const href = `${userRoute()}/${user.userRef}`;\n\n return (\n <Grid item xs={12} md={6} xl={4}>\n <Card className={classes.card}>\n <ClickableLink href={href} ariaLabel={primaryTitle}>\n <Box\n className={classes.cardHeader}\n display=\"flex\"\n alignItems=\"center\"\n >\n {Icon && (\n <Avatar\n src={userEntity?.spec?.profile?.picture}\n className=\"avatar\"\n alt={name}\n variant=\"rounded\"\n style={{ marginRight: 16 }}\n >\n {initials}\n </Avatar>\n )}\n <Box flex={1} minWidth={0}>\n <Tooltip title={secondaryTitle ?? ''} arrow>\n <Typography variant=\"h6\" noWrap>\n {primaryTitle}\n </Typography>\n </Tooltip>\n </Box>\n {!loadingUser &&\n !userError &&\n currentUser?.userEntityRef !== user.userRef ? (\n <Box\n flexShrink={0}\n onClick={e => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n <UserFollowButton userRef={user.userRef} />\n </Box>\n ) : null}\n </Box>\n <CardContent\n className={`${classes.cardContent} ${localClasses.flexColumn}`}\n >\n <Grid container spacing={1} className={localClasses.statsGrid}>\n <Grid item xs={4}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <QuestionAnswerIcon fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalQuestions}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.questions')}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={4}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <CheckCircleIcon fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalAnswers}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.answers')}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={4}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <ThumbUpIcon fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalVotes}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.votes')}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={4}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <DescriptionIcon fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalArticles}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.articles')}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={4}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <Visibility fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalViews}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.views')}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={4}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <LinkIcon fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalLinks}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.links')}\n </Typography>\n </Box>\n </Grid>\n </Grid>\n </CardContent>\n </ClickableLink>\n </Card>\n </Gr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AC9C,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAQ,EAAA,KAAA,EAAO,EAAE,UAAY,EAAA,GAAA,EAC9C,EAAA,QAAA,EAAA,IAAA,CAAK,UACR,EAAA,CAAA;AAAA,gCACA,GAAA,CAAC,cAAW,OAAQ,EAAA,SAAA,EAAU,OAAM,eACjC,EAAA,QAAA,EAAA,CAAA,CAAE,cAAc,CACnB,EAAA;AAAA;AAAA;AAAA,WAEJ,EAAA,CAAA;AAAA,0BACC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,CACb,EAAA,QAAA,kBAAA,IAAA;AAAA,YAAC,GAAA;AAAA,YAAA;AAAA,cACC,OAAQ,EAAA,MAAA;AAAA,cACR,aAAc,EAAA,QAAA;AAAA,cACd,UAAW,EAAA,QAAA;AAAA,cACX,WAAW,YAAa,CAAA,QAAA;AAAA,cAExB,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,QAAS,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,KAAA,EAAM,UAAW,EAAA,CAAA;AAAA,gCAC5C,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAQ,EAAA,KAAA,EAAO,EAAE,UAAY,EAAA,GAAA,EAC9C,EAAA,QAAA,EAAA,IAAA,CAAK,UACR,EAAA,CAAA;AAAA,gCACA,GAAA,CAAC,cAAW,OAAQ,EAAA,SAAA,EAAU,OAAM,eACjC,EAAA,QAAA,EAAA,CAAA,CAAE,cAAc,CACnB,EAAA;AAAA;AAAA;AAAA,WAEJ,EAAA;AAAA,SACF,EAAA;AAAA;AAAA;AACF,GAAA,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"UsersGridItem.esm.js","sources":["../../../src/components/UsersGrid/UsersGridItem.tsx"],"sourcesContent":["import { UserResponse } from '@drodil/backstage-plugin-qeta-common';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { userRouteRef } from '../../routes';\nimport { useIdentityApi } from '../../hooks';\nimport { useEntityAuthor } from '../../hooks/useEntityAuthor';\nimport {\n Avatar,\n Box,\n Card,\n CardContent,\n Grid,\n makeStyles,\n Tooltip,\n Typography,\n} from '@material-ui/core';\nimport { UserFollowButton } from '../Buttons/UserFollowButton';\nimport Visibility from '@material-ui/icons/Visibility';\nimport QuestionAnswerIcon from '@material-ui/icons/QuestionAnswer';\nimport ThumbUpIcon from '@material-ui/icons/ThumbUp';\nimport CheckCircleIcon from '@material-ui/icons/CheckCircle';\nimport DescriptionIcon from '@material-ui/icons/Description';\nimport LinkIcon from '@material-ui/icons/Link';\nimport EmojiEvents from '@material-ui/icons/EmojiEvents';\nimport { qetaTranslationRef } from '../../translation.ts';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport useGridItemStyles from '../GridItemStyles/useGridItemStyles';\nimport { ClickableLink } from '../Utility/ClickableLink';\nimport { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model';\n\nconst useStyles = makeStyles(theme => ({\n statsGrid: {\n marginTop: 'auto',\n },\n statItem: {\n padding: theme.spacing(1),\n borderRadius: theme.shape.borderRadius,\n width: '100%',\n height: '100%',\n justifyContent: 'center',\n },\n flexColumn: {\n display: 'flex',\n flexDirection: 'column',\n },\n}));\n\nexport const UsersGridItem = (props: { user: UserResponse }) => {\n const { user } = props;\n const classes = useGridItemStyles();\n const localClasses = useStyles();\n const userRoute = useRouteRef(userRouteRef);\n const { t } = useTranslationRef(qetaTranslationRef);\n const entityRef = stringifyEntityRef(\n parseEntityRef(user.userRef, { defaultKind: 'user' }),\n );\n const { primaryTitle, Icon } = useEntityPresentation(entityRef);\n const {\n name,\n initials,\n user: userEntity,\n secondaryTitle,\n } = useEntityAuthor(user);\n const {\n value: currentUser,\n loading: loadingUser,\n error: userError,\n } = useIdentityApi(api => api.getBackstageIdentity(), []);\n\n const href = `${userRoute()}/${user.userRef}`;\n\n return (\n <Grid item xs={12} md={6} xl={4}>\n <Card className={classes.card}>\n <ClickableLink href={href} ariaLabel={primaryTitle}>\n <Box\n className={classes.cardHeader}\n display=\"flex\"\n alignItems=\"center\"\n >\n {Icon && (\n <Avatar\n src={userEntity?.spec?.profile?.picture}\n className=\"avatar\"\n alt={name}\n variant=\"rounded\"\n style={{ marginRight: 16 }}\n >\n {initials}\n </Avatar>\n )}\n <Box flex={1} minWidth={0}>\n <Tooltip title={secondaryTitle ?? ''} arrow>\n <Typography variant=\"h6\" noWrap>\n {primaryTitle}\n </Typography>\n </Tooltip>\n </Box>\n {!loadingUser &&\n !userError &&\n currentUser?.userEntityRef !== user.userRef ? (\n <Box\n flexShrink={0}\n onClick={e => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n <UserFollowButton userRef={user.userRef} />\n </Box>\n ) : null}\n </Box>\n <CardContent\n className={`${classes.cardContent} ${localClasses.flexColumn}`}\n >\n <Grid container spacing={1} className={localClasses.statsGrid}>\n <Grid item xs={3}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <EmojiEvents fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.reputation}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('impactCard.reputation')}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={3}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <QuestionAnswerIcon fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalQuestions}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.questions')}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={3}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <DescriptionIcon fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalArticles}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.articles')}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={3}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <LinkIcon fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalLinks}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.links')}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={4}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <CheckCircleIcon fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalAnswers}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.answers')}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={4}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <ThumbUpIcon fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalVotes}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.votes')}\n </Typography>\n </Box>\n </Grid>\n <Grid item xs={4}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n className={localClasses.statItem}\n >\n <Visibility fontSize=\"small\" color=\"disabled\" />\n <Typography variant=\"body2\" style={{ fontWeight: 600 }}>\n {user.totalViews}\n </Typography>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {t('common.views')}\n </Typography>\n </Box>\n </Grid>\n </Grid>\n </CardContent>\n </ClickableLink>\n </Card>\n </Grid>\n );\n};\n"],"names":["CheckCircleIcon","ThumbUpIcon"],"mappings":";;;;;;;;;;;;;;;;;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A,cACd,UAAW,EAAA,QAAA;AAAA,cACX,WAAW,YAAa,CAAA,QAAA;AAAA,cAExB,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,UAAW,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,KAAA,EAAM,UAAW,EAAA,CAAA;AAAA,gCAC9C,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAQ,EAAA,KAAA,EAAO,EAAE,UAAY,EAAA,GAAA,EAC9C,EAAA,QAAA,EAAA,IAAA,CAAK,UACR,EAAA,CAAA;AAAA,gCACA,GAAA,CAAC,cAAW,OAAQ,EAAA,SAAA,EAAU,OAAM,eACjC,EAAA,QAAA,EAAA,CAAA,CAAE,cAAc,CACnB,EAAA;AAAA;AAAA;AAAA,WAEJ,EAAA;AAAA,SACF,EAAA;AAAA;AAAA;AACF,GAAA,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,31 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { makeStyles, Paper, Typography } from '@material-ui/core';
3
+ import WarningIcon from '@material-ui/icons/Warning';
4
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
5
+ import { qetaTranslationRef } from '../../translation.esm.js';
6
+
7
+ const useStyles = makeStyles(
8
+ (theme) => ({
9
+ obsoleteBanner: {
10
+ backgroundColor: theme.palette.warning.main,
11
+ color: theme.palette.warning.contrastText,
12
+ padding: "8px 16px",
13
+ marginBottom: "16px",
14
+ display: "flex",
15
+ alignItems: "center",
16
+ gap: "8px"
17
+ }
18
+ }),
19
+ { name: "QetaObsoleteBanner" }
20
+ );
21
+ const ObsoleteBanner = () => {
22
+ const styles = useStyles();
23
+ const { t } = useTranslationRef(qetaTranslationRef);
24
+ return /* @__PURE__ */ jsxs(Paper, { className: styles.obsoleteBanner, elevation: 0, children: [
25
+ /* @__PURE__ */ jsx(WarningIcon, { fontSize: "small" }),
26
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", children: t("questionPage.obsoleteStatus") })
27
+ ] });
28
+ };
29
+
30
+ export { ObsoleteBanner };
31
+ //# sourceMappingURL=ObsoleteBanner.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObsoleteBanner.esm.js","sources":["../../../src/components/Utility/ObsoleteBanner.tsx"],"sourcesContent":["import { makeStyles, Paper, Typography } from '@material-ui/core';\nimport WarningIcon from '@material-ui/icons/Warning';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { qetaTranslationRef } from '../../translation.ts';\n\nconst useStyles = makeStyles(\n theme => ({\n obsoleteBanner: {\n backgroundColor: theme.palette.warning.main,\n color: theme.palette.warning.contrastText,\n padding: '8px 16px',\n marginBottom: '16px',\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n },\n }),\n { name: 'QetaObsoleteBanner' },\n);\n\nexport const ObsoleteBanner = () => {\n const styles = useStyles();\n const { t } = useTranslationRef(qetaTranslationRef);\n\n return (\n <Paper className={styles.obsoleteBanner} elevation={0}>\n <WarningIcon fontSize=\"small\" />\n <Typography variant=\"body2\">\n {t('questionPage.obsoleteStatus')}\n </Typography>\n </Paper>\n );\n};\n"],"names":[],"mappings":";;;;;;AAKA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,cAAgB,EAAA;AAAA,MACd,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA,IAAA;AAAA,MACvC,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA,YAAA;AAAA,MAC7B,OAAS,EAAA,UAAA;AAAA,MACT,YAAc,EAAA,MAAA;AAAA,MACd,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,QAAA;AAAA,MACZ,GAAK,EAAA;AAAA;AACP,GACF,CAAA;AAAA,EACA,EAAE,MAAM,oBAAqB;AAC/B,CAAA;AAEO,MAAM,iBAAiB,MAAM;AAClC,EAAA,MAAM,SAAS,SAAU,EAAA;AACzB,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,kBAAkB,CAAA;AAElD,EAAA,4BACG,KAAM,EAAA,EAAA,SAAA,EAAW,MAAO,CAAA,cAAA,EAAgB,WAAW,CAClD,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,WAAA,EAAA,EAAY,UAAS,OAAQ,EAAA,CAAA;AAAA,wBAC7B,UAAW,EAAA,EAAA,OAAA,EAAQ,OACjB,EAAA,QAAA,EAAA,CAAA,CAAE,6BAA6B,CAClC,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,36 @@
1
+ import { useApi, configApiRef } from '@backstage/core-plugin-api';
2
+ import { useState, useMemo, useEffect } from 'react';
3
+ import { permissionApiRef } from '@backstage/plugin-permission-react';
4
+ import { qetaReadPostReviewPermission } from '@drodil/backstage-plugin-qeta-common';
5
+ import { AuthorizeResult } from '@backstage/plugin-permission-common';
6
+ import { useIsModerator } from './useIsModerator.esm.js';
7
+
8
+ const useCanReview = () => {
9
+ const configApi = useApi(configApiRef);
10
+ const permissionApi = useApi(permissionApiRef);
11
+ const { isModerator } = useIsModerator();
12
+ const [canReview, setCanReview] = useState(false);
13
+ const [loading, setLoading] = useState(true);
14
+ const usePermissions = useMemo(
15
+ () => configApi.getOptionalBoolean("qeta.permissions") ?? false,
16
+ [configApi]
17
+ );
18
+ useEffect(() => {
19
+ if (usePermissions) {
20
+ permissionApi.authorize({ permission: qetaReadPostReviewPermission }).then((resp) => {
21
+ setCanReview(resp.result === AuthorizeResult.ALLOW);
22
+ setLoading(false);
23
+ }).catch(() => {
24
+ setCanReview(false);
25
+ setLoading(false);
26
+ });
27
+ return;
28
+ }
29
+ setCanReview(isModerator);
30
+ setLoading(false);
31
+ }, [isModerator, permissionApi, usePermissions]);
32
+ return { canReview, loading };
33
+ };
34
+
35
+ export { useCanReview };
36
+ //# sourceMappingURL=useCanReview.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCanReview.esm.js","sources":["../../src/hooks/useCanReview.ts"],"sourcesContent":["import { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useEffect, useMemo, useState } from 'react';\nimport { permissionApiRef } from '@backstage/plugin-permission-react';\nimport { qetaReadPostReviewPermission } from '@drodil/backstage-plugin-qeta-common';\nimport { AuthorizeResult } from '@backstage/plugin-permission-common';\nimport { useIsModerator } from './useIsModerator';\n\nexport const useCanReview = () => {\n const configApi = useApi(configApiRef);\n const permissionApi = useApi(permissionApiRef);\n const { isModerator } = useIsModerator();\n const [canReview, setCanReview] = useState(false);\n const [loading, setLoading] = useState(true);\n\n const usePermissions = useMemo(\n () => configApi.getOptionalBoolean('qeta.permissions') ?? false,\n [configApi],\n );\n\n useEffect(() => {\n if (usePermissions) {\n permissionApi\n .authorize({ permission: qetaReadPostReviewPermission })\n .then(resp => {\n setCanReview(resp.result === AuthorizeResult.ALLOW);\n setLoading(false);\n })\n .catch(() => {\n setCanReview(false);\n setLoading(false);\n });\n return;\n }\n\n setCanReview(isModerator);\n setLoading(false);\n }, [isModerator, permissionApi, usePermissions]);\n\n return { canReview, loading };\n};\n"],"names":[],"mappings":";;;;;;;AAOO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAM,MAAA,EAAE,WAAY,EAAA,GAAI,cAAe,EAAA;AACvC,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAChD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,IAAI,CAAA;AAE3C,EAAA,MAAM,cAAiB,GAAA,OAAA;AAAA,IACrB,MAAM,SAAA,CAAU,kBAAmB,CAAA,kBAAkB,CAAK,IAAA,KAAA;AAAA,IAC1D,CAAC,SAAS;AAAA,GACZ;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,cAAgB,EAAA;AAClB,MAAA,aAAA,CACG,UAAU,EAAE,UAAA,EAAY,8BAA8B,CAAA,CACtD,KAAK,CAAQ,IAAA,KAAA;AACZ,QAAa,YAAA,CAAA,IAAA,CAAK,MAAW,KAAA,eAAA,CAAgB,KAAK,CAAA;AAClD,QAAA,UAAA,CAAW,KAAK,CAAA;AAAA,OACjB,CACA,CAAA,KAAA,CAAM,MAAM;AACX,QAAA,YAAA,CAAa,KAAK,CAAA;AAClB,QAAA,UAAA,CAAW,KAAK,CAAA;AAAA,OACjB,CAAA;AACH,MAAA;AAAA;AAGF,IAAA,YAAA,CAAa,WAAW,CAAA;AACxB,IAAA,UAAA,CAAW,KAAK,CAAA;AAAA,GACf,EAAA,CAAC,WAAa,EAAA,aAAA,EAAe,cAAc,CAAC,CAAA;AAE/C,EAAO,OAAA,EAAE,WAAW,OAAQ,EAAA;AAC9B;;;;"}
@@ -1,4 +1,4 @@
1
- import { parseEntityRef } from '@backstage/catalog-model';
1
+ import { stringifyEntityRef, parseEntityRef } from '@backstage/catalog-model';
2
2
  import DataLoader from 'dataloader';
3
3
  import { useApi, identityApiRef } from '@backstage/core-plugin-api';
4
4
  import { catalogApiRef, useEntityPresentation } from '@backstage/plugin-catalog-react';
@@ -41,12 +41,14 @@ const useUserInfo = (entityRef, anonymous) => {
41
41
  const [user, setUser] = useState(null);
42
42
  const [initials, setInitials] = useState(null);
43
43
  const [currentUser, setCurrentUser] = useState(null);
44
- const ref = entityRef.startsWith("user:") ? entityRef : `user:${entityRef}`;
44
+ const ref = stringifyEntityRef(
45
+ parseEntityRef(entityRef, { defaultKind: "user" })
46
+ );
45
47
  const {
46
48
  primaryTitle: userName,
47
49
  secondaryTitle,
48
50
  Icon
49
- } = useEntityPresentation(ref);
51
+ } = useEntityPresentation(ref, { defaultKind: "user" });
50
52
  useEffect(() => {
51
53
  if (anonymous) {
52
54
  return;
@@ -73,8 +75,10 @@ const useUserInfo = (entityRef, anonymous) => {
73
75
  useEffect(() => {
74
76
  let displayName = userName;
75
77
  if (currentUser) {
76
- const currentUserRef = parseEntityRef(currentUser);
77
- const userRef = parseEntityRef(ref);
78
+ const currentUserRef = parseEntityRef(currentUser, {
79
+ defaultKind: "user"
80
+ });
81
+ const userRef = parseEntityRef(ref, { defaultKind: "user" });
78
82
  if (currentUserRef.name === userRef.name && currentUserRef.namespace === userRef.namespace) {
79
83
  displayName = `${t("userLink.you")}${anonymous ? ` (${t("userLink.anonymous").toLocaleLowerCase("en-US")})` : ""}`;
80
84
  } else if (anonymous) {
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityAuthor.esm.js","sources":["../../src/hooks/useEntityAuthor.ts"],"sourcesContent":["import { parseEntityRef, UserEntity } from '@backstage/catalog-model';\nimport { CatalogApi } from '@backstage/catalog-client';\nimport DataLoader from 'dataloader';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n useEntityPresentation,\n} from '@backstage/plugin-catalog-react';\nimport { useEffect, useState } from 'react';\nimport {\n AnswerResponse,\n CollectionResponse,\n PostResponse,\n UserResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { qetaTranslationRef } from '../translation.ts';\n\nconst userCache: Map<string, UserEntity> = new Map();\nconst dataLoaderFactory = (catalogApi: CatalogApi) =>\n new DataLoader(\n async (entityRefs: readonly string[]) => {\n const { items } = await catalogApi.getEntitiesByRefs({\n fields: [\n 'kind',\n 'metadata.name',\n 'metadata.namespace',\n 'spec.profile.displayName',\n 'spec.profile.picture',\n ],\n entityRefs: entityRefs as string[],\n });\n\n entityRefs.forEach((entityRef, index) => {\n userCache.set(entityRef, items[index] as UserEntity);\n });\n return items;\n },\n {\n name: 'EntityAuthorLoader',\n cacheMap: new Map(),\n maxBatchSize: 100,\n batchScheduleFn: callback => {\n setTimeout(callback, 50);\n },\n },\n );\n\nexport const useUserInfo = (entityRef: string, anonymous?: boolean) => {\n const catalogApi = useApi(catalogApiRef);\n const identityApi = useApi(identityApiRef);\n const { t } = useTranslationRef(qetaTranslationRef);\n const [name, setName] = useState<string>('');\n const [user, setUser] = useState<UserEntity | null>(null);\n const [initials, setInitials] = useState<string | null>(null);\n const [currentUser, setCurrentUser] = useState<string | null>(null);\n const ref = entityRef.startsWith('user:') ? entityRef : `user:${entityRef}`;\n\n const {\n primaryTitle: userName,\n secondaryTitle,\n Icon,\n } = useEntityPresentation(ref);\n\n useEffect(() => {\n if (anonymous) {\n return;\n }\n\n if (userCache.get(ref)) {\n setUser(userCache.get(ref) as UserEntity);\n return;\n }\n\n dataLoaderFactory(catalogApi)\n .load(ref)\n .then(data => {\n if (data) {\n setUser(data as UserEntity);\n } else {\n setUser(null);\n }\n })\n .catch(() => {\n setUser(null);\n });\n }, [catalogApi, ref, anonymous]);\n\n useEffect(() => {\n identityApi.getBackstageIdentity().then(res => {\n setCurrentUser(res.userEntityRef ?? 'user:default/guest');\n });\n }, [identityApi]);\n\n useEffect(() => {\n let displayName = userName;\n if (currentUser) {\n const currentUserRef = parseEntityRef(currentUser);\n const userRef = parseEntityRef(ref);\n if (\n currentUserRef.name === userRef.name &&\n currentUserRef.namespace === userRef.namespace\n ) {\n displayName = `${t('userLink.you')}${\n anonymous\n ? ` (${t('userLink.anonymous').toLocaleLowerCase('en-US')})`\n : ''\n }`;\n } else if (anonymous) {\n displayName = t('userLink.anonymous');\n }\n } else if (anonymous) {\n displayName = t('userLink.anonymous');\n }\n setName(displayName);\n }, [ref, anonymous, currentUser, userName, t]);\n\n useEffect(() => {\n const init = (name ?? '')\n .replace(/[^a-zA-Z]/g, '')\n .split(' ')\n .map(p => p[0])\n .join('')\n .substring(0, 2)\n .toUpperCase();\n setInitials(init);\n }, [name]);\n\n return { name, initials, user, secondaryTitle, Icon };\n};\n\nexport const useEntityAuthor = (\n entity: PostResponse | AnswerResponse | CollectionResponse | UserResponse,\n) => {\n const anonymous = 'anonymous' in entity ? entity.anonymous ?? false : false;\n const author =\n // eslint-disable-next-line no-nested-ternary\n 'author' in entity\n ? entity.author\n : 'userRef' in entity\n ? entity.userRef\n : entity.owner;\n return useUserInfo(author, anonymous);\n};\n"],"names":[],"mappings":";;;;;;;;AAkBA,MAAM,SAAA,uBAAyC,GAAI,EAAA;AACnD,MAAM,iBAAA,GAAoB,CAAC,UAAA,KACzB,IAAI,UAAA;AAAA,EACF,OAAO,UAAkC,KAAA;AACvC,IAAA,MAAM,EAAE,KAAA,EAAU,GAAA,MAAM,WAAW,iBAAkB,CAAA;AAAA,MACnD,MAAQ,EAAA;AAAA,QACN,MAAA;AAAA,QACA,eAAA;AAAA,QACA,oBAAA;AAAA,QACA,0BAAA;AAAA,QACA;AAAA,OACF;AAAA,MACA;AAAA,KACD,CAAA;AAED,IAAW,UAAA,CAAA,OAAA,CAAQ,CAAC,SAAA,EAAW,KAAU,KAAA;AACvC,MAAA,SAAA,CAAU,GAAI,CAAA,SAAA,EAAW,KAAM,CAAA,KAAK,CAAe,CAAA;AAAA,KACpD,CAAA;AACD,IAAO,OAAA,KAAA;AAAA,GACT;AAAA,EACA;AAAA,IACE,IAAM,EAAA,oBAAA;AAAA,IACN,QAAA,sBAAc,GAAI,EAAA;AAAA,IAClB,YAAc,EAAA,GAAA;AAAA,IACd,iBAAiB,CAAY,QAAA,KAAA;AAC3B,MAAA,UAAA,CAAW,UAAU,EAAE,CAAA;AAAA;AACzB;AAEJ,CAAA;AAEW,MAAA,WAAA,GAAc,CAAC,SAAA,EAAmB,SAAwB,KAAA;AACrE,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AACvC,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,kBAAkB,CAAA;AAClD,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAiB,EAAE,CAAA;AAC3C,EAAA,MAAM,CAAC,IAAA,EAAM,OA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SAAY,GAAA,WAAA,IAAe,MAAS,GAAA,MAAA,CAAO,aAAa,KAAQ,GAAA,KAAA;AACtE,EAAM,MAAA,MAAA;AAAA;AAAA,IAEJ,QAAA,IAAY,SACR,MAAO,CAAA,MAAA,GACP,aAAa,MACb,GAAA,MAAA,CAAO,UACP,MAAO,CAAA;AAAA,GAAA;AACb,EAAO,OAAA,WAAA,CAAY,QAAQ,SAAS,CAAA;AACtC;;;;"}
1
+ {"version":3,"file":"useEntityAuthor.esm.js","sources":["../../src/hooks/useEntityAuthor.ts"],"sourcesContent":["import {\n parseEntityRef,\n stringifyEntityRef,\n UserEntity,\n} from '@backstage/catalog-model';\nimport { CatalogApi } from '@backstage/catalog-client';\nimport DataLoader from 'dataloader';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n useEntityPresentation,\n} from '@backstage/plugin-catalog-react';\nimport { useEffect, useState } from 'react';\nimport {\n AnswerResponse,\n CollectionResponse,\n PostResponse,\n UserResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { qetaTranslationRef } from '../translation.ts';\n\nconst userCache: Map<string, UserEntity> = new Map();\nconst dataLoaderFactory = (catalogApi: CatalogApi) =>\n new DataLoader(\n async (entityRefs: readonly string[]) => {\n const { items } = await catalogApi.getEntitiesByRefs({\n fields: [\n 'kind',\n 'metadata.name',\n 'metadata.namespace',\n 'spec.profile.displayName',\n 'spec.profile.picture',\n ],\n entityRefs: entityRefs as string[],\n });\n\n entityRefs.forEach((entityRef, index) => {\n userCache.set(entityRef, items[index] as UserEntity);\n });\n return items;\n },\n {\n name: 'EntityAuthorLoader',\n cacheMap: new Map(),\n maxBatchSize: 100,\n batchScheduleFn: callback => {\n setTimeout(callback, 50);\n },\n },\n );\n\nexport const useUserInfo = (entityRef: string, anonymous?: boolean) => {\n const catalogApi = useApi(catalogApiRef);\n const identityApi = useApi(identityApiRef);\n const { t } = useTranslationRef(qetaTranslationRef);\n const [name, setName] = useState<string>('');\n const [user, setUser] = useState<UserEntity | null>(null);\n const [initials, setInitials] = useState<string | null>(null);\n const [currentUser, setCurrentUser] = useState<string | null>(null);\n const ref = stringifyEntityRef(\n parseEntityRef(entityRef, { defaultKind: 'user' }),\n );\n\n const {\n primaryTitle: userName,\n secondaryTitle,\n Icon,\n } = useEntityPresentation(ref, { defaultKind: 'user' });\n\n useEffect(() => {\n if (anonymous) {\n return;\n }\n\n if (userCache.get(ref)) {\n setUser(userCache.get(ref) as UserEntity);\n return;\n }\n\n dataLoaderFactory(catalogApi)\n .load(ref)\n .then(data => {\n if (data) {\n setUser(data as UserEntity);\n } else {\n setUser(null);\n }\n })\n .catch(() => {\n setUser(null);\n });\n }, [catalogApi, ref, anonymous]);\n\n useEffect(() => {\n identityApi.getBackstageIdentity().then(res => {\n setCurrentUser(res.userEntityRef ?? 'user:default/guest');\n });\n }, [identityApi]);\n\n useEffect(() => {\n let displayName = userName;\n if (currentUser) {\n const currentUserRef = parseEntityRef(currentUser, {\n defaultKind: 'user',\n });\n const userRef = parseEntityRef(ref, { defaultKind: 'user' });\n if (\n currentUserRef.name === userRef.name &&\n currentUserRef.namespace === userRef.namespace\n ) {\n displayName = `${t('userLink.you')}${\n anonymous\n ? ` (${t('userLink.anonymous').toLocaleLowerCase('en-US')})`\n : ''\n }`;\n } else if (anonymous) {\n displayName = t('userLink.anonymous');\n }\n } else if (anonymous) {\n displayName = t('userLink.anonymous');\n }\n setName(displayName);\n }, [ref, anonymous, currentUser, userName, t]);\n\n useEffect(() => {\n const init = (name ?? '')\n .replace(/[^a-zA-Z]/g, '')\n .split(' ')\n .map(p => p[0])\n .join('')\n .substring(0, 2)\n .toUpperCase();\n setInitials(init);\n }, [name]);\n\n return { name, initials, user, secondaryTitle, Icon };\n};\n\nexport const useEntityAuthor = (\n entity: PostResponse | AnswerResponse | CollectionResponse | UserResponse,\n) => {\n const anonymous = 'anonymous' in entity ? entity.anonymous ?? false : false;\n const author =\n // eslint-disable-next-line no-nested-ternary\n 'author' in entity\n ? entity.author\n : 'userRef' in entity\n ? entity.userRef\n : entity.owner;\n return useUserInfo(author, anonymous);\n};\n"],"names":[],"mappings":";;;;;;;;AAsBA,MAAM,SAAA,uBAAyC,GAAI,EAAA;AACnD,MAAM,iBAAA,GAAoB,CAAC,UAAA,KACzB,IAAI,UAAA;AAAA,EACF,OAAO,UAAkC,KAAA;AACvC,IAAA,MAAM,EAAE,KAAA,EAAU,GAAA,MAAM,WAAW,iBAAkB,CAAA;AAAA,MACnD,MAAQ,EAAA;AAAA,QACN,MAAA;AAAA,QACA,eAAA;AAAA,QACA,oBAAA;AAAA,QACA,0BAAA;AAAA,QACA;AAAA,OACF;AAAA,MACA;AAAA,KACD,CAAA;AAED,IAAW,UAAA,CAAA,OAAA,CAAQ,CAAC,SAAA,EAAW,KAAU,KAAA;AACvC,MAAA,SAAA,CAAU,GAAI,CAAA,SAAA,EAAW,KAAM,CAAA,KAAK,CAAe,CAAA;AAAA,KACpD,CAAA;AACD,IAAO,OAAA,KAAA;AAAA,GACT;AAAA,EACA;AAAA,IACE,IAAM,EAAA,oBAAA;AAAA,IACN,QAAA,sBAAc,GAAI,EAAA;AAAA,IAClB,YAAc,EAAA,GAAA;AAAA,IACd,iBAAiB,CAAY,QAAA,KAAA;AAC3B,MAAA,UAAA,CAAW,UAAU,EAAE,CAAA;AAAA;AACzB;AAEJ,CAAA;AAEW,MAAA,WAAA,GAAc,CAAC,SAAA,EAAmB,SAAwB,KAAA;AACrE,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AACvC,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,kBAAkB,CAAA;AAClD,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAiB,EAAE,CAAA;AAC3C,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,G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AAA,EAAM,gBAAgB,IAAK,EAAA;AACtD;AAEa,MAAA,eAAA,GAAkB,CAC7B,MACG,KAAA;AACH,EAAA,MAAM,SAAY,GAAA,WAAA,IAAe,MAAS,GAAA,MAAA,CAAO,aAAa,KAAQ,GAAA,KAAA;AACtE,EAAM,MAAA,MAAA;AAAA;AAAA,IAEJ,QAAA,IAAY,SACR,MAAO,CAAA,MAAA,GACP,aAAa,MACb,GAAA,MAAA,CAAO,UACP,MAAO,CAAA;AAAA,GAAA;AACb,EAAO,OAAA,WAAA,CAAY,QAAQ,SAAS,CAAA;AACtC;;;;"}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
2
2
  import { IdentityApi } from '@backstage/core-plugin-api';
3
3
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
4
4
  import * as _drodil_backstage_plugin_qeta_common from '@drodil/backstage-plugin-qeta-common';
5
- import { QetaApi, PostType, PostStatus, PostResponse, Template, PostsResponse, AnswersResponse, AnswerResponse, Collection, Post, PostsQuery, CollectionResponse, TagResponse, Answer, Comment, Stat, TemplatesResponse, Article, UserResponse, AIQuery } from '@drodil/backstage-plugin-qeta-common';
5
+ import { QetaApi, PostType, PostStatus, PostResponse, Template, PostsResponse, AnswersResponse, AnswerResponse, Collection, Post, PostsQuery, CollectionResponse, TagResponse, Answer, Comment, Stat, Badge, TemplatesResponse, Article, UserResponse, AIQuery } from '@drodil/backstage-plugin-qeta-common';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
7
  import { Entity, UserEntity } from '@backstage/catalog-model';
8
8
  import * as react from 'react';
@@ -40,6 +40,7 @@ declare const tagRouteRef: _backstage_core_plugin_api.SubRouteRef<_backstage_cor
40
40
  declare const entitiesRouteRef: _backstage_core_plugin_api.SubRouteRef<undefined>;
41
41
  declare const entityRouteRef: _backstage_core_plugin_api.SubRouteRef<_backstage_core_plugin_api.PathParams<"/entities/:entityRef">>;
42
42
  declare const moderatorRouteRef: _backstage_core_plugin_api.SubRouteRef<undefined>;
43
+ declare const reviewRouteRef: _backstage_core_plugin_api.SubRouteRef<undefined>;
43
44
 
44
45
  declare const qetaApiRef: _backstage_frontend_plugin_api.ApiRef<QetaApi>;
45
46
 
@@ -306,6 +307,20 @@ declare const DeleteModal: (props: {
306
307
  onDelete?: (entity: PostResponse | AnswerResponse | CollectionResponse | TagResponse) => void;
307
308
  }) => react_jsx_runtime.JSX.Element;
308
309
 
310
+ declare const ObsoleteModal: (props: {
311
+ post: PostResponse;
312
+ open: boolean;
313
+ onClose: () => void;
314
+ onConfirm?: () => void;
315
+ }) => react_jsx_runtime.JSX.Element;
316
+
317
+ declare const ValidReviewModal: (props: {
318
+ post: PostResponse;
319
+ open: boolean;
320
+ onClose: () => void;
321
+ onConfirm?: () => void;
322
+ }) => react_jsx_runtime.JSX.Element;
323
+
309
324
  type AnswerCardClassKeys = 'root' | 'highlight' | 'buttons' | 'metadata' | 'markdownContainer' | 'contentContainer';
310
325
  declare const AnswerCard: (props: {
311
326
  answer: AnswerResponse;
@@ -348,6 +363,7 @@ declare const UserLink: (props: {
348
363
  entityRef: string;
349
364
  anonymous?: boolean;
350
365
  linkProps?: LinkProps;
366
+ noLink?: boolean;
351
367
  }) => react_jsx_runtime.JSX.Element;
352
368
  declare const AuthorLink: (props: {
353
369
  entity: Post | Answer | Comment;
@@ -383,6 +399,15 @@ declare const StatsChart: (props: {
383
399
  error?: string;
384
400
  }) => react_jsx_runtime.JSX.Element;
385
401
 
402
+ declare const BadgeChip: ({ badge, count, }: {
403
+ badge: Badge;
404
+ count?: number;
405
+ }) => react_jsx_runtime.JSX.Element;
406
+
407
+ declare const UserBadges: ({ entityRef }: {
408
+ entityRef: string;
409
+ }) => react_jsx_runtime.JSX.Element;
410
+
386
411
  declare const TopRankingUsers: (props: {
387
412
  title?: string;
388
413
  hideTitle?: boolean;
@@ -488,6 +513,8 @@ declare const DeletedBanner: () => react_jsx_runtime.JSX.Element;
488
513
 
489
514
  declare const DraftBanner: () => react_jsx_runtime.JSX.Element;
490
515
 
516
+ declare const ObsoleteBanner: () => react_jsx_runtime.JSX.Element;
517
+
491
518
  interface StatusChipProps {
492
519
  status?: string;
493
520
  className?: string;
@@ -611,6 +638,11 @@ declare const useAI: () => {
611
638
  summarizeArticle: (articleId: number, options?: AIQuery) => Promise<_drodil_backstage_plugin_qeta_common.AIResponse | null>;
612
639
  };
613
640
 
641
+ declare const useCanReview: () => {
642
+ canReview: boolean;
643
+ loading: boolean;
644
+ };
645
+
614
646
  /** @alpha */
615
647
  declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<"qeta", {
616
648
  readonly "answer.questionTitle": "Q: {{question}}";
@@ -648,6 +680,7 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
648
680
  readonly "common.post": "post";
649
681
  readonly "common.collection": "collection";
650
682
  readonly "common.favorite": "Favorite";
683
+ readonly "common.obsolete": "Obsolete";
651
684
  readonly "common.question": "question";
652
685
  readonly "common.article": "article";
653
686
  readonly "common.link": "link";
@@ -855,6 +888,20 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
855
888
  readonly "deleteModal.articleDeleted": "Article deleted";
856
889
  readonly "deleteModal.answerDeleted": "Answer deleted";
857
890
  readonly "deleteModal.linkDeleted": "Link deleted";
891
+ readonly "obsoleteModal.comment": "Comment (optional)";
892
+ readonly "obsoleteModal.title": "Mark post as obsolete";
893
+ readonly "obsoleteModal.description": "Marking a post as obsolete indicates that the content is outdated and no longer relevant. Obsolete posts cannot be edited or receive new answers.";
894
+ readonly "obsoleteModal.cancelButton": "Cancel";
895
+ readonly "obsoleteModal.confirmButton": "Mark as obsolete";
896
+ readonly "obsoleteModal.errorMarking": "Failed to mark as obsolete";
897
+ readonly "obsoleteModal.success": "Post marked as obsolete";
898
+ readonly "validReviewModal.comment": "Comment (optional)";
899
+ readonly "validReviewModal.title": "Mark post as valid";
900
+ readonly "validReviewModal.description": "Confirming this post is still valid indicates that the content is up-to-date and relevant. This will reset the review timer.";
901
+ readonly "validReviewModal.cancelButton": "Cancel";
902
+ readonly "validReviewModal.confirmButton": "Confirm valid";
903
+ readonly "validReviewModal.errorMarking": "Failed to mark as valid";
904
+ readonly "validReviewModal.success": "Post marked as valid";
858
905
  readonly "favoritePage.title": "Favorited posts";
859
906
  readonly "leftMenu.tags": "Tags";
860
907
  readonly "leftMenu.entities": "Entities";
@@ -866,6 +913,7 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
866
913
  readonly "leftMenu.questions": "Questions";
867
914
  readonly "leftMenu.articles": "Articles";
868
915
  readonly "leftMenu.moderate": "Moderate";
916
+ readonly "leftMenu.review": "Review";
869
917
  readonly "leftMenu.manage": "Manage";
870
918
  readonly "leftMenu.buttonLabel": "Menu";
871
919
  readonly "leftMenu.home": "Home";
@@ -912,6 +960,7 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
912
960
  readonly "suggestionsCard.randomPost4": "Join the discussion on \"{{title}}\"";
913
961
  readonly "suggestionsCard.randomPost5": "Check this out: \"{{title}}\"";
914
962
  readonly "homePage.title": "Home";
963
+ readonly "impactCard.reputation": "Reputation";
915
964
  readonly "impactCard.title": "Your impact";
916
965
  readonly "impactCard.error": "Failed to load impact data";
917
966
  readonly "impactCard.answers": "Answers";
@@ -920,6 +969,9 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
920
969
  readonly "impactCard.views": "views";
921
970
  readonly "impactCard.followers": "Followers";
922
971
  readonly "impactCard.contributions": "Your contributions helped {{lastWeek}} people this week";
972
+ readonly "userBadges.title": "Badges";
973
+ readonly "userBadges.error": "Failed to load badges";
974
+ readonly "userBadges.noBadges": "No badges earned yet";
923
975
  readonly "rightMenu.expand": "Expand sidebar";
924
976
  readonly "rightMenu.collapse": "Collapse sidebar";
925
977
  readonly "rightMenu.followedEntities": "Followed entities";
@@ -927,6 +979,7 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
927
979
  readonly "rightMenu.followedCollections": "Followed collections";
928
980
  readonly "rightMenu.followedUsers": "Followed users";
929
981
  readonly "rightMenu.similarQuestions": "Similar questions";
982
+ readonly "rightMenu.similarPosts": "Similar posts";
930
983
  readonly "highlights.loadError": "Failed to load questions";
931
984
  readonly "highlights.own.title": "Your latest questions";
932
985
  readonly "highlights.own.noQuestionsLabel": "No questions";
@@ -988,6 +1041,8 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
988
1041
  readonly "questionPage.restoreButton": "Restore";
989
1042
  readonly "questionPage.draftStatus": "This is a draft post. Please edit and publish it to make it visible to others.";
990
1043
  readonly "questionPage.deletedStatus": "This post has been deleted. You can delete it permanently or restore it.";
1044
+ readonly "questionPage.obsoleteTitle": "Obsolete Content";
1045
+ readonly "questionPage.obsoleteStatus": "This post has been marked as obsolete. It may contain outdated information. Commenting and answering are disabled.";
991
1046
  readonly "questionPage.answerButton": "Answer";
992
1047
  readonly "questionPage.sortAnswers.default": "Default";
993
1048
  readonly "questionPage.sortAnswers.label": "Sort answers";
@@ -1041,6 +1096,7 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
1041
1096
  readonly "filterPanel.orderBy.score": "Score";
1042
1097
  readonly "filterPanel.orderBy.created": "Created";
1043
1098
  readonly "filterPanel.orderBy.updated": "Updated";
1099
+ readonly "filterPanel.orderBy.reputation": "Reputation";
1044
1100
  readonly "filterPanel.orderBy.entityRef": "Name";
1045
1101
  readonly "filterPanel.orderBy.title": "Title";
1046
1102
  readonly "filterPanel.orderBy.posts": "Posts";
@@ -1129,6 +1185,7 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
1129
1185
  readonly "stats.totalLinks": "Total links";
1130
1186
  readonly "stats.totalViews": "Total views";
1131
1187
  readonly "stats.totalVotes": "Total votes";
1188
+ readonly "stats.reputation": "Reputation";
1132
1189
  readonly "stats.users": "Users";
1133
1190
  readonly "stats.answers": "Answers";
1134
1191
  readonly "stats.links": "Links";
@@ -1149,6 +1206,9 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
1149
1206
  readonly "stats.totalUsers": "Total users";
1150
1207
  readonly "stats.totalTags": "Total tags";
1151
1208
  readonly "stats.totalFollowers": "Total followers";
1209
+ readonly "stats.answerScore": "Answer score";
1210
+ readonly "stats.postScore": "Post score";
1211
+ readonly "stats.correctAnswers": "Correct answers";
1152
1212
  readonly "collectionButton.follow": "Follow";
1153
1213
  readonly "collectionButton.tooltip": "By following a collection, you will get notified when ever a new post is added to the collection";
1154
1214
  readonly "collectionButton.unfollow": "Unfollow";
@@ -1165,6 +1225,30 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
1165
1225
  readonly "userButton.unfollow": "Unfollow";
1166
1226
  readonly "viewToggle.listView": "List View";
1167
1227
  readonly "viewToggle.gridView": "Grid View";
1228
+ readonly "contentHealth.obsolete": "Obsolete";
1229
+ readonly "contentHealth.valid": "Valid";
1230
+ readonly "contentHealth.description": "This content has been marked as potentially outdated. Please review it and mark it as valid or obsolete.";
1231
+ readonly "contentHealth.cardTitle": "Content Health";
1232
+ readonly "contentHealth.healthScore": "Health Score: {{score}}%";
1233
+ readonly "contentHealth.obsoleteWarning": "This content has been marked as obsolete.";
1234
+ readonly "contentHealth.markValid": "Mark as Valid";
1235
+ readonly "contentHealth.markObsolete": "Mark as Obsolete";
1236
+ readonly "contentHealth.reviewHistory": "Review History";
1237
+ readonly "reviewPage.title": "Review";
1238
+ readonly "reviewPage.description": "Review posts that are possibly outdated.";
1239
+ readonly "reviewPage.dialog.title": "Mark Post as Obsolete";
1240
+ readonly "reviewPage.dialog.cancel": "Cancel";
1241
+ readonly "reviewPage.dialog.commentLabel": "Comment (Optional)";
1242
+ readonly "reviewPage.dialog.confirm": "Mark as Obsolete";
1243
+ readonly "reviewPage.table.author": "Author";
1244
+ readonly "reviewPage.table.score": "Health Score";
1245
+ readonly "reviewPage.table.created": "Created";
1246
+ readonly "reviewPage.table.title": "Title";
1247
+ readonly "reviewPage.table.healthScore": "Health";
1248
+ readonly "reviewPage.table.actions": "Actions";
1249
+ readonly "reviewPage.errorLoading": "Could not load posts for review";
1250
+ readonly "reviewPage.actions.markValid": "Mark Valid";
1251
+ readonly "reviewPage.actions.markObsolete": "Mark Obsolete";
1168
1252
  }>;
1169
1253
  declare const qetaTranslations: _backstage_frontend_plugin_api.TranslationResource<"qeta">;
1170
1254
 
@@ -1200,4 +1284,4 @@ type QetaOverrides = Overrides & {
1200
1284
  [Name in keyof QetaComponentsNameToClassKey]?: Partial<StyleRules<QetaComponentsNameToClassKey[Name]>>;
1201
1285
  };
1202
1286
 
1203
- export { AIAnswerCard, AddToCollectionButton, AnswerCard, AnswerForm, AnswerList, AnswerListItem, AnswersContainer, ArticleContent, AskQuestionButton, AuthorLink, ButtonContainer, CollectionFollowButton, CollectionForm, CollectionsGrid, ContentHeader, ContentHeaderButton, ContentHeaderCard, type ContentHeaderCardProps, type ContentHeaderProps, CreateCollectionButton, CreateLinkButton, DeleteModal, DeletedBanner, DraftBanner, EntitiesGrid, EntityFollowButton, FaviconItem, FilterPanel, FollowedCollectionsList, FollowedEntitiesList, FollowedTagsList, FollowedUsersList, ImpactCard, LeftMenu, LeftMenuButton, LinkCard, MarkdownRenderer, OpenLinkButton, PostForm, type PostGridProps, PostHighlightList, PostHighlightListContainer, PostHighlightListContent, PostList, PostListItem, PostsCard, PostsContainer, type PostsContainerProps, PostsGrid, PostsTable, QetaContext, type QetaContextProps, type QetaOverrides, QetaProvider, QuestionCard, type QuestionFormValues, QuestionsTable, RelativeTimeWithTooltip, SelectTemplateList, StatsChart, StatusChip, SuggestionsCard, type TagAndEntitiesFormValues, TagFollowButton, TagsGrid, type TemplateFormValues, TemplateList, TopRankingUsers, TrophyIcon, UpdatedByLink, UserFollowButton, UserLink, UsersGrid, ViewToggle, type ViewType, WriteArticleButton, articleRouteRef, articlesRouteRef, askRouteRef, collectionCreateRouteRef, collectionEditRouteRef, collectionRouteRef, collectionsRouteRef, createLinkRouteRef, editArticleRouteRef, editLinkRouteRef, editQuestionRouteRef, entitiesRouteRef, entityRouteRef, favoriteQuestionsRouteRef, linkRouteRef, linksRouteRef, moderatorRouteRef, qetaApiRef, qetaRouteRef, qetaTranslationRef, qetaTranslations, questionRouteRef, questionsRouteRef, statisticsRouteRef, tagRouteRef, tagsRouteRef, useAI, useCollectionsFollow, useEntityAuthor, useEntityFollow, useIdentityApi, useIsModerator, useQetaApi, useQetaContext, useTagsFollow, useUserFollow, useUserInfo, userRouteRef, usersRouteRef, writeRouteRef };
1287
+ export { AIAnswerCard, AddToCollectionButton, AnswerCard, AnswerForm, AnswerList, AnswerListItem, AnswersContainer, ArticleContent, AskQuestionButton, AuthorLink, BadgeChip, ButtonContainer, CollectionFollowButton, CollectionForm, CollectionsGrid, ContentHeader, ContentHeaderButton, ContentHeaderCard, type ContentHeaderCardProps, type ContentHeaderProps, CreateCollectionButton, CreateLinkButton, DeleteModal, DeletedBanner, DraftBanner, EntitiesGrid, EntityFollowButton, FaviconItem, FilterPanel, FollowedCollectionsList, FollowedEntitiesList, FollowedTagsList, FollowedUsersList, ImpactCard, LeftMenu, LeftMenuButton, LinkCard, MarkdownRenderer, ObsoleteBanner, ObsoleteModal, OpenLinkButton, PostForm, type PostGridProps, PostHighlightList, PostHighlightListContainer, PostHighlightListContent, PostList, PostListItem, PostsCard, PostsContainer, type PostsContainerProps, PostsGrid, PostsTable, QetaContext, type QetaContextProps, type QetaOverrides, QetaProvider, QuestionCard, type QuestionFormValues, QuestionsTable, RelativeTimeWithTooltip, SelectTemplateList, StatsChart, StatusChip, SuggestionsCard, type TagAndEntitiesFormValues, TagFollowButton, TagsGrid, type TemplateFormValues, TemplateList, TopRankingUsers, TrophyIcon, UpdatedByLink, UserBadges, UserFollowButton, UserLink, UsersGrid, ValidReviewModal, ViewToggle, type ViewType, WriteArticleButton, articleRouteRef, articlesRouteRef, askRouteRef, collectionCreateRouteRef, collectionEditRouteRef, collectionRouteRef, collectionsRouteRef, createLinkRouteRef, editArticleRouteRef, editLinkRouteRef, editQuestionRouteRef, entitiesRouteRef, entityRouteRef, favoriteQuestionsRouteRef, linkRouteRef, linksRouteRef, moderatorRouteRef, qetaApiRef, qetaRouteRef, qetaTranslationRef, qetaTranslations, questionRouteRef, questionsRouteRef, reviewRouteRef, statisticsRouteRef, tagRouteRef, tagsRouteRef, useAI, useCanReview, useCollectionsFollow, useEntityAuthor, useEntityFollow, useIdentityApi, useIsModerator, useQetaApi, useQetaContext, useTagsFollow, useUserFollow, useUserInfo, userRouteRef, usersRouteRef, writeRouteRef };