@drodil/backstage-plugin-qeta 2.13.1 → 2.15.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/AnswersContainer/AnswerList.esm.js +2 -2
- package/dist/components/AnswersContainer/AnswerList.esm.js.map +1 -1
- package/dist/components/AnswersContainer/AnswerListItem.esm.js +56 -53
- package/dist/components/AnswersContainer/AnswerListItem.esm.js.map +1 -1
- package/dist/components/CommentSection/CommentList.esm.js +3 -3
- package/dist/components/CommentSection/CommentList.esm.js.map +1 -1
- package/dist/components/FavoritePage/FavoritePage.esm.js +1 -1
- package/dist/components/FavoritePage/FavoritePage.esm.js.map +1 -1
- package/dist/components/HomePage/HomePage.esm.js +1 -1
- package/dist/components/HomePage/HomePage.esm.js.map +1 -1
- package/dist/components/HomePageCards/ImpactCard.esm.js +4 -2
- package/dist/components/HomePageCards/ImpactCard.esm.js.map +1 -1
- package/dist/components/LeftMenu/LeftMenu.esm.js +1 -0
- package/dist/components/LeftMenu/LeftMenu.esm.js.map +1 -1
- package/dist/components/MarkdownEditor/MarkdownEditor.esm.js +2 -3
- package/dist/components/MarkdownEditor/MarkdownEditor.esm.js.map +1 -1
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js +37 -0
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js.map +1 -0
- package/dist/components/QuestionPage/AnswerCard.esm.js +3 -4
- package/dist/components/QuestionPage/AnswerCard.esm.js.map +1 -1
- package/dist/components/QuestionPage/QuestionCard.esm.js +2 -3
- package/dist/components/QuestionPage/QuestionCard.esm.js.map +1 -1
- package/dist/components/QuestionsContainer/QuestionList.esm.js +1 -1
- package/dist/components/QuestionsContainer/QuestionList.esm.js.map +1 -1
- package/dist/components/QuestionsPage/QuestionsPage.esm.js +1 -1
- package/dist/components/QuestionsPage/QuestionsPage.esm.js.map +1 -1
- package/dist/components/Statistics/GlobalStatsContent.esm.js +20 -0
- package/dist/components/Statistics/GlobalStatsContent.esm.js.map +1 -0
- package/dist/components/Statistics/StatisticsPage.esm.js +2 -2
- package/dist/components/Statistics/StatisticsPage.esm.js.map +1 -1
- package/dist/components/Statistics/StatsChart.esm.js +192 -13
- package/dist/components/Statistics/StatsChart.esm.js.map +1 -1
- package/dist/components/Statistics/SummaryStatsGrid.esm.js +47 -0
- package/dist/components/Statistics/SummaryStatsGrid.esm.js.map +1 -0
- package/dist/components/TagPage/TagPage.esm.js +1 -1
- package/dist/components/TagPage/TagPage.esm.js.map +1 -1
- package/dist/components/UserPage/UserPage.esm.js +3 -2
- package/dist/components/UserPage/UserPage.esm.js.map +1 -1
- package/dist/components/UserPage/UserStatsContent.esm.js +20 -0
- package/dist/components/UserPage/UserStatsContent.esm.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/translation.esm.js +7 -2
- package/dist/translation.esm.js.map +1 -1
- package/package.json +6 -3
- package/dist/components/Statistics/GlobalStatsCard.esm.js +0 -19
- package/dist/components/Statistics/GlobalStatsCard.esm.js.map +0 -1
- package/dist/components/UserPage/UserStatsCard.esm.js +0 -19
- package/dist/components/UserPage/UserStatsCard.esm.js.map +0 -1
|
@@ -55,9 +55,9 @@ const AnswerList = (props) => {
|
|
|
55
55
|
)));
|
|
56
56
|
}
|
|
57
57
|
const pageCount = response.total < props.pageSize ? 1 : Math.ceil(response.total / props.pageSize);
|
|
58
|
-
return /* @__PURE__ */ React.createElement("div", { ref: listRef }, /* @__PURE__ */ React.createElement(Box, { sx: { mt: 2 }, className: "qetaAnswerList" }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2,
|
|
58
|
+
return /* @__PURE__ */ React.createElement("div", { ref: listRef }, /* @__PURE__ */ React.createElement(Box, { sx: { mt: 2 }, className: "qetaAnswerList" }, /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2, style: { paddingTop: "1rem" } }, response.answers.map((answer) => {
|
|
59
59
|
return /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, key: answer.id }, /* @__PURE__ */ React.createElement(AnswerListItem, { answer, entity }), /* @__PURE__ */ React.createElement(Divider, null));
|
|
60
|
-
})), /* @__PURE__ */ React.createElement(
|
|
60
|
+
}))), /* @__PURE__ */ React.createElement(
|
|
61
61
|
Grid,
|
|
62
62
|
{
|
|
63
63
|
container: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnswerList.esm.js","sources":["../../../src/components/AnswersContainer/AnswerList.tsx"],"sourcesContent":["import { useStyles, useTranslation } from '../../utils/hooks';\nimport { Progress, WarningPanel } from '@backstage/core-components';\nimport {\n Box,\n Card,\n CardContent,\n Divider,\n FormControl,\n Grid,\n MenuItem,\n Select,\n Tooltip,\n Typography,\n} from '@material-ui/core';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Pagination } from '@material-ui/lab';\nimport { AnswersResponse } from '@drodil/backstage-plugin-qeta-common';\nimport { AnswerListItem } from './AnswerListItem';\n\nexport const AnswerList = (props: {\n loading: boolean;\n error: any;\n response?: AnswersResponse;\n onPageChange: (page: number) => void;\n onPageSizeChange: (size: number) => void;\n page: number;\n pageSize: number;\n entity?: string;\n tags?: string[];\n entityPage?: boolean;\n}) => {\n const {\n loading,\n error,\n response,\n onPageChange,\n entity,\n page,\n onPageSizeChange,\n } = props;\n const styles = useStyles();\n const listRef = useRef<HTMLDivElement | null>(null);\n const [initialLoad, setInitialLoad] = useState(true);\n const { t } = useTranslation();\n\n useEffect(() => {\n if (!initialLoad) {\n setInitialLoad(false);\n }\n }, [initialLoad, loading]);\n\n const handlePageChange = (\n _event: React.ChangeEvent<unknown>,\n value: number,\n ) => {\n if (listRef.current) {\n listRef.current.scrollIntoView();\n }\n onPageChange(value);\n };\n\n const handlePageSizeChange = (\n event: React.ChangeEvent<{ value: unknown }>,\n ) => {\n if (listRef.current) {\n listRef.current.scrollIntoView();\n }\n onPageSizeChange(Number.parseInt(event.target.value as string, 10));\n };\n\n if (loading && initialLoad) {\n return <Progress />;\n }\n\n if (error || response === undefined) {\n return (\n <WarningPanel severity=\"error\" title={t('answerList.errorLoading')}>\n {error?.message}\n </WarningPanel>\n );\n }\n\n if (initialLoad && (!response.answers || response.answers.length === 0)) {\n return (\n <Card style={{ marginTop: '2rem' }}>\n <CardContent>\n <Grid\n container\n justifyContent=\"center\"\n alignItems=\"center\"\n direction=\"column\"\n >\n <Grid item>\n <Typography variant=\"h6\">{t('answerList.noAnswers')}</Typography>\n </Grid>\n </Grid>\n </CardContent>\n </Card>\n );\n }\n\n const pageCount =\n response.total < props.pageSize\n ? 1\n : Math.ceil(response.total / props.pageSize);\n\n return (\n <div ref={listRef}>\n <Box sx={{ mt: 2 }} className=\"qetaAnswerList\">\n <Grid container spacing={2}
|
|
1
|
+
{"version":3,"file":"AnswerList.esm.js","sources":["../../../src/components/AnswersContainer/AnswerList.tsx"],"sourcesContent":["import { useStyles, useTranslation } from '../../utils/hooks';\nimport { Progress, WarningPanel } from '@backstage/core-components';\nimport {\n Box,\n Card,\n CardContent,\n Divider,\n FormControl,\n Grid,\n MenuItem,\n Select,\n Tooltip,\n Typography,\n} from '@material-ui/core';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Pagination } from '@material-ui/lab';\nimport { AnswersResponse } from '@drodil/backstage-plugin-qeta-common';\nimport { AnswerListItem } from './AnswerListItem';\n\nexport const AnswerList = (props: {\n loading: boolean;\n error: any;\n response?: AnswersResponse;\n onPageChange: (page: number) => void;\n onPageSizeChange: (size: number) => void;\n page: number;\n pageSize: number;\n entity?: string;\n tags?: string[];\n entityPage?: boolean;\n}) => {\n const {\n loading,\n error,\n response,\n onPageChange,\n entity,\n page,\n onPageSizeChange,\n } = props;\n const styles = useStyles();\n const listRef = useRef<HTMLDivElement | null>(null);\n const [initialLoad, setInitialLoad] = useState(true);\n const { t } = useTranslation();\n\n useEffect(() => {\n if (!initialLoad) {\n setInitialLoad(false);\n }\n }, [initialLoad, loading]);\n\n const handlePageChange = (\n _event: React.ChangeEvent<unknown>,\n value: number,\n ) => {\n if (listRef.current) {\n listRef.current.scrollIntoView();\n }\n onPageChange(value);\n };\n\n const handlePageSizeChange = (\n event: React.ChangeEvent<{ value: unknown }>,\n ) => {\n if (listRef.current) {\n listRef.current.scrollIntoView();\n }\n onPageSizeChange(Number.parseInt(event.target.value as string, 10));\n };\n\n if (loading && initialLoad) {\n return <Progress />;\n }\n\n if (error || response === undefined) {\n return (\n <WarningPanel severity=\"error\" title={t('answerList.errorLoading')}>\n {error?.message}\n </WarningPanel>\n );\n }\n\n if (initialLoad && (!response.answers || response.answers.length === 0)) {\n return (\n <Card style={{ marginTop: '2rem' }}>\n <CardContent>\n <Grid\n container\n justifyContent=\"center\"\n alignItems=\"center\"\n direction=\"column\"\n >\n <Grid item>\n <Typography variant=\"h6\">{t('answerList.noAnswers')}</Typography>\n </Grid>\n </Grid>\n </CardContent>\n </Card>\n );\n }\n\n const pageCount =\n response.total < props.pageSize\n ? 1\n : Math.ceil(response.total / props.pageSize);\n\n return (\n <div ref={listRef}>\n <Box sx={{ mt: 2 }} className=\"qetaAnswerList\">\n <Card>\n <Grid container spacing={2} style={{ paddingTop: '1rem' }}>\n {response.answers.map(answer => {\n return (\n <Grid item xs={12} key={answer.id}>\n <AnswerListItem answer={answer} entity={entity} />\n <Divider />\n </Grid>\n );\n })}\n </Grid>\n </Card>\n <Grid\n container\n spacing={0}\n className={`qetaAnswerListPaginationGrid ${styles.questionListPagination}`}\n alignItems=\"center\"\n justifyContent=\"space-between\"\n >\n <Tooltip title={t('answerList.limitSelect')} arrow>\n <FormControl variant=\"filled\">\n <Select\n value={props.pageSize}\n onChange={handlePageSizeChange}\n className={`qetaAnswerListPaginationSizeSelect ${styles.questionsPerPage}`}\n inputProps={{ className: styles.questionsPerPageInput }}\n >\n <MenuItem value={5}>5</MenuItem>\n <MenuItem value={10}>10</MenuItem>\n <MenuItem value={25}>25</MenuItem>\n <MenuItem value={50}>50</MenuItem>\n <MenuItem value={100}>100</MenuItem>\n </Select>\n </FormControl>\n </Tooltip>\n <Pagination\n page={page}\n onChange={handlePageChange}\n count={pageCount}\n size=\"large\"\n variant=\"outlined\"\n className=\"qetaAnswerListPagination\"\n showFirstButton\n showLastButton\n />\n </Grid>\n </Box>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAmBa,MAAA,UAAA,GAAa,CAAC,KAWrB,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,OAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,MAAA;AAAA,IACA,IAAA;AAAA,IACA,gBAAA;AAAA,GACE,GAAA,KAAA,CAAA;AACJ,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,OAAA,GAAU,OAA8B,IAAI,CAAA,CAAA;AAClD,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,IAAI,CAAA,CAAA;AACnD,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,WAAa,EAAA;AAChB,MAAA,cAAA,CAAe,KAAK,CAAA,CAAA;AAAA,KACtB;AAAA,GACC,EAAA,CAAC,WAAa,EAAA,OAAO,CAAC,CAAA,CAAA;AAEzB,EAAM,MAAA,gBAAA,GAAmB,CACvB,MAAA,EACA,KACG,KAAA;AACH,IAAA,IAAI,QAAQ,OAAS,EAAA;AACnB,MAAA,OAAA,CAAQ,QAAQ,cAAe,EAAA,CAAA;AAAA,KACjC;AACA,IAAA,YAAA,CAAa,KAAK,CAAA,CAAA;AAAA,GACpB,CAAA;AAEA,EAAM,MAAA,oBAAA,GAAuB,CAC3B,KACG,KAAA;AACH,IAAA,IAAI,QAAQ,OAAS,EAAA;AACnB,MAAA,OAAA,CAAQ,QAAQ,cAAe,EAAA,CAAA;AAAA,KACjC;AACA,IAAA,gBAAA,CAAiB,OAAO,QAAS,CAAA,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KAAM,CAAA,QAAA;AAAA,QACb,QAAU,EAAA,oBAAA;AAAA,QACV,SAAA,EAAW,CAAsC,mCAAA,EAAA,MAAA,CAAO,gBAAgB,CAAA,CAAA;AAAA,QACxE,UAAY,EAAA,EAAE,SAAW,EAAA,MAAA,CAAO,qBAAsB,EAAA;AAAA,OAAA;AAAA,sBAErD,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAO,EAAA,CAAA,EAAA,EAAG,GAAC,CAAA;AAAA,sBACpB,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAO,EAAA,EAAA,EAAA,EAAI,IAAE,CAAA;AAAA,sBACtB,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAO,EAAA,EAAA,EAAA,EAAI,IAAE,CAAA;AAAA,sBACtB,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAO,EAAA,EAAA,EAAA,EAAI,IAAE,CAAA;AAAA,sBACtB,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAO,EAAA,GAAA,EAAA,EAAK,KAAG,CAAA;AAAA,KAE7B,CACF,CAAA;AAAA,oBACA,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,QAAU,EAAA,gBAAA;AAAA,QACV,KAAO,EAAA,SAAA;AAAA,QACP,IAAK,EAAA,OAAA;AAAA,QACL,OAAQ,EAAA,UAAA;AAAA,QACR,SAAU,EAAA,0BAAA;AAAA,QACV,eAAe,EAAA,IAAA;AAAA,QACf,cAAc,EAAA,IAAA;AAAA,OAAA;AAAA,KAChB;AAAA,GAEJ,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Grid, Typography, Avatar } from '@material-ui/core';
|
|
2
2
|
import { Link } from '@backstage/core-components';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import DOMPurify from 'dompurify';
|
|
@@ -8,6 +8,7 @@ import { questionRouteRef, userRouteRef } from '@drodil/backstage-plugin-qeta-re
|
|
|
8
8
|
import { RelativeTimeWithTooltip } from '../RelativeTimeWithTooltip/RelativeTimeWithTooltip.esm.js';
|
|
9
9
|
import { useStyles, useEntityAuthor, useTranslation } from '../../utils/hooks.esm.js';
|
|
10
10
|
import { TagsAndEntities } from '../QuestionPage/TagsAndEntities.esm.js';
|
|
11
|
+
import { VoteButtons } from '../QuestionPage/VoteButtons.esm.js';
|
|
11
12
|
|
|
12
13
|
const AnswerListItem = (props) => {
|
|
13
14
|
const { answer, entity } = props;
|
|
@@ -23,64 +24,66 @@ const AnswerListItem = (props) => {
|
|
|
23
24
|
id: answer.questionId.toString(10)
|
|
24
25
|
})}/#answer_${answer.id}`;
|
|
25
26
|
};
|
|
26
|
-
return /* @__PURE__ */ React.createElement(
|
|
27
|
-
|
|
27
|
+
return /* @__PURE__ */ React.createElement(
|
|
28
|
+
Grid,
|
|
28
29
|
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
className:
|
|
30
|
+
container: true,
|
|
31
|
+
spacing: 0,
|
|
32
|
+
className: styles.questionListItem,
|
|
33
|
+
justifyContent: "flex-start"
|
|
32
34
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Link,
|
|
36
|
-
{
|
|
37
|
-
to: getAnswerLink(),
|
|
38
|
-
className: "qetaAnswerListItemQuestionBtn"
|
|
39
|
-
},
|
|
40
|
-
t("answer.questionTitle", {
|
|
41
|
-
question: answer.question?.title ?? ""
|
|
42
|
-
})
|
|
43
|
-
)), /* @__PURE__ */ React.createElement(
|
|
44
|
-
Typography,
|
|
45
|
-
{
|
|
46
|
-
variant: "caption",
|
|
47
|
-
noWrap: true,
|
|
48
|
-
component: "div",
|
|
49
|
-
className: "qetaQuestionListItemContent",
|
|
50
|
-
style: { marginBottom: "5px" }
|
|
51
|
-
},
|
|
52
|
-
DOMPurify.sanitize(
|
|
53
|
-
truncate(removeMarkdownFormatting(answer.content), 150)
|
|
54
|
-
)
|
|
55
|
-
), answer.question && /* @__PURE__ */ React.createElement(TagsAndEntities, { question: answer.question }), /* @__PURE__ */ React.createElement(
|
|
56
|
-
Typography,
|
|
57
|
-
{
|
|
58
|
-
variant: "caption",
|
|
59
|
-
display: "inline",
|
|
60
|
-
className: `${styles.questionListItemAuthor} qetaAnswerListItemAuthor`
|
|
61
|
-
},
|
|
62
|
-
/* @__PURE__ */ React.createElement(
|
|
63
|
-
Avatar,
|
|
64
|
-
{
|
|
65
|
-
src: user?.spec?.profile?.picture,
|
|
66
|
-
className: styles.questionListItemAvatar,
|
|
67
|
-
alt: name,
|
|
68
|
-
variant: "rounded"
|
|
69
|
-
},
|
|
70
|
-
initials
|
|
71
|
-
),
|
|
72
|
-
answer.author === "anonymous" ? t("common.anonymousAuthor") : /* @__PURE__ */ React.createElement(Link, { to: `${userRoute()}/${answer.author}` }, name),
|
|
73
|
-
" ",
|
|
74
|
-
/* @__PURE__ */ React.createElement(
|
|
35
|
+
/* @__PURE__ */ React.createElement(Grid, { container: true, item: true, xs: 1, justifyContent: "center" }, /* @__PURE__ */ React.createElement("div", { className: styles.questionCardVote }, /* @__PURE__ */ React.createElement(VoteButtons, { entity: answer }))),
|
|
36
|
+
/* @__PURE__ */ React.createElement(Grid, { item: true, xs: 11, className: styles.questionListItemContent }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 1 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5", component: "div" }, /* @__PURE__ */ React.createElement(
|
|
75
37
|
Link,
|
|
76
38
|
{
|
|
77
39
|
to: getAnswerLink(),
|
|
78
|
-
className: "
|
|
40
|
+
className: "qetaAnswerListItemQuestionBtn"
|
|
41
|
+
},
|
|
42
|
+
t("answer.questionTitle", {
|
|
43
|
+
question: answer.question?.title ?? ""
|
|
44
|
+
})
|
|
45
|
+
)), /* @__PURE__ */ React.createElement(
|
|
46
|
+
Typography,
|
|
47
|
+
{
|
|
48
|
+
variant: "caption",
|
|
49
|
+
noWrap: true,
|
|
50
|
+
component: "div",
|
|
51
|
+
className: "qetaQuestionListItemContent",
|
|
52
|
+
style: { marginBottom: "5px" }
|
|
53
|
+
},
|
|
54
|
+
DOMPurify.sanitize(
|
|
55
|
+
truncate(removeMarkdownFormatting(answer.content), 150)
|
|
56
|
+
)
|
|
57
|
+
), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, answer.question && /* @__PURE__ */ React.createElement(TagsAndEntities, { question: answer.question }), /* @__PURE__ */ React.createElement(
|
|
58
|
+
Typography,
|
|
59
|
+
{
|
|
60
|
+
variant: "caption",
|
|
61
|
+
display: "inline",
|
|
62
|
+
className: `${styles.questionListItemAuthor} qetaAnswerListItemAuthor`
|
|
79
63
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
64
|
+
/* @__PURE__ */ React.createElement(
|
|
65
|
+
Avatar,
|
|
66
|
+
{
|
|
67
|
+
src: user?.spec?.profile?.picture,
|
|
68
|
+
className: styles.questionListItemAvatar,
|
|
69
|
+
alt: name,
|
|
70
|
+
variant: "rounded"
|
|
71
|
+
},
|
|
72
|
+
initials
|
|
73
|
+
),
|
|
74
|
+
answer.author === "anonymous" ? t("common.anonymousAuthor") : /* @__PURE__ */ React.createElement(Link, { to: `${userRoute()}/${answer.author}` }, name),
|
|
75
|
+
" ",
|
|
76
|
+
/* @__PURE__ */ React.createElement(
|
|
77
|
+
Link,
|
|
78
|
+
{
|
|
79
|
+
to: getAnswerLink(),
|
|
80
|
+
className: "qetaQuestionListItemQuestionBtn"
|
|
81
|
+
},
|
|
82
|
+
`${t("answer.answeredTime")} `,
|
|
83
|
+
/* @__PURE__ */ React.createElement(RelativeTimeWithTooltip, { value: answer.created })
|
|
84
|
+
)
|
|
85
|
+
)))))
|
|
86
|
+
);
|
|
84
87
|
};
|
|
85
88
|
|
|
86
89
|
export { AnswerListItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnswerListItem.esm.js","sources":["../../../src/components/AnswersContainer/AnswerListItem.tsx"],"sourcesContent":["import { Avatar,
|
|
1
|
+
{"version":3,"file":"AnswerListItem.esm.js","sources":["../../../src/components/AnswersContainer/AnswerListItem.tsx"],"sourcesContent":["import { Avatar, Grid, Typography } from '@material-ui/core';\nimport { Link } from '@backstage/core-components';\nimport React from 'react';\nimport DOMPurify from 'dompurify';\nimport {\n AnswerResponse,\n removeMarkdownFormatting,\n truncate,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport {\n questionRouteRef,\n userRouteRef,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { RelativeTimeWithTooltip } from '../RelativeTimeWithTooltip/RelativeTimeWithTooltip';\nimport { useEntityAuthor, useStyles, useTranslation } from '../../utils/hooks';\nimport { TagsAndEntities } from '../QuestionPage/TagsAndEntities';\nimport { VoteButtons } from '../QuestionPage/VoteButtons';\n\nexport interface AnswerListItemProps {\n answer: AnswerResponse;\n entity?: string;\n}\n\nexport const AnswerListItem = (props: AnswerListItemProps) => {\n const { answer, entity } = props;\n\n const questionRoute = useRouteRef(questionRouteRef);\n const userRoute = useRouteRef(userRouteRef);\n const styles = useStyles();\n const { name, initials, user } = useEntityAuthor(answer);\n const { t } = useTranslation();\n\n const getAnswerLink = () => {\n return entity\n ? `${questionRoute({\n id: answer.questionId.toString(10),\n })}?entity=${entity}#answer_${answer.id}`\n : `${questionRoute({\n id: answer.questionId.toString(10),\n })}/#answer_${answer.id}`;\n };\n\n return (\n <Grid\n container\n spacing={0}\n className={styles.questionListItem}\n justifyContent=\"flex-start\"\n >\n <Grid container item xs={1} justifyContent=\"center\">\n <div className={styles.questionCardVote}>\n <VoteButtons entity={answer} />\n </div>\n </Grid>\n <Grid item xs={11} className={styles.questionListItemContent}>\n <Grid container spacing={1}>\n <Grid item xs={12}>\n <Typography variant=\"h5\" component=\"div\">\n <Link\n to={getAnswerLink()}\n className=\"qetaAnswerListItemQuestionBtn\"\n >\n {t('answer.questionTitle', {\n question: answer.question?.title ?? '',\n })}\n </Link>\n </Typography>\n <Typography\n variant=\"caption\"\n noWrap\n component=\"div\"\n className=\"qetaQuestionListItemContent\"\n style={{ marginBottom: '5px' }}\n >\n {DOMPurify.sanitize(\n truncate(removeMarkdownFormatting(answer.content), 150),\n )}\n </Typography>\n <Grid item xs={12}>\n {answer.question && (\n <TagsAndEntities question={answer.question} />\n )}\n <Typography\n variant=\"caption\"\n display=\"inline\"\n className={`${styles.questionListItemAuthor} qetaAnswerListItemAuthor`}\n >\n <Avatar\n src={user?.spec?.profile?.picture}\n className={styles.questionListItemAvatar}\n alt={name}\n variant=\"rounded\"\n >\n {initials}\n </Avatar>\n {answer.author === 'anonymous' ? (\n t('common.anonymousAuthor')\n ) : (\n <Link to={`${userRoute()}/${answer.author}`}>{name}</Link>\n )}{' '}\n <Link\n to={getAnswerLink()}\n className=\"qetaQuestionListItemQuestionBtn\"\n >\n {`${t('answer.answeredTime')} `}\n <RelativeTimeWithTooltip value={answer.created} />\n </Link>\n </Typography>\n </Grid>\n </Grid>\n </Grid>\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBa,MAAA,cAAA,GAAiB,CAAC,KAA+B,KAAA;AAC5D,EAAM,MAAA,EAAE,MAAQ,EAAA,MAAA,EAAW,GAAA,KAAA,CAAA;AAE3B,EAAM,MAAA,aAAA,GAAgB,YAAY,gBAAgB,CAAA,CAAA;AAClD,EAAM,MAAA,SAAA,GAAY,YAAY,YAAY,CAAA,CAAA;AAC1C,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAA,MAAM,EAAE,IAAM,EAAA,QAAA,EAAU,IAAK,EAAA,GAAI,gBAAgB,MAAM,CAAA,CAAA;AACvD,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAA,MAAM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UAC1B,WAAW,MAAO,CAAA,sBAAA;AAAA,UAClB,GAAK,EAAA,IAAA;AAAA,UACL,OAAQ,EAAA,SAAA;AAAA,SAAA;AAAA,QAEP,QAAA;AAAA,OACH;AAAA,MACC,OAAO,MAAW,KAAA,WAAA,GACjB,CAAE,CAAA,wBAAwB,oBAEzB,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,EAAI,EAAA,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,MAAO,CAAA,MAAM,MAAK,IAAK,CAAA;AAAA,MAClD,GAAA;AAAA,sBACH,KAAA,CAAA,aAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,IAAI,aAAc,EAAA;AAAA,UAClB,SAAU,EAAA,iCAAA;AAAA,SAAA;AAAA,QAET,CAAA,EAAG,CAAE,CAAA,qBAAqB,CAAC,CAAA,CAAA,CAAA;AAAA,wBAC3B,KAAA,CAAA,aAAA,CAAA,uBAAA,EAAA,EAAwB,KAAO,EAAA,MAAA,CAAO,OAAS,EAAA,CAAA;AAAA,OAClD;AAAA,KAEJ,CACF,CACF,CACF,CAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Box, Typography, Divider } from '@material-ui/core';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Link } from '@backstage/core-components';
|
|
4
4
|
import { useStyles, useTranslation } from '../../utils/hooks.esm.js';
|
|
5
5
|
import { useApi } from '@backstage/core-plugin-api';
|
|
6
6
|
import { RelativeTimeWithTooltip } from '../RelativeTimeWithTooltip/RelativeTimeWithTooltip.esm.js';
|
|
7
7
|
import { AuthorLink } from '../Links/Links.esm.js';
|
|
8
8
|
import { qetaApiRef } from '../../api/QetaClient.esm.js';
|
|
9
|
+
import { MarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer.esm.js';
|
|
9
10
|
|
|
10
11
|
const CommentList = (props) => {
|
|
11
12
|
const { question, answer, onCommentDelete } = props;
|
|
@@ -24,9 +25,8 @@ const CommentList = (props) => {
|
|
|
24
25
|
};
|
|
25
26
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, entity.comments?.map((c) => {
|
|
26
27
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box, { key: c.id, className: "qetaCommentBox" }, /* @__PURE__ */ React.createElement(
|
|
27
|
-
|
|
28
|
+
MarkdownRenderer,
|
|
28
29
|
{
|
|
29
|
-
dialect: "gfm",
|
|
30
30
|
content: c.content,
|
|
31
31
|
className: `${styles.markdownContent} inline`
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentList.esm.js","sources":["../../../src/components/CommentSection/CommentList.tsx"],"sourcesContent":["import {\n AnswerResponse,\n QuestionResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { Box, Divider, Typography } from '@material-ui/core';\nimport React from 'react';\nimport { Link
|
|
1
|
+
{"version":3,"file":"CommentList.esm.js","sources":["../../../src/components/CommentSection/CommentList.tsx"],"sourcesContent":["import {\n AnswerResponse,\n QuestionResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { Box, Divider, Typography } from '@material-ui/core';\nimport React from 'react';\nimport { Link } from '@backstage/core-components';\nimport { useStyles, useTranslation } from '../../utils/hooks';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { RelativeTimeWithTooltip } from '../RelativeTimeWithTooltip/RelativeTimeWithTooltip';\nimport { AuthorLink } from '../Links/Links';\nimport { qetaApiRef } from '../../api';\nimport { MarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer';\n\nexport const CommentList = (props: {\n onCommentDelete: (\n question: QuestionResponse,\n answer?: AnswerResponse,\n ) => void;\n question: QuestionResponse;\n answer?: AnswerResponse;\n}) => {\n const { question, answer, onCommentDelete } = props;\n const entity = answer ?? question;\n const styles = useStyles();\n const qetaApi = useApi(qetaApiRef);\n const { t } = useTranslation();\n\n const deleteComment = (id: number) => {\n if (answer) {\n qetaApi.deleteAnswerComment(question.id, answer.id, id).then(a => {\n onCommentDelete(question, a);\n return;\n });\n }\n qetaApi\n .deleteQuestionComment(question.id, id)\n .then(q => onCommentDelete(q));\n };\n\n return (\n <>\n {entity.comments?.map(c => {\n return (\n <>\n <Box key={c.id} className=\"qetaCommentBox\">\n <MarkdownRenderer\n content={c.content}\n className={`${styles.markdownContent} inline`}\n />\n {' – '}\n <AuthorLink entity={c} />{' '}\n <Typography variant=\"caption\" className=\"qetaCommentTime\">\n <RelativeTimeWithTooltip value={c.created} />\n </Typography>\n {(c.own || c.canDelete) && (\n <>\n {' / '}\n <Link\n underline=\"none\"\n to=\"#\"\n className=\"qetaCommentDeleteBtn\"\n onClick={() => deleteComment(c.id)}\n >\n {t('commentList.deleteLink')}\n </Link>\n </>\n )}\n </Box>\n <Divider />\n </>\n );\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAca,MAAA,WAAA,GAAc,CAAC,KAOtB,KAAA;AACJ,EAAA,MAAM,EAAE,QAAA,EAAU,MAAQ,EAAA,eAAA,EAAoB,GAAA,KAAA,CAAA;AAC9C,EAAA,MAAM,SAAS,MAAU,IAAA,QAAA,CAAA;AACzB,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA,CAAA;AACjC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAM,MAAA,aAAA,GAAgB,CAAC,EAAe,KAAA;AACpC,IAAA,IAAI,MAAQ,EAAA;AACV,MAAQ,OAAA,CAAA,mBAAA,CAAoB,SAAS,EAAI,EAAA,MAAA,CAAO,IAAI,EAAE,CAAA,CAAE,KAAK,CAAK,CAAA,KAAA;AAChE,QAAA,eAAA,CAAgB,UAAU,CAAC,CAAA,CAAA;AAC3B,QAAA,OAAA;AAAA,OACD,CAAA,CAAA;AAAA,KACH;AACA,IACG,OAAA,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A;AAAA,KAE/B,CAEJ,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAQ,CACX,CAAA,CAAA;AAAA,GAEH,CACH,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -9,7 +9,7 @@ import Whatshot from '@material-ui/icons/Whatshot';
|
|
|
9
9
|
|
|
10
10
|
const FavoritePage = () => {
|
|
11
11
|
const { t } = useTranslation();
|
|
12
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__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(QuestionsContainer, { favorite: true })), /* @__PURE__ */ React.createElement(Grid, { item: true, lg: 3, xl: 2 }, /* @__PURE__ */ React.createElement(
|
|
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(QuestionsContainer, { favorite: true })), /* @__PURE__ */ React.createElement(Grid, { item: true, lg: 3, xl: 2 }, /* @__PURE__ */ React.createElement(
|
|
13
13
|
QuestionHighlightList,
|
|
14
14
|
{
|
|
15
15
|
type: "hot",
|
|
@@ -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 { QuestionsContainer } from '../QuestionsContainer';\nimport { AskQuestionButton } from '../Buttons/AskQuestionButton';\nimport { useTranslation } from '../../utils/hooks';\nimport { Grid } from '@material-ui/core';\nimport { QuestionHighlightList } from '../QuestionHighlightList/QuestionHighlightList';\nimport Whatshot from '@material-ui/icons/Whatshot';\n\nexport const FavoritePage = () => {\n const { t } = useTranslation();\n return (\n <Grid container>\n <Grid item md={12} lg={9} xl={10}>\n <ContentHeader title={t('favoritePage.title')}>\n <AskQuestionButton />\n </ContentHeader>\n <QuestionsContainer favorite />\n </Grid>\n <Grid item lg={3} xl={2}>\n <QuestionHighlightList\n type=\"hot\"\n title={t('highlights.hot.title')}\n noQuestionsLabel={t('highlights.hot.noQuestionsLabel')}\n icon={<Whatshot fontSize=\"small\" />}\n options={{ favorite: true }}\n />\n <QuestionHighlightList\n type=\"unanswered\"\n title={t('highlights.unanswered.title')}\n noQuestionsLabel={t('highlights.unanswered.noQuestionsLabel')}\n options={{ favorite: true }}\n />\n <QuestionHighlightList\n type=\"incorrect\"\n title={t('highlights.incorrect.title')}\n noQuestionsLabel={t('highlights.incorrect.noQuestionsLabel')}\n options={{ favorite: true }}\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AASO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,2CACG,IAAK,EAAA,EAAA,SAAA,EAAS,
|
|
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 { QuestionsContainer } from '../QuestionsContainer';\nimport { AskQuestionButton } from '../Buttons/AskQuestionButton';\nimport { useTranslation } from '../../utils/hooks';\nimport { Grid } from '@material-ui/core';\nimport { QuestionHighlightList } from '../QuestionHighlightList/QuestionHighlightList';\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 </ContentHeader>\n <QuestionsContainer favorite />\n </Grid>\n <Grid item lg={3} xl={2}>\n <QuestionHighlightList\n type=\"hot\"\n title={t('highlights.hot.title')}\n noQuestionsLabel={t('highlights.hot.noQuestionsLabel')}\n icon={<Whatshot fontSize=\"small\" />}\n options={{ favorite: true }}\n />\n <QuestionHighlightList\n type=\"unanswered\"\n title={t('highlights.unanswered.title')}\n noQuestionsLabel={t('highlights.unanswered.noQuestionsLabel')}\n options={{ favorite: true }}\n />\n <QuestionHighlightList\n type=\"incorrect\"\n title={t('highlights.incorrect.title')}\n noQuestionsLabel={t('highlights.incorrect.noQuestionsLabel')}\n options={{ favorite: true }}\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AASO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,2CACG,IAAK,EAAA,EAAA,SAAA,EAAS,IAAC,EAAA,OAAA,EAAS,qBACtB,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EAAI,EAAA,EAAA,EAAI,GAAG,EAAI,EAAA,EAAA,EAAA,sCAC3B,aAAc,EAAA,EAAA,KAAA,EAAO,CAAE,CAAA,oBAAoB,qBACzC,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,IAAkB,CACrB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,sBAAmB,QAAQ,EAAA,IAAA,EAAC,CAC/B,CAAA,sCACC,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,EAAI,EAAA,CAAA,EAAG,IAAI,CACpB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,KAAA;AAAA,MACL,KAAA,EAAO,EAAE,sBAAsB,CAAA;AAAA,MAC/B,gBAAA,EAAkB,EAAE,iCAAiC,CAAA;AAAA,MACrD,IAAM,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA;AAAA,MACjC,OAAA,EAAS,EAAE,QAAA,EAAU,IAAK,EAAA;AAAA,KAAA;AAAA,GAE5B,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,qBAAA;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,QAAA,EAAU,IAAK,EAAA;AAAA,KAAA;AAAA,GAE5B,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,qBAAA;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,QAAA,EAAU,IAAK,EAAA;AAAA,KAAA;AAAA,GAE9B,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -15,7 +15,7 @@ const HomePage = () => {
|
|
|
15
15
|
loading: loadingUser,
|
|
16
16
|
error: userError
|
|
17
17
|
} = useIdentityApi((api) => api.getBackstageIdentity(), []);
|
|
18
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__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(
|
|
18
|
+
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
19
|
QuestionsCard,
|
|
20
20
|
{
|
|
21
21
|
type: "own",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomePage.esm.js","sources":["../../../src/components/HomePage/HomePage.tsx"],"sourcesContent":["import { ContentHeader } from '@backstage/core-components';\nimport { AskQuestionButton } from '../Buttons/AskQuestionButton';\nimport React from 'react';\nimport { useIdentityApi, useTranslation } from '../../utils/hooks';\nimport { QuestionsCard } from '../HomePageCards/QuestionsCard';\nimport { Grid } from '@material-ui/core';\nimport { FollowedTagsList } from '../QetaPage/FollowedTagsList';\nimport { FollowedEntitiesList } from '../QetaPage/FollowedEntitiesList';\nimport { ImpactCard } from '../HomePageCards/ImpactCard';\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>\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 <QuestionsCard\n type=\"own\"\n title={t('highlights.own.title')}\n options={{ author: user.userEntityRef }}\n />\n </Grid>\n )}\n <Grid item xs={12}>\n <QuestionsCard\n type=\"own\"\n title={t('highlights.unanswered.title')}\n options={{ noAnswers: 'true', random: 'true' }}\n />\n </Grid>\n </Grid>\n </Grid>\n <Grid item lg={3} xl={2}>\n <ImpactCard />\n <FollowedTagsList />\n <FollowedEntitiesList />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAUO,MAAM,WAAW,MAAM;AAC5B,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,IAAA;AAAA,IACP,OAAS,EAAA,WAAA;AAAA,IACT,KAAO,EAAA,SAAA;AAAA,MACL,cAAe,CAAA,CAAA,GAAA,KAAO,IAAI,oBAAqB,EAAA,EAAG,EAAE,CAAA,CAAA;AAExD,EAAA,2CACG,IAAK,EAAA,EAAA,SAAA,EAAS,
|
|
1
|
+
{"version":3,"file":"HomePage.esm.js","sources":["../../../src/components/HomePage/HomePage.tsx"],"sourcesContent":["import { ContentHeader } from '@backstage/core-components';\nimport { AskQuestionButton } from '../Buttons/AskQuestionButton';\nimport React from 'react';\nimport { useIdentityApi, useTranslation } from '../../utils/hooks';\nimport { QuestionsCard } from '../HomePageCards/QuestionsCard';\nimport { Grid } from '@material-ui/core';\nimport { FollowedTagsList } from '../QetaPage/FollowedTagsList';\nimport { FollowedEntitiesList } from '../QetaPage/FollowedEntitiesList';\nimport { ImpactCard } from '../HomePageCards/ImpactCard';\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 <QuestionsCard\n type=\"own\"\n title={t('highlights.own.title')}\n options={{ author: user.userEntityRef }}\n />\n </Grid>\n )}\n <Grid item xs={12}>\n <QuestionsCard\n type=\"own\"\n title={t('highlights.unanswered.title')}\n options={{ noAnswers: 'true', random: 'true' }}\n />\n </Grid>\n </Grid>\n </Grid>\n <Grid item lg={3} xl={2}>\n <ImpactCard />\n <FollowedTagsList />\n <FollowedEntitiesList />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAUO,MAAM,WAAW,MAAM;AAC5B,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,C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F,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,6 +1,6 @@
|
|
|
1
1
|
import { useTranslation, useQetaApi } from '../../utils/hooks.esm.js';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Card, CardContent, Typography } from '@material-ui/core';
|
|
3
|
+
import { Box, Card, CardContent, Typography } from '@material-ui/core';
|
|
4
4
|
import numeral from 'numeral';
|
|
5
5
|
|
|
6
6
|
const ImpactCard = () => {
|
|
@@ -13,7 +13,9 @@ const ImpactCard = () => {
|
|
|
13
13
|
if (loading || error || !response) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
|
-
return /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, t("impactCard.title")), /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, response.impact >= 1e3 ? numeral(response.impact).format("0.0 a") : response.impact, /* @__PURE__ */ React.createElement(Typography, { variant: "caption", style: { marginLeft: "1rem" } }, t("impactCard.views"))), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, t("impactCard.contributions"
|
|
16
|
+
return /* @__PURE__ */ React.createElement(Box, { display: { md: "none", lg: "block" } }, /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, t("impactCard.title")), /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, response.impact >= 1e3 ? numeral(response.impact).format("0.0 a") : response.impact, /* @__PURE__ */ React.createElement(Typography, { variant: "caption", style: { marginLeft: "1rem" } }, t("impactCard.views"))), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, t("impactCard.contributions", {
|
|
17
|
+
lastWeek: response.lastWeekImpact.toString(10)
|
|
18
|
+
})))));
|
|
17
19
|
};
|
|
18
20
|
|
|
19
21
|
export { ImpactCard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImpactCard.esm.js","sources":["../../../src/components/HomePageCards/ImpactCard.tsx"],"sourcesContent":["import { useQetaApi, useTranslation } from '../../utils/hooks';\nimport React from 'react';\nimport { Card, CardContent, Typography } from '@material-ui/core';\nimport numeral from 'numeral';\n\nexport const ImpactCard = () => {\n const { t } = useTranslation();\n const {\n value: response,\n loading,\n error,\n } = useQetaApi(api => api.getUserImpact(), []);\n\n if (loading || error || !response) {\n return null;\n }\n\n return (\n <
|
|
1
|
+
{"version":3,"file":"ImpactCard.esm.js","sources":["../../../src/components/HomePageCards/ImpactCard.tsx"],"sourcesContent":["import { useQetaApi, useTranslation } from '../../utils/hooks';\nimport React from 'react';\nimport { Box, Card, CardContent, Typography } from '@material-ui/core';\nimport numeral from 'numeral';\n\nexport const ImpactCard = () => {\n const { t } = useTranslation();\n const {\n value: response,\n loading,\n error,\n } = useQetaApi(api => api.getUserImpact(), []);\n\n if (loading || error || !response) {\n return null;\n }\n\n return (\n <Box display={{ md: 'none', lg: 'block' }}>\n <Card>\n <CardContent>\n <Typography variant=\"h5\">{t('impactCard.title')}</Typography>\n <Typography variant=\"h5\">\n {response.impact >= 1000\n ? numeral(response.impact).format('0.0 a')\n : response.impact}\n <Typography variant=\"caption\" style={{ marginLeft: '1rem' }}>\n {t('impactCard.views')}\n </Typography>\n </Typography>\n <Typography variant=\"body2\">\n {t('impactCard.contributions', {\n lastWeek: response.lastWeekImpact.toString(10),\n })}\n </Typography>\n </CardContent>\n </Card>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;AAKO,MAAM,aAAa,MAAM;AAC9B,EAAM,MAAA,EAAE,CAAE,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 +14,7 @@ import '@material-ui/icons/HelpOutline';
|
|
|
14
14
|
import '@backstage/plugin-permission-react';
|
|
15
15
|
import '@drodil/backstage-plugin-qeta-common';
|
|
16
16
|
import '../Statistics/StatsChart.esm.js';
|
|
17
|
+
import 'numeral';
|
|
17
18
|
import HelpOutlined from '@material-ui/icons/HelpOutlined';
|
|
18
19
|
import { useNavigate } from 'react-router-dom';
|
|
19
20
|
import Home from '@material-ui/icons/Home';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LeftMenu.esm.js","sources":["../../../src/components/LeftMenu/LeftMenu.tsx"],"sourcesContent":["import {\n ListItem,\n ListItemIcon,\n MenuItem,\n MenuList,\n Typography,\n} from '@material-ui/core';\nimport AccountBox from '@material-ui/icons/AccountBox';\nimport LoyaltyOutlined from '@material-ui/icons/LoyaltyOutlined';\nimport StarIcon from '@material-ui/icons/Star';\nimport { TrophyIcon } from '../Statistics';\nimport React, { ReactNode } from 'react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { useIdentityApi, useStyles, useTranslation } from '../../utils/hooks';\nimport {\n favoriteQuestionsRouteRef,\n qetaRouteRef,\n questionsRouteRef,\n statisticsRouteRef,\n tagsRouteRef,\n userRouteRef,\n} from '@drodil/backstage-plugin-qeta-react';\nimport HelpOutlined from '@material-ui/icons/HelpOutlined';\nimport { useNavigate } from 'react-router-dom';\nimport Home from '@material-ui/icons/Home';\nimport { useLocation } from 'react-use';\n\nexport const LeftMenu = () => {\n const rootRoute = useRouteRef(qetaRouteRef);\n const tagsRoute = useRouteRef(tagsRouteRef);\n const favoritesRoute = useRouteRef(favoriteQuestionsRouteRef);\n const statisticsRoute = useRouteRef(statisticsRouteRef);\n const userRoute = useRouteRef(userRouteRef);\n const questionsRoute = useRouteRef(questionsRouteRef);\n const styles = useStyles();\n const { t } = useTranslation();\n const location = useLocation();\n const navigate = useNavigate();\n const {\n value: user,\n loading: loadingUser,\n error: userError,\n } = useIdentityApi(api => api.getBackstageIdentity(), []);\n\n const CustomMenuItem = ({\n route,\n children,\n }: {\n route: string;\n children: ReactNode[];\n }) => {\n return (\n <MenuItem\n onClick={() => navigate(route)}\n className={\n route === location.pathname\n ? styles.selectedMenuItem\n : styles.nonSelectedMenuItem\n }\n >\n {children}\n </MenuItem>\n );\n };\n\n return (\n <MenuList id=\"left-menu\" className={styles.leftMenu}>\n <CustomMenuItem route={rootRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <Home fontSize=\"small\" />\n </ListItemIcon>\n {t('leftMenu.home')}\n </CustomMenuItem>\n <ListItem>\n <Typography variant=\"subtitle2\">Content</Typography>\n </ListItem>\n <CustomMenuItem route={questionsRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <HelpOutlined fontSize=\"small\" />\n </ListItemIcon>\n {t('leftMenu.questions')}\n </CustomMenuItem>\n <CustomMenuItem route={favoritesRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <StarIcon fontSize=\"small\" />\n </ListItemIcon>\n {t('leftMenu.favoriteQuestions')}\n </CustomMenuItem>\n <CustomMenuItem route={tagsRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <LoyaltyOutlined fontSize=\"small\" />\n </ListItemIcon>\n {t('leftMenu.tags')}\n </CustomMenuItem>\n {user && !loadingUser && !userError && (\n <CustomMenuItem route={`${userRoute()}/${user.userEntityRef}`}>\n <ListItemIcon className={styles.menuIcon}>\n <AccountBox fontSize=\"small\" />\n </ListItemIcon>\n {t('leftMenu.profile')}\n </CustomMenuItem>\n )}\n <CustomMenuItem route={statisticsRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <TrophyIcon />\n </ListItemIcon>\n {t('leftMenu.statistics')}\n </CustomMenuItem>\n </MenuList>\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LeftMenu.esm.js","sources":["../../../src/components/LeftMenu/LeftMenu.tsx"],"sourcesContent":["import {\n ListItem,\n ListItemIcon,\n MenuItem,\n MenuList,\n Typography,\n} from '@material-ui/core';\nimport AccountBox from '@material-ui/icons/AccountBox';\nimport LoyaltyOutlined from '@material-ui/icons/LoyaltyOutlined';\nimport StarIcon from '@material-ui/icons/Star';\nimport { TrophyIcon } from '../Statistics';\nimport React, { ReactNode } from 'react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { useIdentityApi, useStyles, useTranslation } from '../../utils/hooks';\nimport {\n favoriteQuestionsRouteRef,\n qetaRouteRef,\n questionsRouteRef,\n statisticsRouteRef,\n tagsRouteRef,\n userRouteRef,\n} from '@drodil/backstage-plugin-qeta-react';\nimport HelpOutlined from '@material-ui/icons/HelpOutlined';\nimport { useNavigate } from 'react-router-dom';\nimport Home from '@material-ui/icons/Home';\nimport { useLocation } from 'react-use';\n\nexport const LeftMenu = () => {\n const rootRoute = useRouteRef(qetaRouteRef);\n const tagsRoute = useRouteRef(tagsRouteRef);\n const favoritesRoute = useRouteRef(favoriteQuestionsRouteRef);\n const statisticsRoute = useRouteRef(statisticsRouteRef);\n const userRoute = useRouteRef(userRouteRef);\n const questionsRoute = useRouteRef(questionsRouteRef);\n const styles = useStyles();\n const { t } = useTranslation();\n const location = useLocation();\n const navigate = useNavigate();\n const {\n value: user,\n loading: loadingUser,\n error: userError,\n } = useIdentityApi(api => api.getBackstageIdentity(), []);\n\n const CustomMenuItem = ({\n route,\n children,\n }: {\n route: string;\n children: ReactNode[];\n }) => {\n return (\n <MenuItem\n onClick={() => navigate(route)}\n className={\n route === location.pathname\n ? styles.selectedMenuItem\n : styles.nonSelectedMenuItem\n }\n >\n {children}\n </MenuItem>\n );\n };\n\n return (\n <MenuList id=\"left-menu\" className={styles.leftMenu}>\n <CustomMenuItem route={rootRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <Home fontSize=\"small\" />\n </ListItemIcon>\n {t('leftMenu.home')}\n </CustomMenuItem>\n <ListItem>\n <Typography variant=\"subtitle2\">Content</Typography>\n </ListItem>\n <CustomMenuItem route={questionsRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <HelpOutlined fontSize=\"small\" />\n </ListItemIcon>\n {t('leftMenu.questions')}\n </CustomMenuItem>\n <CustomMenuItem route={favoritesRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <StarIcon fontSize=\"small\" />\n </ListItemIcon>\n {t('leftMenu.favoriteQuestions')}\n </CustomMenuItem>\n <CustomMenuItem route={tagsRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <LoyaltyOutlined fontSize=\"small\" />\n </ListItemIcon>\n {t('leftMenu.tags')}\n </CustomMenuItem>\n {user && !loadingUser && !userError && (\n <CustomMenuItem route={`${userRoute()}/${user.userEntityRef}`}>\n <ListItemIcon className={styles.menuIcon}>\n <AccountBox fontSize=\"small\" />\n </ListItemIcon>\n {t('leftMenu.profile')}\n </CustomMenuItem>\n )}\n <CustomMenuItem route={statisticsRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <TrophyIcon />\n </ListItemIcon>\n {t('leftMenu.statistics')}\n </CustomMenuItem>\n </MenuList>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2BO,MAAM,WAAW,MAAM;AAC5B,EAAM,MAAA,SAAA,GAAY,YAAY,YAAY,CAAA,CAAA;AAC1C,EAAM,MAAA,SAAA,GAAY,YAAY,YAAY,CAAA,CAAA;AAC1C,EAAM,MAAA,cAAA,GAAiB,YAAY,yBAAyB,CAAA,CAAA;AAC5D,EAAM,MAAA,eAAA,GAAkB,YAAY,kBAAkB,CAAA,CAAA;AACtD,EAAM,MAAA,SAAA,GAAY,YAAY,YAAY,CAAA,CAAA;AAC1C,EAAM,MAAA,cAAA,GAAiB,YAAY,iBAAiB,CAAA,CAAA;AACpD,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,EA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qB,CAC1B,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ReactMde from 'react-mde';
|
|
3
|
-
import { MarkdownContent } from '@backstage/core-components';
|
|
4
3
|
import 'react-mde/lib/styles/css/react-mde.css';
|
|
5
4
|
import 'react-mde/lib/styles/css/react-mde-editor.css';
|
|
6
5
|
import 'react-mde/lib/styles/css/react-mde-toolbar.css';
|
|
@@ -8,6 +7,7 @@ import { useStyles } from '../../utils/hooks.esm.js';
|
|
|
8
7
|
import FileType from 'file-type';
|
|
9
8
|
import { useApi, errorApiRef } from '@backstage/core-plugin-api';
|
|
10
9
|
import { qetaApiRef } from '../../api/QetaClient.esm.js';
|
|
10
|
+
import { MarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer.esm.js';
|
|
11
11
|
|
|
12
12
|
const MarkdownEditor = (props) => {
|
|
13
13
|
const { config, value, onChange, height, error, placeholder } = props;
|
|
@@ -60,10 +60,9 @@ const MarkdownEditor = (props) => {
|
|
|
60
60
|
},
|
|
61
61
|
generateMarkdownPreview: (content) => Promise.resolve(
|
|
62
62
|
/* @__PURE__ */ React.createElement(
|
|
63
|
-
|
|
63
|
+
MarkdownRenderer,
|
|
64
64
|
{
|
|
65
65
|
content,
|
|
66
|
-
dialect: "gfm",
|
|
67
66
|
className: `qetaMarkdownEditorPreview ${styles.markdownContent}`
|
|
68
67
|
}
|
|
69
68
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownEditor.esm.js","sources":["../../../src/components/MarkdownEditor/MarkdownEditor.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport React from 'react';\nimport ReactMde from 'react-mde';\n\nimport { Config } from '@backstage/config';\nimport
|
|
1
|
+
{"version":3,"file":"MarkdownEditor.esm.js","sources":["../../../src/components/MarkdownEditor/MarkdownEditor.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport React from 'react';\nimport ReactMde from 'react-mde';\n\nimport { Config } from '@backstage/config';\nimport 'react-mde/lib/styles/css/react-mde.css';\nimport 'react-mde/lib/styles/css/react-mde-editor.css';\nimport 'react-mde/lib/styles/css/react-mde-toolbar.css';\nimport { useStyles } from '../../utils/hooks';\nimport FileType from 'file-type';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { qetaApiRef } from '../../api';\nimport { MarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer';\n\nexport const MarkdownEditor = (props: {\n config: Config;\n value: string;\n onChange: (value: string) => void;\n height: number;\n error?: boolean;\n placeholder?: string;\n onImageUpload: (imageId: number) => void;\n}) => {\n const { config, value, onChange, height, error, placeholder } = props;\n const [selectedTab, setSelectedTab] = React.useState<'write' | 'preview'>(\n 'write',\n );\n const styles = useStyles();\n const errorApi = useApi(errorApiRef);\n const qetaApi = useApi(qetaApiRef);\n\n const imageUpload = () => {\n // eslint-disable-next-line func-names\n return async function* (data: ArrayBuffer) {\n const fileType = await FileType.fromBuffer(data);\n\n const mimeType = fileType ? fileType.mime : 'text/plain';\n const attachment = await qetaApi.postAttachment(\n new Blob([data], { type: mimeType }),\n );\n if ('errors' in attachment) {\n errorApi.post({\n name: 'Upload failed',\n message: attachment.errors?.map(e => e.message).join(', ') ?? '',\n });\n return false;\n }\n props.onImageUpload(attachment.id);\n yield attachment.locationUri;\n return true;\n };\n };\n\n const isUploadDisabled =\n config?.getOptionalBoolean('qeta.storage.disabled') || false;\n\n return (\n <ReactMde\n classes={{\n reactMde: `qetaMarkdownEditorEdit ${styles.markdownEditor}`,\n textArea: error\n ? `qetaMarkdownEditorError ${styles.markdownEditorError}`\n : undefined,\n preview: 'qetaMarkdownEditorPreview',\n toolbar: 'qetaMarkdownEditorToolbar',\n }}\n value={value}\n onChange={onChange}\n selectedTab={selectedTab}\n onTabChange={setSelectedTab}\n minEditorHeight={height}\n minPreviewHeight={height - 10}\n childProps={{\n textArea: {\n required: true,\n placeholder,\n },\n }}\n generateMarkdownPreview={content =>\n Promise.resolve(\n <MarkdownRenderer\n content={content}\n className={`qetaMarkdownEditorPreview ${styles.markdownContent}`}\n />,\n )\n }\n paste={\n isUploadDisabled\n ? undefined\n : {\n saveImage: imageUpload(),\n }\n }\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAca,MAAA,cAAA,GAAiB,CAAC,KAQzB,KAAA;AACJ,EAAA,MAAM,EAAE,MAAQ,EAAA,KAAA,EAAO,UAAU,MAAQ,EAAA,KAAA,EAAO,aAAgB,GAAA,KAAA,CAAA;AAChE,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,KAAM,CAAA,QAAA;AAAA,IAC1C,OAAA;AAAA,GACF,CAAA;AACA,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA,CAAA;AACnC,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA,CAAA;AAEjC,EAAA,MAAM,cAAc,MAAM;AAExB,IAAA,OAAO,iBAAiB,IAAmB,EAAA;AACzC,MAAA,MAAM,QAAW,GAAA,MAAM,QAAS,CAAA,UAAA,CAAW,IAAI,CAAA,CAAA;AAE/C,MAAM,MAAA,QAAA,GAAW,QAAW,GAAA,QAAA,CAAS,IAAO,GAAA,YAAA,CAAA;AAC5C,MAAM,MAAA,UAAA,GAAa,MAAM,OAAQ,CAAA,cAAA;AAAA,QAC/B,IAAI,KAAK,CAAC,IAAI,GAAG,EAAE,IAAA,EAAM,UAAU,CAAA;AAAA,OACrC,CAAA;AACA,MAAA,IAAI,YAAY,UAAY,EAAA;AAC1B,QAAA,QAAA,CAAS,IAAK,CAAA;AAAA,UACZ,IAAM,EAAA,eAAA;AAAA,UACN,OAAA,EAAS,UAAW,CAAA,MAAA,EAAQ,GAAI,CAAA,CAAA,CAAA,KAAK,EAAE,OAAO,CAAA,CAAE,IAAK,CAAA,IAAI,CAAK,IAAA,EAAA;AAAA,SAC/D,CAAA,CA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A,KAAA;AAAA,GAER,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SyntaxHighlighter from 'react-syntax-highlighter';
|
|
3
|
+
import ReactMarkdown from 'react-markdown';
|
|
4
|
+
import { a11yDark, a11yLight } from 'react-syntax-highlighter/dist/esm/styles/hljs';
|
|
5
|
+
import { useIsDarkTheme } from '../../utils/hooks.esm.js';
|
|
6
|
+
|
|
7
|
+
const MarkdownRenderer = (props) => {
|
|
8
|
+
const { content, className: mainClassName } = props;
|
|
9
|
+
const darkTheme = useIsDarkTheme();
|
|
10
|
+
return /* @__PURE__ */ React.createElement(
|
|
11
|
+
ReactMarkdown,
|
|
12
|
+
{
|
|
13
|
+
className: mainClassName,
|
|
14
|
+
components: {
|
|
15
|
+
code(p) {
|
|
16
|
+
const { children, className, node, ...rest } = p;
|
|
17
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
18
|
+
return match ? /* @__PURE__ */ React.createElement(
|
|
19
|
+
SyntaxHighlighter,
|
|
20
|
+
{
|
|
21
|
+
...rest,
|
|
22
|
+
PreTag: "div",
|
|
23
|
+
language: match[1],
|
|
24
|
+
style: darkTheme ? a11yDark : a11yLight,
|
|
25
|
+
showLineNumbers: true
|
|
26
|
+
},
|
|
27
|
+
String(children).replace(/\n$/, "")
|
|
28
|
+
) : /* @__PURE__ */ React.createElement("code", { ...rest, className }, children);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
content
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { MarkdownRenderer };
|
|
37
|
+
//# sourceMappingURL=MarkdownRenderer.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.esm.js","sources":["../../../src/components/MarkdownRenderer/MarkdownRenderer.tsx"],"sourcesContent":["import React from 'react';\nimport SyntaxHighlighter from 'react-syntax-highlighter';\nimport ReactMarkdown from 'react-markdown';\nimport {\n a11yDark,\n a11yLight,\n} from 'react-syntax-highlighter/dist/esm/styles/hljs';\nimport { useIsDarkTheme } from '../../utils/hooks';\n\nexport const MarkdownRenderer = (props: {\n content: string;\n className?: string;\n}) => {\n const { content, className: mainClassName } = props;\n const darkTheme = useIsDarkTheme();\n return (\n <ReactMarkdown\n className={mainClassName}\n components={{\n code(p: any) {\n const { children, className, node, ...rest } = p;\n const match = /language-(\\w+)/.exec(className || '');\n return match ? (\n <SyntaxHighlighter\n {...rest}\n PreTag=\"div\"\n language={match[1]}\n style={darkTheme ? a11yDark : a11yLight}\n showLineNumbers\n >\n {String(children).replace(/\\n$/, '')}\n </SyntaxHighlighter>\n ) : (\n <code {...rest} className={className}>\n {children}\n </code>\n );\n },\n }}\n >\n {content}\n </ReactMarkdown>\n );\n};\n"],"names":[],"mappings":";;;;;;AASa,MAAA,gBAAA,GAAmB,CAAC,KAG3B,KAAA;AACJ,EAAA,MAAM,EAAE,OAAA,EAAS,SAAW,EAAA,aAAA,EAAkB,GAAA,KAAA,CAAA;AAC9C,EAAA,MAAM,YAAY,cAAe,EAAA,CAAA;AACjC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,aAAA;AAAA,MACX,UAAY,EAAA;AAAA,QACV,KAAK,CAAQ,EAAA;AACX,UAAA,MAAM,EAAE,QAAU,EAAA,SAAA,EAAW,IAAM,EAAA,GAAG,MAAS,GAAA,CAAA,CAAA;AAC/C,UAAA,MAAM,KAAQ,GAAA,gBAAA,CAAiB,IAAK,CAAA,SAAA,IAAa,EAAE,CAAA,CAAA;AACnD,UAAA,OAAO,KACL,mBAAA,KAAA,CAAA,aAAA;AAAA,YAAC,iBAAA;AAAA,YAAA;AAAA,cACE,GAAG,IAAA;AAAA,cACJ,MAAO,EAAA,KAAA;AAAA,cACP,QAAA,EAAU,MAAM,CAAC,CAAA;AAAA,cACjB,KAAA,EAAO,YAAY,QAAW,GAAA,SAAA;AAAA,cAC9B,eAAe,EAAA,IAAA;AAAA,aAAA;AAAA,YAEd,MAAO,CAAA,QAAQ,CAAE,CAAA,OAAA,CAAQ,OAAO,EAAE,CAAA;AAAA,8BAGpC,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,GAAG,IAAA,EAAM,aACb,QACH,CAAA,CAAA;AAAA,SAEJ;AAAA,OACF;AAAA,KAAA;AAAA,IAEC,OAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Card, CardContent, Grid, Typography, Box, Button } from '@material-ui/core';
|
|
2
|
-
import { MarkdownContent } from '@backstage/core-components';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { VoteButtons } from './VoteButtons.esm.js';
|
|
5
4
|
import { useStyles, useTranslation } from '../../utils/hooks.esm.js';
|
|
@@ -10,6 +9,7 @@ import { CommentSection } from '../CommentSection/CommentSection.esm.js';
|
|
|
10
9
|
import { LinkButton } from './LinkButton.esm.js';
|
|
11
10
|
import DeleteIcon from '@material-ui/icons/Delete';
|
|
12
11
|
import EditIcon from '@material-ui/icons/Edit';
|
|
12
|
+
import { MarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer.esm.js';
|
|
13
13
|
|
|
14
14
|
const AnswerCard = (props) => {
|
|
15
15
|
const { answer, question } = props;
|
|
@@ -44,11 +44,10 @@ const AnswerCard = (props) => {
|
|
|
44
44
|
id: answerEntity.id
|
|
45
45
|
}
|
|
46
46
|
) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body1", gutterBottom: true }, /* @__PURE__ */ React.createElement(
|
|
47
|
-
|
|
47
|
+
MarkdownRenderer,
|
|
48
48
|
{
|
|
49
49
|
className: `qetaAndwerCardAnswerContent ${styles.markdownContent}`,
|
|
50
|
-
content: answerEntity.content
|
|
51
|
-
dialect: "gfm"
|
|
50
|
+
content: answerEntity.content
|
|
52
51
|
}
|
|
53
52
|
)), /* @__PURE__ */ React.createElement(
|
|
54
53
|
Grid,
|