@drodil/backstage-plugin-qeta 2.15.0 → 3.0.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/ArticlePage/ArticlePage.esm.js +45 -0
- package/dist/components/ArticlePage/ArticlePage.esm.js.map +1 -0
- package/dist/components/ArticlesPage/ArticlesPage.esm.js +34 -0
- package/dist/components/ArticlesPage/ArticlesPage.esm.js.map +1 -0
- package/dist/components/AskPage/AskPage.esm.js +4 -4
- package/dist/components/AskPage/AskPage.esm.js.map +1 -1
- package/dist/components/CollectionCreatePage/CollectionCreatePage.esm.js +20 -0
- package/dist/components/CollectionCreatePage/CollectionCreatePage.esm.js.map +1 -0
- package/dist/components/CollectionPage/CollectionPage.esm.js +34 -0
- package/dist/components/CollectionPage/CollectionPage.esm.js.map +1 -0
- package/dist/components/CollectionsPage/CollectionsPage.esm.js +11 -0
- package/dist/components/CollectionsPage/CollectionsPage.esm.js.map +1 -0
- package/dist/components/EntityPage/EntityPage.esm.js +75 -0
- package/dist/components/EntityPage/EntityPage.esm.js.map +1 -0
- package/dist/components/FavoritePage/FavoritePage.esm.js +14 -22
- package/dist/components/FavoritePage/FavoritePage.esm.js.map +1 -1
- package/dist/components/HomePage/HomePage.esm.js +7 -10
- package/dist/components/HomePage/HomePage.esm.js.map +1 -1
- package/dist/components/LeftMenu/LeftMenu.esm.js +47 -16
- package/dist/components/LeftMenu/LeftMenu.esm.js.map +1 -1
- package/dist/components/LeftMenu/LeftMenuButton.esm.js +75 -0
- package/dist/components/LeftMenu/LeftMenuButton.esm.js.map +1 -0
- package/dist/components/QetaPage/QetaPage.esm.js +51 -9
- package/dist/components/QetaPage/QetaPage.esm.js.map +1 -1
- package/dist/components/QuestionPage/QuestionPage.esm.js +7 -13
- package/dist/components/QuestionPage/QuestionPage.esm.js.map +1 -1
- package/dist/components/QuestionTableCard/Content.esm.js +1 -1
- package/dist/components/QuestionTableCard/Content.esm.js.map +1 -1
- package/dist/components/QuestionTableCard/index.esm.js +0 -1
- package/dist/components/QuestionTableCard/index.esm.js.map +1 -1
- package/dist/components/QuestionsPage/QuestionsPage.esm.js +13 -15
- package/dist/components/QuestionsPage/QuestionsPage.esm.js.map +1 -1
- package/dist/components/Statistics/GlobalStatsContent.esm.js +1 -3
- package/dist/components/Statistics/GlobalStatsContent.esm.js.map +1 -1
- package/dist/components/Statistics/StatisticsPage.esm.js +2 -3
- package/dist/components/Statistics/StatisticsPage.esm.js.map +1 -1
- package/dist/components/TagPage/TagPage.esm.js +32 -25
- package/dist/components/TagPage/TagPage.esm.js.map +1 -1
- package/dist/components/UserPage/UserPage.esm.js +7 -16
- package/dist/components/UserPage/UserPage.esm.js.map +1 -1
- package/dist/components/UserPage/UserStatsContent.esm.js +1 -3
- package/dist/components/UserPage/UserStatsContent.esm.js.map +1 -1
- package/dist/components/UsersPage/UsersPage.esm.js +11 -0
- package/dist/components/UsersPage/UsersPage.esm.js.map +1 -0
- package/dist/components/WritePage/WritePage.esm.js +40 -0
- package/dist/components/WritePage/WritePage.esm.js.map +1 -0
- package/dist/index.d.ts +8 -422
- package/dist/index.esm.js +0 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin.esm.js +2 -2
- package/dist/plugin.esm.js.map +1 -1
- package/package.json +4 -24
- package/dist/api/QetaClient.esm.js +0 -513
- package/dist/api/QetaClient.esm.js.map +0 -1
- package/dist/components/AnswersContainer/AnswerList.esm.js +0 -100
- package/dist/components/AnswersContainer/AnswerList.esm.js.map +0 -1
- package/dist/components/AnswersContainer/AnswerListItem.esm.js +0 -90
- package/dist/components/AnswersContainer/AnswerListItem.esm.js.map +0 -1
- package/dist/components/AnswersContainer/AnswersContainer.esm.js +0 -210
- package/dist/components/AnswersContainer/AnswersContainer.esm.js.map +0 -1
- package/dist/components/AskAnonymouslyCheckbox/AskAnonymouslyCheckbox.esm.js +0 -34
- package/dist/components/AskAnonymouslyCheckbox/AskAnonymouslyCheckbox.esm.js.map +0 -1
- package/dist/components/AskForm/AskForm.esm.js +0 -245
- package/dist/components/AskForm/AskForm.esm.js.map +0 -1
- package/dist/components/AskForm/EntitiesInput.esm.js +0 -100
- package/dist/components/AskForm/EntitiesInput.esm.js.map +0 -1
- package/dist/components/AskForm/TagInput.esm.js +0 -81
- package/dist/components/AskForm/TagInput.esm.js.map +0 -1
- package/dist/components/Buttons/AskQuestionButton.esm.js +0 -45
- package/dist/components/Buttons/AskQuestionButton.esm.js.map +0 -1
- package/dist/components/Buttons/BackToQuestionsButton.esm.js +0 -39
- package/dist/components/Buttons/BackToQuestionsButton.esm.js.map +0 -1
- package/dist/components/Buttons/EntityFollowButton.esm.js +0 -34
- package/dist/components/Buttons/EntityFollowButton.esm.js.map +0 -1
- package/dist/components/Buttons/TagFollowButton.esm.js +0 -33
- package/dist/components/Buttons/TagFollowButton.esm.js.map +0 -1
- package/dist/components/CommentSection/CommentList.esm.js +0 -47
- package/dist/components/CommentSection/CommentList.esm.js.map +0 -1
- package/dist/components/CommentSection/CommentSection.esm.js +0 -126
- package/dist/components/CommentSection/CommentSection.esm.js.map +0 -1
- package/dist/components/DeleteModal/DeleteModal.esm.js +0 -78
- package/dist/components/DeleteModal/DeleteModal.esm.js.map +0 -1
- package/dist/components/HomePageCards/ImpactCard.esm.js +0 -22
- package/dist/components/HomePageCards/ImpactCard.esm.js.map +0 -1
- package/dist/components/HomePageCards/QuestionsCard.esm.js +0 -21
- package/dist/components/HomePageCards/QuestionsCard.esm.js.map +0 -1
- package/dist/components/Links/Links.esm.js +0 -33
- package/dist/components/Links/Links.esm.js.map +0 -1
- package/dist/components/MarkdownEditor/MarkdownEditor.esm.js +0 -78
- package/dist/components/MarkdownEditor/MarkdownEditor.esm.js.map +0 -1
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js +0 -37
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js.map +0 -1
- package/dist/components/QetaPage/FollowedEntitiesList.esm.js +0 -43
- package/dist/components/QetaPage/FollowedEntitiesList.esm.js.map +0 -1
- package/dist/components/QetaPage/FollowedTagsList.esm.js +0 -56
- package/dist/components/QetaPage/FollowedTagsList.esm.js.map +0 -1
- package/dist/components/QuestionHighlightList/QuestionHighlightList.esm.js +0 -64
- package/dist/components/QuestionHighlightList/QuestionHighlightList.esm.js.map +0 -1
- package/dist/components/QuestionPage/AnswerCard.esm.js +0 -113
- package/dist/components/QuestionPage/AnswerCard.esm.js.map +0 -1
- package/dist/components/QuestionPage/AnswerForm.esm.js +0 -153
- package/dist/components/QuestionPage/AnswerForm.esm.js.map +0 -1
- package/dist/components/QuestionPage/AuthorBox.esm.js +0 -25
- package/dist/components/QuestionPage/AuthorBox.esm.js.map +0 -1
- package/dist/components/QuestionPage/EntityChip.esm.js +0 -27
- package/dist/components/QuestionPage/EntityChip.esm.js.map +0 -1
- package/dist/components/QuestionPage/FavoriteButton.esm.js +0 -45
- package/dist/components/QuestionPage/FavoriteButton.esm.js.map +0 -1
- package/dist/components/QuestionPage/LinkButton.esm.js +0 -28
- package/dist/components/QuestionPage/LinkButton.esm.js.map +0 -1
- package/dist/components/QuestionPage/QuestionCard.esm.js +0 -107
- package/dist/components/QuestionPage/QuestionCard.esm.js.map +0 -1
- package/dist/components/QuestionPage/TagsAndEntities.esm.js +0 -44
- package/dist/components/QuestionPage/TagsAndEntities.esm.js.map +0 -1
- package/dist/components/QuestionPage/VoteButtons.esm.js +0 -153
- package/dist/components/QuestionPage/VoteButtons.esm.js.map +0 -1
- package/dist/components/QuestionTableCard/QuestionTableRow.esm.js +0 -21
- package/dist/components/QuestionTableCard/QuestionTableRow.esm.js.map +0 -1
- package/dist/components/QuestionTableCard/QuestionsTable.esm.js +0 -130
- package/dist/components/QuestionTableCard/QuestionsTable.esm.js.map +0 -1
- package/dist/components/QuestionsContainer/DateRangeFilter.esm.js +0 -110
- package/dist/components/QuestionsContainer/DateRangeFilter.esm.js.map +0 -1
- package/dist/components/QuestionsContainer/FilterPanel.esm.js +0 -237
- package/dist/components/QuestionsContainer/FilterPanel.esm.js.map +0 -1
- package/dist/components/QuestionsContainer/NoQuestionsCard.esm.js +0 -47
- package/dist/components/QuestionsContainer/NoQuestionsCard.esm.js.map +0 -1
- package/dist/components/QuestionsContainer/QuestionList.esm.js +0 -103
- package/dist/components/QuestionsContainer/QuestionList.esm.js.map +0 -1
- package/dist/components/QuestionsContainer/QuestionListItem.esm.js +0 -123
- package/dist/components/QuestionsContainer/QuestionListItem.esm.js.map +0 -1
- package/dist/components/QuestionsContainer/QuestionsContainer.esm.js +0 -243
- package/dist/components/QuestionsContainer/QuestionsContainer.esm.js.map +0 -1
- package/dist/components/RelativeTimeWithTooltip/RelativeTimeWithTooltip.esm.js +0 -22
- package/dist/components/RelativeTimeWithTooltip/RelativeTimeWithTooltip.esm.js.map +0 -1
- package/dist/components/Statistics/StatsChart.esm.js +0 -238
- package/dist/components/Statistics/StatsChart.esm.js.map +0 -1
- package/dist/components/Statistics/SummaryStatsGrid.esm.js +0 -47
- package/dist/components/Statistics/SummaryStatsGrid.esm.js.map +0 -1
- package/dist/components/Statistics/TopRankingUsersCard.esm.js +0 -161
- package/dist/components/Statistics/TopRankingUsersCard.esm.js.map +0 -1
- package/dist/components/Statistics/TrophyIcon.esm.js +0 -19
- package/dist/components/Statistics/TrophyIcon.esm.js.map +0 -1
- package/dist/components/Statistics/styles.esm.js +0 -23
- package/dist/components/Statistics/styles.esm.js.map +0 -1
- package/dist/components/TagPage/TagsContainer.esm.js +0 -57
- package/dist/components/TagPage/TagsContainer.esm.js.map +0 -1
- package/dist/locale/fi.esm.js +0 -195
- package/dist/locale/fi.esm.js.map +0 -1
- package/dist/translation.esm.js +0 -359
- package/dist/translation.esm.js.map +0 -1
- package/dist/utils/hooks.esm.js +0 -430
- package/dist/utils/hooks.esm.js.map +0 -1
- package/dist/utils/utils.esm.js +0 -72
- package/dist/utils/utils.esm.js.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useParams, useSearchParams } from 'react-router-dom';
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { useSignal } from '@backstage/plugin-signals-react';
|
|
4
|
+
import { Skeleton } from '@material-ui/lab';
|
|
5
|
+
import { WarningPanel, ContentHeader } from '@backstage/core-components';
|
|
6
|
+
import { useTranslation, useQetaApi, BackToArticlesButton, WriteArticleButton, AddToCollectionButton, ArticleContent } from '@drodil/backstage-plugin-qeta-react';
|
|
7
|
+
import { Container } from '@material-ui/core';
|
|
8
|
+
|
|
9
|
+
const ArticlePage = () => {
|
|
10
|
+
const { id } = useParams();
|
|
11
|
+
const { t } = useTranslation();
|
|
12
|
+
const [searchParams] = useSearchParams();
|
|
13
|
+
const [views, setViews] = useState(0);
|
|
14
|
+
const { lastSignal } = useSignal(`qeta:post_${id}`);
|
|
15
|
+
const {
|
|
16
|
+
value: post,
|
|
17
|
+
loading,
|
|
18
|
+
error
|
|
19
|
+
} = useQetaApi((api) => api.getPost(id), [id]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (post) {
|
|
22
|
+
setViews(post.views);
|
|
23
|
+
}
|
|
24
|
+
}, [post]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (lastSignal?.type === "post_stats") {
|
|
27
|
+
setViews(lastSignal.views);
|
|
28
|
+
}
|
|
29
|
+
}, [lastSignal]);
|
|
30
|
+
if (loading) {
|
|
31
|
+
return /* @__PURE__ */ React.createElement(Skeleton, { variant: "rect", height: 200 });
|
|
32
|
+
}
|
|
33
|
+
if (error || post === void 0) {
|
|
34
|
+
return /* @__PURE__ */ React.createElement(WarningPanel, { severity: "error", title: t("articlePage.errorLoading") }, error?.message);
|
|
35
|
+
}
|
|
36
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, null, /* @__PURE__ */ React.createElement(
|
|
37
|
+
BackToArticlesButton,
|
|
38
|
+
{
|
|
39
|
+
entityPage: searchParams.get("entityPage") === "true"
|
|
40
|
+
}
|
|
41
|
+
), /* @__PURE__ */ React.createElement(WriteArticleButton, null), /* @__PURE__ */ React.createElement(AddToCollectionButton, { post })), /* @__PURE__ */ React.createElement(Container, { maxWidth: "md" }, /* @__PURE__ */ React.createElement(ArticleContent, { post, views })));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { ArticlePage };
|
|
45
|
+
//# sourceMappingURL=ArticlePage.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticlePage.esm.js","sources":["../../../src/components/ArticlePage/ArticlePage.tsx"],"sourcesContent":["import { useParams, useSearchParams } from 'react-router-dom';\nimport React, { useEffect, useState } from 'react';\nimport { useSignal } from '@backstage/plugin-signals-react';\nimport { Skeleton } from '@material-ui/lab';\nimport { ContentHeader, WarningPanel } from '@backstage/core-components';\nimport { QetaSignal } from '@drodil/backstage-plugin-qeta-common';\nimport {\n AddToCollectionButton,\n ArticleContent,\n BackToArticlesButton,\n useQetaApi,\n useTranslation,\n WriteArticleButton,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { Container } from '@material-ui/core';\n\nexport const ArticlePage = () => {\n const { id } = useParams();\n const { t } = useTranslation();\n const [searchParams] = useSearchParams();\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 return (\n <>\n <ContentHeader>\n <BackToArticlesButton\n entityPage={searchParams.get('entityPage') === 'true'}\n />\n <WriteArticleButton />\n <AddToCollectionButton post={post} />\n </ContentHeader>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EAAA;AAC/B,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,gBAAa,QAAS,EAAA,OAAA,EAAQ,OAAO,CAAE,CAAA,0BAA0B,CAC/D,EAAA,EAAA,KAAA,EAAO,OACV,CAAA,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,sCACG,aACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,YAAA,CAAa,GAAI,CAAA,YAAY,CAAM,KAAA,MAAA;AAAA,KAAA;AAAA,qBAEhD,KAAA,CAAA,aAAA,CAAA,kBAAA,EAAA,IAAmB,mBACnB,KAAA,CAAA,aAAA,CAAA,qBAAA,EAAA,EAAsB,MAAY,CACrC,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAU,UAAS,IAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,IAAY,EAAA,KAAA,EAAc,CAC5C,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useSearchParams } from 'react-router-dom';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { ContentHeader } from '@backstage/core-components';
|
|
4
|
+
import { useTranslation, WriteArticleButton, PostsGrid, PostHighlightList } from '@drodil/backstage-plugin-qeta-react';
|
|
5
|
+
import { filterTags } from '@drodil/backstage-plugin-qeta-common';
|
|
6
|
+
import { Grid } from '@material-ui/core';
|
|
7
|
+
import Whatshot from '@material-ui/icons/Whatshot';
|
|
8
|
+
|
|
9
|
+
const ArticlesPage = () => {
|
|
10
|
+
const [searchParams] = useSearchParams();
|
|
11
|
+
const [entityRef, setEntityRef] = React.useState(
|
|
12
|
+
void 0
|
|
13
|
+
);
|
|
14
|
+
const [tags, setTags] = React.useState(void 0);
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setEntityRef(searchParams.get("entity") ?? void 0);
|
|
18
|
+
setTags(filterTags(searchParams.get("tags")));
|
|
19
|
+
}, [searchParams, setEntityRef]);
|
|
20
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 4 }, /* @__PURE__ */ React.createElement(Grid, { item: true, md: 12, lg: 9, xl: 10 }, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("articlesPage.title") }, /* @__PURE__ */ React.createElement(WriteArticleButton, { entity: entityRef, tags })), /* @__PURE__ */ React.createElement(PostsGrid, { type: "article" })), /* @__PURE__ */ React.createElement(Grid, { item: true, lg: 3, xl: 2 }, /* @__PURE__ */ React.createElement(
|
|
21
|
+
PostHighlightList,
|
|
22
|
+
{
|
|
23
|
+
type: "hot",
|
|
24
|
+
title: t("highlights.hotArticles.title"),
|
|
25
|
+
noQuestionsLabel: t("highlights.hotArticles.noArticlesLabel"),
|
|
26
|
+
icon: /* @__PURE__ */ React.createElement(Whatshot, { fontSize: "small" }),
|
|
27
|
+
options: { favorite: true },
|
|
28
|
+
postType: "article"
|
|
29
|
+
}
|
|
30
|
+
)));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { ArticlesPage };
|
|
34
|
+
//# sourceMappingURL=ArticlesPage.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticlesPage.esm.js","sources":["../../../src/components/ArticlesPage/ArticlesPage.tsx"],"sourcesContent":["import { useSearchParams } from 'react-router-dom';\nimport React, { useEffect } from 'react';\nimport { ContentHeader } from '@backstage/core-components';\nimport {\n PostHighlightList,\n PostsGrid,\n useTranslation,\n WriteArticleButton,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\nimport { Grid } from '@material-ui/core';\nimport Whatshot from '@material-ui/icons/Whatshot';\n\nexport const ArticlesPage = () => {\n const [searchParams] = useSearchParams();\n\n const [entityRef, setEntityRef] = React.useState<string | undefined>(\n undefined,\n );\n const [tags, setTags] = React.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 <WriteArticleButton entity={entityRef} tags={tags} />\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 options={{ favorite: true }}\n postType=\"article\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAaO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,CAAC,YAAY,CAAA,GAAI,eAAgB,EAAA,CAAA;AAEvC,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,KAAM,CAAA,QAAA;AAAA,IACtC,KAAA,CAAA;AAAA,GACF,CAAA;AACA,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAA,KAAA,CAAM,SAA+B,KAAS,CAAA,CAAA,CAAA;AACtE,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,YAAA,CAAa,YAAa,CAAA,GAAA,CAAI,QAAQ,CAAA,IAAK,KAAS,CAAA,CAAA,CAAA;AACpD,IAAA,OAAA,CAAQ,UAAW,CAAA,YAAA,CAAa,GAAI,CAAA,MAAM,CAAC,CAAC,CAAA,CAAA;AAAA,GAC3C,EAAA,CAAC,YAAc,EAAA,YAAY,CAAC,CAAA,CAAA;AAE/B,EAAA,2CACG,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,OAAS,EAAA,CAAA,EAAA,sCACtB,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,EAAI,EAAA,EAAA,EAAI,IAAI,CAAG,EAAA,EAAA,EAAI,sBAC3B,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,OAAO,CAAE,CAAA,oBAAoB,CAC1C,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,sBAAmB,MAAQ,EAAA,SAAA,EAAW,MAAY,CACrD,CAAA,sCACC,SAAU,EAAA,EAAA,IAAA,EAAK,WAAU,CAC5B,CAAA,sCACC,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,EAAI,EAAA,CAAA,EAAG,IAAI,CACpB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,KAAA;AAAA,MACL,KAAA,EAAO,EAAE,8BAA8B,CAAA;AAAA,MACvC,gBAAA,EAAkB,EAAE,wCAAwC,CAAA;AAAA,MAC5D,IAAM,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA;AAAA,MACjC,OAAA,EAAS,EAAE,QAAA,EAAU,IAAK,EAAA;AAAA,MAC1B,QAAS,EAAA,SAAA;AAAA,KAAA;AAAA,GAEb,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ContentHeader, InfoCard } from '@backstage/core-components';
|
|
2
2
|
import { Grid } from '@material-ui/core';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { useTranslation, PostForm } from '@drodil/backstage-plugin-qeta-react';
|
|
5
5
|
import { useParams, useSearchParams } from 'react-router-dom';
|
|
6
6
|
import { useEntityPresentation } from '@backstage/plugin-catalog-react';
|
|
7
7
|
import { filterTags } from '@drodil/backstage-plugin-qeta-common';
|
|
8
|
-
import { useTranslation } from '../../utils/hooks.esm.js';
|
|
9
8
|
|
|
10
9
|
const AskPage = () => {
|
|
11
10
|
const { id } = useParams();
|
|
@@ -26,12 +25,13 @@ const AskPage = () => {
|
|
|
26
25
|
title = t("askPage.title.newQuestion");
|
|
27
26
|
}
|
|
28
27
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, { title }), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(InfoCard, null, /* @__PURE__ */ React.createElement(
|
|
29
|
-
|
|
28
|
+
PostForm,
|
|
30
29
|
{
|
|
31
30
|
id,
|
|
32
31
|
entity,
|
|
33
32
|
entityPage,
|
|
34
|
-
tags
|
|
33
|
+
tags,
|
|
34
|
+
type: "question"
|
|
35
35
|
}
|
|
36
36
|
)))));
|
|
37
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AskPage.esm.js","sources":["../../../src/components/AskPage/AskPage.tsx"],"sourcesContent":["import { ContentHeader, InfoCard } from '@backstage/core-components';\nimport { Grid } from '@material-ui/core';\nimport React from 'react';\
|
|
1
|
+
{"version":3,"file":"AskPage.esm.js","sources":["../../../src/components/AskPage/AskPage.tsx"],"sourcesContent":["import { ContentHeader, InfoCard } from '@backstage/core-components';\nimport { Grid } from '@material-ui/core';\nimport React from 'react';\nimport { PostForm, useTranslation } from '@drodil/backstage-plugin-qeta-react';\nimport { useParams, useSearchParams } from 'react-router-dom';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\n\nexport const AskPage = () => {\n const { id } = useParams();\n const [searchParams] = useSearchParams();\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 return (\n <>\n <ContentHeader title={title} />\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <InfoCard>\n <PostForm\n id={id}\n entity={entity}\n entityPage={entityPage}\n tags={tags}\n type=\"question\"\n />\n </InfoCard>\n </Grid>\n </Grid>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAQO,MAAM,UAAU,MAAM;AAC3B,EAAM,MAAA,EAAE,EAAG,EAAA,GAAI,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,CAAC,YAAY,CAAA,GAAI,eAAgB,EAAA,CAAA;AACvC,EAAA,MAAM,MAAS,GAAA,YAAA,CAAa,GAAI,CAAA,QAAQ,CAAK,IAAA,KAAA,CAAA,CAAA;AAC7C,EAAA,MAAM,UAAa,GAAA,YAAA,CAAa,GAAI,CAAA,YAAY,CAAM,KAAA,MAAA,CAAA;AACtD,EAAA,MAAM,IAAO,GAAA,UAAA,CAAW,YAAa,CAAA,GAAA,CAAI,MAAM,CAAC,CAAA,CAAA;AAChD,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAI,IAAA,KAAA,CAAA;AACJ,EAAA,IAAI,EAAI,EAAA;AACN,IAAA,KAAA,GAAQ,EAAE,gCAAgC,CAAA,CAAA;AAAA,aACjC,MAAQ,EAAA;AAEjB,IAAM,MAAA,cAAA,GAAiB,sBAAsB,MAAM,CAAA,CAAA;AACnD,IAAA,KAAA,GAAQ,EAAE,8BAAgC,EAAA;AAAA,MACxC,QAAQ,cAAe,CAAA,YAAA;AAAA,KACxB,CAAA,CAAA;AAAA,GACI,MAAA;AACL,IAAA,KAAA,GAAQ,EAAE,2BAA2B,CAAA,CAAA;AAAA,GACvC;AAEA,EAAA,iFAEK,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,OAAc,CAC7B,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,SAAS,EAAA,IAAA,EAAC,OAAS,EAAA,CAAA,EAAG,WAAU,QACpC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAA,sCACP,QACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,EAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAK,EAAA,UAAA;AAAA,KAAA;AAAA,GAET,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useParams } from 'react-router-dom';
|
|
3
|
+
import { ContentHeader, InfoCard } from '@backstage/core-components';
|
|
4
|
+
import { Grid } from '@material-ui/core';
|
|
5
|
+
import { useTranslation, CollectionForm } from '@drodil/backstage-plugin-qeta-react';
|
|
6
|
+
|
|
7
|
+
const CollectionCreatePage = () => {
|
|
8
|
+
const { id } = useParams();
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
let title;
|
|
11
|
+
if (id) {
|
|
12
|
+
title = t("collectionCreatePage.title.existingCollection");
|
|
13
|
+
} else {
|
|
14
|
+
title = t("collectionCreatePage.title.newCollection");
|
|
15
|
+
}
|
|
16
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, { title }), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(InfoCard, null, /* @__PURE__ */ React.createElement(CollectionForm, { id })))));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { CollectionCreatePage };
|
|
20
|
+
//# sourceMappingURL=CollectionCreatePage.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectionCreatePage.esm.js","sources":["../../../src/components/CollectionCreatePage/CollectionCreatePage.tsx"],"sourcesContent":["import React from 'react';\nimport { useParams } from 'react-router-dom';\nimport { ContentHeader, InfoCard } from '@backstage/core-components';\nimport { Grid } from '@material-ui/core';\nimport {\n CollectionForm,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\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":";;;;;;AASO,MAAM,uBAAuB,MAAM;AACxC,EAAM,MAAA,EAAE,EAAG,EAAA,GAAI,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAI,IAAA,KAAA,CAAA;AACJ,EAAA,IAAI,EAAI,EAAA;AACN,IAAA,KAAA,GAAQ,EAAE,+CAA+C,CAAA,CAAA;AAAA,GACpD,MAAA;AACL,IAAA,KAAA,GAAQ,EAAE,0CAA0C,CAAA,CAAA;AAAA,GACtD;AACA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBACG,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,KAAc,EAAA,CAAA,sCAC5B,IAAK,EAAA,EAAA,SAAA,EAAS,IAAC,EAAA,OAAA,EAAS,CAAG,EAAA,SAAA,EAAU,4BACnC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAA,kBACP,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,EAAQ,EAAA,CAC1B,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useParams } from 'react-router-dom';
|
|
3
|
+
import { useTranslation, useQetaApi, BackToCollectionsButton, CreateCollectionButton, CollectionCard, PostsGrid } from '@drodil/backstage-plugin-qeta-react';
|
|
4
|
+
import { Skeleton } from '@material-ui/lab';
|
|
5
|
+
import { WarningPanel, ContentHeader } from '@backstage/core-components';
|
|
6
|
+
import { Grid } from '@material-ui/core';
|
|
7
|
+
|
|
8
|
+
const CollectionPage = () => {
|
|
9
|
+
const { id } = useParams();
|
|
10
|
+
const { t } = useTranslation();
|
|
11
|
+
const {
|
|
12
|
+
value: collection,
|
|
13
|
+
loading,
|
|
14
|
+
error
|
|
15
|
+
} = useQetaApi((api) => api.getCollection(id), [id]);
|
|
16
|
+
if (loading) {
|
|
17
|
+
return /* @__PURE__ */ React.createElement(Skeleton, { variant: "rect", height: 200 });
|
|
18
|
+
}
|
|
19
|
+
if (error || collection === void 0) {
|
|
20
|
+
return /* @__PURE__ */ React.createElement(WarningPanel, { severity: "error", title: t("questionPage.errorLoading") }, error?.message);
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
23
|
+
ContentHeader,
|
|
24
|
+
{
|
|
25
|
+
title: collection.title,
|
|
26
|
+
description: t("collectionPage.info")
|
|
27
|
+
},
|
|
28
|
+
/* @__PURE__ */ React.createElement(BackToCollectionsButton, null),
|
|
29
|
+
/* @__PURE__ */ React.createElement(CreateCollectionButton, null)
|
|
30
|
+
), /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(CollectionCard, { collection })), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(PostsGrid, { collectionId: collection.id }))));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { CollectionPage };
|
|
34
|
+
//# sourceMappingURL=CollectionPage.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectionPage.esm.js","sources":["../../../src/components/CollectionPage/CollectionPage.tsx"],"sourcesContent":["import React from 'react';\nimport { useParams } from 'react-router-dom';\nimport {\n BackToCollectionsButton,\n CollectionCard,\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 } 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 return (\n <>\n <ContentHeader\n title={collection.title}\n description={t('collectionPage.info')}\n >\n <BackToCollectionsButton />\n <CreateCollectionButton />\n </ContentHeader>\n <Grid container>\n <Grid item xs={12}>\n <CollectionCard collection={collection} />\n </Grid>\n <Grid item xs={12}>\n <PostsGrid collectionId={collection.id} />\n </Grid>\n </Grid>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAcO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,EAAE,EAAG,EAAA,GAAI,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,UAAA;AAAA,IACP,OAAA;AAAA,IACA,KAAA;AAAA,GACF,GAAI,WAAW,CAAO,GAAA,KAAA,GAAA,CAAI,cAAc,EAAE,CAAA,EAA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import React from 'react';
|
|
2
|
+
import { ContentHeader } from '@backstage/core-components';
|
|
3
|
+
import { useTranslation, CreateCollectionButton, CollectionsGrid } from '@drodil/backstage-plugin-qeta-react';
|
|
4
|
+
|
|
5
|
+
const CollectionsPage = () => {
|
|
6
|
+
const { t } = useTranslation();
|
|
7
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("collectionsPage.title") }, /* @__PURE__ */ React.createElement(CreateCollectionButton, null)), /* @__PURE__ */ React.createElement(CollectionsGrid, null));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { CollectionsPage };
|
|
11
|
+
//# sourceMappingURL=CollectionsPage.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectionsPage.esm.js","sources":["../../../src/components/CollectionsPage/CollectionsPage.tsx"],"sourcesContent":["import React from 'react';\nimport { ContentHeader } from '@backstage/core-components';\nimport {\n CollectionsGrid,\n CreateCollectionButton,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\n\nexport const CollectionsPage = () => {\n const { t } = useTranslation();\n\n return (\n <>\n <ContentHeader title={t('collectionsPage.title')}>\n <CreateCollectionButton />\n </ContentHeader>\n <CollectionsGrid />\n </>\n );\n};\n"],"names":[],"mappings":";;;;AAQO,MAAM,kBAAkB,MAAM;AACnC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,KAAA,EAAO,CAAE,CAAA,uBAAuB,CAC7C,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,sBAAuB,EAAA,IAAA,CAC1B,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,qBAAgB,CACnB,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { ContentHeader } from '@backstage/core-components';
|
|
3
|
+
import { useParams } from 'react-router-dom';
|
|
4
|
+
import { useTranslation, qetaApiRef, EntityFollowButton, AskQuestionButton, WriteArticleButton, PostsContainer, EntitiesGrid, FollowedEntitiesList, PostHighlightList } from '@drodil/backstage-plugin-qeta-react';
|
|
5
|
+
import { Grid, Typography, Card, CardContent } from '@material-ui/core';
|
|
6
|
+
import Whatshot from '@material-ui/icons/Whatshot';
|
|
7
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
8
|
+
import { EntityRefLink } from '@backstage/plugin-catalog-react';
|
|
9
|
+
|
|
10
|
+
const EntityPage = () => {
|
|
11
|
+
const { entityRef } = useParams();
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const [resp, setResp] = React.useState();
|
|
14
|
+
const qetaApi = useApi(qetaApiRef);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!entityRef) {
|
|
17
|
+
setResp(void 0);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
qetaApi.getEntity(entityRef).then((res) => {
|
|
21
|
+
if (res) {
|
|
22
|
+
setResp(res);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}, [qetaApi, entityRef]);
|
|
26
|
+
let shownTitle = t("entitiesPage.defaultTitle");
|
|
27
|
+
let link = void 0;
|
|
28
|
+
if (entityRef) {
|
|
29
|
+
shownTitle = t(`postsContainer.title.about`, { itemType: "Post" });
|
|
30
|
+
link = /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef });
|
|
31
|
+
}
|
|
32
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 4 }, /* @__PURE__ */ React.createElement(Grid, { item: true, md: 12, lg: 9, xl: 10 }, /* @__PURE__ */ React.createElement(
|
|
33
|
+
ContentHeader,
|
|
34
|
+
{
|
|
35
|
+
titleComponent: /* @__PURE__ */ React.createElement(Typography, { variant: "h5", component: "h2" }, shownTitle, " ", link)
|
|
36
|
+
},
|
|
37
|
+
entityRef && /* @__PURE__ */ React.createElement(EntityFollowButton, { entityRef }),
|
|
38
|
+
/* @__PURE__ */ React.createElement(AskQuestionButton, { entity: entityRef }),
|
|
39
|
+
/* @__PURE__ */ React.createElement(WriteArticleButton, { entity: entityRef })
|
|
40
|
+
), resp && /* @__PURE__ */ React.createElement(Card, { variant: "outlined", style: { marginBottom: "1rem" } }, /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, { variant: "caption" }, t("common.posts", {
|
|
41
|
+
count: resp.postsCount,
|
|
42
|
+
itemType: "post"
|
|
43
|
+
}), " \xB7 ", t("common.followers", { count: resp.followerCount })))), entityRef ? /* @__PURE__ */ React.createElement(PostsContainer, { entity: entityRef }) : /* @__PURE__ */ React.createElement(EntitiesGrid, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, lg: 3, xl: 2 }, /* @__PURE__ */ React.createElement(FollowedEntitiesList, null), /* @__PURE__ */ React.createElement(
|
|
44
|
+
PostHighlightList,
|
|
45
|
+
{
|
|
46
|
+
type: "hot",
|
|
47
|
+
title: t("highlights.hotQuestions.title"),
|
|
48
|
+
noQuestionsLabel: t("highlights.hotQuestions.noQuestionsLabel"),
|
|
49
|
+
icon: /* @__PURE__ */ React.createElement(Whatshot, { fontSize: "small" }),
|
|
50
|
+
options: { entity: entityRef },
|
|
51
|
+
postType: "question"
|
|
52
|
+
}
|
|
53
|
+
), /* @__PURE__ */ React.createElement(
|
|
54
|
+
PostHighlightList,
|
|
55
|
+
{
|
|
56
|
+
type: "unanswered",
|
|
57
|
+
title: t("highlights.unanswered.title"),
|
|
58
|
+
noQuestionsLabel: t("highlights.unanswered.noQuestionsLabel"),
|
|
59
|
+
options: { entity: entityRef },
|
|
60
|
+
postType: "question"
|
|
61
|
+
}
|
|
62
|
+
), /* @__PURE__ */ React.createElement(
|
|
63
|
+
PostHighlightList,
|
|
64
|
+
{
|
|
65
|
+
type: "incorrect",
|
|
66
|
+
title: t("highlights.incorrect.title"),
|
|
67
|
+
noQuestionsLabel: t("highlights.incorrect.noQuestionsLabel"),
|
|
68
|
+
options: { entity: entityRef },
|
|
69
|
+
postType: "question"
|
|
70
|
+
}
|
|
71
|
+
)));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { EntityPage };
|
|
75
|
+
//# sourceMappingURL=EntityPage.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityPage.esm.js","sources":["../../../src/components/EntityPage/EntityPage.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { ContentHeader } from '@backstage/core-components';\nimport { useParams } from 'react-router-dom';\nimport {\n AskQuestionButton,\n EntitiesGrid,\n EntityFollowButton,\n FollowedEntitiesList,\n PostHighlightList,\n PostsContainer,\n qetaApiRef,\n useTranslation,\n WriteArticleButton,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { Card, CardContent, Grid, Typography } from '@material-ui/core';\nimport Whatshot from '@material-ui/icons/Whatshot';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { EntityResponse } from '@drodil/backstage-plugin-qeta-common';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\n\nexport const EntityPage = () => {\n const { entityRef } = useParams();\n const { t } = useTranslation();\n const [resp, setResp] = React.useState<undefined | EntityResponse>();\n\n const qetaApi = useApi(qetaApiRef);\n\n useEffect(() => {\n if (!entityRef) {\n setResp(undefined);\n return;\n }\n\n qetaApi.getEntity(entityRef).then(res => {\n if (res) {\n setResp(res);\n }\n });\n }, [qetaApi, entityRef]);\n\n let shownTitle: string = t('entitiesPage.defaultTitle');\n let link = undefined;\n if (entityRef) {\n shownTitle = t(`postsContainer.title.about`, { itemType: 'Post' });\n link = <EntityRefLink entityRef={entityRef} />;\n }\n\n return (\n <Grid container spacing={4}>\n <Grid item md={12} lg={9} xl={10}>\n <ContentHeader\n titleComponent={\n <Typography variant=\"h5\" component=\"h2\">\n {shownTitle} {link}\n </Typography>\n }\n >\n {entityRef && <EntityFollowButton entityRef={entityRef} />}\n <AskQuestionButton entity={entityRef} />\n <WriteArticleButton entity={entityRef} />\n </ContentHeader>\n {resp && (\n <Card variant=\"outlined\" style={{ marginBottom: '1rem' }}>\n <CardContent>\n <Typography variant=\"caption\">\n {t('common.posts', {\n count: resp.postsCount,\n itemType: 'post',\n })}\n {' · '}\n {t('common.followers', { count: resp.followerCount })}\n </Typography>\n </CardContent>\n </Card>\n )}\n {entityRef ? <PostsContainer entity={entityRef} /> : <EntitiesGrid />}\n </Grid>\n <Grid item lg={3} xl={2}>\n <FollowedEntitiesList />\n <PostHighlightList\n type=\"hot\"\n title={t('highlights.hotQuestions.title')}\n noQuestionsLabel={t('highlights.hotQuestions.noQuestionsLabel')}\n icon={<Whatshot fontSize=\"small\" />}\n options={{ entity: entityRef }}\n postType=\"question\"\n />\n <PostHighlightList\n type=\"unanswered\"\n title={t('highlights.unanswered.title')}\n noQuestionsLabel={t('highlights.unanswered.noQuestionsLabel')}\n options={{ entity: entityRef }}\n postType=\"question\"\n />\n <PostHighlightList\n type=\"incorrect\"\n title={t('highlights.incorrect.title')}\n noQuestionsLabel={t('highlights.incorrect.noQuestionsLabel')}\n options={{ entity: entityRef }}\n postType=\"question\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAoBO,MAAM,aAAa,MAAM;AAC9B,EAAM,MAAA,EAAE,SAAU,EAAA,GAAI,SAAU,EAAA,CAAA;AAChC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,MAAM,QAAqC,EAAA,CAAA;AAEnE,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA,CAAA;AAEjC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,SAAW,EAAA;AACd,MAAA,OAAA,CAAQ,KAAS,CAAA,C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;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,YAAA;AAAA,MACL,KAAA,EAAO,EAAE,6BAA6B,CAAA;AAAA,MACtC,gBAAA,EAAkB,EAAE,wCAAwC,CAAA;AAAA,MAC5D,OAAA,EAAS,EAAE,MAAA,EAAQ,SAAU,EAAA;AAAA,MAC7B,QAAS,EAAA,UAAA;AAAA,KAAA;AAAA,GAEX,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,WAAA;AAAA,MACL,KAAA,EAAO,EAAE,4BAA4B,CAAA;AAAA,MACrC,gBAAA,EAAkB,EAAE,uCAAuC,CAAA;AAAA,MAC3D,OAAA,EAAS,EAAE,MAAA,EAAQ,SAAU,EAAA;AAAA,MAC7B,QAAS,EAAA,UAAA;AAAA,KAAA;AAAA,GAEb,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,38 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ContentHeader } from '@backstage/core-components';
|
|
3
|
-
import {
|
|
4
|
-
import { AskQuestionButton } from '../Buttons/AskQuestionButton.esm.js';
|
|
5
|
-
import { useTranslation } from '../../utils/hooks.esm.js';
|
|
3
|
+
import { useTranslation, AskQuestionButton, WriteArticleButton, PostsContainer, PostHighlightList } from '@drodil/backstage-plugin-qeta-react';
|
|
6
4
|
import { Grid } from '@material-ui/core';
|
|
7
|
-
import { QuestionHighlightList } from '../QuestionHighlightList/QuestionHighlightList.esm.js';
|
|
8
5
|
import Whatshot from '@material-ui/icons/Whatshot';
|
|
9
6
|
|
|
10
7
|
const FavoritePage = () => {
|
|
11
8
|
const { t } = useTranslation();
|
|
12
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 4 }, /* @__PURE__ */ React.createElement(Grid, { item: true, md: 12, lg: 9, xl: 10 }, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("favoritePage.title") }, /* @__PURE__ */ React.createElement(AskQuestionButton, null)), /* @__PURE__ */ React.createElement(
|
|
13
|
-
|
|
9
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 4 }, /* @__PURE__ */ React.createElement(Grid, { item: true, md: 12, lg: 9, xl: 10 }, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("favoritePage.title") }, /* @__PURE__ */ React.createElement(AskQuestionButton, null), /* @__PURE__ */ React.createElement(WriteArticleButton, null)), /* @__PURE__ */ React.createElement(PostsContainer, { favorite: true })), /* @__PURE__ */ React.createElement(Grid, { item: true, lg: 3, xl: 2 }, /* @__PURE__ */ React.createElement(
|
|
10
|
+
PostHighlightList,
|
|
14
11
|
{
|
|
15
12
|
type: "hot",
|
|
16
|
-
title: t("highlights.
|
|
17
|
-
noQuestionsLabel: t("highlights.
|
|
13
|
+
title: t("highlights.hotQuestions.title"),
|
|
14
|
+
noQuestionsLabel: t("highlights.hotQuestions.noQuestionsLabel"),
|
|
18
15
|
icon: /* @__PURE__ */ React.createElement(Whatshot, { fontSize: "small" }),
|
|
19
|
-
options: { favorite: true }
|
|
16
|
+
options: { favorite: true },
|
|
17
|
+
postType: "question"
|
|
20
18
|
}
|
|
21
19
|
), /* @__PURE__ */ React.createElement(
|
|
22
|
-
|
|
20
|
+
PostHighlightList,
|
|
23
21
|
{
|
|
24
|
-
type: "
|
|
25
|
-
title: t("highlights.
|
|
26
|
-
noQuestionsLabel: t("highlights.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
QuestionHighlightList,
|
|
31
|
-
{
|
|
32
|
-
type: "incorrect",
|
|
33
|
-
title: t("highlights.incorrect.title"),
|
|
34
|
-
noQuestionsLabel: t("highlights.incorrect.noQuestionsLabel"),
|
|
35
|
-
options: { favorite: true }
|
|
22
|
+
type: "hot",
|
|
23
|
+
title: t("highlights.hotArticles.title"),
|
|
24
|
+
noQuestionsLabel: t("highlights.hotArticles.noArticlesLabel"),
|
|
25
|
+
icon: /* @__PURE__ */ React.createElement(Whatshot, { fontSize: "small" }),
|
|
26
|
+
options: { favorite: true },
|
|
27
|
+
postType: "article"
|
|
36
28
|
}
|
|
37
29
|
)));
|
|
38
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePage.esm.js","sources":["../../../src/components/FavoritePage/FavoritePage.tsx"],"sourcesContent":["import React from 'react';\nimport { ContentHeader } from '@backstage/core-components';\nimport {
|
|
1
|
+
{"version":3,"file":"FavoritePage.esm.js","sources":["../../../src/components/FavoritePage/FavoritePage.tsx"],"sourcesContent":["import React from 'react';\nimport { ContentHeader } from '@backstage/core-components';\nimport {\n AskQuestionButton,\n PostHighlightList,\n PostsContainer,\n useTranslation,\n WriteArticleButton,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { Grid } from '@material-ui/core';\nimport Whatshot from '@material-ui/icons/Whatshot';\n\nexport const FavoritePage = () => {\n const { t } = useTranslation();\n return (\n <Grid container spacing={4}>\n <Grid item md={12} lg={9} xl={10}>\n <ContentHeader title={t('favoritePage.title')}>\n <AskQuestionButton />\n <WriteArticleButton />\n </ContentHeader>\n <PostsContainer favorite />\n </Grid>\n <Grid item lg={3} xl={2}>\n <PostHighlightList\n type=\"hot\"\n title={t('highlights.hotQuestions.title')}\n noQuestionsLabel={t('highlights.hotQuestions.noQuestionsLabel')}\n icon={<Whatshot fontSize=\"small\" />}\n options={{ favorite: true }}\n postType=\"question\"\n />\n <PostHighlightList\n type=\"hot\"\n title={t('highlights.hotArticles.title')}\n noQuestionsLabel={t('highlights.hotArticles.noArticlesLabel')}\n icon={<Whatshot fontSize=\"small\" />}\n options={{ favorite: true }}\n postType=\"article\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;AAYO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,2CACG,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,OAAS,EAAA,CAAA,EAAA,sCACt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1,12 +1,7 @@
|
|
|
1
1
|
import { ContentHeader } from '@backstage/core-components';
|
|
2
|
-
import { AskQuestionButton } from '
|
|
2
|
+
import { useTranslation, useIdentityApi, AskQuestionButton, PostsCard, ImpactCard, FollowedTagsList, FollowedEntitiesList } from '@drodil/backstage-plugin-qeta-react';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { useTranslation, useIdentityApi } from '../../utils/hooks.esm.js';
|
|
5
|
-
import { QuestionsCard } from '../HomePageCards/QuestionsCard.esm.js';
|
|
6
4
|
import { Grid } from '@material-ui/core';
|
|
7
|
-
import { FollowedTagsList } from '../QetaPage/FollowedTagsList.esm.js';
|
|
8
|
-
import { FollowedEntitiesList } from '../QetaPage/FollowedEntitiesList.esm.js';
|
|
9
|
-
import { ImpactCard } from '../HomePageCards/ImpactCard.esm.js';
|
|
10
5
|
|
|
11
6
|
const HomePage = () => {
|
|
12
7
|
const { t } = useTranslation();
|
|
@@ -16,18 +11,20 @@ const HomePage = () => {
|
|
|
16
11
|
error: userError
|
|
17
12
|
} = useIdentityApi((api) => api.getBackstageIdentity(), []);
|
|
18
13
|
return /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 4 }, /* @__PURE__ */ React.createElement(Grid, { item: true, md: 12, lg: 9, xl: 10 }, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("homePage.title") }, /* @__PURE__ */ React.createElement(AskQuestionButton, null)), /* @__PURE__ */ React.createElement(Grid, { container: true }, user && !loadingUser && !userError && /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
19
|
-
|
|
14
|
+
PostsCard,
|
|
20
15
|
{
|
|
21
16
|
type: "own",
|
|
22
17
|
title: t("highlights.own.title"),
|
|
23
|
-
options: { author: user.userEntityRef }
|
|
18
|
+
options: { author: user.userEntityRef },
|
|
19
|
+
postType: "question"
|
|
24
20
|
}
|
|
25
21
|
)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
26
|
-
|
|
22
|
+
PostsCard,
|
|
27
23
|
{
|
|
28
24
|
type: "own",
|
|
29
25
|
title: t("highlights.unanswered.title"),
|
|
30
|
-
options: { noAnswers:
|
|
26
|
+
options: { noAnswers: true, random: true, type: "question" },
|
|
27
|
+
postType: "question"
|
|
31
28
|
}
|
|
32
29
|
)))), /* @__PURE__ */ React.createElement(Grid, { item: true, lg: 3, xl: 2 }, /* @__PURE__ */ React.createElement(ImpactCard, null), /* @__PURE__ */ React.createElement(FollowedTagsList, null), /* @__PURE__ */ React.createElement(FollowedEntitiesList, null)));
|
|
33
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomePage.esm.js","sources":["../../../src/components/HomePage/HomePage.tsx"],"sourcesContent":["import { ContentHeader } from '@backstage/core-components';\nimport {
|
|
1
|
+
{"version":3,"file":"HomePage.esm.js","sources":["../../../src/components/HomePage/HomePage.tsx"],"sourcesContent":["import { ContentHeader } from '@backstage/core-components';\nimport {\n AskQuestionButton,\n FollowedEntitiesList,\n FollowedTagsList,\n ImpactCard,\n PostsCard,\n useIdentityApi,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\nimport React from 'react';\nimport { Grid } from '@material-ui/core';\n\nexport const HomePage = () => {\n const { t } = useTranslation();\n const {\n value: user,\n loading: loadingUser,\n error: userError,\n } = useIdentityApi(api => api.getBackstageIdentity(), []);\n\n return (\n <Grid container spacing={4}>\n <Grid item md={12} lg={9} xl={10}>\n <ContentHeader title={t('homePage.title')}>\n <AskQuestionButton />\n </ContentHeader>\n <Grid container>\n {user && !loadingUser && !userError && (\n <Grid item xs={12}>\n <PostsCard\n type=\"own\"\n title={t('highlights.own.title')}\n options={{ author: user.userEntityRef }}\n postType=\"question\"\n />\n </Grid>\n )}\n <Grid item xs={12}>\n <PostsCard\n type=\"own\"\n title={t('highlights.unanswered.title')}\n options={{ noAnswers: true, random: true, type: 'question' }}\n postType=\"question\"\n />\n </Grid>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b,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,KAAA;AAAA,MACL,KAAA,EAAO,EAAE,6BAA6B,CAAA;AAAA,MACtC,SAAS,EAAE,SAAA,EAAW,MAAM,MAAQ,EAAA,IAAA,EAAM,MAAM,UAAW,EAAA;AAAA,MAC3D,QAAS,EAAA,UAAA;AAAA,KAAA;AAAA,GAEb,CACF,CACF,CAAA,sCACC,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,EAAI,EAAA,CAAA,EAAG,IAAI,CACpB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,gBAAW,CACZ,kBAAA,KAAA,CAAA,aAAA,CAAC,sBAAiB,CAClB,kBAAA,KAAA,CAAA,aAAA,CAAC,oBAAqB,EAAA,IAAA,CACxB,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
import { MenuList, ListItemIcon, ListItem, Typography, MenuItem } from '@material-ui/core';
|
|
1
|
+
import { SvgIcon, MenuList, Box, ListItemIcon, ListItem, Typography, MenuItem } from '@material-ui/core';
|
|
2
2
|
import AccountBox from '@material-ui/icons/AccountBox';
|
|
3
3
|
import LoyaltyOutlined from '@material-ui/icons/LoyaltyOutlined';
|
|
4
4
|
import StarIcon from '@material-ui/icons/Star';
|
|
5
|
+
import { qetaRouteRef, tagsRouteRef, favoriteQuestionsRouteRef, statisticsRouteRef, userRouteRef, questionsRouteRef, articlesRouteRef, collectionsRouteRef, entitiesRouteRef, usersRouteRef, useStyles, useTranslation, useIdentityApi, TrophyIcon } from '@drodil/backstage-plugin-qeta-react';
|
|
5
6
|
import React from 'react';
|
|
6
|
-
import '@backstage/core-
|
|
7
|
-
import { useStyles, useTranslation, useIdentityApi } from '../../utils/hooks.esm.js';
|
|
8
|
-
import { TrophyIcon } from '../Statistics/TrophyIcon.esm.js';
|
|
9
|
-
import '../Statistics/styles.esm.js';
|
|
10
|
-
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
11
|
-
import { qetaRouteRef, tagsRouteRef, favoriteQuestionsRouteRef, statisticsRouteRef, userRouteRef, questionsRouteRef } from '@drodil/backstage-plugin-qeta-react';
|
|
12
|
-
import '@backstage/plugin-catalog-react';
|
|
13
|
-
import '@material-ui/icons/HelpOutline';
|
|
14
|
-
import '@backstage/plugin-permission-react';
|
|
15
|
-
import '@drodil/backstage-plugin-qeta-common';
|
|
16
|
-
import '../Statistics/StatsChart.esm.js';
|
|
17
|
-
import 'numeral';
|
|
7
|
+
import { useRouteRef, useApp } from '@backstage/core-plugin-api';
|
|
18
8
|
import HelpOutlined from '@material-ui/icons/HelpOutlined';
|
|
19
9
|
import { useNavigate } from 'react-router-dom';
|
|
20
10
|
import Home from '@material-ui/icons/Home';
|
|
21
11
|
import { useLocation } from 'react-use';
|
|
12
|
+
import CollectionsBookmarkIcon from '@material-ui/icons/CollectionsBookmark';
|
|
13
|
+
import PlaylistPlay from '@material-ui/icons/PlaylistPlay';
|
|
14
|
+
import { GroupIcon } from '@backstage/core-components';
|
|
22
15
|
|
|
23
|
-
const LeftMenu = () => {
|
|
16
|
+
const LeftMenu = (props) => {
|
|
24
17
|
const rootRoute = useRouteRef(qetaRouteRef);
|
|
25
18
|
const tagsRoute = useRouteRef(tagsRouteRef);
|
|
26
19
|
const favoritesRoute = useRouteRef(favoriteQuestionsRouteRef);
|
|
27
20
|
const statisticsRoute = useRouteRef(statisticsRouteRef);
|
|
28
21
|
const userRoute = useRouteRef(userRouteRef);
|
|
29
22
|
const questionsRoute = useRouteRef(questionsRouteRef);
|
|
23
|
+
const articlesRoute = useRouteRef(articlesRouteRef);
|
|
24
|
+
const collectionsRoute = useRouteRef(collectionsRouteRef);
|
|
25
|
+
const entitiesRoute = useRouteRef(entitiesRouteRef);
|
|
26
|
+
const usersRoute = useRouteRef(usersRouteRef);
|
|
30
27
|
const styles = useStyles();
|
|
31
28
|
const { t } = useTranslation();
|
|
32
29
|
const location = useLocation();
|
|
33
30
|
const navigate = useNavigate();
|
|
31
|
+
const app = useApp();
|
|
34
32
|
const {
|
|
35
33
|
value: user,
|
|
36
34
|
loading: loadingUser,
|
|
@@ -43,13 +41,46 @@ const LeftMenu = () => {
|
|
|
43
41
|
return /* @__PURE__ */ React.createElement(
|
|
44
42
|
MenuItem,
|
|
45
43
|
{
|
|
46
|
-
onClick: () =>
|
|
44
|
+
onClick: (e) => {
|
|
45
|
+
navigate(route);
|
|
46
|
+
if (props.onClick) {
|
|
47
|
+
props.onClick(e);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
47
50
|
className: route === location.pathname ? styles.selectedMenuItem : styles.nonSelectedMenuItem
|
|
48
51
|
},
|
|
49
52
|
children
|
|
50
53
|
);
|
|
51
54
|
};
|
|
52
|
-
|
|
55
|
+
const EntityIcon = app.getSystemIcon("kind:system") ?? SvgIcon;
|
|
56
|
+
return /* @__PURE__ */ React.createElement(
|
|
57
|
+
MenuList,
|
|
58
|
+
{
|
|
59
|
+
id: "left-menu",
|
|
60
|
+
className: styles.leftMenu,
|
|
61
|
+
onKeyDown: props.onKeyDown,
|
|
62
|
+
autoFocusItem: props.autoFocusItem,
|
|
63
|
+
style: props.inPopup ? { marginRight: 0, padding: "0.5rem" } : { marginRight: "2rem", float: "right", position: "sticky" }
|
|
64
|
+
},
|
|
65
|
+
/* @__PURE__ */ React.createElement(
|
|
66
|
+
Box,
|
|
67
|
+
{
|
|
68
|
+
display: props.inPopup ? {} : { xs: "none", sm: "none", md: "none", lg: "block" }
|
|
69
|
+
},
|
|
70
|
+
/* @__PURE__ */ React.createElement(CustomMenuItem, { route: rootRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(Home, { fontSize: "small" })), t("leftMenu.home")),
|
|
71
|
+
/* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, t("leftMenu.content"))),
|
|
72
|
+
/* @__PURE__ */ React.createElement(CustomMenuItem, { route: questionsRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(HelpOutlined, { fontSize: "small" })), t("leftMenu.questions")),
|
|
73
|
+
/* @__PURE__ */ React.createElement(CustomMenuItem, { route: articlesRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(CollectionsBookmarkIcon, { fontSize: "small" })), t("leftMenu.articles")),
|
|
74
|
+
/* @__PURE__ */ React.createElement(CustomMenuItem, { route: favoritesRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(StarIcon, { fontSize: "small" })), t("leftMenu.favoriteQuestions")),
|
|
75
|
+
/* @__PURE__ */ React.createElement(CustomMenuItem, { route: entitiesRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(EntityIcon, { fontSize: "small" })), t("leftMenu.entities")),
|
|
76
|
+
/* @__PURE__ */ React.createElement(CustomMenuItem, { route: tagsRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(LoyaltyOutlined, { fontSize: "small" })), t("leftMenu.tags")),
|
|
77
|
+
/* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, t("leftMenu.community"))),
|
|
78
|
+
/* @__PURE__ */ React.createElement(CustomMenuItem, { route: collectionsRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(PlaylistPlay, { fontSize: "small" })), t("leftMenu.collections")),
|
|
79
|
+
/* @__PURE__ */ React.createElement(CustomMenuItem, { route: usersRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(GroupIcon, { fontSize: "small" })), t("leftMenu.users")),
|
|
80
|
+
user && !loadingUser && !userError && /* @__PURE__ */ React.createElement(CustomMenuItem, { route: `${userRoute()}/${user.userEntityRef}` }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(AccountBox, { fontSize: "small" })), t("leftMenu.profile")),
|
|
81
|
+
/* @__PURE__ */ React.createElement(CustomMenuItem, { route: statisticsRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(TrophyIcon, null)), t("leftMenu.statistics"))
|
|
82
|
+
)
|
|
83
|
+
);
|
|
53
84
|
};
|
|
54
85
|
|
|
55
86
|
export { LeftMenu };
|