@drodil/backstage-plugin-qeta-react 3.57.0 → 3.58.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Badges/BadgeChip.esm.js +2 -2
- package/dist/components/Badges/BadgeChip.esm.js.map +1 -1
- package/dist/components/Buttons/CollectionFollowButton.esm.js +4 -4
- package/dist/components/Buttons/CollectionFollowButton.esm.js.map +1 -1
- package/dist/components/Buttons/EntityFollowButton.esm.js +4 -4
- package/dist/components/Buttons/EntityFollowButton.esm.js.map +1 -1
- package/dist/components/Buttons/FollowPostButton.esm.js +44 -0
- package/dist/components/Buttons/FollowPostButton.esm.js.map +1 -0
- package/dist/components/Buttons/TagFollowButton.esm.js +4 -4
- package/dist/components/Buttons/TagFollowButton.esm.js.map +1 -1
- package/dist/components/Buttons/UserFollowButton.esm.js +4 -4
- package/dist/components/Buttons/UserFollowButton.esm.js.map +1 -1
- package/dist/components/ContentHeader/ContentHeader.esm.js +2 -2
- package/dist/components/HomePageCards/CommunityActivityCard.esm.js +164 -0
- package/dist/components/HomePageCards/CommunityActivityCard.esm.js.map +1 -0
- package/dist/components/HomePageCards/FollowedItemsCard.esm.js +296 -0
- package/dist/components/HomePageCards/FollowedItemsCard.esm.js.map +1 -0
- package/dist/components/HomePageCards/ImpactCard.esm.js +141 -112
- package/dist/components/HomePageCards/ImpactCard.esm.js.map +1 -1
- package/dist/components/HomePageCards/PostsCard.esm.js +2 -2
- package/dist/components/Links/Links.esm.js +1 -1
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js +1 -5
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js.map +1 -1
- package/dist/components/PostHighlightList/PostHighlightList.esm.js +33 -5
- package/dist/components/PostHighlightList/PostHighlightList.esm.js.map +1 -1
- package/dist/components/PostsContainer/PostListItem.esm.js +2 -1
- package/dist/components/PostsContainer/PostListItem.esm.js.map +1 -1
- package/dist/components/PostsContainer/PostsContainer.esm.js +2 -2
- package/dist/components/PostsContainer/PostsGridItem.esm.js +2 -2
- package/dist/components/QetaEntityContainer/QetaEntityContainer.esm.js +3 -3
- package/dist/components/QetaEntityContainer/QetaEntityContainer.esm.js.map +1 -1
- package/dist/components/StatsChart/StatsChart.esm.js +10 -1
- package/dist/components/StatsChart/StatsChart.esm.js.map +1 -1
- package/dist/components/SuggestionsCard/SuggestionsCard.esm.js +8 -1
- package/dist/components/SuggestionsCard/SuggestionsCard.esm.js.map +1 -1
- package/dist/components/Timeline/Timeline.esm.js +3 -0
- package/dist/components/Timeline/Timeline.esm.js.map +1 -1
- package/dist/components/Timeline/TimelineItem.esm.js +1 -1
- package/dist/components/Tooltips/PostTooltip.esm.js +1 -0
- package/dist/components/Tooltips/PostTooltip.esm.js.map +1 -1
- package/dist/components/UsersContainer/UserListItem.esm.js +1 -0
- package/dist/components/UsersContainer/UserListItem.esm.js.map +1 -1
- package/dist/components/Utility/RightList.esm.js +14 -4
- package/dist/components/Utility/RightList.esm.js.map +1 -1
- package/dist/hooks/useEntityAuthor.esm.js +1 -1
- package/dist/hooks/useEntityAuthor.esm.js.map +1 -1
- package/dist/hooks/useUserFollow.esm.js +22 -1
- package/dist/hooks/useUserFollow.esm.js.map +1 -1
- package/dist/index.d.ts +55 -6
- package/dist/index.esm.js +5 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/translation.esm.js +48 -3
- package/dist/translation.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { makeStyles, Card, CardHeader, CardContent, Box, List, ListItem, Typography, ListItemText, ListItemAvatar, Avatar } from '@material-ui/core';
|
|
4
|
+
import { Skeleton } from '@material-ui/lab';
|
|
5
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
6
|
+
import { qetaTranslationRef } from '../../translation.esm.js';
|
|
7
|
+
import { tagRouteRef, userRouteRef, collectionRouteRef, entityRouteRef } from '../../routes.esm.js';
|
|
8
|
+
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
9
|
+
import '../../api.esm.js';
|
|
10
|
+
import 'react-use';
|
|
11
|
+
import '@backstage/plugin-signals-react';
|
|
12
|
+
import '../../hooks/useListItemStyles.esm.js';
|
|
13
|
+
import { useTagsFollow } from '../../hooks/useTagsFollow.esm.js';
|
|
14
|
+
import { useEntityFollow } from '../../hooks/useEntityFollow.esm.js';
|
|
15
|
+
import '@backstage/catalog-model';
|
|
16
|
+
import 'dataloader';
|
|
17
|
+
import { useEntityPresentation } from '@backstage/plugin-catalog-react';
|
|
18
|
+
import { useUserFollow } from '../../hooks/useUserFollow.esm.js';
|
|
19
|
+
import 'react-use/lib/useAsync';
|
|
20
|
+
import { useCollectionsFollow } from '../../hooks/useCollectionsFollow.esm.js';
|
|
21
|
+
import '@backstage/plugin-permission-react';
|
|
22
|
+
import '@drodil/backstage-plugin-qeta-common';
|
|
23
|
+
import '@backstage/plugin-permission-common';
|
|
24
|
+
import { Link } from 'react-router-dom';
|
|
25
|
+
import 'react-use/lib/useDebounce';
|
|
26
|
+
import '../FilterPanel/FilterPanel.esm.js';
|
|
27
|
+
import '../QetaContext/QetaContext.esm.js';
|
|
28
|
+
import { TagTooltip } from '../Tooltips/TagTooltip.esm.js';
|
|
29
|
+
import { EntityTooltip } from '../Tooltips/EntityTooltip.esm.js';
|
|
30
|
+
import { CollectionTooltip } from '../Tooltips/CollectionTooltip.esm.js';
|
|
31
|
+
import { UserTooltip } from '../Tooltips/UserTooltip.esm.js';
|
|
32
|
+
import 'react-relative-time';
|
|
33
|
+
import '@material-ui/icons/ThumbUpOutlined';
|
|
34
|
+
import '@material-ui/icons/VisibilityOutlined';
|
|
35
|
+
import '@material-ui/icons/QuestionAnswerOutlined';
|
|
36
|
+
import '@material-ui/icons/ChatBubbleOutline';
|
|
37
|
+
import '@material-ui/icons/CheckCircleOutline';
|
|
38
|
+
import '../../hooks/useTooltipStyles.esm.js';
|
|
39
|
+
import LocalOfferOutlined from '@material-ui/icons/LocalOfferOutlined';
|
|
40
|
+
import LibraryBooks from '@material-ui/icons/LibraryBooks';
|
|
41
|
+
import CategoryIcon from '@material-ui/icons/Category';
|
|
42
|
+
import NotificationsActive from '@material-ui/icons/NotificationsActive';
|
|
43
|
+
|
|
44
|
+
const useStyles = makeStyles((theme) => ({
|
|
45
|
+
root: {
|
|
46
|
+
height: "100%",
|
|
47
|
+
display: "flex",
|
|
48
|
+
flexDirection: "column"
|
|
49
|
+
},
|
|
50
|
+
header: {
|
|
51
|
+
padding: theme.spacing(2, 2, 1, 2)
|
|
52
|
+
},
|
|
53
|
+
content: {
|
|
54
|
+
padding: theme.spacing(0, 2, 2, 2),
|
|
55
|
+
flexGrow: 1,
|
|
56
|
+
overflow: "auto",
|
|
57
|
+
"&:last-child": {
|
|
58
|
+
paddingBottom: theme.spacing(2)
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
sectionTitle: {
|
|
62
|
+
color: theme.palette.text.secondary,
|
|
63
|
+
marginTop: theme.spacing(2),
|
|
64
|
+
marginBottom: theme.spacing(0.5),
|
|
65
|
+
fontSize: "0.75rem",
|
|
66
|
+
fontWeight: 500,
|
|
67
|
+
textTransform: "uppercase",
|
|
68
|
+
letterSpacing: "0.5px"
|
|
69
|
+
},
|
|
70
|
+
list: {
|
|
71
|
+
padding: 0
|
|
72
|
+
},
|
|
73
|
+
listItem: {
|
|
74
|
+
paddingLeft: 0,
|
|
75
|
+
paddingRight: 0,
|
|
76
|
+
paddingTop: theme.spacing(0.5),
|
|
77
|
+
paddingBottom: theme.spacing(0.5)
|
|
78
|
+
},
|
|
79
|
+
iconBox: {
|
|
80
|
+
minWidth: 24,
|
|
81
|
+
maxWidth: 24,
|
|
82
|
+
height: 20,
|
|
83
|
+
display: "flex",
|
|
84
|
+
alignItems: "center",
|
|
85
|
+
justifyContent: "center",
|
|
86
|
+
marginRight: theme.spacing(1),
|
|
87
|
+
color: theme.palette.text.secondary
|
|
88
|
+
},
|
|
89
|
+
avatar: {
|
|
90
|
+
width: 20,
|
|
91
|
+
height: 20,
|
|
92
|
+
fontSize: "0.65rem"
|
|
93
|
+
},
|
|
94
|
+
emptyMessage: {
|
|
95
|
+
color: theme.palette.text.disabled,
|
|
96
|
+
fontStyle: "italic",
|
|
97
|
+
padding: theme.spacing(2, 0),
|
|
98
|
+
textAlign: "center"
|
|
99
|
+
},
|
|
100
|
+
entityText: {
|
|
101
|
+
whiteSpace: "nowrap",
|
|
102
|
+
overflow: "hidden",
|
|
103
|
+
textOverflow: "ellipsis"
|
|
104
|
+
}
|
|
105
|
+
}));
|
|
106
|
+
const EntityItem = ({ entityRef }) => {
|
|
107
|
+
const classes = useStyles();
|
|
108
|
+
const entityRoute = useRouteRef(entityRouteRef);
|
|
109
|
+
const { primaryTitle, Icon } = useEntityPresentation(entityRef);
|
|
110
|
+
return /* @__PURE__ */ jsx(
|
|
111
|
+
EntityTooltip,
|
|
112
|
+
{
|
|
113
|
+
entity: entityRef,
|
|
114
|
+
interactive: false,
|
|
115
|
+
enterDelay: 400,
|
|
116
|
+
enterNextDelay: 400,
|
|
117
|
+
placement: "left",
|
|
118
|
+
children: /* @__PURE__ */ jsxs(
|
|
119
|
+
ListItem,
|
|
120
|
+
{
|
|
121
|
+
button: true,
|
|
122
|
+
component: Link,
|
|
123
|
+
to: entityRoute({ entityRef }),
|
|
124
|
+
className: classes.listItem,
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ jsx(Box, { className: classes.iconBox, children: Icon ? /* @__PURE__ */ jsx(Icon, { fontSize: "small" }) : /* @__PURE__ */ jsx(CategoryIcon, { style: { fontSize: 14 } }) }),
|
|
127
|
+
/* @__PURE__ */ jsx(
|
|
128
|
+
ListItemText,
|
|
129
|
+
{
|
|
130
|
+
primary: primaryTitle ?? entityRef,
|
|
131
|
+
classes: { primary: classes.entityText }
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
const FollowedItemsCard = () => {
|
|
141
|
+
const classes = useStyles();
|
|
142
|
+
const { t } = useTranslationRef(qetaTranslationRef);
|
|
143
|
+
const { tags, loading: tagsLoading } = useTagsFollow();
|
|
144
|
+
const { entities, loading: entitiesLoading } = useEntityFollow();
|
|
145
|
+
const { users, userEntities, loading: usersLoading } = useUserFollow();
|
|
146
|
+
const { collections, loading: collectionsLoading } = useCollectionsFollow();
|
|
147
|
+
const tagRoute = useRouteRef(tagRouteRef);
|
|
148
|
+
const userRoute = useRouteRef(userRouteRef);
|
|
149
|
+
const collectionRoute = useRouteRef(collectionRouteRef);
|
|
150
|
+
const isLoading = tagsLoading || entitiesLoading || usersLoading || collectionsLoading;
|
|
151
|
+
const hasAnyItems = tags.length > 0 || entities.length > 0 || users.length > 0 || collections.length > 0;
|
|
152
|
+
const renderContent = () => {
|
|
153
|
+
if (isLoading) {
|
|
154
|
+
return /* @__PURE__ */ jsx(Box, { children: [1, 2, 3].map((row) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
155
|
+
/* @__PURE__ */ jsx(
|
|
156
|
+
Skeleton,
|
|
157
|
+
{
|
|
158
|
+
variant: "text",
|
|
159
|
+
width: "40%",
|
|
160
|
+
style: { marginTop: 16, marginBottom: 8 }
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ jsx(List, { dense: true, children: [1, 2].map((i) => /* @__PURE__ */ jsxs(ListItem, { className: classes.listItem, children: [
|
|
164
|
+
/* @__PURE__ */ jsx(
|
|
165
|
+
Skeleton,
|
|
166
|
+
{
|
|
167
|
+
variant: "circle",
|
|
168
|
+
width: 20,
|
|
169
|
+
height: 20,
|
|
170
|
+
style: { marginRight: 8 }
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "60%" })
|
|
174
|
+
] }, i)) })
|
|
175
|
+
] }, row)) });
|
|
176
|
+
}
|
|
177
|
+
if (!hasAnyItems) {
|
|
178
|
+
return /* @__PURE__ */ jsx(Typography, { className: classes.emptyMessage, children: t("homePage.noFollowedItems") });
|
|
179
|
+
}
|
|
180
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
181
|
+
tags.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
182
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.sectionTitle, children: t("homePage.tags") }),
|
|
183
|
+
/* @__PURE__ */ jsx(List, { className: classes.list, dense: true, children: tags.slice(0, 5).map((tag) => /* @__PURE__ */ jsx(
|
|
184
|
+
TagTooltip,
|
|
185
|
+
{
|
|
186
|
+
tag,
|
|
187
|
+
interactive: false,
|
|
188
|
+
enterDelay: 400,
|
|
189
|
+
enterNextDelay: 400,
|
|
190
|
+
placement: "left",
|
|
191
|
+
children: /* @__PURE__ */ jsxs(
|
|
192
|
+
ListItem,
|
|
193
|
+
{
|
|
194
|
+
button: true,
|
|
195
|
+
component: Link,
|
|
196
|
+
to: tagRoute({ tag }),
|
|
197
|
+
className: classes.listItem,
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ jsx(Box, { className: classes.iconBox, children: /* @__PURE__ */ jsx(LocalOfferOutlined, { style: { fontSize: 14 } }) }),
|
|
200
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: tag })
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
},
|
|
205
|
+
tag
|
|
206
|
+
)) })
|
|
207
|
+
] }),
|
|
208
|
+
entities.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
209
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.sectionTitle, children: t("homePage.entities") }),
|
|
210
|
+
/* @__PURE__ */ jsx(List, { className: classes.list, dense: true, children: entities.slice(0, 5).map((entity) => /* @__PURE__ */ jsx(EntityItem, { entityRef: entity }, entity)) })
|
|
211
|
+
] }),
|
|
212
|
+
users.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
213
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.sectionTitle, children: t("homePage.users") }),
|
|
214
|
+
/* @__PURE__ */ jsx(List, { className: classes.list, dense: true, children: users.slice(0, 5).map((user) => {
|
|
215
|
+
const entity = userEntities.get(user);
|
|
216
|
+
const displayName = entity?.spec?.profile?.displayName ?? user;
|
|
217
|
+
const initials = (displayName ?? "").replace(/[^a-zA-Z]/g, "").split(" ").map((p) => p[0]).join("").substring(0, 2).toUpperCase();
|
|
218
|
+
return /* @__PURE__ */ jsx(
|
|
219
|
+
UserTooltip,
|
|
220
|
+
{
|
|
221
|
+
entityRef: user,
|
|
222
|
+
interactive: false,
|
|
223
|
+
enterDelay: 400,
|
|
224
|
+
enterNextDelay: 400,
|
|
225
|
+
placement: "left",
|
|
226
|
+
children: /* @__PURE__ */ jsxs(
|
|
227
|
+
ListItem,
|
|
228
|
+
{
|
|
229
|
+
button: true,
|
|
230
|
+
component: Link,
|
|
231
|
+
to: `${userRoute()}/${user}`,
|
|
232
|
+
className: classes.listItem,
|
|
233
|
+
children: [
|
|
234
|
+
/* @__PURE__ */ jsx(ListItemAvatar, { style: { minWidth: 32 }, children: /* @__PURE__ */ jsx(
|
|
235
|
+
Avatar,
|
|
236
|
+
{
|
|
237
|
+
alt: user,
|
|
238
|
+
src: entity?.spec?.profile?.picture,
|
|
239
|
+
className: classes.avatar,
|
|
240
|
+
children: initials || user.charAt(0).toUpperCase()
|
|
241
|
+
}
|
|
242
|
+
) }),
|
|
243
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: displayName })
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
},
|
|
248
|
+
user
|
|
249
|
+
);
|
|
250
|
+
}) })
|
|
251
|
+
] }),
|
|
252
|
+
collections.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
253
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.sectionTitle, children: t("homePage.collections") }),
|
|
254
|
+
/* @__PURE__ */ jsx(List, { className: classes.list, dense: true, children: collections.slice(0, 5).map((collection) => /* @__PURE__ */ jsx(
|
|
255
|
+
CollectionTooltip,
|
|
256
|
+
{
|
|
257
|
+
collectionId: collection.id,
|
|
258
|
+
interactive: false,
|
|
259
|
+
enterDelay: 400,
|
|
260
|
+
enterNextDelay: 400,
|
|
261
|
+
placement: "left",
|
|
262
|
+
children: /* @__PURE__ */ jsxs(
|
|
263
|
+
ListItem,
|
|
264
|
+
{
|
|
265
|
+
button: true,
|
|
266
|
+
component: Link,
|
|
267
|
+
to: collectionRoute({ id: collection.id.toString() }),
|
|
268
|
+
className: classes.listItem,
|
|
269
|
+
children: [
|
|
270
|
+
/* @__PURE__ */ jsx(Box, { className: classes.iconBox, children: /* @__PURE__ */ jsx(LibraryBooks, { style: { fontSize: 14 } }) }),
|
|
271
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: collection.title })
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
},
|
|
276
|
+
collection.id
|
|
277
|
+
)) })
|
|
278
|
+
] })
|
|
279
|
+
] });
|
|
280
|
+
};
|
|
281
|
+
return /* @__PURE__ */ jsxs(Card, { className: classes.root, variant: "outlined", children: [
|
|
282
|
+
/* @__PURE__ */ jsx(
|
|
283
|
+
CardHeader,
|
|
284
|
+
{
|
|
285
|
+
title: t("homePage.followedItems"),
|
|
286
|
+
className: classes.header,
|
|
287
|
+
avatar: /* @__PURE__ */ jsx(NotificationsActive, {}),
|
|
288
|
+
titleTypographyProps: { variant: "h5" }
|
|
289
|
+
}
|
|
290
|
+
),
|
|
291
|
+
/* @__PURE__ */ jsx(CardContent, { className: classes.content, children: renderContent() })
|
|
292
|
+
] });
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
export { FollowedItemsCard };
|
|
296
|
+
//# sourceMappingURL=FollowedItemsCard.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FollowedItemsCard.esm.js","sources":["../../../src/components/HomePageCards/FollowedItemsCard.tsx"],"sourcesContent":["import { Fragment } from 'react';\nimport {\n Box,\n Card,\n CardContent,\n CardHeader,\n List,\n ListItem,\n ListItemText,\n ListItemAvatar,\n Avatar,\n makeStyles,\n Typography,\n} from '@material-ui/core';\nimport { Skeleton } from '@material-ui/lab';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { qetaTranslationRef } from '../../translation';\nimport {\n tagRouteRef,\n userRouteRef,\n collectionRouteRef,\n entityRouteRef,\n} from '../../routes';\nimport {\n useTagsFollow,\n useEntityFollow,\n useUserFollow,\n useCollectionsFollow,\n} from '../../hooks';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { Link } from 'react-router-dom';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport {\n EntityTooltip,\n UserTooltip,\n TagTooltip,\n CollectionTooltip,\n} from '../Tooltips';\nimport LocalOfferOutlined from '@material-ui/icons/LocalOfferOutlined';\nimport LibraryBooks from '@material-ui/icons/LibraryBooks';\nimport CategoryIcon from '@material-ui/icons/Category';\nimport NotificationsActive from '@material-ui/icons/NotificationsActive';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n height: '100%',\n display: 'flex',\n flexDirection: 'column',\n },\n header: {\n padding: theme.spacing(2, 2, 1, 2),\n },\n content: {\n padding: theme.spacing(0, 2, 2, 2),\n flexGrow: 1,\n overflow: 'auto',\n '&:last-child': {\n paddingBottom: theme.spacing(2),\n },\n },\n sectionTitle: {\n color: theme.palette.text.secondary,\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(0.5),\n fontSize: '0.75rem',\n fontWeight: 500,\n textTransform: 'uppercase',\n letterSpacing: '0.5px',\n },\n list: {\n padding: 0,\n },\n listItem: {\n paddingLeft: 0,\n paddingRight: 0,\n paddingTop: theme.spacing(0.5),\n paddingBottom: theme.spacing(0.5),\n },\n iconBox: {\n minWidth: 24,\n maxWidth: 24,\n height: 20,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n marginRight: theme.spacing(1),\n color: theme.palette.text.secondary,\n },\n avatar: {\n width: 20,\n height: 20,\n fontSize: '0.65rem',\n },\n emptyMessage: {\n color: theme.palette.text.disabled,\n fontStyle: 'italic',\n padding: theme.spacing(2, 0),\n textAlign: 'center',\n },\n entityText: {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n}));\n\nconst EntityItem = ({ entityRef }: { entityRef: string }) => {\n const classes = useStyles();\n const entityRoute = useRouteRef(entityRouteRef);\n const { primaryTitle, Icon } = useEntityPresentation(entityRef);\n\n return (\n <EntityTooltip\n entity={entityRef}\n interactive={false}\n enterDelay={400}\n enterNextDelay={400}\n placement=\"left\"\n >\n <ListItem\n button\n component={Link}\n to={entityRoute({ entityRef })}\n className={classes.listItem}\n >\n <Box className={classes.iconBox}>\n {Icon ? (\n <Icon fontSize=\"small\" />\n ) : (\n <CategoryIcon style={{ fontSize: 14 }} />\n )}\n </Box>\n <ListItemText\n primary={primaryTitle ?? entityRef}\n classes={{ primary: classes.entityText }}\n />\n </ListItem>\n </EntityTooltip>\n );\n};\n\nexport const FollowedItemsCard = () => {\n const classes = useStyles();\n const { t } = useTranslationRef(qetaTranslationRef);\n\n const { tags, loading: tagsLoading } = useTagsFollow();\n const { entities, loading: entitiesLoading } = useEntityFollow();\n const { users, userEntities, loading: usersLoading } = useUserFollow();\n const { collections, loading: collectionsLoading } = useCollectionsFollow();\n\n const tagRoute = useRouteRef(tagRouteRef);\n const userRoute = useRouteRef(userRouteRef);\n const collectionRoute = useRouteRef(collectionRouteRef);\n\n const isLoading =\n tagsLoading || entitiesLoading || usersLoading || collectionsLoading;\n\n const hasAnyItems =\n tags.length > 0 ||\n entities.length > 0 ||\n users.length > 0 ||\n collections.length > 0;\n\n const renderContent = () => {\n if (isLoading) {\n return (\n <Box>\n {[1, 2, 3].map(row => (\n <Fragment key={row}>\n <Skeleton\n variant=\"text\"\n width=\"40%\"\n style={{ marginTop: 16, marginBottom: 8 }}\n />\n <List dense>\n {[1, 2].map(i => (\n <ListItem key={i} className={classes.listItem}>\n <Skeleton\n variant=\"circle\"\n width={20}\n height={20}\n style={{ marginRight: 8 }}\n />\n <Skeleton variant=\"text\" width=\"60%\" />\n </ListItem>\n ))}\n </List>\n </Fragment>\n ))}\n </Box>\n );\n }\n\n if (!hasAnyItems) {\n return (\n <Typography className={classes.emptyMessage}>\n {t('homePage.noFollowedItems')}\n </Typography>\n );\n }\n\n return (\n <>\n {tags.length > 0 && (\n <>\n <Typography className={classes.sectionTitle}>\n {t('homePage.tags')}\n </Typography>\n <List className={classes.list} dense>\n {tags.slice(0, 5).map(tag => (\n <TagTooltip\n key={tag}\n tag={tag}\n interactive={false}\n enterDelay={400}\n enterNextDelay={400}\n placement=\"left\"\n >\n <ListItem\n button\n component={Link}\n to={tagRoute({ tag })}\n className={classes.listItem}\n >\n <Box className={classes.iconBox}>\n <LocalOfferOutlined style={{ fontSize: 14 }} />\n </Box>\n <ListItemText primary={tag} />\n </ListItem>\n </TagTooltip>\n ))}\n </List>\n </>\n )}\n\n {entities.length > 0 && (\n <>\n <Typography className={classes.sectionTitle}>\n {t('homePage.entities')}\n </Typography>\n <List className={classes.list} dense>\n {entities.slice(0, 5).map(entity => (\n <EntityItem key={entity} entityRef={entity} />\n ))}\n </List>\n </>\n )}\n\n {users.length > 0 && (\n <>\n <Typography className={classes.sectionTitle}>\n {t('homePage.users')}\n </Typography>\n <List className={classes.list} dense>\n {users.slice(0, 5).map(user => {\n const entity = userEntities.get(user);\n const displayName = entity?.spec?.profile?.displayName ?? user;\n const initials = (displayName ?? '')\n .replace(/[^a-zA-Z]/g, '')\n .split(' ')\n .map(p => p[0])\n .join('')\n .substring(0, 2)\n .toUpperCase();\n return (\n <UserTooltip\n key={user}\n entityRef={user}\n interactive={false}\n enterDelay={400}\n enterNextDelay={400}\n placement=\"left\"\n >\n <ListItem\n button\n component={Link}\n to={`${userRoute()}/${user}`}\n className={classes.listItem}\n >\n <ListItemAvatar style={{ minWidth: 32 }}>\n <Avatar\n alt={user}\n src={entity?.spec?.profile?.picture}\n className={classes.avatar}\n >\n {initials || user.charAt(0).toUpperCase()}\n </Avatar>\n </ListItemAvatar>\n <ListItemText primary={displayName} />\n </ListItem>\n </UserTooltip>\n );\n })}\n </List>\n </>\n )}\n\n {collections.length > 0 && (\n <>\n <Typography className={classes.sectionTitle}>\n {t('homePage.collections')}\n </Typography>\n <List className={classes.list} dense>\n {collections.slice(0, 5).map(collection => (\n <CollectionTooltip\n key={collection.id}\n collectionId={collection.id}\n interactive={false}\n enterDelay={400}\n enterNextDelay={400}\n placement=\"left\"\n >\n <ListItem\n button\n component={Link}\n to={collectionRoute({ id: collection.id.toString() })}\n className={classes.listItem}\n >\n <Box className={classes.iconBox}>\n <LibraryBooks style={{ fontSize: 14 }} />\n </Box>\n <ListItemText primary={collection.title} />\n </ListItem>\n </CollectionTooltip>\n ))}\n </List>\n </>\n )}\n </>\n );\n };\n\n return (\n <Card className={classes.root} variant=\"outlined\">\n <CardHeader\n title={t('homePage.followedItems')}\n className={classes.header}\n avatar={<NotificationsActive />}\n titleTypographyProps={{ variant: 'h5' }}\n />\n <CardContent className={classes.content}>{renderContent()}</CardContent>\n </Card>\n );\n};\n"],"names":["Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,MAAA;AAAA,IACR,OAAS,EAAA,MAAA;AAAA,IACT,aAAe,EAAA;AAAA,GACjB;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,SAAS,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAA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AAwB,CAAA;AAAA,QACjC,WAAW,OAAQ,CAAA,MAAA;AAAA,QACnB,MAAA,sBAAS,mBAAoB,EAAA,EAAA,CAAA;AAAA,QAC7B,oBAAA,EAAsB,EAAE,OAAA,EAAS,IAAK;AAAA;AAAA,KACxC;AAAA,wBACC,WAAY,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,OAAA,EAAU,yBAAgB,EAAA;AAAA,GAC5D,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import numeral from 'numeral';
|
|
3
3
|
import { useQetaApi } from '../../hooks/useQetaApi.esm.js';
|
|
4
4
|
import 'react';
|
|
@@ -15,7 +15,7 @@ import { useIdentityApi } from '../../hooks/useIdentityApi.esm.js';
|
|
|
15
15
|
import '@backstage/plugin-permission-react';
|
|
16
16
|
import '@drodil/backstage-plugin-qeta-common';
|
|
17
17
|
import '@backstage/plugin-permission-common';
|
|
18
|
-
import {
|
|
18
|
+
import { makeStyles, Card, CardHeader, CardContent, Box, Grid, Typography, Tooltip } from '@material-ui/core';
|
|
19
19
|
import 'react-router-dom';
|
|
20
20
|
import 'react-use/lib/useDebounce';
|
|
21
21
|
import '../FilterPanel/FilterPanel.esm.js';
|
|
@@ -31,10 +31,88 @@ import LinkIcon from '@material-ui/icons/Link';
|
|
|
31
31
|
import StarIcon from '@material-ui/icons/Star';
|
|
32
32
|
import CheckCircle from '@material-ui/icons/CheckCircle';
|
|
33
33
|
import TrendingUp from '@material-ui/icons/TrendingUp';
|
|
34
|
+
import Visibility from '@material-ui/icons/Visibility';
|
|
34
35
|
|
|
36
|
+
const useStyles = makeStyles((theme) => ({
|
|
37
|
+
card: {
|
|
38
|
+
height: "100%"
|
|
39
|
+
},
|
|
40
|
+
header: {
|
|
41
|
+
paddingBottom: 0
|
|
42
|
+
},
|
|
43
|
+
content: {
|
|
44
|
+
paddingTop: theme.spacing(1)
|
|
45
|
+
},
|
|
46
|
+
heroSection: {
|
|
47
|
+
display: "flex",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
justifyContent: "space-between",
|
|
50
|
+
padding: theme.spacing(1, 0),
|
|
51
|
+
marginBottom: theme.spacing(1.5)
|
|
52
|
+
},
|
|
53
|
+
viewsBox: {
|
|
54
|
+
display: "flex",
|
|
55
|
+
alignItems: "baseline"
|
|
56
|
+
},
|
|
57
|
+
viewsValue: {
|
|
58
|
+
fontSize: "2rem",
|
|
59
|
+
fontWeight: "bold",
|
|
60
|
+
color: theme.palette.primary.main,
|
|
61
|
+
lineHeight: 1
|
|
62
|
+
},
|
|
63
|
+
viewsLabel: {
|
|
64
|
+
marginLeft: theme.spacing(0.5),
|
|
65
|
+
color: theme.palette.text.secondary,
|
|
66
|
+
fontSize: "0.9rem"
|
|
67
|
+
},
|
|
68
|
+
reputationBox: {
|
|
69
|
+
display: "flex",
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
background: theme.palette.type === "dark" ? "rgba(255, 215, 0, 0.1)" : "rgba(255, 215, 0, 0.15)",
|
|
72
|
+
padding: theme.spacing(0.75, 1.5),
|
|
73
|
+
borderRadius: 20
|
|
74
|
+
},
|
|
75
|
+
reputationIcon: {
|
|
76
|
+
color: "#FFD700",
|
|
77
|
+
marginRight: theme.spacing(0.5),
|
|
78
|
+
fontSize: "1.2rem"
|
|
79
|
+
},
|
|
80
|
+
reputationValue: {
|
|
81
|
+
fontWeight: "bold",
|
|
82
|
+
fontSize: "1rem",
|
|
83
|
+
userSelect: "none"
|
|
84
|
+
},
|
|
85
|
+
statGrid: {
|
|
86
|
+
marginTop: theme.spacing(0.5)
|
|
87
|
+
},
|
|
88
|
+
statItem: {
|
|
89
|
+
display: "flex",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
padding: theme.spacing(0.5, 0)
|
|
92
|
+
},
|
|
93
|
+
statIcon: {
|
|
94
|
+
color: theme.palette.text.secondary,
|
|
95
|
+
marginRight: theme.spacing(1),
|
|
96
|
+
fontSize: "1rem"
|
|
97
|
+
},
|
|
98
|
+
statValue: {
|
|
99
|
+
fontWeight: "bold",
|
|
100
|
+
marginRight: theme.spacing(0.5),
|
|
101
|
+
minWidth: 24
|
|
102
|
+
},
|
|
103
|
+
statLabel: {
|
|
104
|
+
color: theme.palette.text.secondary,
|
|
105
|
+
fontSize: "0.8rem"
|
|
106
|
+
},
|
|
107
|
+
contributionsText: {
|
|
108
|
+
color: theme.palette.text.secondary,
|
|
109
|
+
marginBottom: theme.spacing(1),
|
|
110
|
+
fontSize: "0.875rem"
|
|
111
|
+
}
|
|
112
|
+
}));
|
|
35
113
|
const ImpactCard = () => {
|
|
36
114
|
const { t } = useTranslationRef(qetaTranslationRef);
|
|
37
|
-
const
|
|
115
|
+
const classes = useStyles();
|
|
38
116
|
const { value: user, loading: userLoading } = useIdentityApi(
|
|
39
117
|
(api) => api.getBackstageIdentity(),
|
|
40
118
|
[]
|
|
@@ -59,14 +137,20 @@ const ImpactCard = () => {
|
|
|
59
137
|
const loading = userLoading || statsLoading;
|
|
60
138
|
const renderContent = () => {
|
|
61
139
|
if (loading) {
|
|
62
|
-
return /* @__PURE__ */ jsxs(Box, {
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
140
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
141
|
+
/* @__PURE__ */ jsxs(Box, { display: "flex", justifyContent: "space-between", mb: 2, children: [
|
|
142
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "40%", height: 40 }),
|
|
143
|
+
/* @__PURE__ */ jsx(
|
|
144
|
+
Skeleton,
|
|
145
|
+
{
|
|
146
|
+
variant: "rect",
|
|
147
|
+
width: 80,
|
|
148
|
+
height: 32,
|
|
149
|
+
style: { borderRadius: 16 }
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ jsx(Grid, { container: true, spacing: 1, children: Array.from(new Array(6)).map((_, i) => /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "80%" }) }, i)) })
|
|
70
154
|
] });
|
|
71
155
|
}
|
|
72
156
|
if (error) {
|
|
@@ -77,143 +161,88 @@ const ImpactCard = () => {
|
|
|
77
161
|
}
|
|
78
162
|
const { impact, stats } = response;
|
|
79
163
|
const formatNumber = (num) => {
|
|
80
|
-
return num >= 1e3 ? numeral(num).format("0.
|
|
164
|
+
return num >= 1e3 ? numeral(num).format("0.0a") : num;
|
|
81
165
|
};
|
|
82
|
-
const formattedImpact = formatNumber(impact.impact);
|
|
83
|
-
const totalContributions = stats.summary.totalQuestions + stats.summary.totalAnswers + stats.summary.totalArticles + stats.summary.totalLinks;
|
|
84
166
|
const statItems = [
|
|
85
167
|
{
|
|
86
|
-
icon:
|
|
87
|
-
value:
|
|
168
|
+
icon: TrendingUp,
|
|
169
|
+
value: stats.summary.totalQuestions + stats.summary.totalAnswers + stats.summary.totalArticles + stats.summary.totalLinks,
|
|
88
170
|
label: t("impactCard.totalContributions")
|
|
89
171
|
},
|
|
90
172
|
{
|
|
91
|
-
icon:
|
|
92
|
-
value:
|
|
173
|
+
icon: HelpOutline,
|
|
174
|
+
value: stats.summary.totalQuestions,
|
|
93
175
|
label: t("impactCard.questions")
|
|
94
176
|
},
|
|
95
177
|
{
|
|
96
|
-
icon:
|
|
97
|
-
value:
|
|
178
|
+
icon: QuestionAnswerIcon,
|
|
179
|
+
value: stats.summary.totalAnswers,
|
|
98
180
|
label: t("impactCard.answers")
|
|
99
181
|
},
|
|
100
182
|
{
|
|
101
|
-
icon:
|
|
102
|
-
value:
|
|
183
|
+
icon: DescriptionIcon,
|
|
184
|
+
value: stats.summary.totalArticles,
|
|
103
185
|
label: t("impactCard.articles")
|
|
104
186
|
},
|
|
105
187
|
{
|
|
106
|
-
icon:
|
|
107
|
-
value:
|
|
188
|
+
icon: LinkIcon,
|
|
189
|
+
value: stats.summary.totalLinks,
|
|
108
190
|
label: t("impactCard.links")
|
|
109
191
|
},
|
|
110
192
|
{
|
|
111
|
-
icon:
|
|
112
|
-
value:
|
|
193
|
+
icon: ThumbUp,
|
|
194
|
+
value: stats.summary.totalVotes,
|
|
113
195
|
label: t("impactCard.votes")
|
|
114
196
|
},
|
|
115
197
|
{
|
|
116
|
-
icon:
|
|
117
|
-
value:
|
|
198
|
+
icon: PeopleIcon,
|
|
199
|
+
value: stats.summary.totalFollowers,
|
|
118
200
|
label: t("impactCard.followers")
|
|
119
201
|
},
|
|
120
202
|
{
|
|
121
|
-
icon:
|
|
122
|
-
value:
|
|
123
|
-
label: t("impactCard.answerScore")
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
icon: /* @__PURE__ */ jsx(StarIcon, { fontSize: "small" }),
|
|
127
|
-
value: formatNumber(stats.summary.postScore),
|
|
203
|
+
icon: StarIcon,
|
|
204
|
+
value: stats.summary.postScore,
|
|
128
205
|
label: t("impactCard.postScore")
|
|
129
206
|
},
|
|
130
207
|
{
|
|
131
|
-
icon:
|
|
132
|
-
value:
|
|
208
|
+
icon: CheckCircle,
|
|
209
|
+
value: stats.summary.correctAnswers,
|
|
133
210
|
label: t("impactCard.correctAnswers")
|
|
134
211
|
}
|
|
135
212
|
];
|
|
136
213
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
Typography,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
),
|
|
148
|
-
/* @__PURE__ */ jsx(
|
|
149
|
-
Typography,
|
|
150
|
-
{
|
|
151
|
-
variant: "body2",
|
|
152
|
-
component: "span",
|
|
153
|
-
style: { marginLeft: "0.5em", verticalAlign: "middle" },
|
|
154
|
-
color: "textSecondary",
|
|
155
|
-
children: t("impactCard.views")
|
|
156
|
-
}
|
|
157
|
-
)
|
|
214
|
+
/* @__PURE__ */ jsxs(Box, { className: classes.heroSection, children: [
|
|
215
|
+
/* @__PURE__ */ jsxs(Box, { className: classes.viewsBox, children: [
|
|
216
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.viewsValue, children: formatNumber(impact.impact) }),
|
|
217
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.viewsLabel, children: t("impactCard.views") })
|
|
218
|
+
] }),
|
|
219
|
+
/* @__PURE__ */ jsxs(Box, { className: classes.reputationBox, children: [
|
|
220
|
+
/* @__PURE__ */ jsx(EmojiEvents, { className: classes.reputationIcon }),
|
|
221
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.reputationValue, children: stats.summary.reputation || 0 })
|
|
222
|
+
] })
|
|
158
223
|
] }),
|
|
159
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2",
|
|
224
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: classes.contributionsText, children: t("impactCard.contributions", {
|
|
160
225
|
lastWeek: impact.lastWeekImpact.toString(10)
|
|
161
226
|
}) }),
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */ jsx(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
),
|
|
169
|
-
/* @__PURE__ */ jsxs(
|
|
170
|
-
Typography,
|
|
171
|
-
{
|
|
172
|
-
variant: "subtitle1",
|
|
173
|
-
component: "span",
|
|
174
|
-
style: { fontWeight: "bold" },
|
|
175
|
-
children: [
|
|
176
|
-
t("impactCard.reputation"),
|
|
177
|
-
":",
|
|
178
|
-
" ",
|
|
179
|
-
/* @__PURE__ */ jsx(Box, { component: "span", style: { fontSize: "1.1em" }, children: stats.summary.reputation || 0 })
|
|
180
|
-
]
|
|
181
|
-
}
|
|
182
|
-
)
|
|
183
|
-
] }),
|
|
184
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
185
|
-
/* @__PURE__ */ jsx(Box, { mt: 2, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 2, children: statItems.map((item, index) => /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, sm: 4, md: 3, children: /* @__PURE__ */ jsx(Tooltip, { title: item.label, children: /* @__PURE__ */ jsxs(
|
|
186
|
-
Box,
|
|
187
|
-
{
|
|
188
|
-
display: "flex",
|
|
189
|
-
flexDirection: "column",
|
|
190
|
-
alignItems: "center",
|
|
191
|
-
style: { cursor: "default" },
|
|
192
|
-
children: [
|
|
193
|
-
/* @__PURE__ */ jsx(Box, { color: "textSecondary", children: item.icon }),
|
|
194
|
-
/* @__PURE__ */ jsx(
|
|
195
|
-
Typography,
|
|
196
|
-
{
|
|
197
|
-
variant: "body2",
|
|
198
|
-
style: { fontWeight: "bold", marginTop: "4px" },
|
|
199
|
-
children: item.value
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
]
|
|
203
|
-
}
|
|
204
|
-
) }) }, index)) }) })
|
|
227
|
+
/* @__PURE__ */ jsx(Grid, { container: true, spacing: 1, className: classes.statGrid, children: statItems.map((item, index) => /* @__PURE__ */ jsx(Grid, { item: true, xs: 6, sm: 4, children: /* @__PURE__ */ jsx(Tooltip, { title: item.label, children: /* @__PURE__ */ jsxs(Box, { className: classes.statItem, children: [
|
|
228
|
+
/* @__PURE__ */ jsx(item.icon, { className: classes.statIcon }),
|
|
229
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.statValue, children: formatNumber(item.value) }),
|
|
230
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.statLabel, noWrap: true, children: item.label })
|
|
231
|
+
] }) }) }, index)) })
|
|
205
232
|
] });
|
|
206
233
|
};
|
|
207
|
-
return /* @__PURE__ */
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
234
|
+
return /* @__PURE__ */ jsxs(Card, { className: classes.card, variant: "outlined", children: [
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
236
|
+
CardHeader,
|
|
237
|
+
{
|
|
238
|
+
title: t("impactCard.title"),
|
|
239
|
+
className: classes.header,
|
|
240
|
+
avatar: /* @__PURE__ */ jsx(Visibility, {}),
|
|
241
|
+
titleTypographyProps: { variant: "h5" }
|
|
242
|
+
}
|
|
243
|
+
),
|
|
244
|
+
/* @__PURE__ */ jsx(CardContent, { className: classes.content, children: renderContent() })
|
|
245
|
+
] });
|
|
217
246
|
};
|
|
218
247
|
|
|
219
248
|
export { ImpactCard };
|