@drodil/backstage-plugin-qeta 3.13.1 → 3.14.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/CollectionPage/CollectionPage.esm.js +7 -1
- package/dist/components/CollectionPage/CollectionPage.esm.js.map +1 -1
- package/dist/components/QuestionPage/QuestionPage.esm.js +12 -2
- package/dist/components/QuestionPage/QuestionPage.esm.js.map +1 -1
- package/dist/components/UserPage/UserPage.esm.js +12 -7
- package/dist/components/UserPage/UserPage.esm.js.map +1 -1
- package/dist/components/UsersPage/UsersPage.esm.js +21 -2
- package/dist/components/UsersPage/UsersPage.esm.js.map +1 -1
- package/package.json +3 -3
|
@@ -19,7 +19,13 @@ const CollectionPage = () => {
|
|
|
19
19
|
if (error || collection === void 0) {
|
|
20
20
|
return /* @__PURE__ */ React.createElement(WarningPanel, { severity: "error", title: t("questionPage.errorLoading") }, error?.message);
|
|
21
21
|
}
|
|
22
|
-
const title = /* @__PURE__ */ React.createElement(Typography, { variant: "h5", component: "h2" }, collection.title, /* @__PURE__ */ React.createElement(
|
|
22
|
+
const title = /* @__PURE__ */ React.createElement(Typography, { variant: "h5", component: "h2" }, collection.title, /* @__PURE__ */ React.createElement(
|
|
23
|
+
CollectionFollowButton,
|
|
24
|
+
{
|
|
25
|
+
collection,
|
|
26
|
+
style: { marginLeft: "0.5em" }
|
|
27
|
+
}
|
|
28
|
+
));
|
|
23
29
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
24
30
|
ContentHeader,
|
|
25
31
|
{
|
|
@@ -1 +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 ButtonContainer,\n CollectionCard,\n CollectionFollowButton,\n CreateCollectionButton,\n PostsGrid,\n useQetaApi,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { Skeleton } from '@material-ui/lab';\nimport { ContentHeader, WarningPanel } from '@backstage/core-components';\nimport { Grid, Typography } from '@material-ui/core';\n\nexport const CollectionPage = () => {\n const { id } = useParams();\n const { t } = useTranslation();\n\n const {\n value: collection,\n loading,\n error,\n } = useQetaApi(api => api.getCollection(id), [id]);\n\n if (loading) {\n return <Skeleton variant=\"rect\" height={200} />;\n }\n\n if (error || collection === undefined) {\n return (\n <WarningPanel severity=\"error\" title={t('questionPage.errorLoading')}>\n {error?.message}\n </WarningPanel>\n );\n }\n\n const title = (\n <Typography variant=\"h5\" component=\"h2\">\n {collection.title}\n <CollectionFollowButton
|
|
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 ButtonContainer,\n CollectionCard,\n CollectionFollowButton,\n CreateCollectionButton,\n PostsGrid,\n useQetaApi,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { Skeleton } from '@material-ui/lab';\nimport { ContentHeader, WarningPanel } from '@backstage/core-components';\nimport { Grid, Typography } from '@material-ui/core';\n\nexport const CollectionPage = () => {\n const { id } = useParams();\n const { t } = useTranslation();\n\n const {\n value: collection,\n loading,\n error,\n } = useQetaApi(api => api.getCollection(id), [id]);\n\n if (loading) {\n return <Skeleton variant=\"rect\" height={200} />;\n }\n\n if (error || collection === undefined) {\n return (\n <WarningPanel severity=\"error\" title={t('questionPage.errorLoading')}>\n {error?.message}\n </WarningPanel>\n );\n }\n\n const title = (\n <Typography variant=\"h5\" component=\"h2\">\n {collection.title}\n <CollectionFollowButton\n collection={collection}\n style={{ marginLeft: '0.5em' }}\n />\n </Typography>\n );\n\n return (\n <>\n <ContentHeader\n titleComponent={title}\n description={t('collectionPage.info')}\n >\n <ButtonContainer>\n <CreateCollectionButton />\n </ButtonContainer>\n </ContentHeader>\n <Grid container>\n <Grid item xs={12}>\n <CollectionCard collection={collection} />\n </Grid>\n <Grid item xs={12}>\n <PostsGrid\n collectionId={collection.id}\n orderBy=\"rank\"\n allowRanking={collection.canEdit}\n />\n </Grid>\n </Grid>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAeO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,EAAE,EAAG,EAAA,GAAI,SAAU,EAAA;AACzB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,UAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACF,GAAI,WAAW,CAAO,GAAA,KAAA,GAAA,CAAI,cAAc,EAAE,CAAA,EAAG,CAAC,EAAE,CAAC,CAAA;AAEjD,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,OAAQ,EAAA,MAAA,EAAO,QAAQ,GAAK,EAAA,CAAA;AAAA;AAG/C,EAAI,IAAA,KAAA,IAAS,eAAe,KAAW,CAAA,EAAA;AACrC,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,gBAAa,QAAS,EAAA,OAAA,EAAQ,OAAO,CAAE,CAAA,2BAA2B,CAChE,EAAA,EAAA,KAAA,EAAO,OACV,CAAA;AAAA;AAIJ,EAAM,MAAA,KAAA,uCACH,UAAW,EAAA,EAAA,OAAA,EAAQ,MAAK,SAAU,EAAA,IAAA,EAAA,EAChC,WAAW,KACZ,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,sBAAA;AAAA,IAAA;AAAA,MACC,UAAA;AAAA,MACA,KAAA,EAAO,EAAE,UAAA,EAAY,OAAQ;AAAA;AAAA,GAEjC,CAAA;AAGF,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,cAAgB,EAAA,KAAA;AAAA,MAChB,WAAA,EAAa,EAAE,qBAAqB;AAAA,KAAA;AAAA,oBAEnC,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA,IAAuB,CAC1B;AAAA,GACF,sCACC,IAAK,EAAA,EAAA,SAAA,EAAS,wBACZ,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,EAAI,sBACZ,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,YAAwB,CAC1C,CAAA,sCACC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,EACb,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,cAAc,UAAW,CAAA,EAAA;AAAA,MACzB,OAAQ,EAAA,MAAA;AAAA,MACR,cAAc,UAAW,CAAA;AAAA;AAAA,GAE7B,CACF,CACF,CAAA;AAEJ;;;;"}
|
|
@@ -3,14 +3,24 @@ import { WarningPanel, ContentHeader } from '@backstage/core-components';
|
|
|
3
3
|
import { useParams } from 'react-router-dom';
|
|
4
4
|
import { useTranslation, useQetaApi, ButtonContainer, AskQuestionButton, AddToCollectionButton, QuestionCard, AIAnswerCard, AnswerCard, AnswerForm, RelativeTimeWithTooltip, UpdatedByLink } from '@drodil/backstage-plugin-qeta-react';
|
|
5
5
|
import { useSignal } from '@backstage/plugin-signals-react';
|
|
6
|
-
import { Box, Grid, Typography, FormControl, TextField, MenuItem, Divider } from '@material-ui/core';
|
|
6
|
+
import { makeStyles, Box, Grid, Typography, FormControl, TextField, MenuItem, Divider } from '@material-ui/core';
|
|
7
7
|
import { Skeleton } from '@material-ui/lab';
|
|
8
8
|
|
|
9
|
+
const useDescriptionStyles = makeStyles(
|
|
10
|
+
() => ({
|
|
11
|
+
root: {},
|
|
12
|
+
box: {
|
|
13
|
+
display: "inline"
|
|
14
|
+
}
|
|
15
|
+
}),
|
|
16
|
+
{ name: "QetaDescription" }
|
|
17
|
+
);
|
|
9
18
|
const QuestionPage = () => {
|
|
10
19
|
const { id } = useParams();
|
|
11
20
|
const { t } = useTranslation();
|
|
12
21
|
const [newAnswers, setNewAnswers] = React.useState([]);
|
|
13
22
|
const [answerSort, setAnswerSort] = React.useState("default");
|
|
23
|
+
const dStyles = useDescriptionStyles();
|
|
14
24
|
const [answersCount, setAnswersCount] = useState(0);
|
|
15
25
|
const [views, setViews] = useState(0);
|
|
16
26
|
const { lastSignal } = useSignal(`qeta:post_${id}`);
|
|
@@ -76,7 +86,7 @@ const QuestionPage = () => {
|
|
|
76
86
|
setAnswersCount((prev) => prev + 1);
|
|
77
87
|
};
|
|
78
88
|
const getDescription = (q) => {
|
|
79
|
-
return /* @__PURE__ */ React.createElement("span",
|
|
89
|
+
return /* @__PURE__ */ React.createElement("span", { className: dStyles.root }, /* @__PURE__ */ React.createElement(Box, { fontWeight: "fontWeightMedium", className: dStyles.box }, t("authorBox.postedAtTime"), " ", /* @__PURE__ */ React.createElement(RelativeTimeWithTooltip, { value: q.created }), " \xB7 "), q.updated && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box, { fontWeight: "fontWeightMedium", className: dStyles.box }, t("authorBox.updatedAtTime"), " ", /* @__PURE__ */ React.createElement(RelativeTimeWithTooltip, { value: q.updated }), " ", t("authorBox.updatedBy"), " ", /* @__PURE__ */ React.createElement(UpdatedByLink, { entity: q }), " \xB7 ")), /* @__PURE__ */ React.createElement(Box, { fontWeight: "fontWeightMedium", className: dStyles.box }, t("common.views", { count: views })));
|
|
80
90
|
};
|
|
81
91
|
if (loading) {
|
|
82
92
|
return /* @__PURE__ */ React.createElement(Skeleton, { variant: "rect", height: 200 });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuestionPage.esm.js","sources":["../../../src/components/QuestionPage/QuestionPage.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { ContentHeader, WarningPanel } from '@backstage/core-components';\nimport { useParams } from 'react-router-dom';\nimport {\n AddToCollectionButton,\n AIAnswerCard,\n AnswerCard,\n AnswerForm,\n AskQuestionButton,\n ButtonContainer,\n QuestionCard,\n RelativeTimeWithTooltip,\n UpdatedByLink,\n useQetaApi,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\nimport {\n Answer,\n AnswerResponse,\n PostResponse,\n QetaSignal,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { useSignal } from '@backstage/plugin-signals-react';\nimport {\n Box,\n Divider,\n FormControl,\n Grid,\n MenuItem,\n TextField,\n Typography,\n} from '@material-ui/core';\nimport { Skeleton } from '@material-ui/lab';\n\nexport const QuestionPage = () => {\n const { id } = useParams();\n const { t } = useTranslation();\n const [newAnswers, setNewAnswers] = React.useState<AnswerResponse[]>([]);\n const [answerSort, setAnswerSort] = React.useState<string>('default');\n\n const [answersCount, setAnswersCount] = useState(0);\n const [views, setViews] = useState(0);\n\n const { lastSignal } = useSignal<QetaSignal>(`qeta:post_${id}`);\n\n const {\n value: question,\n loading,\n error,\n } = useQetaApi(api => api.getPost(id), [id]);\n\n useEffect(() => {\n if (question) {\n setAnswersCount(question.answersCount);\n setViews(question.views);\n }\n }, [question]);\n\n useEffect(() => {\n if (lastSignal?.type === 'post_stats') {\n setAnswersCount(lastSignal.answersCount);\n setViews(lastSignal.views);\n }\n }, [lastSignal]);\n\n const sortAnswers = useCallback(\n (a: Answer, b: Answer) => {\n if (answerSort === 'default') {\n return 1;\n }\n\n const parts = answerSort.split('_');\n const field = parts[0];\n const order = parts[1];\n\n let ret = -1;\n switch (field) {\n case 'created':\n ret = a.created > b.created ? -1 : 1;\n break;\n case 'score':\n ret = a.score > b.score ? -1 : 1;\n break;\n case 'author':\n ret = a.author > b.author ? -1 : 1;\n break;\n case 'comments':\n ret = (a.comments?.length ?? 0) > (b.comments?.length ?? 0) ? -1 : 1;\n break;\n case 'updated':\n ret = (a.updated ?? a.created) > (b.updated ?? b.created) ? -1 : 1;\n break;\n default:\n return 1;\n }\n\n if (order === 'desc') {\n ret *= -1;\n }\n return ret;\n },\n [answerSort],\n );\n\n const allAnswers = (question?.answers ?? []).concat(newAnswers);\n const sortedAnswers = useMemo(\n () => allAnswers.sort(sortAnswers),\n [allAnswers, sortAnswers],\n );\n\n const onAnswerPost = (answer: AnswerResponse) => {\n setNewAnswers(newAnswers.concat([answer]));\n setAnswersCount(prev => prev + 1);\n };\n\n const getDescription = (q: PostResponse) => {\n return (\n <span>\n {t('authorBox.postedAtTime')}{' '}\n <Box fontWeight=\"fontWeightMedium\" display=\"inline\">\n <RelativeTimeWithTooltip value={q.created} />\n </Box>\n {q.updated && (\n <React.Fragment>\n {t('authorBox.updatedAtTime')}{' '}\n <Box fontWeight=\"fontWeightMedium\" display=\"inline\">\n <RelativeTimeWithTooltip value={q.updated} />{' '}\n {t('authorBox.updatedBy')} <UpdatedByLink entity={q} />\n </Box>\n </React.Fragment>\n )}\n <Box fontWeight=\"fontWeightMedium\" display=\"inline\">\n {t('common.views', { count: views })}\n </Box>\n </span>\n );\n };\n\n if (loading) {\n return <Skeleton variant=\"rect\" height={200} />;\n }\n\n if (error || question === undefined) {\n return (\n <WarningPanel severity=\"error\" title={t('questionPage.errorLoading')}>\n {error?.message}\n </WarningPanel>\n );\n }\n\n if (question.type !== 'question') {\n return (\n <WarningPanel title=\"Not found\" message={t('questionPage.notFound')} />\n );\n }\n\n return (\n <>\n <ContentHeader\n title={question.title}\n // @ts-ignore\n description={getDescription(question)}\n >\n <ButtonContainer>\n <AskQuestionButton />\n <AddToCollectionButton post={question} />\n </ButtonContainer>\n </ContentHeader>\n <QuestionCard question={question} />\n <AIAnswerCard question={question} debounceMs={0} />\n <Box sx={{ mt: 3, mb: 2 }}>\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h6\">\n {t('common.answers', {\n count: answersCount,\n })}\n </Typography>\n </Grid>\n {allAnswers.length > 1 && (\n <Grid item>\n <FormControl>\n <TextField\n select\n size=\"small\"\n label={t('questionPage.sortAnswers.label')}\n value={answerSort}\n onChange={val => setAnswerSort(val.target.value as string)}\n inputProps={{\n name: 'sortAnswers',\n id: 'sort-answers',\n }}\n variant=\"outlined\"\n >\n <MenuItem value=\"default\">\n {t('questionPage.sortAnswers.default')}\n </MenuItem>\n <MenuItem value=\"created_desc\">\n {t('questionPage.sortAnswers.createdDesc')}\n </MenuItem>\n <MenuItem value=\"created_asc\">\n {t('questionPage.sortAnswers.createdAsc')}\n </MenuItem>\n <MenuItem value=\"score_desc\">\n {t('questionPage.sortAnswers.scoreDesc')}\n </MenuItem>\n <MenuItem value=\"score_asc\">\n {t('questionPage.sortAnswers.scoreAsc')}\n </MenuItem>\n <MenuItem value=\"comments_desc\">\n {t('questionPage.sortAnswers.commentsDesc')}\n </MenuItem>\n <MenuItem value=\"comments_asc\">\n {t('questionPage.sortAnswers.commentsAsc')}\n </MenuItem>\n <MenuItem value=\"author_desc\">\n {t('questionPage.sortAnswers.authorDesc')}\n </MenuItem>\n <MenuItem value=\"author_asc\">\n {t('questionPage.sortAnswers.authorAsc')}\n </MenuItem>\n <MenuItem value=\"updated_desc\">\n {t('questionPage.sortAnswers.updatedDesc')}\n </MenuItem>\n <MenuItem value=\"updated_asc\">\n {t('questionPage.sortAnswers.updatedAsc')}\n </MenuItem>\n </TextField>\n </FormControl>\n </Grid>\n )}\n </Grid>\n </Box>\n <Divider />\n {sortedAnswers.map(a => {\n return (\n <React.Fragment key={a.id}>\n <Box key={a.id} sx={{ mb: 1 }}>\n <AnswerCard answer={a} question={question} />\n </Box>\n </React.Fragment>\n );\n })}\n <Divider />\n <AnswerForm post={question} onPost={onAnswerPost} />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAkCO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,EAAE,EAAG,EAAA,GAAI,SAAU,EAAA;AACzB,EAAM,MAAA,EAAE,C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Content":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { ContentHeader, WarningPanel } from '@backstage/core-components';\nimport { useParams } from 'react-router-dom';\nimport {\n AddToCollectionButton,\n AIAnswerCard,\n AnswerCard,\n AnswerForm,\n AskQuestionButton,\n ButtonContainer,\n QuestionCard,\n RelativeTimeWithTooltip,\n UpdatedByLink,\n useQetaApi,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\nimport {\n Answer,\n AnswerResponse,\n PostResponse,\n QetaSignal,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { useSignal } from '@backstage/plugin-signals-react';\nimport {\n Box,\n Divider,\n FormControl,\n Grid,\n makeStyles,\n MenuItem,\n TextField,\n Typography,\n} from '@material-ui/core';\nimport { Skeleton } from '@material-ui/lab';\n\nconst useDescriptionStyles = makeStyles(\n () => ({\n root: {},\n box: {\n display: 'inline',\n },\n }),\n { name: 'QetaDescription' },\n);\n\nexport const QuestionPage = () => {\n const { id } = useParams();\n const { t } = useTranslation();\n const [newAnswers, setNewAnswers] = React.useState<AnswerResponse[]>([]);\n const [answerSort, setAnswerSort] = React.useState<string>('default');\n const dStyles = useDescriptionStyles();\n\n const [answersCount, setAnswersCount] = useState(0);\n const [views, setViews] = useState(0);\n\n const { lastSignal } = useSignal<QetaSignal>(`qeta:post_${id}`);\n\n const {\n value: question,\n loading,\n error,\n } = useQetaApi(api => api.getPost(id), [id]);\n\n useEffect(() => {\n if (question) {\n setAnswersCount(question.answersCount);\n setViews(question.views);\n }\n }, [question]);\n\n useEffect(() => {\n if (lastSignal?.type === 'post_stats') {\n setAnswersCount(lastSignal.answersCount);\n setViews(lastSignal.views);\n }\n }, [lastSignal]);\n\n const sortAnswers = useCallback(\n (a: Answer, b: Answer) => {\n if (answerSort === 'default') {\n return 1;\n }\n\n const parts = answerSort.split('_');\n const field = parts[0];\n const order = parts[1];\n\n let ret = -1;\n switch (field) {\n case 'created':\n ret = a.created > b.created ? -1 : 1;\n break;\n case 'score':\n ret = a.score > b.score ? -1 : 1;\n break;\n case 'author':\n ret = a.author > b.author ? -1 : 1;\n break;\n case 'comments':\n ret = (a.comments?.length ?? 0) > (b.comments?.length ?? 0) ? -1 : 1;\n break;\n case 'updated':\n ret = (a.updated ?? a.created) > (b.updated ?? b.created) ? -1 : 1;\n break;\n default:\n return 1;\n }\n\n if (order === 'desc') {\n ret *= -1;\n }\n return ret;\n },\n [answerSort],\n );\n\n const allAnswers = (question?.answers ?? []).concat(newAnswers);\n const sortedAnswers = useMemo(\n () => allAnswers.sort(sortAnswers),\n [allAnswers, sortAnswers],\n );\n\n const onAnswerPost = (answer: AnswerResponse) => {\n setNewAnswers(newAnswers.concat([answer]));\n setAnswersCount(prev => prev + 1);\n };\n\n const getDescription = (q: PostResponse) => {\n return (\n <span className={dStyles.root}>\n <Box fontWeight=\"fontWeightMedium\" className={dStyles.box}>\n {t('authorBox.postedAtTime')}{' '}\n <RelativeTimeWithTooltip value={q.created} />\n {' · '}\n </Box>\n {q.updated && (\n <React.Fragment>\n <Box fontWeight=\"fontWeightMedium\" className={dStyles.box}>\n {t('authorBox.updatedAtTime')}{' '}\n <RelativeTimeWithTooltip value={q.updated} />{' '}\n {t('authorBox.updatedBy')} <UpdatedByLink entity={q} />\n {' · '}\n </Box>\n </React.Fragment>\n )}\n <Box fontWeight=\"fontWeightMedium\" className={dStyles.box}>\n {t('common.views', { count: views })}\n </Box>\n </span>\n );\n };\n\n if (loading) {\n return <Skeleton variant=\"rect\" height={200} />;\n }\n\n if (error || question === undefined) {\n return (\n <WarningPanel severity=\"error\" title={t('questionPage.errorLoading')}>\n {error?.message}\n </WarningPanel>\n );\n }\n\n if (question.type !== 'question') {\n return (\n <WarningPanel title=\"Not found\" message={t('questionPage.notFound')} />\n );\n }\n\n return (\n <>\n <ContentHeader\n title={question.title}\n // @ts-ignore\n description={getDescription(question)}\n >\n <ButtonContainer>\n <AskQuestionButton />\n <AddToCollectionButton post={question} />\n </ButtonContainer>\n </ContentHeader>\n <QuestionCard question={question} />\n <AIAnswerCard question={question} debounceMs={0} />\n <Box sx={{ mt: 3, mb: 2 }}>\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h6\">\n {t('common.answers', {\n count: answersCount,\n })}\n </Typography>\n </Grid>\n {allAnswers.length > 1 && (\n <Grid item>\n <FormControl>\n <TextField\n select\n size=\"small\"\n label={t('questionPage.sortAnswers.label')}\n value={answerSort}\n onChange={val => setAnswerSort(val.target.value as string)}\n inputProps={{\n name: 'sortAnswers',\n id: 'sort-answers',\n }}\n variant=\"outlined\"\n >\n <MenuItem value=\"default\">\n {t('questionPage.sortAnswers.default')}\n </MenuItem>\n <MenuItem value=\"created_desc\">\n {t('questionPage.sortAnswers.createdDesc')}\n </MenuItem>\n <MenuItem value=\"created_asc\">\n {t('questionPage.sortAnswers.createdAsc')}\n </MenuItem>\n <MenuItem value=\"score_desc\">\n {t('questionPage.sortAnswers.scoreDesc')}\n </MenuItem>\n <MenuItem value=\"score_asc\">\n {t('questionPage.sortAnswers.scoreAsc')}\n </MenuItem>\n <MenuItem value=\"comments_desc\">\n {t('questionPage.sortAnswers.commentsDesc')}\n </MenuItem>\n <MenuItem value=\"comments_asc\">\n {t('questionPage.sortAnswers.commentsAsc')}\n </MenuItem>\n <MenuItem value=\"author_desc\">\n {t('questionPage.sortAnswers.authorDesc')}\n </MenuItem>\n <MenuItem value=\"author_asc\">\n {t('questionPage.sortAnswers.authorAsc')}\n </MenuItem>\n <MenuItem value=\"updated_desc\">\n {t('questionPage.sortAnswers.updatedDesc')}\n </MenuItem>\n <MenuItem value=\"updated_asc\">\n {t('questionPage.sortAnswers.updatedAsc')}\n </MenuItem>\n </TextField>\n </FormControl>\n </Grid>\n )}\n </Grid>\n </Box>\n <Divider />\n {sortedAnswers.map(a => {\n return (\n <React.Fragment key={a.id}>\n <Box key={a.id} sx={{ mb: 1 }}>\n <AnswerCard answer={a} question={question} />\n </Box>\n </React.Fragment>\n );\n })}\n <Divider />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AA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,GAAK,EAAA,CAAA,CAAE,IAAI,EAAI,EAAA,EAAE,EAAI,EAAA,CAAA,EACxB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,MAAQ,EAAA,CAAA,EAAG,QAAoB,EAAA,CAC7C,CACF,CAAA;AAAA,GAEH,CACD,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,IAAA,CAAA,kBACR,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,IAAM,EAAA,QAAA,EAAU,MAAQ,EAAA,YAAA,EAAc,CACpD,CAAA;AAEJ;;;;"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { ContentHeader } from '@backstage/core-components';
|
|
3
3
|
import { useParams, useSearchParams } from 'react-router-dom';
|
|
4
|
-
import { useTranslation, useIdentityApi, UserFollowButton, ButtonContainer, AskQuestionButton, WriteArticleButton, PostsContainer, PostsGrid, CollectionsGrid, AnswersContainer } from '@drodil/backstage-plugin-qeta-react';
|
|
5
|
-
import { useEntityPresentation } from '@backstage/plugin-catalog-react';
|
|
4
|
+
import { useUserInfo, useTranslation, useIdentityApi, UserFollowButton, ButtonContainer, AskQuestionButton, WriteArticleButton, PostsContainer, PostsGrid, CollectionsGrid, AnswersContainer } from '@drodil/backstage-plugin-qeta-react';
|
|
6
5
|
import { UserStatsContent } from './UserStatsContent.esm.js';
|
|
7
6
|
import { TabContext, TabList, TabPanel } from '@material-ui/lab';
|
|
8
|
-
import { Typography, Box, Tab } from '@material-ui/core';
|
|
7
|
+
import { Typography, Box, Avatar, Tab } from '@material-ui/core';
|
|
9
8
|
|
|
10
9
|
const UserPage = () => {
|
|
11
10
|
const identity = useParams()["*"] ?? "unknown";
|
|
12
|
-
const
|
|
11
|
+
const { name, initials, user, secondaryTitle } = useUserInfo(identity);
|
|
13
12
|
const [tab, setTab] = useState("statistics");
|
|
14
13
|
const { t } = useTranslation();
|
|
15
14
|
const [_searchParams, setSearchParams] = useSearchParams();
|
|
16
15
|
const {
|
|
17
|
-
value:
|
|
16
|
+
value: currentUser,
|
|
18
17
|
loading: loadingUser,
|
|
19
18
|
error: userError
|
|
20
19
|
} = useIdentityApi((api) => api.getBackstageIdentity(), []);
|
|
@@ -22,8 +21,14 @@ const UserPage = () => {
|
|
|
22
21
|
setSearchParams({});
|
|
23
22
|
setTab(newValue);
|
|
24
23
|
};
|
|
25
|
-
const title = /* @__PURE__ */ React.createElement(Typography, { variant: "h5", component: "h2" },
|
|
26
|
-
|
|
24
|
+
const title = /* @__PURE__ */ React.createElement(Typography, { variant: "h5", component: "h2" }, /* @__PURE__ */ React.createElement(Box, { style: { display: "inline-block", marginRight: "0.5em" } }, /* @__PURE__ */ React.createElement(Avatar, { src: user?.spec?.profile?.picture, alt: name, variant: "rounded" }, initials)), name, !loadingUser && !userError && currentUser?.userEntityRef !== identity && /* @__PURE__ */ React.createElement(
|
|
25
|
+
UserFollowButton,
|
|
26
|
+
{
|
|
27
|
+
userRef: identity,
|
|
28
|
+
style: { marginLeft: "0.5em" }
|
|
29
|
+
}
|
|
30
|
+
));
|
|
31
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ContentHeader, { titleComponent: title, description: secondaryTitle }, /* @__PURE__ */ React.createElement(ButtonContainer, null, /* @__PURE__ */ React.createElement(AskQuestionButton, null), /* @__PURE__ */ React.createElement(WriteArticleButton, null))), /* @__PURE__ */ React.createElement(TabContext, { value: tab }, /* @__PURE__ */ React.createElement(Box, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React.createElement(
|
|
27
32
|
TabList,
|
|
28
33
|
{
|
|
29
34
|
onChange: handleChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserPage.esm.js","sources":["../../../src/components/UserPage/UserPage.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { ContentHeader } from '@backstage/core-components';\nimport { useParams, useSearchParams } from 'react-router-dom';\nimport {\n AnswersContainer,\n AskQuestionButton,\n ButtonContainer,\n CollectionsGrid,\n PostsContainer,\n PostsGrid,\n useIdentityApi,\n UserFollowButton,\n useTranslation,\n WriteArticleButton,\n} from '@drodil/backstage-plugin-qeta-react';\nimport {
|
|
1
|
+
{"version":3,"file":"UserPage.esm.js","sources":["../../../src/components/UserPage/UserPage.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { ContentHeader } from '@backstage/core-components';\nimport { useParams, useSearchParams } from 'react-router-dom';\nimport {\n AnswersContainer,\n AskQuestionButton,\n ButtonContainer,\n CollectionsGrid,\n PostsContainer,\n PostsGrid,\n useIdentityApi,\n UserFollowButton,\n useTranslation,\n useUserInfo,\n WriteArticleButton,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { UserStatsContent } from './UserStatsContent';\nimport { TabContext, TabList, TabPanel } from '@material-ui/lab';\nimport { Avatar, Box, Tab, Typography } from '@material-ui/core';\n\nexport const UserPage = () => {\n const identity = useParams()['*'] ?? 'unknown';\n const { name, initials, user, secondaryTitle } = useUserInfo(identity);\n const [tab, setTab] = useState('statistics');\n const { t } = useTranslation();\n const [_searchParams, setSearchParams] = useSearchParams();\n const {\n value: currentUser,\n loading: loadingUser,\n error: userError,\n } = useIdentityApi(api => api.getBackstageIdentity(), []);\n\n const handleChange = (_event: React.ChangeEvent<{}>, newValue: string) => {\n setSearchParams({});\n setTab(newValue);\n };\n const title = (\n <Typography variant=\"h5\" component=\"h2\">\n <Box style={{ display: 'inline-block', marginRight: '0.5em' }}>\n <Avatar src={user?.spec?.profile?.picture} alt={name} variant=\"rounded\">\n {initials}\n </Avatar>\n </Box>\n {name}\n {!loadingUser &&\n !userError &&\n currentUser?.userEntityRef !== identity && (\n <UserFollowButton\n userRef={identity}\n style={{ marginLeft: '0.5em' }}\n />\n )}\n </Typography>\n );\n\n return (\n <>\n <ContentHeader titleComponent={title} description={secondaryTitle}>\n <ButtonContainer>\n <AskQuestionButton />\n <WriteArticleButton />\n </ButtonContainer>\n </ContentHeader>\n <TabContext value={tab}>\n <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>\n <TabList\n onChange={handleChange}\n aria-label={t('userPage.profileTab')}\n >\n <Tab label={t('userPage.statistics')} value=\"statistics\" />\n <Tab label={t('userPage.questions')} value=\"questions\" />\n <Tab label={t('userPage.articles')} value=\"articles\" />\n <Tab label={t('userPage.collections')} value=\"collections\" />\n <Tab label={t('userPage.answers')} value=\"answers\" />\n </TabList>\n </Box>\n <TabPanel value=\"statistics\">\n <UserStatsContent userRef={identity ?? ''} />\n </TabPanel>\n <TabPanel value=\"questions\">\n <PostsContainer\n author={identity ?? ''}\n showNoQuestionsBtn={false}\n type=\"question\"\n />\n </TabPanel>\n <TabPanel value=\"articles\">\n <PostsGrid author={identity ?? ''} type=\"article\" />\n </TabPanel>\n <TabPanel value=\"collections\">\n <CollectionsGrid owner={identity ?? ''} />\n </TabPanel>\n <TabPanel value=\"answers\">\n <AnswersContainer\n author={identity ?? ''}\n title={t('userPage.answers')}\n />\n </TabPanel>\n </TabContext>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAoBO,MAAM,WAAW,MAAM;AAC5B,EAAA,MAAM,QAAW,GAAA,SAAA,EAAY,CAAA,GAAG,CAAK,IAAA,SAAA;AACrC,EAAA,MAAM,EAAE,IAAM,EAAA,QAAA,EAAU,MAAM,cAAe,EAAA,GAAI,YAAY,QAAQ,CAAA;AACrE,EAAA,MAAM,CAAC,GAAA,EAAK,MAAM,CAAA,GAAI,SAAS,YAAY,CAAA;AAC3C,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,CAAC,aAAA,EAAe,eAAe,CAAA,GAAI,eAAgB,EAAA;AACzD,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,WAAA;AAAA,IACP,OAAS,EAAA,WAAA;AAAA,IACT,KAAO,EAAA;AAAA,MACL,cAAe,CA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,CAAA,SAAA,EAAA,EAAU,MAAQ,EAAA,QAAA,IAAY,EAAI,EAAA,IAAA,EAAK,SAAU,EAAA,CACpD,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,KAAA,EAAM,aACd,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,eAAgB,EAAA,EAAA,KAAA,EAAO,QAAY,IAAA,EAAA,EAAI,CAC1C,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,OAAM,SACd,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,QAAQ,QAAY,IAAA,EAAA;AAAA,MACpB,KAAA,EAAO,EAAE,kBAAkB;AAAA;AAAA,GAE/B,CACF,CACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useTranslation, UsersGrid, FollowedUsersList } from '@drodil/backstage-plugin-qeta-react';
|
|
2
|
+
import { useTranslation, UsersGrid, FollowedUsersList, PostHighlightList } from '@drodil/backstage-plugin-qeta-react';
|
|
3
3
|
import { ContentHeader } from '@backstage/core-components';
|
|
4
4
|
import { Grid } from '@material-ui/core';
|
|
5
|
+
import Whatshot from '@material-ui/icons/Whatshot';
|
|
5
6
|
|
|
6
7
|
const UsersPage = () => {
|
|
7
8
|
const { t } = useTranslation();
|
|
8
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 4 }, /* @__PURE__ */ React.createElement(Grid, { item: true, md: 12, lg: 8, xl: 9 }, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("usersPage.title") }), /* @__PURE__ */ React.createElement(UsersGrid, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, lg: 4, xl: 3 }, /* @__PURE__ */ React.createElement(FollowedUsersList, null)
|
|
9
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 4 }, /* @__PURE__ */ React.createElement(Grid, { item: true, md: 12, lg: 8, xl: 9 }, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("usersPage.title") }), /* @__PURE__ */ React.createElement(UsersGrid, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, lg: 4, xl: 3 }, /* @__PURE__ */ React.createElement(FollowedUsersList, null), /* @__PURE__ */ React.createElement(
|
|
10
|
+
PostHighlightList,
|
|
11
|
+
{
|
|
12
|
+
type: "hot",
|
|
13
|
+
title: t("highlights.hotQuestions.title"),
|
|
14
|
+
noQuestionsLabel: t("highlights.hotQuestions.noQuestionsLabel"),
|
|
15
|
+
icon: /* @__PURE__ */ React.createElement(Whatshot, { fontSize: "small" }),
|
|
16
|
+
postType: "question"
|
|
17
|
+
}
|
|
18
|
+
), /* @__PURE__ */ React.createElement(
|
|
19
|
+
PostHighlightList,
|
|
20
|
+
{
|
|
21
|
+
type: "hot",
|
|
22
|
+
title: t("highlights.hotArticles.title"),
|
|
23
|
+
noQuestionsLabel: t("highlights.hotArticles.noArticlesLabel"),
|
|
24
|
+
icon: /* @__PURE__ */ React.createElement(Whatshot, { fontSize: "small" }),
|
|
25
|
+
postType: "article"
|
|
26
|
+
}
|
|
27
|
+
)));
|
|
9
28
|
};
|
|
10
29
|
|
|
11
30
|
export { UsersPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UsersPage.esm.js","sources":["../../../src/components/UsersPage/UsersPage.tsx"],"sourcesContent":["import React from 'react';\nimport {\n FollowedUsersList,\n UsersGrid,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { ContentHeader } from '@backstage/core-components';\nimport { Grid } from '@material-ui/core';\n\nexport const UsersPage = () => {\n const { t } = useTranslation();\n\n return (\n <Grid container spacing={4}>\n <Grid item md={12} lg={8} xl={9}>\n <ContentHeader title={t('usersPage.title')} />\n <UsersGrid />\n </Grid>\n <Grid item lg={4} xl={3}>\n <FollowedUsersList />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UsersPage.esm.js","sources":["../../../src/components/UsersPage/UsersPage.tsx"],"sourcesContent":["import React from 'react';\nimport {\n FollowedUsersList,\n PostHighlightList,\n UsersGrid,\n useTranslation,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { ContentHeader } from '@backstage/core-components';\nimport { Grid } from '@material-ui/core';\nimport Whatshot from '@material-ui/icons/Whatshot';\n\nexport const UsersPage = () => {\n const { t } = useTranslation();\n\n return (\n <Grid container spacing={4}>\n <Grid item md={12} lg={8} xl={9}>\n <ContentHeader title={t('usersPage.title')} />\n <UsersGrid />\n </Grid>\n <Grid item lg={4} xl={3}>\n <FollowedUsersList />\n <PostHighlightList\n type=\"hot\"\n title={t('highlights.hotQuestions.title')}\n noQuestionsLabel={t('highlights.hotQuestions.noQuestionsLabel')}\n icon={<Whatshot fontSize=\"small\" />}\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 postType=\"article\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;AAWO,MAAM,YAAY,MAAM;AAC7B,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,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,CAAG,EAAA,EAAA,EAAI,qBAC3B,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,KAAO,EAAA,CAAA,CAAE,iBAAiB,CAAG,EAAA,CAAA,kBAC3C,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,IAAU,CACb,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,EAAI,EAAA,CAAA,EAAG,IAAI,CACpB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,uBAAkB,CACnB,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,KAAA;AAAA,MACL,KAAA,EAAO,EAAE,+BAA+B,CAAA;AAAA,MACxC,gBAAA,EAAkB,EAAE,0CAA0C,CAAA;AAAA,MAC9D,IAAM,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA;AAAA,MACjC,QAAS,EAAA;AAAA;AAAA,GAEX,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,QAAS,EAAA;AAAA;AAAA,GAEb,CACF,CAAA;AAEJ;;;;"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"frontend",
|
|
8
8
|
"backstage.io"
|
|
9
9
|
],
|
|
10
|
-
"version": "3.
|
|
10
|
+
"version": "3.14.0",
|
|
11
11
|
"main": "dist/index.esm.js",
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
13
|
"prepublishOnly": "yarn tsc && yarn build",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"@backstage/plugin-catalog-react": "^1.14.2",
|
|
55
55
|
"@backstage/plugin-home-react": "^0.1.20",
|
|
56
56
|
"@backstage/plugin-signals-react": "^0.0.7",
|
|
57
|
-
"@drodil/backstage-plugin-qeta-common": "^3.
|
|
58
|
-
"@drodil/backstage-plugin-qeta-react": "^3.
|
|
57
|
+
"@drodil/backstage-plugin-qeta-common": "^3.14.0",
|
|
58
|
+
"@drodil/backstage-plugin-qeta-react": "^3.14.0",
|
|
59
59
|
"@material-ui/core": "^4.12.2",
|
|
60
60
|
"@material-ui/icons": "^4.11.3",
|
|
61
61
|
"@material-ui/lab": "4.0.0-alpha.61",
|