@drodil/backstage-plugin-qeta 3.24.5 → 3.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ArticlePage/ArticlePage.esm.js +21 -11
- package/dist/components/ArticlePage/ArticlePage.esm.js.map +1 -1
- package/dist/components/ArticlesPage/ArticlesPage.esm.js +24 -15
- package/dist/components/ArticlesPage/ArticlesPage.esm.js.map +1 -1
- package/dist/components/AskPage/AskPage.esm.js +22 -15
- package/dist/components/AskPage/AskPage.esm.js.map +1 -1
- package/dist/components/CollectionCreatePage/CollectionCreatePage.esm.js +5 -2
- package/dist/components/CollectionCreatePage/CollectionCreatePage.esm.js.map +1 -1
- package/dist/components/CollectionPage/CollectionPage.esm.js +34 -25
- package/dist/components/CollectionPage/CollectionPage.esm.js.map +1 -1
- package/dist/components/CollectionsPage/CollectionsPage.esm.js +17 -12
- package/dist/components/CollectionsPage/CollectionsPage.esm.js.map +1 -1
- package/dist/components/EntityPage/EntityPage.esm.js +96 -65
- package/dist/components/EntityPage/EntityPage.esm.js.map +1 -1
- package/dist/components/FavoritePage/FavoritePage.esm.js +34 -22
- package/dist/components/FavoritePage/FavoritePage.esm.js.map +1 -1
- package/dist/components/HomePage/HomePage.esm.js +34 -16
- package/dist/components/HomePage/HomePage.esm.js.map +1 -1
- package/dist/components/ModeratorPage/ModeratorPage.esm.js +19 -9
- package/dist/components/ModeratorPage/ModeratorPage.esm.js.map +1 -1
- package/dist/components/PostsTableCard/Content.esm.js +2 -2
- package/dist/components/PostsTableCard/Content.esm.js.map +1 -1
- package/dist/components/QetaPage/QetaPage.esm.js +120 -85
- package/dist/components/QetaPage/QetaPage.esm.js.map +1 -1
- package/dist/components/QetaSearchResultListItem/QetaSearchResultListItem.esm.js +70 -34
- package/dist/components/QetaSearchResultListItem/QetaSearchResultListItem.esm.js.map +1 -1
- package/dist/components/QuestionPage/QuestionPage.esm.js +79 -42
- package/dist/components/QuestionPage/QuestionPage.esm.js.map +1 -1
- package/dist/components/QuestionsPage/QuestionsPage.esm.js +54 -43
- package/dist/components/QuestionsPage/QuestionsPage.esm.js.map +1 -1
- package/dist/components/Statistics/GlobalStatsContent.esm.js +10 -4
- package/dist/components/Statistics/GlobalStatsContent.esm.js.map +1 -1
- package/dist/components/Statistics/StatisticsPage.esm.js +11 -2
- package/dist/components/Statistics/StatisticsPage.esm.js.map +1 -1
- package/dist/components/TagPage/TagPage.esm.js +88 -58
- package/dist/components/TagPage/TagPage.esm.js.map +1 -1
- package/dist/components/UserPage/UserPage.esm.js +60 -40
- package/dist/components/UserPage/UserPage.esm.js.map +1 -1
- package/dist/components/UserPage/UserStatsContent.esm.js +10 -4
- package/dist/components/UserPage/UserStatsContent.esm.js.map +1 -1
- package/dist/components/UsersPage/UsersPage.esm.js +30 -20
- package/dist/components/UsersPage/UsersPage.esm.js.map +1 -1
- package/dist/components/WritePage/WritePage.esm.js +14 -11
- package/dist/components/WritePage/WritePage.esm.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/package.json +24 -17
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
1
2
|
import { useParams } from 'react-router-dom';
|
|
2
|
-
import
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
3
4
|
import { useSignal } from '@backstage/plugin-signals-react';
|
|
4
5
|
import { WarningPanel, ContentHeader } from '@backstage/core-components';
|
|
5
6
|
import { useTranslation, useQetaApi, ButtonContainer, WriteArticleButton, AddToCollectionButton, AIAnswerCard, ArticleContent } from '@drodil/backstage-plugin-qeta-react';
|
|
@@ -27,21 +28,30 @@ const ArticlePage = () => {
|
|
|
27
28
|
}
|
|
28
29
|
}, [lastSignal]);
|
|
29
30
|
if (loading) {
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsx(Skeleton, { variant: "rect", height: 200 });
|
|
31
32
|
}
|
|
32
33
|
if (error || post === void 0) {
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsx(WarningPanel, { severity: "error", title: t("articlePage.errorLoading"), children: error?.message });
|
|
34
35
|
}
|
|
35
36
|
if (post.type !== "article") {
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ jsx(WarningPanel, { title: "Not found", message: t("articlePage.notFound") });
|
|
37
38
|
}
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(ContentHeader, { children: /* @__PURE__ */ jsxs(ButtonContainer, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx(WriteArticleButton, {}),
|
|
42
|
+
/* @__PURE__ */ jsx(AddToCollectionButton, { post })
|
|
43
|
+
] }) }),
|
|
44
|
+
/* @__PURE__ */ jsxs(Container, { maxWidth: "md", children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
AIAnswerCard,
|
|
47
|
+
{
|
|
48
|
+
article: post,
|
|
49
|
+
style: { marginBottom: "2em" }
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ jsx(ArticleContent, { post, views })
|
|
53
|
+
] })
|
|
54
|
+
] });
|
|
45
55
|
};
|
|
46
56
|
|
|
47
57
|
export { ArticlePage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticlePage.esm.js","sources":["../../../src/components/ArticlePage/ArticlePage.tsx"],"sourcesContent":["import { useParams } from 'react-router-dom';\nimport
|
|
1
|
+
{"version":3,"file":"ArticlePage.esm.js","sources":["../../../src/components/ArticlePage/ArticlePage.tsx"],"sourcesContent":["import { useParams } from 'react-router-dom';\nimport { useEffect, useState } from 'react';\nimport { useSignal } from '@backstage/plugin-signals-react';\nimport { ContentHeader, WarningPanel } from '@backstage/core-components';\nimport { Article, QetaSignal } from '@drodil/backstage-plugin-qeta-common';\nimport {\n AddToCollectionButton,\n AIAnswerCard,\n ArticleContent,\n ButtonContainer,\n useQetaApi,\n useTranslation,\n WriteArticleButton,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { Container } from '@material-ui/core';\nimport { Skeleton } from '@material-ui/lab';\n\nexport const ArticlePage = () => {\n const { id } = useParams();\n const { t } = useTranslation();\n\n const [views, setViews] = useState(0);\n\n const { lastSignal } = useSignal<QetaSignal>(`qeta:post_${id}`);\n\n const {\n value: post,\n loading,\n error,\n } = useQetaApi(api => api.getPost(id), [id]);\n\n useEffect(() => {\n if (post) {\n setViews(post.views);\n }\n }, [post]);\n\n useEffect(() => {\n if (lastSignal?.type === 'post_stats') {\n setViews(lastSignal.views);\n }\n }, [lastSignal]);\n\n if (loading) {\n return <Skeleton variant=\"rect\" height={200} />;\n }\n\n if (error || post === undefined) {\n return (\n <WarningPanel severity=\"error\" title={t('articlePage.errorLoading')}>\n {error?.message}\n </WarningPanel>\n );\n }\n\n if (post.type !== 'article') {\n return (\n <WarningPanel title=\"Not found\" message={t('articlePage.notFound')} />\n );\n }\n\n return (\n <>\n <ContentHeader>\n <ButtonContainer>\n <WriteArticleButton />\n <AddToCollectionButton post={post} />\n </ButtonContainer>\n </ContentHeader>\n <Container maxWidth=\"md\">\n <AIAnswerCard\n article={post as Article}\n style={{ marginBottom: '2em' }}\n />\n <ArticleContent post={post} views={views} />\n </Container>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAiBO,MAAM,cAAc,MAAM;AAC/B,EAAM,MAAA,EAAE,EAAG,EAAA,GAAI,SAAU,EAAA;AACzB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,CAAC,CAAA;AAEpC,EAAA,MAAM,EAAE,UAAW,EAAA,GAAI,SAAsB,CAAA,CAAA,UAAA,EAAa,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CAAC,yBAAsB,IAAY,EAAA;AAAA,KAAA,EACrC,CACF,EAAA,CAAA;AAAA,oBACA,IAAA,CAAC,SAAU,EAAA,EAAA,QAAA,EAAS,IAClB,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,IAAA;AAAA,UACT,KAAA,EAAO,EAAE,YAAA,EAAc,KAAM;AAAA;AAAA,OAC/B;AAAA,sBACA,GAAA,CAAC,cAAe,EAAA,EAAA,IAAA,EAAY,KAAc,EAAA;AAAA,KAC5C,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { useSearchParams } from 'react-router-dom';
|
|
2
|
-
import
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
3
4
|
import { ContentHeader } from '@backstage/core-components';
|
|
4
5
|
import { useTranslation, ButtonContainer, WriteArticleButton, PostsGrid, PostHighlightList, FollowedTagsList, FollowedEntitiesList } from '@drodil/backstage-plugin-qeta-react';
|
|
5
6
|
import { filterTags } from '@drodil/backstage-plugin-qeta-common';
|
|
@@ -8,25 +9,33 @@ import { Grid } from '@material-ui/core';
|
|
|
8
9
|
|
|
9
10
|
const ArticlesPage = () => {
|
|
10
11
|
const [searchParams] = useSearchParams();
|
|
11
|
-
const [entityRef, setEntityRef] =
|
|
12
|
-
|
|
13
|
-
);
|
|
14
|
-
const [tags, setTags] = React.useState(void 0);
|
|
12
|
+
const [entityRef, setEntityRef] = useState(void 0);
|
|
13
|
+
const [tags, setTags] = useState(void 0);
|
|
15
14
|
const { t } = useTranslation();
|
|
16
15
|
useEffect(() => {
|
|
17
16
|
setEntityRef(searchParams.get("entity") ?? void 0);
|
|
18
17
|
setTags(filterTags(searchParams.get("tags")));
|
|
19
18
|
}, [searchParams, setEntityRef]);
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
type: "
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 4, children: [
|
|
20
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, md: 12, lg: 9, xl: 10, children: [
|
|
21
|
+
/* @__PURE__ */ jsx(ContentHeader, { title: t("articlesPage.title"), children: /* @__PURE__ */ jsx(ButtonContainer, { children: /* @__PURE__ */ jsx(WriteArticleButton, { entity: entityRef, tags }) }) }),
|
|
22
|
+
/* @__PURE__ */ jsx(PostsGrid, { type: "article" })
|
|
23
|
+
] }),
|
|
24
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, lg: 3, xl: 2, children: [
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
PostHighlightList,
|
|
27
|
+
{
|
|
28
|
+
type: "hot",
|
|
29
|
+
title: t("highlights.hotArticles.title"),
|
|
30
|
+
noQuestionsLabel: t("highlights.hotArticles.noArticlesLabel"),
|
|
31
|
+
icon: /* @__PURE__ */ jsx(Whatshot, { fontSize: "small" }),
|
|
32
|
+
postType: "article"
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ jsx(FollowedTagsList, {}),
|
|
36
|
+
/* @__PURE__ */ jsx(FollowedEntitiesList, {})
|
|
37
|
+
] })
|
|
38
|
+
] });
|
|
30
39
|
};
|
|
31
40
|
|
|
32
41
|
export { ArticlesPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticlesPage.esm.js","sources":["../../../src/components/ArticlesPage/ArticlesPage.tsx"],"sourcesContent":["import { useSearchParams } from 'react-router-dom';\nimport
|
|
1
|
+
{"version":3,"file":"ArticlesPage.esm.js","sources":["../../../src/components/ArticlesPage/ArticlesPage.tsx"],"sourcesContent":["import { useSearchParams } from 'react-router-dom';\nimport { useState, useEffect } from 'react';\nimport { ContentHeader } from '@backstage/core-components';\nimport {\n ButtonContainer,\n FollowedEntitiesList,\n FollowedTagsList,\n PostHighlightList,\n PostsGrid,\n useTranslation,\n WriteArticleButton,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\nimport Whatshot from '@material-ui/icons/Whatshot';\nimport { Grid } from '@material-ui/core';\n\nexport const ArticlesPage = () => {\n const [searchParams] = useSearchParams();\n\n const [entityRef, setEntityRef] = useState<string | undefined>(undefined);\n const [tags, setTags] = useState<string[] | undefined>(undefined);\n const { t } = useTranslation();\n useEffect(() => {\n setEntityRef(searchParams.get('entity') ?? undefined);\n setTags(filterTags(searchParams.get('tags')));\n }, [searchParams, setEntityRef]);\n\n return (\n <Grid container spacing={4}>\n <Grid item md={12} lg={9} xl={10}>\n <ContentHeader title={t('articlesPage.title')}>\n <ButtonContainer>\n <WriteArticleButton entity={entityRef} tags={tags} />\n </ButtonContainer>\n </ContentHeader>\n <PostsGrid type=\"article\" />\n </Grid>\n <Grid item lg={3} xl={2}>\n <PostHighlightList\n type=\"hot\"\n title={t('highlights.hotArticles.title')}\n noQuestionsLabel={t('highlights.hotArticles.noArticlesLabel')}\n icon={<Whatshot fontSize=\"small\" />}\n postType=\"article\"\n />\n <FollowedTagsList />\n <FollowedEntitiesList />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAgBO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,CAAC,YAAY,CAAA,GAAI,eAAgB,EAAA;AAEvC,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAA6B,KAAS,CAAA,CAAA;AACxE,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAA+B,KAAS,CAAA,CAAA;AAChE,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,YAAA,CAAa,YAAa,CAAA,GAA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KACxB,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
1
2
|
import { Progress, ContentHeader, InfoCard } from '@backstage/core-components';
|
|
2
|
-
import
|
|
3
|
+
import { useState } from 'react';
|
|
3
4
|
import { useAI, useQetaApi, useTranslation, SelectTemplateList, PostForm, AIAnswerCard } from '@drodil/backstage-plugin-qeta-react';
|
|
4
5
|
import { useParams, useSearchParams } from 'react-router-dom';
|
|
5
6
|
import { useEntityPresentation } from '@backstage/plugin-catalog-react';
|
|
@@ -31,10 +32,10 @@ const AskPage = () => {
|
|
|
31
32
|
title = t("askPage.title.newQuestion");
|
|
32
33
|
}
|
|
33
34
|
if (loading) {
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
35
36
|
}
|
|
36
37
|
if (!id && value && value.templates && value.total > 0 && template === void 0) {
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
38
39
|
SelectTemplateList,
|
|
39
40
|
{
|
|
40
41
|
templates: value,
|
|
@@ -51,18 +52,24 @@ const AskPage = () => {
|
|
|
51
52
|
content: data.content
|
|
52
53
|
});
|
|
53
54
|
};
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
|
+
/* @__PURE__ */ jsx(ContentHeader, { title }),
|
|
57
|
+
/* @__PURE__ */ jsx(Grid, { container: true, spacing: 3, direction: "column", children: /* @__PURE__ */ jsx(Grid, { item: true, style: { width: "100%" }, children: /* @__PURE__ */ jsxs(InfoCard, { children: [
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
PostForm,
|
|
60
|
+
{
|
|
61
|
+
id,
|
|
62
|
+
entity,
|
|
63
|
+
entityPage,
|
|
64
|
+
tags,
|
|
65
|
+
type: "question",
|
|
66
|
+
template,
|
|
67
|
+
onFormChange: handleFormChange
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsx(AIAnswerCard, { draft })
|
|
71
|
+
] }) }) })
|
|
72
|
+
] });
|
|
66
73
|
};
|
|
67
74
|
|
|
68
75
|
export { AskPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AskPage.esm.js","sources":["../../../src/components/AskPage/AskPage.tsx"],"sourcesContent":["import { ContentHeader, InfoCard, Progress } from '@backstage/core-components';\nimport
|
|
1
|
+
{"version":3,"file":"AskPage.esm.js","sources":["../../../src/components/AskPage/AskPage.tsx"],"sourcesContent":["import { ContentHeader, InfoCard, Progress } from '@backstage/core-components';\nimport { useState } from 'react';\nimport {\n AIAnswerCard,\n PostForm,\n SelectTemplateList,\n useAI,\n useQetaApi,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { useParams, useSearchParams } from 'react-router-dom';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { filterTags, Template } from '@drodil/backstage-plugin-qeta-common';\nimport { Grid } from '@material-ui/core';\n\nexport const AskPage = () => {\n const { id } = useParams();\n const [searchParams] = useSearchParams();\n const { isNewQuestionsEnabled } = useAI();\n const { value, loading } = useQetaApi(api => api.getTemplates());\n const [draft, setDraft] = useState<\n { title: string; content: string } | undefined\n >(undefined);\n const [template, setTemplate] = useState<Template | null | undefined>(\n undefined,\n );\n\n const entity = searchParams.get('entity') ?? undefined;\n const entityPage = searchParams.get('entityPage') === 'true';\n const tags = filterTags(searchParams.get('tags'));\n const { t } = useTranslation();\n let title;\n if (id) {\n title = t('askPage.title.existingQuestion');\n } else if (entity) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const representation = useEntityPresentation(entity);\n title = t('askPage.title.entityQuestion', {\n entity: representation.primaryTitle,\n });\n } else {\n title = t('askPage.title.newQuestion');\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (\n !id &&\n value &&\n value.templates &&\n value.total > 0 &&\n template === undefined\n ) {\n return (\n <SelectTemplateList\n templates={value}\n onTemplateSelect={temp => setTemplate(temp)}\n />\n );\n }\n\n const handleFormChange = (data: { title: string; content: string }) => {\n if (!isNewQuestionsEnabled) {\n return;\n }\n setDraft({\n title: data.title,\n content: data.content,\n });\n };\n\n return (\n <>\n <ContentHeader title={title} />\n <Grid container spacing={3} direction=\"column\">\n <Grid item style={{ width: '100%' }}>\n <InfoCard>\n <PostForm\n id={id}\n entity={entity}\n entityPage={entityPage}\n tags={tags}\n type=\"question\"\n template={template}\n onFormChange={handleFormChange}\n />\n <AIAnswerCard draft={draft} />\n </InfoCard>\n </Grid>\n </Grid>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAeO,MAAM,UAAU,MAAM;AAC3B,EAAM,MAAA,EAAE,EAAG,EAAA,GAAI,SAAU,EAAA;AACzB,EAAM,MAAA,CAAC,YAAY,CAAA,GAAI,eAAgB,EAAA;AACvC,EAAM,MAAA,EAAE,qBAAsB,EAAA,GAAI,KAAM,EAAA;AACxC,EAAM,MAAA,EAAE,OAAO,OAAQ,EAAA,GAAI,WAAW,CAAO,GAAA,KAAA,GAAA,CAAI,cAAc,CAAA;AAC/D,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAExB,KAAS,CAAA,CAAA;AACX,EAAM,MAAA,CAAC,QAAU,EAAA,WAAW,CAAI,GAAA,QAAA;AAAA,IAC9B,KAAA;AAAA,GACF;AAEA,EAAA,MAAM,MAAS,GAAA,YAAA,CAAa,GAAI,CAAA,QAAQ,CAAK,IAAA,KAAA,CAAA;AAC7C,EAAA,MAAM,UAAa,GAAA,YAAA,CAAa,GAAI,CAAA,YAAY,CAAM,KAAA,MAAA;AACtD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AAC,OAAS,EAAA,CAAA,EAAG,WAAU,QACpC,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,KAAO,EAAA,EAAE,OAAO,MAAO,EAAA,EAChC,+BAAC,QACC,EAAA,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,EAAA;AAAA,UACA,MAAA;AAAA,UACA,UAAA;AAAA,UACA,IAAA;AAAA,UACA,IAAK,EAAA,UAAA;AAAA,UACL,QAAA;AAAA,UACA,YAAc,EAAA;AAAA;AAAA,OAChB;AAAA,sBACA,GAAA,CAAC,gBAAa,KAAc,EAAA;AAAA,KAAA,EAC9B,GACF,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useParams } from 'react-router-dom';
|
|
3
3
|
import { ContentHeader, InfoCard } from '@backstage/core-components';
|
|
4
4
|
import { useTranslation, CollectionForm } from '@drodil/backstage-plugin-qeta-react';
|
|
@@ -13,7 +13,10 @@ const CollectionCreatePage = () => {
|
|
|
13
13
|
} else {
|
|
14
14
|
title = t("collectionCreatePage.title.newCollection");
|
|
15
15
|
}
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
|
+
/* @__PURE__ */ jsx(ContentHeader, { title }),
|
|
18
|
+
/* @__PURE__ */ jsx(Grid, { container: true, spacing: 3, direction: "column", children: /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(InfoCard, { children: /* @__PURE__ */ jsx(CollectionForm, { id }) }) }) })
|
|
19
|
+
] });
|
|
17
20
|
};
|
|
18
21
|
|
|
19
22
|
export { CollectionCreatePage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionCreatePage.esm.js","sources":["../../../src/components/CollectionCreatePage/CollectionCreatePage.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"CollectionCreatePage.esm.js","sources":["../../../src/components/CollectionCreatePage/CollectionCreatePage.tsx"],"sourcesContent":["import { useParams } from 'react-router-dom';\nimport { ContentHeader, InfoCard } from '@backstage/core-components';\nimport {\n CollectionForm,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { Grid } from '@material-ui/core';\n\nexport const CollectionCreatePage = () => {\n const { id } = useParams();\n const { t } = useTranslation();\n\n let title;\n if (id) {\n title = t('collectionCreatePage.title.existingCollection');\n } else {\n title = t('collectionCreatePage.title.newCollection');\n }\n return (\n <>\n <ContentHeader title={title} />\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <InfoCard>\n <CollectionForm id={id} />\n </InfoCard>\n </Grid>\n </Grid>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AAQO,MAAM,uBAAuB,MAAM;AACxC,EAAM,MAAA,EAAE,EAAG,EAAA,GAAI,SAAU,EAAA;AACzB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EAAI,IAAA,KAAA;AACJ,EAAA,IAAI,EAAI,EAAA;AACN,IAAA,KAAA,GAAQ,EAAE,+CAA+C,CAAA;AAAA,GACpD,MAAA;AACL,IAAA,KAAA,GAAQ,EAAE,0CAA0C,CAAA;AAAA;AAEtD,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAc,KAAc,EAAA,CAAA;AAAA,wBAC5B,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,OAAS,EAAA,CAAA,EAAG,WAAU,QACpC,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EACR,8BAAC,QACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,kBAAe,EAAQ,EAAA,CAAA,EAC1B,GACF,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useParams } from 'react-router-dom';
|
|
3
3
|
import { useTranslation, useQetaApi, CollectionFollowButton, ButtonContainer, CreateCollectionButton, CollectionCard, PostsGrid } from '@drodil/backstage-plugin-qeta-react';
|
|
4
4
|
import { Skeleton } from '@material-ui/lab';
|
|
@@ -14,33 +14,42 @@ const CollectionPage = () => {
|
|
|
14
14
|
error
|
|
15
15
|
} = useQetaApi((api) => api.getCollection(id), [id]);
|
|
16
16
|
if (loading) {
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsx(Skeleton, { variant: "rect", height: 200 });
|
|
18
18
|
}
|
|
19
19
|
if (error || collection === void 0) {
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ jsx(WarningPanel, { severity: "error", title: t("questionPage.errorLoading"), children: error?.message });
|
|
21
21
|
}
|
|
22
|
-
const title = /* @__PURE__ */
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
22
|
+
const title = /* @__PURE__ */ jsxs(Typography, { variant: "h5", component: "h2", children: [
|
|
23
|
+
collection.title,
|
|
24
|
+
/* @__PURE__ */ jsx(
|
|
25
|
+
CollectionFollowButton,
|
|
26
|
+
{
|
|
27
|
+
collection,
|
|
28
|
+
style: { marginLeft: "0.5em" }
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
] });
|
|
32
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
ContentHeader,
|
|
35
|
+
{
|
|
36
|
+
titleComponent: title,
|
|
37
|
+
description: t("collectionPage.info"),
|
|
38
|
+
children: /* @__PURE__ */ jsx(ButtonContainer, { children: /* @__PURE__ */ jsx(CreateCollectionButton, {}) })
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, children: [
|
|
42
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(CollectionCard, { collection }) }),
|
|
43
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
|
|
44
|
+
PostsGrid,
|
|
45
|
+
{
|
|
46
|
+
collectionId: collection.id,
|
|
47
|
+
orderBy: "rank",
|
|
48
|
+
allowRanking: collection.canEdit
|
|
49
|
+
}
|
|
50
|
+
) })
|
|
51
|
+
] })
|
|
52
|
+
] });
|
|
44
53
|
};
|
|
45
54
|
|
|
46
55
|
export { CollectionPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionPage.esm.js","sources":["../../../src/components/CollectionPage/CollectionPage.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"CollectionPage.esm.js","sources":["../../../src/components/CollectionPage/CollectionPage.tsx"],"sourcesContent":["import { useParams } from 'react-router-dom';\nimport {\n ButtonContainer,\n CollectionCard,\n CollectionFollowButton,\n CreateCollectionButton,\n PostsGrid,\n useQetaApi,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { Skeleton } from '@material-ui/lab';\nimport { ContentHeader, WarningPanel } from '@backstage/core-components';\nimport { Grid, Typography } from '@material-ui/core';\n\nexport const CollectionPage = () => {\n const { id } = useParams();\n const { t } = useTranslation();\n\n const {\n value: collection,\n loading,\n error,\n } = useQetaApi(api => api.getCollection(id), [id]);\n\n if (loading) {\n return <Skeleton variant=\"rect\" height={200} />;\n }\n\n if (error || collection === undefined) {\n return (\n <WarningPanel severity=\"error\" title={t('questionPage.errorLoading')}>\n {error?.message}\n </WarningPanel>\n );\n }\n\n const title = (\n <Typography variant=\"h5\" component=\"h2\">\n {collection.title}\n <CollectionFollowButton\n collection={collection}\n style={{ marginLeft: '0.5em' }}\n />\n </Typography>\n );\n\n return (\n <>\n <ContentHeader\n titleComponent={title}\n description={t('collectionPage.info')}\n >\n <ButtonContainer>\n <CreateCollectionButton />\n </ButtonContainer>\n </ContentHeader>\n <Grid container>\n <Grid item xs={12}>\n <CollectionCard collection={collection} />\n </Grid>\n <Grid item xs={12}>\n <PostsGrid\n collectionId={collection.id}\n orderBy=\"rank\"\n allowRanking={collection.canEdit}\n />\n </Grid>\n </Grid>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAcO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,EAAE,EAAG,EAAA,GAAI,SAAU,EAAA;AACzB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,UAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACF,GAAI,WAAW,CAAO,GAAA,KAAA,GAAA,CAAI,cAAc,EAAE,CAAA,EAAG,CAAC,EAAE,CAAC,CAAA;AAEjD,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,uBAAQ,GAAA,CAAA,QAAA,EAAA,EAAS,OAAQ,EAAA,MAAA,EAAO,QAAQ,GAAK,EAAA,CAAA;AAAA;AAG/C,EAAI,IAAA,KAAA,IAAS,eAAe,KAAW,CAAA,EAAA;AACrC,IACE,uBAAA,GAAA,CAAC,gBAAa,QAAS,EAAA,OAAA,EAAQ,OAAO,CAAE,CAAA,2BAA2B,CAChE,EAAA,QAAA,EAAA,KAAA,EAAO,OACV,EAAA,CAAA;AAAA;AAIJ,EAAA,MAAM,wBACH,IAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAK,WAAU,IAChC,EAAA,QAAA,EAAA;AAAA,IAAW,UAAA,CAAA,KAAA;AAAA,oBACZ,GAAA;AAAA,MAAC,sBAAA;AAAA,MAAA;AAAA,QACC,UAAA;AAAA,QACA,KAAA,EAAO,EAAE,UAAA,EAAY,OAAQ;AAAA;AAAA;AAC/B,GACF,EAAA,CAAA;AAGF,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,cAAgB,EAAA,KAAA;AAAA,QAChB,WAAA,EAAa,EAAE,qBAAqB,CAAA;AAAA,QAEpC,QAAC,kBAAA,GAAA,CAAA,eAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,sBAAA,EAAA,EAAuB,CAC1B,EAAA;AAAA;AAAA,KACF;AAAA,oBACA,IAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAS,IACb,EAAA,QAAA,EAAA;AAAA,sBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,EAAI,IACb,QAAC,kBAAA,GAAA,CAAA,cAAA,EAAA,EAAe,YAAwB,CAC1C,EAAA,CAAA;AAAA,sBACC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EACb,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UACC,cAAc,UAAW,CAAA,EAAA;AAAA,UACzB,OAAQ,EAAA,MAAA;AAAA,UACR,cAAc,UAAW,CAAA;AAAA;AAAA,OAE7B,EAAA;AAAA,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { ContentHeader } from '@backstage/core-components';
|
|
3
3
|
import { useTranslation, useCollectionsFollow, ButtonContainer, CreateCollectionButton, CollectionsGrid, FollowedCollectionsList } from '@drodil/backstage-plugin-qeta-react';
|
|
4
4
|
import { Grid } from '@material-ui/core';
|
|
@@ -6,17 +6,22 @@ import { Grid } from '@material-ui/core';
|
|
|
6
6
|
const CollectionsPage = () => {
|
|
7
7
|
const { t } = useTranslation();
|
|
8
8
|
const collections = useCollectionsFollow();
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 4, children: [
|
|
10
|
+
/* @__PURE__ */ jsxs(
|
|
11
|
+
Grid,
|
|
12
|
+
{
|
|
13
|
+
item: true,
|
|
14
|
+
md: 12,
|
|
15
|
+
lg: collections.collections.length > 0 ? 9 : 12,
|
|
16
|
+
xl: collections.collections.length > 0 ? 10 : 12,
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ jsx(ContentHeader, { title: t("collectionsPage.title"), children: /* @__PURE__ */ jsx(ButtonContainer, { children: /* @__PURE__ */ jsx(CreateCollectionButton, {}) }) }),
|
|
19
|
+
/* @__PURE__ */ jsx(CollectionsGrid, {})
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
/* @__PURE__ */ jsx(Grid, { item: true, lg: 3, xl: 2, children: /* @__PURE__ */ jsx(FollowedCollectionsList, {}) })
|
|
24
|
+
] });
|
|
20
25
|
};
|
|
21
26
|
|
|
22
27
|
export { CollectionsPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionsPage.esm.js","sources":["../../../src/components/CollectionsPage/CollectionsPage.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"CollectionsPage.esm.js","sources":["../../../src/components/CollectionsPage/CollectionsPage.tsx"],"sourcesContent":["import { ContentHeader } from '@backstage/core-components';\nimport {\n ButtonContainer,\n CollectionsGrid,\n CreateCollectionButton,\n FollowedCollectionsList,\n useCollectionsFollow,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { Grid } from '@material-ui/core';\n\nexport const CollectionsPage = () => {\n const { t } = useTranslation();\n const collections = useCollectionsFollow();\n\n return (\n <Grid container spacing={4}>\n <Grid\n item\n md={12}\n lg={collections.collections.length > 0 ? 9 : 12}\n xl={collections.collections.length > 0 ? 10 : 12}\n >\n <ContentHeader title={t('collectionsPage.title')}>\n <ButtonContainer>\n <CreateCollectionButton />\n </ButtonContainer>\n </ContentHeader>\n <CollectionsGrid />\n </Grid>\n <Grid item lg={3} xl={2}>\n <FollowedCollectionsList />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;AAWO,MAAM,kBAAkB,MAAM;AACnC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,cAAc,oBAAqB,EAAA;AAEzC,EAAA,uBACG,IAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAA,IAAA,EAAC,SAAS,CACvB,EAAA,QAAA,EAAA;AAAA,oBAAA,IAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,IAAI,EAAA,IAAA;AAAA,QACJ,EAAI,EAAA,EAAA;AAAA,QACJ,EAAI,EAAA,WAAA,CAAY,WAAY,CAAA,MAAA,GAAS,IAAI,CAAI,GAAA,EAAA;AAAA,QAC7C,EAAI,EAAA,WAAA,CAAY,WAAY,CAAA,MAAA,GAAS,IAAI,EAAK,GAAA,EAAA;AAAA,QAE9C,QAAA,EAAA;AAAA,0BAAC,GAAA,CAAA,aAAA,EAAA,EAAc,KAAO,EAAA,CAAA,CAAE,uBAAuB,CAAA,EAC7C,8BAAC,eACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,sBAAuB,EAAA,EAAA,CAAA,EAC1B,CACF,EAAA,CAAA;AAAA,8BACC,eAAgB,EAAA,EAAA;AAAA;AAAA;AAAA,KACnB;AAAA,oBACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,GAAG,EAAI,EAAA,CAAA,EACpB,QAAC,kBAAA,GAAA,CAAA,uBAAA,EAAA,EAAwB,CAC3B,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
2
3
|
import { ContentHeader } from '@backstage/core-components';
|
|
3
4
|
import { useParams } from 'react-router-dom';
|
|
4
5
|
import { useTranslation, qetaApiRef, ButtonContainer, EntityFollowButton, AskQuestionButton, WriteArticleButton, PostsContainer, EntitiesGrid, FollowedEntitiesList, PostHighlightList } from '@drodil/backstage-plugin-qeta-react';
|
|
@@ -10,7 +11,7 @@ import { Grid, Typography, Card, CardContent } from '@material-ui/core';
|
|
|
10
11
|
const EntityPage = () => {
|
|
11
12
|
const { entityRef } = useParams();
|
|
12
13
|
const { t } = useTranslation();
|
|
13
|
-
const [resp, setResp] =
|
|
14
|
+
const [resp, setResp] = useState();
|
|
14
15
|
const qetaApi = useApi(qetaApiRef);
|
|
15
16
|
useEffect(() => {
|
|
16
17
|
if (!entityRef) {
|
|
@@ -27,70 +28,100 @@ const EntityPage = () => {
|
|
|
27
28
|
let link = void 0;
|
|
28
29
|
if (entityRef) {
|
|
29
30
|
shownTitle = t(`postsContainer.title.about`, { itemType: "Post" });
|
|
30
|
-
link = /* @__PURE__ */
|
|
31
|
+
link = /* @__PURE__ */ jsx(EntityRefLink, { entityRef });
|
|
31
32
|
}
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
33
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 4, children: [
|
|
34
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, md: 12, lg: 9, xl: 10, children: [
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
ContentHeader,
|
|
37
|
+
{
|
|
38
|
+
titleComponent: /* @__PURE__ */ jsxs(Typography, { variant: "h5", component: "h2", children: [
|
|
39
|
+
shownTitle,
|
|
40
|
+
" ",
|
|
41
|
+
link
|
|
42
|
+
] }),
|
|
43
|
+
children: /* @__PURE__ */ jsxs(ButtonContainer, { children: [
|
|
44
|
+
entityRef && /* @__PURE__ */ jsx(EntityFollowButton, { entityRef }),
|
|
45
|
+
/* @__PURE__ */ jsx(AskQuestionButton, { entity: entityRef }),
|
|
46
|
+
/* @__PURE__ */ jsx(WriteArticleButton, { entity: entityRef })
|
|
47
|
+
] })
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
resp && /* @__PURE__ */ jsx(Card, { variant: "outlined", style: { marginBottom: "1em" }, children: /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs(Typography, { variant: "caption", children: [
|
|
51
|
+
t("common.posts", {
|
|
52
|
+
count: resp.postsCount,
|
|
53
|
+
itemType: "post"
|
|
54
|
+
}),
|
|
55
|
+
" \xB7 ",
|
|
56
|
+
t("common.followers", { count: resp.followerCount })
|
|
57
|
+
] }) }) }),
|
|
58
|
+
entityRef ? /* @__PURE__ */ jsx(
|
|
59
|
+
PostsContainer,
|
|
60
|
+
{
|
|
61
|
+
entity: entityRef,
|
|
62
|
+
filterPanelProps: { showEntityFilter: false }
|
|
63
|
+
}
|
|
64
|
+
) : /* @__PURE__ */ jsx(EntitiesGrid, {})
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, lg: 3, xl: 2, children: [
|
|
67
|
+
/* @__PURE__ */ jsx(FollowedEntitiesList, {}),
|
|
68
|
+
resp && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
PostHighlightList,
|
|
71
|
+
{
|
|
72
|
+
type: "hot",
|
|
73
|
+
title: t("highlights.hotQuestions.title"),
|
|
74
|
+
noQuestionsLabel: t("highlights.hotQuestions.noQuestionsLabel"),
|
|
75
|
+
icon: /* @__PURE__ */ jsx(Whatshot, { fontSize: "small" }),
|
|
76
|
+
options: { entities: [resp.entityRef] },
|
|
77
|
+
postType: "question"
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
PostHighlightList,
|
|
82
|
+
{
|
|
83
|
+
type: "unanswered",
|
|
84
|
+
title: t("highlights.unanswered.title"),
|
|
85
|
+
noQuestionsLabel: t("highlights.unanswered.noQuestionsLabel"),
|
|
86
|
+
options: { entities: [resp.entityRef] },
|
|
87
|
+
postType: "question"
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
PostHighlightList,
|
|
92
|
+
{
|
|
93
|
+
type: "incorrect",
|
|
94
|
+
title: t("highlights.incorrect.title"),
|
|
95
|
+
noQuestionsLabel: t("highlights.incorrect.noQuestionsLabel"),
|
|
96
|
+
options: { entities: [resp.entityRef] },
|
|
97
|
+
postType: "question"
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] }),
|
|
101
|
+
!resp && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
PostHighlightList,
|
|
104
|
+
{
|
|
105
|
+
type: "hot",
|
|
106
|
+
title: t("highlights.hotQuestions.title"),
|
|
107
|
+
noQuestionsLabel: t("highlights.hotQuestions.noQuestionsLabel"),
|
|
108
|
+
icon: /* @__PURE__ */ jsx(Whatshot, { fontSize: "small" }),
|
|
109
|
+
postType: "question"
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
PostHighlightList,
|
|
114
|
+
{
|
|
115
|
+
type: "hot",
|
|
116
|
+
title: t("highlights.hotArticles.title"),
|
|
117
|
+
noQuestionsLabel: t("highlights.hotArticles.noArticlesLabel"),
|
|
118
|
+
icon: /* @__PURE__ */ jsx(Whatshot, { fontSize: "small" }),
|
|
119
|
+
postType: "article"
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] })
|
|
123
|
+
] })
|
|
124
|
+
] });
|
|
94
125
|
};
|
|
95
126
|
|
|
96
127
|
export { EntityPage };
|