@drodil/backstage-plugin-qeta-react 3.49.0 → 3.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AIAnswerCard/AIAnswerCard.esm.js +2 -2
- package/dist/components/AIAnswerCard/AIAnswerCard.esm.js.map +1 -1
- package/dist/components/AuthorBox/AuthorBoxes.esm.js +1 -3
- package/dist/components/AuthorBox/AuthorBoxes.esm.js.map +1 -1
- package/dist/components/Badges/BadgeChip.esm.js +231 -0
- package/dist/components/Badges/BadgeChip.esm.js.map +1 -0
- package/dist/components/Badges/UserBadges.esm.js +79 -0
- package/dist/components/Badges/UserBadges.esm.js.map +1 -0
- package/dist/components/Buttons/LinkButton.esm.js +4 -3
- package/dist/components/Buttons/LinkButton.esm.js.map +1 -1
- package/dist/components/Buttons/OpenLinkButton.esm.js +6 -1
- package/dist/components/Buttons/OpenLinkButton.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js +8 -10
- package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js.map +1 -1
- package/dist/components/DeleteModal/DeleteModal.esm.js +10 -10
- package/dist/components/DeleteModal/DeleteModal.esm.js.map +1 -1
- package/dist/components/EntitiesGrid/EntitiesGridItem.esm.js +84 -84
- package/dist/components/EntitiesGrid/EntitiesGridItem.esm.js.map +1 -1
- package/dist/components/FilterPanel/FilterPanel.esm.js +2 -1
- package/dist/components/FilterPanel/FilterPanel.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedCollectionsList.esm.js +27 -22
- package/dist/components/FollowedLists/FollowedCollectionsList.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedEntitiesList.esm.js +6 -3
- package/dist/components/FollowedLists/FollowedEntitiesList.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedTagsList.esm.js +27 -22
- package/dist/components/FollowedLists/FollowedTagsList.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedUsersList.esm.js +6 -3
- package/dist/components/FollowedLists/FollowedUsersList.esm.js.map +1 -1
- package/dist/components/HomePageCards/ImpactCard.esm.js +27 -4
- package/dist/components/HomePageCards/ImpactCard.esm.js.map +1 -1
- package/dist/components/LeftMenu/LeftMenu.esm.js +1 -1
- package/dist/components/LeftMenu/LeftMenu.esm.js.map +1 -1
- package/dist/components/PostHighlightList/PostHighlightList.esm.js +6 -3
- package/dist/components/PostHighlightList/PostHighlightList.esm.js.map +1 -1
- package/dist/components/PostsContainer/PostListItem.esm.js +8 -13
- package/dist/components/PostsContainer/PostListItem.esm.js.map +1 -1
- package/dist/components/PostsGrid/PostsGridItem.esm.js +6 -2
- package/dist/components/PostsGrid/PostsGridItem.esm.js.map +1 -1
- package/dist/components/StatsChart/StatsChart.esm.js +9 -0
- package/dist/components/StatsChart/StatsChart.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/EntityChip.esm.js +8 -7
- package/dist/components/TagsAndEntities/EntityChip.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/TagChip.esm.js +8 -7
- package/dist/components/TagsAndEntities/TagChip.esm.js.map +1 -1
- package/dist/components/TagsGrid/TagGridItem.esm.js +157 -154
- package/dist/components/TagsGrid/TagGridItem.esm.js.map +1 -1
- package/dist/components/UsersGrid/UsersGridItem.esm.js +133 -114
- package/dist/components/UsersGrid/UsersGridItem.esm.js.map +1 -1
- package/dist/components/Utility/ClickableLink.esm.js +28 -0
- package/dist/components/Utility/ClickableLink.esm.js.map +1 -0
- package/dist/hooks/useEntityAuthor.esm.js +9 -5
- package/dist/hooks/useEntityAuthor.esm.js.map +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.esm.js +4 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/translation.esm.js +11 -3
- package/dist/translation.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
3
|
-
import { useNavigate } from 'react-router-dom';
|
|
4
3
|
import { useEntityPresentation } from '@backstage/plugin-catalog-react';
|
|
5
4
|
import { userRouteRef } from '../../routes.esm.js';
|
|
6
5
|
import '../../api.esm.js';
|
|
@@ -19,9 +18,12 @@ import ThumbUp from '@material-ui/icons/ThumbUp';
|
|
|
19
18
|
import CheckCircle from '@material-ui/icons/CheckCircle';
|
|
20
19
|
import DescriptionIcon from '@material-ui/icons/Description';
|
|
21
20
|
import LinkIcon from '@material-ui/icons/Link';
|
|
21
|
+
import EmojiEvents from '@material-ui/icons/EmojiEvents';
|
|
22
22
|
import { qetaTranslationRef } from '../../translation.esm.js';
|
|
23
23
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
24
24
|
import useGridItemStyles from '../GridItemStyles/useGridItemStyles.esm.js';
|
|
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: {
|
|
@@ -44,9 +46,11 @@ const UsersGridItem = (props) => {
|
|
|
44
46
|
const classes = useGridItemStyles();
|
|
45
47
|
const localClasses = useStyles();
|
|
46
48
|
const userRoute = useRouteRef(userRouteRef);
|
|
47
|
-
const navigate = useNavigate();
|
|
48
49
|
const { t } = useTranslationRef(qetaTranslationRef);
|
|
49
|
-
const
|
|
50
|
+
const entityRef = stringifyEntityRef(
|
|
51
|
+
parseEntityRef(user.userRef, { defaultKind: "user" })
|
|
52
|
+
);
|
|
53
|
+
const { primaryTitle, Icon } = useEntityPresentation(entityRef);
|
|
50
54
|
const {
|
|
51
55
|
name,
|
|
52
56
|
initials,
|
|
@@ -58,14 +62,15 @@ const UsersGridItem = (props) => {
|
|
|
58
62
|
loading: loadingUser,
|
|
59
63
|
error: userError
|
|
60
64
|
} = useIdentityApi((api) => api.getBackstageIdentity(), []);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
const href = `${userRoute()}/${user.userRef}`;
|
|
66
|
+
return /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, md: 6, xl: 4, children: /* @__PURE__ */ jsx(Card, { className: classes.card, children: /* @__PURE__ */ jsxs(ClickableLink, { href, ariaLabel: primaryTitle, children: [
|
|
67
|
+
/* @__PURE__ */ jsxs(
|
|
68
|
+
Box,
|
|
69
|
+
{
|
|
70
|
+
className: classes.cardHeader,
|
|
71
|
+
display: "flex",
|
|
72
|
+
alignItems: "center",
|
|
73
|
+
children: [
|
|
69
74
|
Icon && /* @__PURE__ */ jsx(
|
|
70
75
|
Avatar,
|
|
71
76
|
{
|
|
@@ -78,113 +83,127 @@ const UsersGridItem = (props) => {
|
|
|
78
83
|
}
|
|
79
84
|
),
|
|
80
85
|
/* @__PURE__ */ jsx(Box, { flex: 1, minWidth: 0, children: /* @__PURE__ */ jsx(Tooltip, { title: secondaryTitle ?? "", arrow: true, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", noWrap: true, children: primaryTitle }) }) }),
|
|
81
|
-
!loadingUser && !userError && currentUser?.userEntityRef !== user.userRef ? /* @__PURE__ */ jsx(
|
|
82
|
-
|
|
86
|
+
!loadingUser && !userError && currentUser?.userEntityRef !== user.userRef ? /* @__PURE__ */ jsx(
|
|
87
|
+
Box,
|
|
83
88
|
{
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
flexShrink: 0,
|
|
90
|
+
onClick: (e) => {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
e.stopPropagation();
|
|
86
93
|
},
|
|
87
|
-
role: "button",
|
|
88
|
-
tabIndex: 0,
|
|
89
94
|
children: /* @__PURE__ */ jsx(UserFollowButton, { userRef: user.userRef })
|
|
90
95
|
}
|
|
91
|
-
)
|
|
92
|
-
]
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
96
|
+
) : null
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ jsx(
|
|
101
|
+
CardContent,
|
|
102
|
+
{
|
|
103
|
+
className: `${classes.cardContent} ${localClasses.flexColumn}`,
|
|
104
|
+
children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 1, className: localClasses.statsGrid, children: [
|
|
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(
|
|
120
|
+
Box,
|
|
121
|
+
{
|
|
122
|
+
display: "flex",
|
|
123
|
+
flexDirection: "column",
|
|
124
|
+
alignItems: "center",
|
|
125
|
+
className: localClasses.statItem,
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ jsx(QuestionAnswerIcon, { fontSize: "small", color: "disabled" }),
|
|
128
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", style: { fontWeight: 600 }, children: user.totalQuestions }),
|
|
129
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "textSecondary", children: t("common.questions") })
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
) }),
|
|
133
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsxs(
|
|
134
|
+
Box,
|
|
135
|
+
{
|
|
136
|
+
display: "flex",
|
|
137
|
+
flexDirection: "column",
|
|
138
|
+
alignItems: "center",
|
|
139
|
+
className: localClasses.statItem,
|
|
140
|
+
children: [
|
|
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") })
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
) }),
|
|
147
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsxs(
|
|
148
|
+
Box,
|
|
149
|
+
{
|
|
150
|
+
display: "flex",
|
|
151
|
+
flexDirection: "column",
|
|
152
|
+
alignItems: "center",
|
|
153
|
+
className: localClasses.statItem,
|
|
154
|
+
children: [
|
|
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") })
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
) }),
|
|
161
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsxs(
|
|
162
|
+
Box,
|
|
163
|
+
{
|
|
164
|
+
display: "flex",
|
|
165
|
+
flexDirection: "column",
|
|
166
|
+
alignItems: "center",
|
|
167
|
+
className: localClasses.statItem,
|
|
168
|
+
children: [
|
|
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") })
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
) }),
|
|
175
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsxs(
|
|
176
|
+
Box,
|
|
177
|
+
{
|
|
178
|
+
display: "flex",
|
|
179
|
+
flexDirection: "column",
|
|
180
|
+
alignItems: "center",
|
|
181
|
+
className: localClasses.statItem,
|
|
182
|
+
children: [
|
|
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") })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
) }),
|
|
189
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsxs(
|
|
190
|
+
Box,
|
|
191
|
+
{
|
|
192
|
+
display: "flex",
|
|
193
|
+
flexDirection: "column",
|
|
194
|
+
alignItems: "center",
|
|
195
|
+
className: localClasses.statItem,
|
|
196
|
+
children: [
|
|
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") })
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
) })
|
|
203
|
+
] })
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
] }) }) });
|
|
188
207
|
};
|
|
189
208
|
|
|
190
209
|
export { UsersGridItem };
|
|
@@ -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 { useNavigate } from 'react-router-dom';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { userRouteRef } from '../../routes';\nimport { useIdentityApi } from '../../hooks';\nimport { useEntityAuthor } from '../../hooks/useEntityAuthor';\nimport {\n Avatar,\n Card,\n CardContent,\n Grid,\n Tooltip,\n Typography,\n Box,\n makeStyles,\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';\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 navigate = useNavigate();\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 return (\n <Grid item xs={12} md={6} xl={4}>\n <Card\n className={classes.card}\n style={{ cursor: 'pointer' }}\n onClick={() => navigate(`${userRoute()}/${user.userRef}`)}\n >\n <Box className={classes.cardHeader} display=\"flex\" alignItems=\"center\">\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 flexShrink={0}>\n <div\n onClick={e => e.stopPropagation()}\n onKeyPress={() => {}}\n role=\"button\"\n tabIndex={0}\n >\n <UserFollowButton userRef={user.userRef} />\n </div>\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 </Card>\n </Grid>\n );\n};\n"],"names":["CheckCircleIcon","ThumbUpIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,SAAW,EAAA;AAAA,GACb;AAAA,EACA,QAAU,EAAA;AAAA,IACR,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,YAAA,EAAc,MAAM,KAAM,CAAA,YAAA;AAAA,IAC1B,KAAO,EAAA,MAAA;AAAA,IACP,MAAQ,EAAA,MAAA;AAAA,IACR,cAAgB,EAAA;AAAA,GAClB;AAAA,EACA,UAAY,EAAA;AA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EAAA;AAAA;AAAA;AAAA,eAEJ,EAAA,CAAA;AAAA,8BACC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,CACb,EAAA,QAAA,kBAAA,IAAA;AAAA,gBAAC,GAAA;AAAA,gBAAA;AAAA,kBACC,OAAQ,EAAA,MAAA;AAAA,kBACR,aAAc,EAAA,QAAA;AAAA,kBACd,UAAW,EAAA,QAAA;AAAA,kBACX,WAAW,YAAa,CAAA,QAAA;AAAA,kBAExB,QAAA,EAAA;AAAA,oCAAA,GAAA,CAAC,QAAS,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,KAAA,EAAM,UAAW,EAAA,CAAA;AAAA,oCAC5C,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,oCACA,GAAA,CAAC,cAAW,OAAQ,EAAA,SAAA,EAAU,OAAM,eACjC,EAAA,QAAA,EAAA,CAAA,CAAE,cAAc,CACnB,EAAA;AAAA;AAAA;AAAA,eAEJ,EAAA;AAAA,aACF,EAAA;AAAA;AAAA;AACF;AAAA;AAAA,GAEJ,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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,SAAW,EAAA;AAAA,GACb;AAAA,EACA,QAAU,EAAA;AAAA,IACR,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,YAAA,EAAc,MAAM,KAAM,CAAA,YAA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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,28 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
const ClickableLink = (props) => {
|
|
5
|
+
const { href, children, ariaLabel } = props;
|
|
6
|
+
const navigate = useNavigate();
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"a",
|
|
9
|
+
{
|
|
10
|
+
href,
|
|
11
|
+
onClick: (e) => {
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
navigate(href);
|
|
14
|
+
},
|
|
15
|
+
"aria-label": ariaLabel,
|
|
16
|
+
style: {
|
|
17
|
+
textDecoration: "none",
|
|
18
|
+
color: "inherit",
|
|
19
|
+
display: "block",
|
|
20
|
+
cursor: "pointer"
|
|
21
|
+
},
|
|
22
|
+
children
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { ClickableLink };
|
|
28
|
+
//# sourceMappingURL=ClickableLink.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClickableLink.esm.js","sources":["../../../src/components/Utility/ClickableLink.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { useNavigate } from 'react-router-dom';\n\nexport interface ClickableLinkProps {\n href: string;\n children: ReactNode;\n ariaLabel?: string;\n}\n\nexport const ClickableLink = (props: ClickableLinkProps) => {\n const { href, children, ariaLabel } = props;\n const navigate = useNavigate();\n\n return (\n <a\n href={href}\n onClick={(e: React.MouseEvent) => {\n e.preventDefault();\n navigate(href);\n }}\n aria-label={ariaLabel}\n style={{\n textDecoration: 'none',\n color: 'inherit',\n display: 'block',\n cursor: 'pointer',\n }}\n >\n {children}\n </a>\n );\n};\n"],"names":[],"mappings":";;;AASa,MAAA,aAAA,GAAgB,CAAC,KAA8B,KAAA;AAC1D,EAAA,MAAM,EAAE,IAAA,EAAM,QAAU,EAAA,SAAA,EAAc,GAAA,KAAA;AACtC,EAAA,MAAM,WAAW,WAAY,EAAA;AAE7B,EACE,uBAAA,GAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,OAAA,EAAS,CAAC,CAAwB,KAAA;AAChC,QAAA,CAAA,CAAE,cAAe,EAAA;AACjB,QAAA,QAAA,CAAS,IAAI,CAAA;AAAA,OACf;AAAA,MACA,YAAY,EAAA,SAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,cAAgB,EAAA,MAAA;AAAA,QAChB,KAAO,EAAA,SAAA;AAAA,QACP,OAAS,EAAA,OAAA;AAAA,QACT,MAAQ,EAAA;AAAA,OACV;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -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 =
|
|
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
|
-
|
|
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 {
|
|
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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ACpB,MAAA,WAAA,GAAc,EAAE,oBAAoB,CAAA;AAAA;AAEtC,IAAA,OAAA,CAAQ,WAAW,CAAA;AAAA,KAClB,CAAC,GAAA,EAAK,WAAW,WAAa,EAAA,QAAA,EAAU,CAAC,CAAC,CAAA;AAE7C,EAAA,SAAA,CAAU,MAAM;AACd,IAAM,MAAA,IAAA,GAAA,CAAQ,QAAQ,EACnB,EAAA,OAAA,CAAQ,cAAc,EAAE,CAAA,CACxB,KAAM,CAAA,GAAG,CACT,CAAA,GAAA,CAAI,OAAK,CAAE,CAAA,CAAC,CAAC,CAAA,CACb,IAAK,CAAA,EAAE,EACP,SAAU,CAAA,CAAA,EAAG,CAAC,CAAA,CACd,WAAY,EAAA;AACf,IAAA,WAAA,CAAY,IAAI,CAAA;AAAA,GAClB,EAAG,CAAC,IAAI,CAAC,CAAA;AAET,EAAA,OAAO,EAAE,IAAA,EAAM,QAAU,EAAA,IAAA,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';
|
|
@@ -236,7 +236,7 @@ declare const OpenLinkButton: (props: {
|
|
|
236
236
|
entity: PostResponse;
|
|
237
237
|
className?: string;
|
|
238
238
|
style?: React.CSSProperties;
|
|
239
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
239
|
+
}) => react_jsx_runtime.JSX.Element | null;
|
|
240
240
|
|
|
241
241
|
declare const CreateCollectionButton: () => react_jsx_runtime.JSX.Element;
|
|
242
242
|
|
|
@@ -383,6 +383,15 @@ declare const StatsChart: (props: {
|
|
|
383
383
|
error?: string;
|
|
384
384
|
}) => react_jsx_runtime.JSX.Element;
|
|
385
385
|
|
|
386
|
+
declare const BadgeChip: ({ badge, count, }: {
|
|
387
|
+
badge: Badge;
|
|
388
|
+
count?: number;
|
|
389
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
390
|
+
|
|
391
|
+
declare const UserBadges: ({ entityRef }: {
|
|
392
|
+
entityRef: string;
|
|
393
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
394
|
+
|
|
386
395
|
declare const TopRankingUsers: (props: {
|
|
387
396
|
title?: string;
|
|
388
397
|
hideTitle?: boolean;
|
|
@@ -912,6 +921,7 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
|
|
|
912
921
|
readonly "suggestionsCard.randomPost4": "Join the discussion on \"{{title}}\"";
|
|
913
922
|
readonly "suggestionsCard.randomPost5": "Check this out: \"{{title}}\"";
|
|
914
923
|
readonly "homePage.title": "Home";
|
|
924
|
+
readonly "impactCard.reputation": "Reputation";
|
|
915
925
|
readonly "impactCard.title": "Your impact";
|
|
916
926
|
readonly "impactCard.error": "Failed to load impact data";
|
|
917
927
|
readonly "impactCard.answers": "Answers";
|
|
@@ -920,6 +930,9 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
|
|
|
920
930
|
readonly "impactCard.views": "views";
|
|
921
931
|
readonly "impactCard.followers": "Followers";
|
|
922
932
|
readonly "impactCard.contributions": "Your contributions helped {{lastWeek}} people this week";
|
|
933
|
+
readonly "userBadges.title": "Badges";
|
|
934
|
+
readonly "userBadges.error": "Failed to load badges";
|
|
935
|
+
readonly "userBadges.noBadges": "No badges earned yet";
|
|
923
936
|
readonly "rightMenu.expand": "Expand sidebar";
|
|
924
937
|
readonly "rightMenu.collapse": "Collapse sidebar";
|
|
925
938
|
readonly "rightMenu.followedEntities": "Followed entities";
|
|
@@ -1041,6 +1054,7 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
|
|
|
1041
1054
|
readonly "filterPanel.orderBy.score": "Score";
|
|
1042
1055
|
readonly "filterPanel.orderBy.created": "Created";
|
|
1043
1056
|
readonly "filterPanel.orderBy.updated": "Updated";
|
|
1057
|
+
readonly "filterPanel.orderBy.reputation": "Reputation";
|
|
1044
1058
|
readonly "filterPanel.orderBy.entityRef": "Name";
|
|
1045
1059
|
readonly "filterPanel.orderBy.title": "Title";
|
|
1046
1060
|
readonly "filterPanel.orderBy.posts": "Posts";
|
|
@@ -1129,6 +1143,7 @@ declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<
|
|
|
1129
1143
|
readonly "stats.totalLinks": "Total links";
|
|
1130
1144
|
readonly "stats.totalViews": "Total views";
|
|
1131
1145
|
readonly "stats.totalVotes": "Total votes";
|
|
1146
|
+
readonly "stats.reputation": "Reputation";
|
|
1132
1147
|
readonly "stats.users": "Users";
|
|
1133
1148
|
readonly "stats.answers": "Answers";
|
|
1134
1149
|
readonly "stats.links": "Links";
|
|
@@ -1200,4 +1215,4 @@ type QetaOverrides = Overrides & {
|
|
|
1200
1215
|
[Name in keyof QetaComponentsNameToClassKey]?: Partial<StyleRules<QetaComponentsNameToClassKey[Name]>>;
|
|
1201
1216
|
};
|
|
1202
1217
|
|
|
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 };
|
|
1218
|
+
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, 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, 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 };
|
package/dist/index.esm.js
CHANGED
|
@@ -37,6 +37,8 @@ export { RelativeTimeWithTooltip } from './components/RelativeTimeWithTooltip/Re
|
|
|
37
37
|
export { AuthorLink, UpdatedByLink, UserLink } from './components/Links/Links.esm.js';
|
|
38
38
|
export { PostsTable, QuestionsTable } from './components/PostsTable/PostsTable.esm.js';
|
|
39
39
|
export { StatsChart } from './components/StatsChart/StatsChart.esm.js';
|
|
40
|
+
export { BadgeChip } from './components/Badges/BadgeChip.esm.js';
|
|
41
|
+
export { UserBadges } from './components/Badges/UserBadges.esm.js';
|
|
40
42
|
export { TopRankingUsers } from './components/TopRankingUsersCard/TopRankingUsersCard.esm.js';
|
|
41
43
|
export { TrophyIcon } from './components/TopRankingUsersCard/TrophyIcon.esm.js';
|
|
42
44
|
export { TagsGrid } from './components/TagsGrid/TagsGrid.esm.js';
|
|
@@ -55,6 +57,8 @@ export { SuggestionsCard } from './components/SuggestionsCard/SuggestionsCard.es
|
|
|
55
57
|
export { LinkCard } from './components/LinkCard/LinkCard.esm.js';
|
|
56
58
|
export { FaviconItem } from './components/FaviconItem/FaviconItem.esm.js';
|
|
57
59
|
export { QetaContext, QetaProvider, useQetaContext } from './components/QetaContext/QetaContext.esm.js';
|
|
60
|
+
import 'react/jsx-runtime';
|
|
61
|
+
import 'react-router-dom';
|
|
58
62
|
export { DeletedBanner } from './components/Utility/DeletedBanner.esm.js';
|
|
59
63
|
export { DraftBanner } from './components/Utility/DraftBanner.esm.js';
|
|
60
64
|
export { StatusChip } from './components/Utility/StatusChip.esm.js';
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/translation.esm.js
CHANGED
|
@@ -386,7 +386,13 @@ const qetaTranslationRef = createTranslationRef({
|
|
|
386
386
|
votes: "Votes",
|
|
387
387
|
questions: "Questions",
|
|
388
388
|
answers: "Answers",
|
|
389
|
-
followers: "Followers"
|
|
389
|
+
followers: "Followers",
|
|
390
|
+
reputation: "Reputation"
|
|
391
|
+
},
|
|
392
|
+
userBadges: {
|
|
393
|
+
title: "Badges",
|
|
394
|
+
error: "Failed to load badges",
|
|
395
|
+
noBadges: "No badges earned yet"
|
|
390
396
|
},
|
|
391
397
|
rightMenu: {
|
|
392
398
|
followedEntities: "Followed entities",
|
|
@@ -634,7 +640,8 @@ const qetaTranslationRef = createTranslationRef({
|
|
|
634
640
|
votes: "Votes",
|
|
635
641
|
tag: "Name",
|
|
636
642
|
entityRef: "Name",
|
|
637
|
-
user: "Name"
|
|
643
|
+
user: "Name",
|
|
644
|
+
reputation: "Reputation"
|
|
638
645
|
},
|
|
639
646
|
order: {
|
|
640
647
|
label: "Order",
|
|
@@ -791,7 +798,8 @@ const qetaTranslationRef = createTranslationRef({
|
|
|
791
798
|
totalTags: "Total tags",
|
|
792
799
|
totalArticles: "Total articles",
|
|
793
800
|
totalLinks: "Total links",
|
|
794
|
-
totalFollowers: "Total followers"
|
|
801
|
+
totalFollowers: "Total followers",
|
|
802
|
+
reputation: "Reputation"
|
|
795
803
|
},
|
|
796
804
|
collectionButton: {
|
|
797
805
|
follow: "Follow",
|