@drodil/backstage-plugin-qeta 2.5.3 → 2.6.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 +5 -4
- package/dist/components/AnswersContainer/AnswerList.esm.js.map +1 -1
- package/dist/components/AnswersContainer/AnswerListItem.esm.js +8 -7
- package/dist/components/AnswersContainer/AnswerListItem.esm.js.map +1 -1
- package/dist/components/AnswersContainer/AnswersContainer.esm.js +12 -15
- package/dist/components/AnswersContainer/AnswersContainer.esm.js.map +1 -1
- package/dist/components/AskAnonymouslyCheckbox/AskAnonymouslyCheckbox.esm.js +3 -1
- package/dist/components/AskAnonymouslyCheckbox/AskAnonymouslyCheckbox.esm.js.map +1 -1
- package/dist/components/AskForm/AskForm.esm.js +13 -6
- package/dist/components/AskForm/AskForm.esm.js.map +1 -1
- package/dist/components/AskForm/EntitiesInput.esm.js +7 -3
- package/dist/components/AskForm/EntitiesInput.esm.js.map +1 -1
- package/dist/components/AskForm/TagInput.esm.js +7 -3
- package/dist/components/AskForm/TagInput.esm.js.map +1 -1
- package/dist/components/AskPage/AskPage.esm.js +7 -3
- package/dist/components/AskPage/AskPage.esm.js.map +1 -1
- package/dist/components/Buttons/AskQuestionButton.esm.js +3 -1
- package/dist/components/Buttons/AskQuestionButton.esm.js.map +1 -1
- package/dist/components/Buttons/BackToQuestionsButton.esm.js +3 -2
- package/dist/components/Buttons/BackToQuestionsButton.esm.js.map +1 -1
- package/dist/components/CommentSection/CommentList.esm.js +3 -2
- package/dist/components/CommentSection/CommentList.esm.js.map +1 -1
- package/dist/components/CommentSection/CommentSection.esm.js +5 -3
- package/dist/components/CommentSection/CommentSection.esm.js.map +1 -1
- package/dist/components/DeleteModal/DeleteModal.esm.js +6 -5
- package/dist/components/DeleteModal/DeleteModal.esm.js.map +1 -1
- package/dist/components/FavoritePage/FavoritePage.esm.js +3 -1
- package/dist/components/FavoritePage/FavoritePage.esm.js.map +1 -1
- package/dist/components/HomePage/HomePage.esm.js +19 -13
- package/dist/components/HomePage/HomePage.esm.js.map +1 -1
- package/dist/components/Links/Links.esm.js +3 -1
- package/dist/components/Links/Links.esm.js.map +1 -1
- package/dist/components/QuestionHighlightList/QuestionHighlightList.esm.js +3 -2
- package/dist/components/QuestionHighlightList/QuestionHighlightList.esm.js.map +1 -1
- package/dist/components/QuestionPage/AnswerCard.esm.js +4 -3
- package/dist/components/QuestionPage/AnswerCard.esm.js.map +1 -1
- package/dist/components/QuestionPage/AnswerForm.esm.js +6 -4
- package/dist/components/QuestionPage/AnswerForm.esm.js.map +1 -1
- package/dist/components/QuestionPage/AuthorBox.esm.js +3 -2
- package/dist/components/QuestionPage/AuthorBox.esm.js.map +1 -1
- package/dist/components/QuestionPage/FavoriteButton.esm.js +4 -2
- package/dist/components/QuestionPage/FavoriteButton.esm.js.map +1 -1
- package/dist/components/QuestionPage/LinkButton.esm.js +9 -13
- package/dist/components/QuestionPage/LinkButton.esm.js.map +1 -1
- package/dist/components/QuestionPage/QuestionCard.esm.js +4 -3
- package/dist/components/QuestionPage/QuestionCard.esm.js.map +1 -1
- package/dist/components/QuestionPage/QuestionPage.esm.js +19 -16
- package/dist/components/QuestionPage/QuestionPage.esm.js.map +1 -1
- package/dist/components/QuestionPage/VoteButtons.esm.js +7 -5
- package/dist/components/QuestionPage/VoteButtons.esm.js.map +1 -1
- package/dist/components/QuestionTableCard/QuestionsTable.esm.js +8 -7
- package/dist/components/QuestionTableCard/QuestionsTable.esm.js.map +1 -1
- package/dist/components/QuestionsContainer/DateRangeFilter.esm.js +12 -11
- package/dist/components/QuestionsContainer/DateRangeFilter.esm.js.map +1 -1
- package/dist/components/QuestionsContainer/FilterPanel.esm.js +22 -19
- package/dist/components/QuestionsContainer/FilterPanel.esm.js.map +1 -1
- package/dist/components/QuestionsContainer/NoQuestionsCard.esm.js +4 -3
- package/dist/components/QuestionsContainer/NoQuestionsCard.esm.js.map +1 -1
- package/dist/components/QuestionsContainer/QuestionList.esm.js +4 -3
- package/dist/components/QuestionsContainer/QuestionList.esm.js.map +1 -1
- package/dist/components/QuestionsContainer/QuestionListItem.esm.js +12 -9
- package/dist/components/QuestionsContainer/QuestionListItem.esm.js.map +1 -1
- package/dist/components/QuestionsContainer/QuestionsContainer.esm.js +13 -9
- package/dist/components/QuestionsContainer/QuestionsContainer.esm.js.map +1 -1
- package/dist/components/Statistics/TopRankingUsersCard.esm.js +15 -14
- package/dist/components/Statistics/TopRankingUsersCard.esm.js.map +1 -1
- package/dist/components/TagPage/TagPage.esm.js +10 -1
- package/dist/components/TagPage/TagPage.esm.js.map +1 -1
- package/dist/components/TagPage/TagsContainer.esm.js +7 -13
- package/dist/components/TagPage/TagsContainer.esm.js.map +1 -1
- package/dist/components/UserPage/UserPage.esm.js +18 -3
- package/dist/components/UserPage/UserPage.esm.js.map +1 -1
- package/dist/index.d.ts +180 -1
- package/dist/index.esm.js +1 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/locale/fi.esm.js +185 -0
- package/dist/locale/fi.esm.js.map +1 -0
- package/dist/translation.esm.js +323 -0
- package/dist/translation.esm.js.map +1 -0
- package/dist/utils/hooks.esm.js +6 -1
- package/dist/utils/hooks.esm.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagInput.esm.js","sources":["../../../src/components/AskForm/TagInput.tsx"],"sourcesContent":["import { Control, Controller } from 'react-hook-form';\nimport { Autocomplete } from '@material-ui/lab';\nimport { TextField } from '@material-ui/core';\nimport React, { useEffect, useMemo } from 'react';\nimport { qetaApiRef } from '../../api';\nimport { QuestionForm } from './types';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\n\nexport const TagInput = (props: { control: Control<QuestionForm> }) => {\n const { control } = props;\n const qetaApi = useApi(qetaApiRef);\n const config = useApi(configApiRef);\n const allowCreation = useMemo(\n () => config.getOptionalBoolean('qeta.tags.allowCreation') ?? true,\n [config],\n );\n const allowedTags = useMemo(\n () => config.getOptionalStringArray('qeta.tags.allowedTags') ?? null,\n [config],\n );\n const maximumTags = useMemo(\n () => config.getOptionalNumber('qeta.tags.max') ?? 5,\n [config],\n );\n const [availableTags, setAvailableTags] = React.useState<string[] | null>([]);\n useEffect(() => {\n if (allowCreation) {\n qetaApi\n .getTags()\n .catch(_ => setAvailableTags(null))\n .then(data =>\n data\n ? setAvailableTags(data.map(tag => tag.tag))\n : setAvailableTags(null),\n );\n } else {\n setAvailableTags(allowedTags);\n }\n }, [qetaApi, allowCreation, allowedTags]);\n\n if (!allowCreation && (allowedTags === null || allowedTags.length === 0)) {\n return null;\n }\n\n return (\n <Controller\n control={control}\n render={({ field: { onChange, value }, fieldState: { error } }) => (\n <Autocomplete\n multiple\n id=\"tags-select\"\n className=\"qetaAskFormTags\"\n value={value}\n options={availableTags ?? []}\n freeSolo={allowCreation}\n onChange={(_e, newValue) => {\n const tags = filterTags(newValue);\n if (\n tags &&\n tags.length <= maximumTags &&\n tags.length === newValue.length\n ) {\n onChange(newValue);\n }\n }}\n renderInput={params => (\n <TextField\n {...params}\n variant=\"outlined\"\n margin=\"normal\"\n label
|
|
1
|
+
{"version":3,"file":"TagInput.esm.js","sources":["../../../src/components/AskForm/TagInput.tsx"],"sourcesContent":["import { Control, Controller } from 'react-hook-form';\nimport { Autocomplete } from '@material-ui/lab';\nimport { TextField } from '@material-ui/core';\nimport React, { useEffect, useMemo } from 'react';\nimport { qetaApiRef } from '../../api';\nimport { QuestionForm } from './types';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\nimport { useTranslation } from '../../utils/hooks';\n\nexport const TagInput = (props: { control: Control<QuestionForm> }) => {\n const { control } = props;\n const qetaApi = useApi(qetaApiRef);\n const config = useApi(configApiRef);\n const { t } = useTranslation();\n const allowCreation = useMemo(\n () => config.getOptionalBoolean('qeta.tags.allowCreation') ?? true,\n [config],\n );\n const allowedTags = useMemo(\n () => config.getOptionalStringArray('qeta.tags.allowedTags') ?? null,\n [config],\n );\n const maximumTags = useMemo(\n () => config.getOptionalNumber('qeta.tags.max') ?? 5,\n [config],\n );\n const [availableTags, setAvailableTags] = React.useState<string[] | null>([]);\n useEffect(() => {\n if (allowCreation) {\n qetaApi\n .getTags()\n .catch(_ => setAvailableTags(null))\n .then(data =>\n data\n ? setAvailableTags(data.map(tag => tag.tag))\n : setAvailableTags(null),\n );\n } else {\n setAvailableTags(allowedTags);\n }\n }, [qetaApi, allowCreation, allowedTags]);\n\n if (!allowCreation && (allowedTags === null || allowedTags.length === 0)) {\n return null;\n }\n\n return (\n <Controller\n control={control}\n render={({ field: { onChange, value }, fieldState: { error } }) => (\n <Autocomplete\n multiple\n id=\"tags-select\"\n className=\"qetaAskFormTags\"\n value={value}\n options={availableTags ?? []}\n freeSolo={allowCreation}\n onChange={(_e, newValue) => {\n const tags = filterTags(newValue);\n if (\n tags &&\n tags.length <= maximumTags &&\n tags.length === newValue.length\n ) {\n onChange(newValue);\n }\n }}\n renderInput={params => (\n <TextField\n {...params}\n variant=\"outlined\"\n margin=\"normal\"\n label={t('tagsInput.label')}\n placeholder={t('tagsInput.placeholder')}\n helperText={t('tagsInput.helperText', {\n max: maximumTags.toString(10),\n })}\n error={error !== undefined}\n />\n )}\n />\n )}\n name=\"tags\"\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAUa,MAAA,QAAA,GAAW,CAAC,KAA8C,KAAA;AACrE,EAAM,MAAA,EAAE,SAAY,GAAA,KAAA,CAAA;AACpB,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA,CAAA;AACjC,EAAM,MAAA,MAAA,GAAS,OAAO,YAAY,CAAA,CAAA;AAClC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,MAAM,aAAgB,GAAA,OAAA;AAAA,IACpB,MAAM,MAAA,CAAO,kBAAmB,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|
import { useEntityPresentation } from '@backstage/plugin-catalog-react';
|
|
8
8
|
import { filterTags } from '@drodil/backstage-plugin-qeta-common';
|
|
9
|
+
import { useTranslation } from '../../utils/hooks.esm.js';
|
|
9
10
|
|
|
10
11
|
const AskPage = () => {
|
|
11
12
|
const { id } = useParams();
|
|
@@ -13,14 +14,17 @@ const AskPage = () => {
|
|
|
13
14
|
const entity = searchParams.get("entity") ?? void 0;
|
|
14
15
|
const entityPage = searchParams.get("entityPage") === "true";
|
|
15
16
|
const tags = filterTags(searchParams.get("tags"));
|
|
17
|
+
const { t } = useTranslation();
|
|
16
18
|
let title;
|
|
17
19
|
if (id) {
|
|
18
|
-
title = "
|
|
20
|
+
title = t("askPage.title.existingQuestion");
|
|
19
21
|
} else if (entity) {
|
|
20
22
|
const representation = useEntityPresentation(entity);
|
|
21
|
-
title =
|
|
23
|
+
title = t("askPage.title.entityQuestion", {
|
|
24
|
+
entity: representation.primaryTitle
|
|
25
|
+
});
|
|
22
26
|
} else {
|
|
23
|
-
title = "
|
|
27
|
+
title = t("askPage.title.newQuestion");
|
|
24
28
|
}
|
|
25
29
|
return /* @__PURE__ */ React.createElement(Content, { className: "qetaAskPage" }, /* @__PURE__ */ React.createElement(ContentHeader, { title }, /* @__PURE__ */ React.createElement(BackToQuestionsButton, { entityPage })), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(InfoCard, null, /* @__PURE__ */ React.createElement(
|
|
26
30
|
AskForm,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AskPage.esm.js","sources":["../../../src/components/AskPage/AskPage.tsx"],"sourcesContent":["import { Content, ContentHeader, InfoCard } from '@backstage/core-components';\nimport { Grid } from '@material-ui/core';\nimport React from 'react';\n\nimport { AskForm } from '../AskForm/AskForm';\nimport { useParams, useSearchParams } from 'react-router-dom';\nimport { BackToQuestionsButton } from '../Buttons/BackToQuestionsButton';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\n\nexport const AskPage = () => {\n const { id } = useParams();\n const [searchParams] = useSearchParams();\n const entity = searchParams.get('entity') ?? undefined;\n const entityPage = searchParams.get('entityPage') === 'true';\n const tags = filterTags(searchParams.get('tags'));\n let title;\n if (id) {\n title = '
|
|
1
|
+
{"version":3,"file":"AskPage.esm.js","sources":["../../../src/components/AskPage/AskPage.tsx"],"sourcesContent":["import { Content, ContentHeader, InfoCard } from '@backstage/core-components';\nimport { Grid } from '@material-ui/core';\nimport React from 'react';\n\nimport { AskForm } from '../AskForm/AskForm';\nimport { useParams, useSearchParams } from 'react-router-dom';\nimport { BackToQuestionsButton } from '../Buttons/BackToQuestionsButton';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\nimport { useTranslation } from '../../utils/hooks';\n\nexport const AskPage = () => {\n const { id } = useParams();\n const [searchParams] = useSearchParams();\n const entity = searchParams.get('entity') ?? undefined;\n const entityPage = searchParams.get('entityPage') === 'true';\n const tags = filterTags(searchParams.get('tags'));\n const { t } = useTranslation();\n let title;\n if (id) {\n title = t('askPage.title.existingQuestion');\n } else if (entity) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const representation = useEntityPresentation(entity);\n title = t('askPage.title.entityQuestion', {\n entity: representation.primaryTitle,\n });\n } else {\n title = t('askPage.title.newQuestion');\n }\n\n return (\n <Content className=\"qetaAskPage\">\n <ContentHeader title={title}>\n <BackToQuestionsButton entityPage={entityPage} />\n </ContentHeader>\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <InfoCard>\n <AskForm\n id={id}\n entity={entity}\n entityPage={entityPage}\n tags={tags}\n />\n </InfoCard>\n </Grid>\n </Grid>\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAWO,MAAM,UAAU,MAAM;AAC3B,EAAM,MAAA,EAAE,EAA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kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,EAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,MACA,IAAA;AAAA,KAAA;AAAA,GAEJ,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -5,10 +5,12 @@ import { qetaCreateQuestionPermission } from '@drodil/backstage-plugin-qeta-comm
|
|
|
5
5
|
import { LinkButton } from '@backstage/core-components';
|
|
6
6
|
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
7
7
|
import { askRouteRef } from '@drodil/backstage-plugin-qeta-react';
|
|
8
|
+
import { useTranslation } from '../../utils/hooks.esm.js';
|
|
8
9
|
|
|
9
10
|
const AskQuestionButton = (props) => {
|
|
10
11
|
const { entity, entityPage, tags } = props;
|
|
11
12
|
const askRoute = useRouteRef(askRouteRef);
|
|
13
|
+
const { t } = useTranslation();
|
|
12
14
|
const params = new URLSearchParams();
|
|
13
15
|
if (entity) {
|
|
14
16
|
params.set("entity", entity);
|
|
@@ -34,7 +36,7 @@ const AskQuestionButton = (props) => {
|
|
|
34
36
|
className: "qetaAskQuestionBtn",
|
|
35
37
|
startIcon: /* @__PURE__ */ React.createElement(HelpOutline, null)
|
|
36
38
|
},
|
|
37
|
-
"
|
|
39
|
+
t("askQuestionButton.title")
|
|
38
40
|
)
|
|
39
41
|
);
|
|
40
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AskQuestionButton.esm.js","sources":["../../../src/components/Buttons/AskQuestionButton.tsx"],"sourcesContent":["import HelpOutline from '@material-ui/icons/HelpOutline';\nimport React from 'react';\nimport { RequirePermission } from '@backstage/plugin-permission-react';\nimport { qetaCreateQuestionPermission } from '@drodil/backstage-plugin-qeta-common';\nimport { LinkButton } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { askRouteRef } from '@drodil/backstage-plugin-qeta-react';\n\nexport const AskQuestionButton = (props: {\n entity?: string;\n tags?: string[];\n entityPage?: boolean;\n}) => {\n const { entity, entityPage, tags } = props;\n const askRoute = useRouteRef(askRouteRef);\n\n const params = new URLSearchParams();\n if (entity) {\n params.set('entity', entity);\n }\n if (entityPage) {\n params.set('entityPage', 'true');\n }\n if (tags && tags.length > 0) {\n params.set('tags', tags.join(','));\n }\n\n return (\n <RequirePermission\n permission={qetaCreateQuestionPermission}\n errorPage={<></>}\n >\n <LinkButton\n variant=\"contained\"\n to={entity || tags ? `${askRoute()}?${params.toString()}` : askRoute()}\n color=\"primary\"\n className=\"qetaAskQuestionBtn\"\n startIcon={<HelpOutline />}\n >\n
|
|
1
|
+
{"version":3,"file":"AskQuestionButton.esm.js","sources":["../../../src/components/Buttons/AskQuestionButton.tsx"],"sourcesContent":["import HelpOutline from '@material-ui/icons/HelpOutline';\nimport React from 'react';\nimport { RequirePermission } from '@backstage/plugin-permission-react';\nimport { qetaCreateQuestionPermission } from '@drodil/backstage-plugin-qeta-common';\nimport { LinkButton } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { askRouteRef } from '@drodil/backstage-plugin-qeta-react';\nimport { useTranslation } from '../../utils/hooks';\n\nexport const AskQuestionButton = (props: {\n entity?: string;\n tags?: string[];\n entityPage?: boolean;\n}) => {\n const { entity, entityPage, tags } = props;\n const askRoute = useRouteRef(askRouteRef);\n const { t } = useTranslation();\n\n const params = new URLSearchParams();\n if (entity) {\n params.set('entity', entity);\n }\n if (entityPage) {\n params.set('entityPage', 'true');\n }\n if (tags && tags.length > 0) {\n params.set('tags', tags.join(','));\n }\n\n return (\n <RequirePermission\n permission={qetaCreateQuestionPermission}\n errorPage={<></>}\n >\n <LinkButton\n variant=\"contained\"\n to={entity || tags ? `${askRoute()}?${params.toString()}` : askRoute()}\n color=\"primary\"\n className=\"qetaAskQuestionBtn\"\n startIcon={<HelpOutline />}\n >\n {t('askQuestionButton.title')}\n </LinkButton>\n </RequirePermission>\n );\n};\n"],"names":[],"mappings":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AA,MAEvB,EAAE,yBAAyB,CAAA;AAAA,KAC9B;AAAA,GACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LinkButton } from '@backstage/core-components';
|
|
2
2
|
import HomeOutlined from '@material-ui/icons/HomeOutlined';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { useStyles } from '../../utils/hooks.esm.js';
|
|
4
|
+
import { useStyles, useTranslation } from '../../utils/hooks.esm.js';
|
|
5
5
|
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
6
6
|
import { entityRouteRef } from '@backstage/plugin-catalog-react';
|
|
7
7
|
import { parseEntityRef } from '@backstage/catalog-model';
|
|
@@ -12,6 +12,7 @@ const BackToQuestionsButton = (props) => {
|
|
|
12
12
|
const styles = useStyles();
|
|
13
13
|
const entityRoute = useRouteRef(entityRouteRef);
|
|
14
14
|
const rootRoute = useRouteRef(qetaRouteRef);
|
|
15
|
+
const { t } = useTranslation();
|
|
15
16
|
let to = rootRoute();
|
|
16
17
|
const [searchParams] = useSearchParams();
|
|
17
18
|
const entity = searchParams.get("entity");
|
|
@@ -30,7 +31,7 @@ const BackToQuestionsButton = (props) => {
|
|
|
30
31
|
to,
|
|
31
32
|
startIcon: /* @__PURE__ */ React.createElement(HomeOutlined, null)
|
|
32
33
|
},
|
|
33
|
-
"
|
|
34
|
+
t("backToQuestionsButton.title")
|
|
34
35
|
);
|
|
35
36
|
};
|
|
36
37
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackToQuestionsButton.esm.js","sources":["../../../src/components/Buttons/BackToQuestionsButton.tsx"],"sourcesContent":["import { LinkButton } from '@backstage/core-components';\nimport HomeOutlined from '@material-ui/icons/HomeOutlined';\nimport React from 'react';\nimport { useStyles } from '../../utils/hooks';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { useSearchParams } from 'react-router-dom';\nimport { qetaRouteRef } from '@drodil/backstage-plugin-qeta-react';\n\nexport const BackToQuestionsButton = (props: { entityPage?: boolean }) => {\n const styles = useStyles();\n const entityRoute = useRouteRef(entityRouteRef);\n const rootRoute = useRouteRef(qetaRouteRef);\n\n let to = rootRoute();\n const [searchParams] = useSearchParams();\n const entity = searchParams.get('entity');\n if (entity) {\n const entityRef = parseEntityRef(entity);\n if (props.entityPage) {\n to = `${entityRoute(entityRef)}/qeta`;\n } else {\n to = `${rootRoute()}?entity=${entity}`;\n }\n }\n\n return (\n <LinkButton\n className={`${styles.marginRight} qetaBackToQuestionsBtn`}\n to={to}\n startIcon={<HomeOutlined />}\n >\n
|
|
1
|
+
{"version":3,"file":"BackToQuestionsButton.esm.js","sources":["../../../src/components/Buttons/BackToQuestionsButton.tsx"],"sourcesContent":["import { LinkButton } from '@backstage/core-components';\nimport HomeOutlined from '@material-ui/icons/HomeOutlined';\nimport React from 'react';\nimport { useStyles, useTranslation } from '../../utils/hooks';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { useSearchParams } from 'react-router-dom';\nimport { qetaRouteRef } from '@drodil/backstage-plugin-qeta-react';\n\nexport const BackToQuestionsButton = (props: { entityPage?: boolean }) => {\n const styles = useStyles();\n const entityRoute = useRouteRef(entityRouteRef);\n const rootRoute = useRouteRef(qetaRouteRef);\n const { t } = useTranslation();\n\n let to = rootRoute();\n const [searchParams] = useSearchParams();\n const entity = searchParams.get('entity');\n if (entity) {\n const entityRef = parseEntityRef(entity);\n if (props.entityPage) {\n to = `${entityRoute(entityRef)}/qeta`;\n } else {\n to = `${rootRoute()}?entity=${entity}`;\n }\n }\n\n return (\n <LinkButton\n className={`${styles.marginRight} qetaBackToQuestionsBtn`}\n to={to}\n startIcon={<HomeOutlined />}\n >\n {t('backToQuestionsButton.title')}\n </LinkButton>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAUa,MAAA,qBAAA,GAAwB,CAAC,KAAoC,KAAA;AACxE,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,WAAA,GAAc,YAAY,cAAc,CAAA,CAAA;AAC9C,EAAM,MAAA,SAAA,GAAY,YAAY,YAAY,CAAA,CAAA;AAC1C,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAA,IAAI,KAAK,SAAU,EAAA,CAAA;AACnB,EAAM,MAAA,CAAC,YAAY,CAAA,GAAI,eAAgB,EAAA,CAAA;AACvC,EAAM,MAAA,MAAA,GAAS,YAAa,CAAA,GAAA,CAAI,QAAQ,CAAA,CAAA;AACxC,EAAA,IAAI,MAAQ,EAAA;AACV,IAAM,MAAA,SAAA,GAAY,eAAe,MAAM,CAAA,CAAA;AACvC,IAAA,IAAI,MAAM,UAAY,EAAA;AACpB,MAAK,EAAA,GAAA,CAAA,EAAG,WAAY,CAAA,SAAS,CAAC,CAAA,KAAA,CAAA,CAAA;AAAA,KACzB,MAAA;AACL,MAAA,EAAA,GAAK,CAAG,EAAA,SAAA,EAAW,CAAA,QAAA,EAAW,MAAM,CAAA,CAAA,CAAA;AAAA,KACtC;AAAA,GACF;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,CAAG,EAAA,MAAA,CAAO,WAAW,CAAA,uBAAA,CAAA;AAAA,MAChC,EAAA;AAAA,MACA,SAAA,sCAAY,YAAa,EAAA,IAAA,CAAA;AAAA,KAAA;AAAA,IAExB,EAAE,6BAA6B,CAAA;AAAA,GAClC,CAAA;AAEJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, Typography, Divider } from '@material-ui/core';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { MarkdownContent, Link } from '@backstage/core-components';
|
|
4
|
-
import { useStyles } from '../../utils/hooks.esm.js';
|
|
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';
|
|
@@ -12,6 +12,7 @@ const CommentList = (props) => {
|
|
|
12
12
|
const entity = answer ?? question;
|
|
13
13
|
const styles = useStyles();
|
|
14
14
|
const qetaApi = useApi(qetaApiRef);
|
|
15
|
+
const { t } = useTranslation();
|
|
15
16
|
const deleteComment = (id) => {
|
|
16
17
|
if (answer) {
|
|
17
18
|
qetaApi.deleteAnswerComment(question.id, answer.id, id).then((a) => {
|
|
@@ -37,7 +38,7 @@ const CommentList = (props) => {
|
|
|
37
38
|
className: "qetaCommentDeleteBtn",
|
|
38
39
|
onClick: () => deleteComment(c.id)
|
|
39
40
|
},
|
|
40
|
-
"
|
|
41
|
+
t("commentList.deleteLink")
|
|
41
42
|
))), /* @__PURE__ */ React.createElement(Divider, null));
|
|
42
43
|
}));
|
|
43
44
|
};
|
|
@@ -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, MarkdownContent } from '@backstage/core-components';\nimport { useStyles } from '../../utils/hooks';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { RelativeTimeWithTooltip } from '../RelativeTimeWithTooltip/RelativeTimeWithTooltip';\nimport { AuthorLink } from '../Links/Links';\nimport { qetaApiRef } from '../../api';\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\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 <MarkdownContent\n dialect=\"gfm\"\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
|
|
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, MarkdownContent } 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';\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 <MarkdownContent\n dialect=\"gfm\"\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":";;;;;;;;;AAaa,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,CAAA,qBAAA,CAAsB,SAAS,EAAI,EAAA,EAAE,EACrC,IAAK,CAA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AA,KAAA,CAAA,aAAA,CAAC,aAAQ,CACX,CAAA,CAAA;AAAA,GAEH,CACH,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -5,6 +5,7 @@ import { useForm, Controller } from 'react-hook-form';
|
|
|
5
5
|
import { useAnalytics, useApi } from '@backstage/core-plugin-api';
|
|
6
6
|
import { CommentList } from './CommentList.esm.js';
|
|
7
7
|
import { qetaApiRef } from '../../api/QetaClient.esm.js';
|
|
8
|
+
import { useTranslation } from '../../utils/hooks.esm.js';
|
|
8
9
|
|
|
9
10
|
const CommentSection = (props) => {
|
|
10
11
|
const { answer, question, onCommentPost, onCommentDelete } = props;
|
|
@@ -12,6 +13,7 @@ const CommentSection = (props) => {
|
|
|
12
13
|
const qetaApi = useApi(qetaApiRef);
|
|
13
14
|
const [posting, setPosting] = React.useState(false);
|
|
14
15
|
const [formVisible, setFormVisible] = useState(false);
|
|
16
|
+
const { t } = useTranslation();
|
|
15
17
|
const {
|
|
16
18
|
handleSubmit,
|
|
17
19
|
control,
|
|
@@ -53,7 +55,7 @@ const CommentSection = (props) => {
|
|
|
53
55
|
className: "qetaAddCommentBtn",
|
|
54
56
|
onClick: () => setFormVisible(true)
|
|
55
57
|
},
|
|
56
|
-
"
|
|
58
|
+
t("commentSection.addComment")
|
|
57
59
|
), formVisible && /* @__PURE__ */ React.createElement("form", { onSubmit: handleSubmit(postComment), className: "qetaCommentForm" }, /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 11 }, /* @__PURE__ */ React.createElement(
|
|
58
60
|
Controller,
|
|
59
61
|
{
|
|
@@ -71,7 +73,7 @@ const CommentSection = (props) => {
|
|
|
71
73
|
fullWidth: true,
|
|
72
74
|
className: "qetaCommentInput",
|
|
73
75
|
value,
|
|
74
|
-
placeholder: "
|
|
76
|
+
placeholder: t("commentSection.input.placeholder"),
|
|
75
77
|
onChange,
|
|
76
78
|
variant: "outlined",
|
|
77
79
|
error: "content" in errors
|
|
@@ -89,7 +91,7 @@ const CommentSection = (props) => {
|
|
|
89
91
|
color: "primary",
|
|
90
92
|
disabled: posting
|
|
91
93
|
},
|
|
92
|
-
"
|
|
94
|
+
t("commentSection.post")
|
|
93
95
|
)))));
|
|
94
96
|
};
|
|
95
97
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentSection.esm.js","sources":["../../../src/components/CommentSection/CommentSection.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Box, Button, Grid, TextField } from '@material-ui/core';\nimport { Link } from '@backstage/core-components';\nimport {\n AnswerResponse,\n QuestionResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { Controller, useForm } from 'react-hook-form';\nimport { useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { CommentList } from './CommentList';\nimport { qetaApiRef } from '../../api';\n\nexport const CommentSection = (props: {\n onCommentPost: (question: QuestionResponse, answer?: AnswerResponse) => void;\n onCommentDelete: (\n question: QuestionResponse,\n answer?: AnswerResponse,\n ) => void;\n question: QuestionResponse;\n answer?: AnswerResponse;\n}) => {\n const { answer, question, onCommentPost, onCommentDelete } = props;\n const analytics = useAnalytics();\n const qetaApi = useApi(qetaApiRef);\n const [posting, setPosting] = React.useState(false);\n const [formVisible, setFormVisible] = useState(false);\n const {\n handleSubmit,\n control,\n formState: { errors },\n reset,\n } = useForm<{ content: string }>({});\n\n const postComment = (data: { content: string }) => {\n setPosting(true);\n if (answer) {\n qetaApi.commentAnswer(question.id, answer.id, data.content).then(a => {\n setFormVisible(false);\n analytics.captureEvent('comment', 'answer');\n reset();\n setPosting(false);\n onCommentPost(question, a);\n });\n return;\n }\n\n qetaApi.commentQuestion(question.id, data.content).then(q => {\n setFormVisible(false);\n analytics.captureEvent('comment', 'question');\n reset();\n setPosting(false);\n onCommentPost(q);\n });\n };\n\n return (\n <Box marginLeft={9} className=\"qetaCommentSection\">\n <CommentList\n question={question}\n answer={answer}\n onCommentDelete={onCommentDelete}\n />\n {!formVisible && (\n <Link\n underline=\"none\"\n to=\"#\"\n className=\"qetaAddCommentBtn\"\n onClick={() => setFormVisible(true)}\n >\n
|
|
1
|
+
{"version":3,"file":"CommentSection.esm.js","sources":["../../../src/components/CommentSection/CommentSection.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Box, Button, Grid, TextField } from '@material-ui/core';\nimport { Link } from '@backstage/core-components';\nimport {\n AnswerResponse,\n QuestionResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { Controller, useForm } from 'react-hook-form';\nimport { useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { CommentList } from './CommentList';\nimport { qetaApiRef } from '../../api';\nimport { useTranslation } from '../../utils/hooks';\n\nexport const CommentSection = (props: {\n onCommentPost: (question: QuestionResponse, answer?: AnswerResponse) => void;\n onCommentDelete: (\n question: QuestionResponse,\n answer?: AnswerResponse,\n ) => void;\n question: QuestionResponse;\n answer?: AnswerResponse;\n}) => {\n const { answer, question, onCommentPost, onCommentDelete } = props;\n const analytics = useAnalytics();\n const qetaApi = useApi(qetaApiRef);\n const [posting, setPosting] = React.useState(false);\n const [formVisible, setFormVisible] = useState(false);\n const { t } = useTranslation();\n const {\n handleSubmit,\n control,\n formState: { errors },\n reset,\n } = useForm<{ content: string }>({});\n\n const postComment = (data: { content: string }) => {\n setPosting(true);\n if (answer) {\n qetaApi.commentAnswer(question.id, answer.id, data.content).then(a => {\n setFormVisible(false);\n analytics.captureEvent('comment', 'answer');\n reset();\n setPosting(false);\n onCommentPost(question, a);\n });\n return;\n }\n\n qetaApi.commentQuestion(question.id, data.content).then(q => {\n setFormVisible(false);\n analytics.captureEvent('comment', 'question');\n reset();\n setPosting(false);\n onCommentPost(q);\n });\n };\n\n return (\n <Box marginLeft={9} className=\"qetaCommentSection\">\n <CommentList\n question={question}\n answer={answer}\n onCommentDelete={onCommentDelete}\n />\n {!formVisible && (\n <Link\n underline=\"none\"\n to=\"#\"\n className=\"qetaAddCommentBtn\"\n onClick={() => setFormVisible(true)}\n >\n {t('commentSection.addComment')}\n </Link>\n )}\n {formVisible && (\n <form onSubmit={handleSubmit(postComment)} className=\"qetaCommentForm\">\n <Grid container>\n <Grid item xs={11}>\n <Controller\n control={control}\n defaultValue=\"\"\n rules={{\n required: true,\n }}\n render={({ field: { onChange, value } }) => (\n <TextField\n id=\"comment\"\n multiline\n minRows={2}\n fullWidth\n className=\"qetaCommentInput\"\n value={value}\n placeholder={t('commentSection.input.placeholder')}\n onChange={onChange}\n variant=\"outlined\"\n error={'content' in errors}\n />\n )}\n name=\"content\"\n />\n </Grid>\n <Grid item xs={1}>\n <Button\n variant=\"contained\"\n size=\"small\"\n className=\"qetaCommentBtn\"\n type=\"submit\"\n color=\"primary\"\n disabled={posting}\n >\n {t('commentSection.post')}\n </Button>\n </Grid>\n </Grid>\n </form>\n )}\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAaa,MAAA,cAAA,GAAiB,CAAC,KAQzB,KAAA;AACJ,EAAA,MAAM,EAAE,MAAA,EAAQ,QAAU,EAAA,aAAA,EAAe,iBAAoB,GAAA,KAAA,CAAA;AAC7D,EAAA,MAAM,YAAY,YAAa,EAAA,CAAA;AAC/B,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA,CAAA;AACjC,EAAA,MAAM,CAAC,OAAS,EAAA,UAAU,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA,CAAA;AAClD,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AACpD,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAM,MAAA;AAAA,IACJ,YAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA,EAAW,EAAE,MAAO,EAAA;AAAA,IACpB,KAAA;AAAA,GACF,GAAI,OAA6B,CAAA,EAAE,CAAA,CAAA;AAEnC,EAAM,MAAA,WAAA,GAAc,CAAC,IAA8B,KAAA;AACjD,IAAA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,gBAAA;AAAA,MACV,IAAK,EAAA,QAAA;AAAA,MACL,KAAM,EAAA,SAAA;AAAA,MACN,QAAU,EAAA,OAAA;AAAA,KAAA;AAAA,IAET,EAAE,qBAAqB,CAAA;AAAA,GAE5B,CACF,CACF,CAEJ,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -2,7 +2,7 @@ import { Modal, Backdrop, Box, Typography, Button } from '@material-ui/core';
|
|
|
2
2
|
import { Alert } from '@material-ui/lab';
|
|
3
3
|
import DeleteIcon from '@material-ui/icons/Delete';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { useBasePath, useStyles } from '../../utils/hooks.esm.js';
|
|
5
|
+
import { useBasePath, useStyles, useTranslation } from '../../utils/hooks.esm.js';
|
|
6
6
|
import { useApi } from '@backstage/core-plugin-api';
|
|
7
7
|
import { useNavigate } from 'react-router-dom';
|
|
8
8
|
import { qetaApiRef } from '../../api/QetaClient.esm.js';
|
|
@@ -14,8 +14,9 @@ const DeleteModal = (props) => {
|
|
|
14
14
|
const { entity, open, question, onClose } = props;
|
|
15
15
|
const styles = useStyles();
|
|
16
16
|
const [error, setError] = React.useState(false);
|
|
17
|
+
const { t } = useTranslation();
|
|
17
18
|
const isQuestion = "title" in entity;
|
|
18
|
-
const title = isQuestion ? "
|
|
19
|
+
const title = isQuestion ? t("deleteModal.title.question") : t("deleteModal.title.answer");
|
|
19
20
|
const handleDelete = () => {
|
|
20
21
|
if (isQuestion) {
|
|
21
22
|
qetaApi.deleteQuestion(entity.id).catch((_) => setError(true)).then((ret) => {
|
|
@@ -51,7 +52,7 @@ const DeleteModal = (props) => {
|
|
|
51
52
|
timeout: 500
|
|
52
53
|
}
|
|
53
54
|
},
|
|
54
|
-
/* @__PURE__ */ React.createElement(Box, { className: `qetaDeleteModalContent ${styles.deleteModal}` }, error && /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, "
|
|
55
|
+
/* @__PURE__ */ React.createElement(Box, { className: `qetaDeleteModalContent ${styles.deleteModal}` }, error && /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, t("deleteModal.errorDeleting")), /* @__PURE__ */ React.createElement(
|
|
55
56
|
Typography,
|
|
56
57
|
{
|
|
57
58
|
id: "modal-modal-title",
|
|
@@ -68,8 +69,8 @@ const DeleteModal = (props) => {
|
|
|
68
69
|
startIcon: /* @__PURE__ */ React.createElement(DeleteIcon, null),
|
|
69
70
|
color: "secondary"
|
|
70
71
|
},
|
|
71
|
-
"
|
|
72
|
-
), /* @__PURE__ */ React.createElement(Button, { onClick: onClose, className: "qetaDeleteModalCancelBtn" }, "
|
|
72
|
+
t("deleteModal.deleteButton")
|
|
73
|
+
), /* @__PURE__ */ React.createElement(Button, { onClick: onClose, className: "qetaDeleteModalCancelBtn" }, t("deleteModal.cancelButton")))
|
|
73
74
|
);
|
|
74
75
|
};
|
|
75
76
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteModal.esm.js","sources":["../../../src/components/DeleteModal/DeleteModal.tsx"],"sourcesContent":["import {\n AnswerResponse,\n QuestionResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { Backdrop, Box, Button, Modal, Typography } from '@material-ui/core';\nimport { Alert } from '@material-ui/lab';\nimport Delete from '@material-ui/icons/Delete';\nimport React from 'react';\nimport { useBasePath, useStyles } from '../../utils/hooks';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { useNavigate } from 'react-router-dom';\nimport { qetaApiRef } from '../../api';\n\nexport const DeleteModal = (props: {\n entity: QuestionResponse | AnswerResponse;\n open: boolean;\n onClose: () => void;\n question?: QuestionResponse;\n}) => {\n const qetaApi = useApi(qetaApiRef);\n const base_path = useBasePath();\n const navigate = useNavigate();\n const { entity, open, question, onClose } = props;\n const styles = useStyles();\n const [error, setError] = React.useState(false);\n const isQuestion = 'title' in entity;\n\n const title = isQuestion\n ? '
|
|
1
|
+
{"version":3,"file":"DeleteModal.esm.js","sources":["../../../src/components/DeleteModal/DeleteModal.tsx"],"sourcesContent":["import {\n AnswerResponse,\n QuestionResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport { Backdrop, Box, Button, Modal, Typography } from '@material-ui/core';\nimport { Alert } from '@material-ui/lab';\nimport Delete from '@material-ui/icons/Delete';\nimport React from 'react';\nimport { useBasePath, useStyles, useTranslation } from '../../utils/hooks';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { useNavigate } from 'react-router-dom';\nimport { qetaApiRef } from '../../api';\n\nexport const DeleteModal = (props: {\n entity: QuestionResponse | AnswerResponse;\n open: boolean;\n onClose: () => void;\n question?: QuestionResponse;\n}) => {\n const qetaApi = useApi(qetaApiRef);\n const base_path = useBasePath();\n const navigate = useNavigate();\n const { entity, open, question, onClose } = props;\n const styles = useStyles();\n const [error, setError] = React.useState(false);\n const { t } = useTranslation();\n const isQuestion = 'title' in entity;\n\n const title = isQuestion\n ? t('deleteModal.title.question')\n : t('deleteModal.title.answer');\n\n const handleDelete = () => {\n if (isQuestion) {\n qetaApi\n .deleteQuestion(entity.id)\n .catch(_ => setError(true))\n .then(ret => {\n if (ret) {\n onClose();\n navigate(`${base_path}/qeta`);\n } else {\n setError(true);\n }\n });\n } else if (question) {\n qetaApi\n .deleteAnswer(question.id, entity.id)\n .catch(_ => setError(true))\n .then(ret => {\n if (ret) {\n onClose();\n window.location.reload();\n } else {\n setError(true);\n }\n });\n }\n };\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n className=\"qetaDeleteModal\"\n aria-labelledby=\"modal-modal-title\"\n aria-describedby=\"modal-modal-description\"\n closeAfterTransition\n BackdropComponent={Backdrop}\n BackdropProps={{\n timeout: 500,\n }}\n >\n <Box className={`qetaDeleteModalContent ${styles.deleteModal}`}>\n {error && (\n <Alert severity=\"error\">{t('deleteModal.errorDeleting')}</Alert>\n )}\n <Typography\n id=\"modal-modal-title\"\n className=\"qetaDeleteModalTitle\"\n variant=\"h6\"\n component=\"h2\"\n >\n {title}\n </Typography>\n <Button\n onClick={handleDelete}\n className=\"qetaDeleteModalDeleteBtn\"\n startIcon={<Delete />}\n color=\"secondary\"\n >\n {t('deleteModal.deleteButton')}\n </Button>\n <Button onClick={onClose} className=\"qetaDeleteModalCancelBtn\">\n {t('deleteModal.cancelButton')}\n </Button>\n </Box>\n </Modal>\n );\n};\n"],"names":["Delete"],"mappings":";;;;;;;;;AAaa,MAAA,WAAA,GAAc,CAAC,KAKtB,KAAA;AACJ,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA,CAAA;AACjC,EAAA,MAAM,YAAY,WAAY,EAAA,CAAA;AAC9B,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,MAAA,EAAQ,IAAM,EAAA,QAAA,EAAU,SAAY,GAAA,KAAA,CAAA;AAC5C,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAA,MAAM,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA,CAAA;AAC9C,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAA,MAAM,aAAa,OAAW,IAAA,MAAA,CAAA;AAE9B,EAAA,MAAM,QAAQ,UACV,GAAA,CAAA,CAAE,4BAA4B,CAAA,GAC9B,EAAE,0BAA0B,CAAA,CAAA;AAEhC,EAAA,MAAM,eAAe,MAAM;AACzB,IAAA,IAAI,UAAY,EAAA;AACd,MACG,OAAA,CAAA,cAAA,CAAe,MAAO,CAAA,EAAE,CACxB,CAAA,KAAA,CAAM,CAAK,CAAA,KAAA,QAAA,CAAS,IAAI,CAAC,CACzB,CAAA,IAAA,CAAK,CAAO,GAAA,KAAA;AACX,QAAA,IAAI,GAAK,EAAA;AACP,UAAQ,OAAA,EAAA,CAAA;AACR,UAAS,QAAA,CAAA,CAAA,EAAG,SAAS,CAAO,KAAA,CAAA,CAAA,CAAA;AAAA,SACvB,MAAA;AACL,UAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AAAA,SAC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EH,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA,YAAA;AAAA,QACT,SAAU,EAAA,0BAAA;AAAA,QACV,SAAA,sCAAYA,UAAO,EAAA,IAAA,CAAA;AAAA,QACnB,KAAM,EAAA,WAAA;AAAA,OAAA;AAAA,MAEL,EAAE,0BAA0B,CAAA;AAAA,KAC/B,kBACC,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,OAAS,EAAA,OAAA,EAAS,WAAU,0BACjC,EAAA,EAAA,CAAA,CAAE,0BAA0B,CAC/B,CACF,CAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
|
|
@@ -4,9 +4,11 @@ import { QuestionsContainer } from '../QuestionsContainer/QuestionsContainer.esm
|
|
|
4
4
|
import { AskQuestionButton } from '../Buttons/AskQuestionButton.esm.js';
|
|
5
5
|
import { Container } from '@material-ui/core';
|
|
6
6
|
import { BackToQuestionsButton } from '../Buttons/BackToQuestionsButton.esm.js';
|
|
7
|
+
import { useTranslation } from '../../utils/hooks.esm.js';
|
|
7
8
|
|
|
8
9
|
const FavoritePage = () => {
|
|
9
|
-
|
|
10
|
+
const { t } = useTranslation();
|
|
11
|
+
return /* @__PURE__ */ React.createElement(Content, { className: "qetaFavoritePage" }, /* @__PURE__ */ React.createElement(Container, { maxWidth: "lg" }, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("favoritePage.title") }, /* @__PURE__ */ React.createElement(BackToQuestionsButton, null), /* @__PURE__ */ React.createElement(AskQuestionButton, null)), /* @__PURE__ */ React.createElement(QuestionsContainer, { favorite: true })));
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export { FavoritePage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePage.esm.js","sources":["../../../src/components/FavoritePage/FavoritePage.tsx"],"sourcesContent":["import React from 'react';\nimport { Content, ContentHeader } from '@backstage/core-components';\nimport { QuestionsContainer } from '../QuestionsContainer
|
|
1
|
+
{"version":3,"file":"FavoritePage.esm.js","sources":["../../../src/components/FavoritePage/FavoritePage.tsx"],"sourcesContent":["import React from 'react';\nimport { Content, ContentHeader } from '@backstage/core-components';\nimport { QuestionsContainer } from '../QuestionsContainer';\nimport { AskQuestionButton } from '../Buttons/AskQuestionButton';\nimport { Container } from '@material-ui/core';\nimport { BackToQuestionsButton } from '../Buttons/BackToQuestionsButton';\nimport { useTranslation } from '../../utils/hooks';\n\nexport const FavoritePage = () => {\n const { t } = useTranslation();\n return (\n <Content className=\"qetaFavoritePage\">\n <Container maxWidth=\"lg\">\n <ContentHeader title={t('favoritePage.title')}>\n <BackToQuestionsButton />\n <AskQuestionButton />\n </ContentHeader>\n <QuestionsContainer favorite />\n </Container>\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAQO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,SAAA,EAAU,kBACjB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAU,EAAA,EAAA,QAAA,EAAS,IAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,KAAA,EAAO,CAAE,CAAA,oBAAoB,qBACzC,KAAA,CAAA,aAAA,CAAA,qBAAA,EAAA,IAAsB,CACvB,kBAAA,KAAA,CAAA,aAAA,CAAC,iBAAkB,EAAA,IAAA,CACrB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,kBAAmB,EAAA,EAAA,QAAA,EAAQ,IAAC,EAAA,CAC/B,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -9,7 +9,7 @@ import { TagPage } from '../TagPage/TagPage.esm.js';
|
|
|
9
9
|
import { UserPage } from '../UserPage/UserPage.esm.js';
|
|
10
10
|
import LoyaltyOutlined from '@material-ui/icons/LoyaltyOutlined';
|
|
11
11
|
import { QuestionHighlightList } from '../QuestionHighlightList/QuestionHighlightList.esm.js';
|
|
12
|
-
import { useStyles, useIdentityApi } from '../../utils/hooks.esm.js';
|
|
12
|
+
import { useTranslation, useStyles, useIdentityApi } from '../../utils/hooks.esm.js';
|
|
13
13
|
import Whatshot from '@material-ui/icons/Whatshot';
|
|
14
14
|
import MoreVertIcon from '@material-ui/icons/MoreVert';
|
|
15
15
|
import StarIcon from '@material-ui/icons/Star';
|
|
@@ -32,6 +32,7 @@ const MoreMenu = () => {
|
|
|
32
32
|
const userRoute = useRouteRef(userRouteRef);
|
|
33
33
|
const open = Boolean(anchorEl);
|
|
34
34
|
const styles = useStyles();
|
|
35
|
+
const { t } = useTranslation();
|
|
35
36
|
const {
|
|
36
37
|
value: user,
|
|
37
38
|
loading: loadingUser,
|
|
@@ -43,7 +44,7 @@ const MoreMenu = () => {
|
|
|
43
44
|
const handleMenuClose = () => {
|
|
44
45
|
setAnchorEl(null);
|
|
45
46
|
};
|
|
46
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Tooltip, { arrow: true, title: "
|
|
47
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Tooltip, { arrow: true, title: t("homePage.moreMenu.title") }, /* @__PURE__ */ React.createElement(
|
|
47
48
|
IconButton,
|
|
48
49
|
{
|
|
49
50
|
"aria-label": "more",
|
|
@@ -70,10 +71,10 @@ const MoreMenu = () => {
|
|
|
70
71
|
},
|
|
71
72
|
onClose: handleMenuClose
|
|
72
73
|
},
|
|
73
|
-
user && !loadingUser && !userError && /* @__PURE__ */ React.createElement(MenuItem, { component: "a", href: `${userRoute()}/${user.userEntityRef}` }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(AccountBox, { fontSize: "small" })), "
|
|
74
|
-
/* @__PURE__ */ React.createElement(MenuItem, { component: "a", href: tagsRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(LoyaltyOutlined, { fontSize: "small" })), "
|
|
75
|
-
/* @__PURE__ */ React.createElement(MenuItem, { component: "a", href: favoritesRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(StarIcon, { fontSize: "small" })), "
|
|
76
|
-
/* @__PURE__ */ React.createElement(MenuItem, { component: "a", href: statisticsRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(TrophyIcon, null)), "
|
|
74
|
+
user && !loadingUser && !userError && /* @__PURE__ */ React.createElement(MenuItem, { component: "a", href: `${userRoute()}/${user.userEntityRef}` }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(AccountBox, { fontSize: "small" })), t("homePage.moreMenu.profile")),
|
|
75
|
+
/* @__PURE__ */ React.createElement(MenuItem, { component: "a", href: tagsRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(LoyaltyOutlined, { fontSize: "small" })), t("homePage.moreMenu.tags")),
|
|
76
|
+
/* @__PURE__ */ React.createElement(MenuItem, { component: "a", href: favoritesRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(StarIcon, { fontSize: "small" })), t("homePage.moreMenu.favoriteQuestions")),
|
|
77
|
+
/* @__PURE__ */ React.createElement(MenuItem, { component: "a", href: statisticsRoute() }, /* @__PURE__ */ React.createElement(ListItemIcon, { className: styles.menuIcon }, /* @__PURE__ */ React.createElement(TrophyIcon, null)), t("homePage.moreMenu.statistics"))
|
|
77
78
|
));
|
|
78
79
|
};
|
|
79
80
|
const HomePageContent = () => {
|
|
@@ -82,31 +83,36 @@ const HomePageContent = () => {
|
|
|
82
83
|
void 0
|
|
83
84
|
);
|
|
84
85
|
const [tags, setTags] = React.useState(void 0);
|
|
86
|
+
const { t } = useTranslation();
|
|
85
87
|
useEffect(() => {
|
|
86
88
|
setEntityRef(searchParams.get("entity") ?? void 0);
|
|
87
89
|
setTags(filterTags(searchParams.get("tags")));
|
|
88
90
|
}, [searchParams, setEntityRef]);
|
|
89
|
-
return /* @__PURE__ */ React.createElement(Content, { className: "qetaHomePage" }, /* @__PURE__ */ React.createElement(Container, { maxWidth: "lg" }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, lg: 9, xl: 10 }, /* @__PURE__ */ React.createElement(ContentHeader, { title: "
|
|
91
|
+
return /* @__PURE__ */ React.createElement(Content, { className: "qetaHomePage" }, /* @__PURE__ */ React.createElement(Container, { maxWidth: "lg" }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, lg: 9, xl: 10 }, /* @__PURE__ */ React.createElement(ContentHeader, { title: t("homePage.title") }, /* @__PURE__ */ React.createElement(MoreMenu, null), /* @__PURE__ */ React.createElement(AskQuestionButton, { entity: entityRef, tags })), /* @__PURE__ */ React.createElement(QuestionsContainer, { entity: entityRef, tags })), /* @__PURE__ */ React.createElement(Grid, { item: true, lg: 3, xl: 2 }, /* @__PURE__ */ React.createElement(
|
|
90
92
|
QuestionHighlightList,
|
|
91
93
|
{
|
|
92
94
|
type: "hot",
|
|
93
|
-
title: "
|
|
94
|
-
noQuestionsLabel: "
|
|
95
|
+
title: t("homePage.highlights.hot.title"),
|
|
96
|
+
noQuestionsLabel: t("homePage.highlights.hot.noQuestionsLabel"),
|
|
95
97
|
icon: /* @__PURE__ */ React.createElement(Whatshot, { fontSize: "small" })
|
|
96
98
|
}
|
|
97
99
|
), /* @__PURE__ */ React.createElement(
|
|
98
100
|
QuestionHighlightList,
|
|
99
101
|
{
|
|
100
102
|
type: "unanswered",
|
|
101
|
-
title: "
|
|
102
|
-
noQuestionsLabel:
|
|
103
|
+
title: t("homePage.highlights.unanswered.title"),
|
|
104
|
+
noQuestionsLabel: t(
|
|
105
|
+
"homePage.highlights.unanswered.noQuestionsLabel"
|
|
106
|
+
)
|
|
103
107
|
}
|
|
104
108
|
), /* @__PURE__ */ React.createElement(
|
|
105
109
|
QuestionHighlightList,
|
|
106
110
|
{
|
|
107
111
|
type: "incorrect",
|
|
108
|
-
title: "
|
|
109
|
-
noQuestionsLabel:
|
|
112
|
+
title: t("homePage.highlights.incorrect.title"),
|
|
113
|
+
noQuestionsLabel: t(
|
|
114
|
+
"homePage.highlights.incorrect.noQuestionsLabel"
|
|
115
|
+
)
|
|
110
116
|
}
|
|
111
117
|
)))));
|
|
112
118
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomePage.esm.js","sources":["../../../src/components/HomePage/HomePage.tsx"],"sourcesContent":["import React, { ReactNode, useEffect } from 'react';\nimport {\n Container,\n Grid,\n IconButton,\n ListItemIcon,\n Menu,\n MenuItem,\n Tooltip,\n} from '@material-ui/core';\nimport {\n Content,\n ContentHeader,\n Header,\n Page,\n} from '@backstage/core-components';\nimport { Route, Routes, useSearchParams } from 'react-router-dom';\nimport { AskPage } from '../AskPage';\nimport { QuestionPage } from '../QuestionPage/QuestionPage';\nimport { QuestionsContainer } from '../QuestionsContainer/QuestionsContainer';\nimport { TagPage } from '../TagPage/TagPage';\nimport { UserPage } from '../UserPage/UserPage';\nimport LoyaltyOutlined from '@material-ui/icons/LoyaltyOutlined';\nimport { QuestionHighlightList } from '../QuestionHighlightList/QuestionHighlightList';\nimport { useIdentityApi, useStyles } from '../../utils/hooks';\nimport Whatshot from '@material-ui/icons/Whatshot';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport StarIcon from '@material-ui/icons/Star';\nimport { FavoritePage } from '../FavoritePage/FavoritePage';\nimport { AskQuestionButton } from '../Buttons/AskQuestionButton';\nimport { StatisticsPage, TrophyIcon } from '../Statistics';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport {\n askRouteRef,\n editQuestionRouteRef,\n favoriteQuestionsRouteRef,\n questionRouteRef,\n statisticsRouteRef,\n tagRouteRef,\n tagsRouteRef,\n userRouteRef,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\nimport AccountBox from '@material-ui/icons/AccountBox';\n\nconst MoreMenu = () => {\n const [anchorEl, setAnchorEl] = React.useState(null);\n const tagsRoute = useRouteRef(tagsRouteRef);\n const favoritesRoute = useRouteRef(favoriteQuestionsRouteRef);\n const statisticsRoute = useRouteRef(statisticsRouteRef);\n const userRoute = useRouteRef(userRouteRef);\n const open = Boolean(anchorEl);\n const styles = useStyles();\n const {\n value: user,\n loading: loadingUser,\n error: userError,\n } = useIdentityApi(api => api.getBackstageIdentity(), []);\n\n const handleMenuOpen = (event: any) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleMenuClose = () => {\n setAnchorEl(null);\n };\n\n return (\n <>\n <Tooltip arrow title=\"More\">\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={handleMenuOpen}\n >\n <MoreVertIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"long-menu\"\n anchorEl={anchorEl}\n keepMounted\n open={open}\n getContentAnchorEl={null}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'center',\n }}\n onClose={handleMenuClose}\n >\n {user && !loadingUser && !userError && (\n <MenuItem component=\"a\" href={`${userRoute()}/${user.userEntityRef}`}>\n <ListItemIcon className={styles.menuIcon}>\n <AccountBox fontSize=\"small\" />\n </ListItemIcon>\n Profile\n </MenuItem>\n )}\n <MenuItem component=\"a\" href={tagsRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <LoyaltyOutlined fontSize=\"small\" />\n </ListItemIcon>\n Tags\n </MenuItem>\n <MenuItem component=\"a\" href={favoritesRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <StarIcon fontSize=\"small\" />\n </ListItemIcon>\n Favorite questions\n </MenuItem>\n <MenuItem component=\"a\" href={statisticsRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <TrophyIcon />\n </ListItemIcon>\n Statistics\n </MenuItem>\n </Menu>\n </>\n );\n};\n\nexport const HomePageContent = () => {\n const [searchParams] = useSearchParams();\n const [entityRef, setEntityRef] = React.useState<string | undefined>(\n undefined,\n );\n const [tags, setTags] = React.useState<string[] | undefined>(undefined);\n useEffect(() => {\n setEntityRef(searchParams.get('entity') ?? undefined);\n setTags(filterTags(searchParams.get('tags')));\n }, [searchParams, setEntityRef]);\n\n return (\n <Content className=\"qetaHomePage\">\n <Container maxWidth=\"lg\">\n <Grid container spacing={3}>\n <Grid item xs={12} lg={9} xl={10}>\n <ContentHeader title=\"All questions\">\n <MoreMenu />\n <AskQuestionButton entity={entityRef} tags={tags} />\n </ContentHeader>\n <QuestionsContainer entity={entityRef} tags={tags} />\n </Grid>\n <Grid item lg={3} xl={2}>\n <QuestionHighlightList\n type=\"hot\"\n title=\"Hot questions\"\n noQuestionsLabel=\"No questions\"\n icon={<Whatshot fontSize=\"small\" />}\n />\n <QuestionHighlightList\n type=\"unanswered\"\n title=\"Unanswered questions\"\n noQuestionsLabel=\"No unanswered questions\"\n />\n <QuestionHighlightList\n type=\"incorrect\"\n title=\"Questions without correct answer\"\n noQuestionsLabel=\"No questions without correct answers\"\n />\n </Grid>\n </Grid>\n </Container>\n </Content>\n );\n};\n\ntype Props = {\n title?: string;\n subtitle?: string;\n headerElements?: ReactNode[];\n themeId?: string;\n headerTooltip?: string;\n headerType?: string;\n headerTypeLink?: string;\n};\n\nexport const HomePage = (props?: Props) => {\n const {\n title = 'Q&A',\n subtitle,\n headerElements,\n themeId = 'tool',\n headerTooltip,\n headerType,\n headerTypeLink,\n } = props ?? {};\n\n return (\n <Page themeId={themeId}>\n <Header\n title={title}\n subtitle={subtitle}\n type={headerType}\n typeLink={headerTypeLink}\n tooltip={headerTooltip}\n >\n {headerElements}\n </Header>\n <Routes>\n <Route path=\"/\" element={<HomePageContent />} />\n <Route path={askRouteRef.path} element={<AskPage />} />\n <Route\n path={favoriteQuestionsRouteRef.path}\n element={<FavoritePage />}\n />\n <Route path={editQuestionRouteRef.path} element={<AskPage />} />\n <Route path={questionRouteRef.path} element={<QuestionPage />} />\n <Route path={tagsRouteRef.path} element={<TagPage />} />\n <Route path={tagRouteRef.path} element={<TagPage />} />\n <Route path={userRouteRef.path} element={<UserPage />} />\n <Route path={statisticsRouteRef.path} element={<StatisticsPage />} />\n </Routes>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,WAAW,MAAM;AACrB,EAAA,MAAM,CAAC,QAAU,EAAA,WAAW,CAAI,GAAA,KAAA,CAAM,SAAS,IAAI,CAAA,CAAA;AACnD,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,IAAA,GAAO,QAAQ,QAAQ,CAAA,CAAA;AAC7B,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,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,EAAM,MAAA,cAAA,GAAiB,CAAC,KAAe,KAAA;AACrC,IAAA,WAAA,CAAY,MAAM,aAAa,CAAA,CAAA;AAAA,GACjC,CAAA;AAEA,EAAA,MAAM,kBAAkB,MAAM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YAAa,EAAA,IAAA,CAAA;AAAA,KAAA;AAAA,GAEzB,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,oBAAqB,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,IAAA,CAAA,EAAI,CAC9D,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,gBAAiB,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,IAAA,CAAA,EAAI,CAC/D,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,YAAa,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,IAAA,CAAA,EAAI,CACtD,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,WAAY,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,IAAA,CAAA,EAAI,CACrD,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,YAAa,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,IAAA,CAAA,EAAI,CACvD,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,kBAAmB,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,IAAA,CAAA,EAAI,CACrE,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"HomePage.esm.js","sources":["../../../src/components/HomePage/HomePage.tsx"],"sourcesContent":["import React, { ReactNode, useEffect } from 'react';\nimport {\n Container,\n Grid,\n IconButton,\n ListItemIcon,\n Menu,\n MenuItem,\n Tooltip,\n} from '@material-ui/core';\nimport {\n Content,\n ContentHeader,\n Header,\n Page,\n} from '@backstage/core-components';\nimport { Route, Routes, useSearchParams } from 'react-router-dom';\nimport { AskPage } from '../AskPage';\nimport { QuestionPage } from '../QuestionPage/QuestionPage';\nimport { QuestionsContainer } from '../QuestionsContainer/QuestionsContainer';\nimport { TagPage } from '../TagPage/TagPage';\nimport { UserPage } from '../UserPage/UserPage';\nimport LoyaltyOutlined from '@material-ui/icons/LoyaltyOutlined';\nimport { QuestionHighlightList } from '../QuestionHighlightList/QuestionHighlightList';\nimport { useIdentityApi, useStyles, useTranslation } from '../../utils/hooks';\nimport Whatshot from '@material-ui/icons/Whatshot';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport StarIcon from '@material-ui/icons/Star';\nimport { FavoritePage } from '../FavoritePage/FavoritePage';\nimport { AskQuestionButton } from '../Buttons/AskQuestionButton';\nimport { StatisticsPage, TrophyIcon } from '../Statistics';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport {\n askRouteRef,\n editQuestionRouteRef,\n favoriteQuestionsRouteRef,\n questionRouteRef,\n statisticsRouteRef,\n tagRouteRef,\n tagsRouteRef,\n userRouteRef,\n} from '@drodil/backstage-plugin-qeta-react';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\nimport AccountBox from '@material-ui/icons/AccountBox';\n\nconst MoreMenu = () => {\n const [anchorEl, setAnchorEl] = React.useState(null);\n const tagsRoute = useRouteRef(tagsRouteRef);\n const favoritesRoute = useRouteRef(favoriteQuestionsRouteRef);\n const statisticsRoute = useRouteRef(statisticsRouteRef);\n const userRoute = useRouteRef(userRouteRef);\n const open = Boolean(anchorEl);\n const styles = useStyles();\n const { t } = useTranslation();\n const {\n value: user,\n loading: loadingUser,\n error: userError,\n } = useIdentityApi(api => api.getBackstageIdentity(), []);\n\n const handleMenuOpen = (event: any) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleMenuClose = () => {\n setAnchorEl(null);\n };\n\n return (\n <>\n <Tooltip arrow title={t('homePage.moreMenu.title')}>\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={handleMenuOpen}\n >\n <MoreVertIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"long-menu\"\n anchorEl={anchorEl}\n keepMounted\n open={open}\n getContentAnchorEl={null}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'center',\n }}\n onClose={handleMenuClose}\n >\n {user && !loadingUser && !userError && (\n <MenuItem component=\"a\" href={`${userRoute()}/${user.userEntityRef}`}>\n <ListItemIcon className={styles.menuIcon}>\n <AccountBox fontSize=\"small\" />\n </ListItemIcon>\n {t('homePage.moreMenu.profile')}\n </MenuItem>\n )}\n <MenuItem component=\"a\" href={tagsRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <LoyaltyOutlined fontSize=\"small\" />\n </ListItemIcon>\n {t('homePage.moreMenu.tags')}\n </MenuItem>\n <MenuItem component=\"a\" href={favoritesRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <StarIcon fontSize=\"small\" />\n </ListItemIcon>\n {t('homePage.moreMenu.favoriteQuestions')}\n </MenuItem>\n <MenuItem component=\"a\" href={statisticsRoute()}>\n <ListItemIcon className={styles.menuIcon}>\n <TrophyIcon />\n </ListItemIcon>\n {t('homePage.moreMenu.statistics')}\n </MenuItem>\n </Menu>\n </>\n );\n};\n\nexport const HomePageContent = () => {\n const [searchParams] = useSearchParams();\n const [entityRef, setEntityRef] = React.useState<string | undefined>(\n undefined,\n );\n const [tags, setTags] = React.useState<string[] | undefined>(undefined);\n const { t } = useTranslation();\n useEffect(() => {\n setEntityRef(searchParams.get('entity') ?? undefined);\n setTags(filterTags(searchParams.get('tags')));\n }, [searchParams, setEntityRef]);\n\n return (\n <Content className=\"qetaHomePage\">\n <Container maxWidth=\"lg\">\n <Grid container spacing={3}>\n <Grid item xs={12} lg={9} xl={10}>\n <ContentHeader title={t('homePage.title')}>\n <MoreMenu />\n <AskQuestionButton entity={entityRef} tags={tags} />\n </ContentHeader>\n <QuestionsContainer entity={entityRef} tags={tags} />\n </Grid>\n <Grid item lg={3} xl={2}>\n <QuestionHighlightList\n type=\"hot\"\n title={t('homePage.highlights.hot.title')}\n noQuestionsLabel={t('homePage.highlights.hot.noQuestionsLabel')}\n icon={<Whatshot fontSize=\"small\" />}\n />\n <QuestionHighlightList\n type=\"unanswered\"\n title={t('homePage.highlights.unanswered.title')}\n noQuestionsLabel={t(\n 'homePage.highlights.unanswered.noQuestionsLabel',\n )}\n />\n <QuestionHighlightList\n type=\"incorrect\"\n title={t('homePage.highlights.incorrect.title')}\n noQuestionsLabel={t(\n 'homePage.highlights.incorrect.noQuestionsLabel',\n )}\n />\n </Grid>\n </Grid>\n </Container>\n </Content>\n );\n};\n\ntype Props = {\n title?: string;\n subtitle?: string;\n headerElements?: ReactNode[];\n themeId?: string;\n headerTooltip?: string;\n headerType?: string;\n headerTypeLink?: string;\n};\n\nexport const HomePage = (props?: Props) => {\n const {\n title = 'Q&A',\n subtitle,\n headerElements,\n themeId = 'tool',\n headerTooltip,\n headerType,\n headerTypeLink,\n } = props ?? {};\n\n return (\n <Page themeId={themeId}>\n <Header\n title={title}\n subtitle={subtitle}\n type={headerType}\n typeLink={headerTypeLink}\n tooltip={headerTooltip}\n >\n {headerElements}\n </Header>\n <Routes>\n <Route path=\"/\" element={<HomePageContent />} />\n <Route path={askRouteRef.path} element={<AskPage />} />\n <Route\n path={favoriteQuestionsRouteRef.path}\n element={<FavoritePage />}\n />\n <Route path={editQuestionRouteRef.path} element={<AskPage />} />\n <Route path={questionRouteRef.path} element={<QuestionPage />} />\n <Route path={tagsRouteRef.path} element={<TagPage />} />\n <Route path={tagRouteRef.path} element={<TagPage />} />\n <Route path={userRouteRef.path} element={<UserPage />} />\n <Route path={statisticsRouteRef.path} element={<StatisticsPage />} />\n </Routes>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;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AAA,GAEzB,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,oBAAqB,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,IAAA,CAAA,EAAI,CAC9D,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,gBAAiB,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,IAAA,CAAA,EAAI,CAC/D,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,YAAa,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,IAAA,CAAA,EAAI,CACtD,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,WAAY,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,IAAA,CAAA,EAAI,CACrD,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,YAAa,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,IAAA,CAAA,EAAI,CACvD,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAM,kBAAmB,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,IAAA,CAAA,EAAI,CACrE,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -3,15 +3,17 @@ import { useRouteRef } from '@backstage/core-plugin-api';
|
|
|
3
3
|
import { userRouteRef } from '@drodil/backstage-plugin-qeta-react';
|
|
4
4
|
import { useEntityPresentation } from '@backstage/plugin-catalog-react';
|
|
5
5
|
import { Link } from '@backstage/core-components';
|
|
6
|
+
import { useTranslation } from '../../utils/hooks.esm.js';
|
|
6
7
|
|
|
7
8
|
const UserLink = (props) => {
|
|
8
9
|
const { entityRef, linkProps } = props;
|
|
9
10
|
const userRoute = useRouteRef(userRouteRef);
|
|
11
|
+
const { t } = useTranslation();
|
|
10
12
|
const { primaryTitle: userName } = useEntityPresentation(
|
|
11
13
|
entityRef.startsWith("user:") ? entityRef : `user:${entityRef}`
|
|
12
14
|
);
|
|
13
15
|
if (entityRef === "anonymous") {
|
|
14
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, "
|
|
16
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, t("userLink.anonymous"));
|
|
15
17
|
}
|
|
16
18
|
return /* @__PURE__ */ React.createElement(Link, { to: `${userRoute()}/${entityRef}`, ...linkProps }, userName);
|
|
17
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Links.esm.js","sources":["../../../src/components/Links/Links.tsx"],"sourcesContent":["import {\n Answer,\n Comment,\n Question,\n} from '@drodil/backstage-plugin-qeta-common';\nimport React from 'react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { userRouteRef } from '@drodil/backstage-plugin-qeta-react';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { Link, LinkProps } from '@backstage/core-components';\n\nexport const UserLink = (props: {\n entityRef: string;\n linkProps?: LinkProps;\n}) => {\n const { entityRef, linkProps } = props;\n const userRoute = useRouteRef(userRouteRef);\n const { primaryTitle: userName } = useEntityPresentation(\n entityRef.startsWith('user:') ? entityRef : `user:${entityRef}`,\n );\n if (entityRef === 'anonymous') {\n return <>
|
|
1
|
+
{"version":3,"file":"Links.esm.js","sources":["../../../src/components/Links/Links.tsx"],"sourcesContent":["import {\n Answer,\n Comment,\n Question,\n} from '@drodil/backstage-plugin-qeta-common';\nimport React from 'react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { userRouteRef } from '@drodil/backstage-plugin-qeta-react';\nimport { useEntityPresentation } from '@backstage/plugin-catalog-react';\nimport { Link, LinkProps } from '@backstage/core-components';\nimport { useTranslation } from '../../utils/hooks';\n\nexport const UserLink = (props: {\n entityRef: string;\n linkProps?: LinkProps;\n}) => {\n const { entityRef, linkProps } = props;\n const userRoute = useRouteRef(userRouteRef);\n const { t } = useTranslation();\n const { primaryTitle: userName } = useEntityPresentation(\n entityRef.startsWith('user:') ? entityRef : `user:${entityRef}`,\n );\n if (entityRef === 'anonymous') {\n return <>{t('userLink.anonymous')}</>;\n }\n return (\n <Link to={`${userRoute()}/${entityRef}`} {...linkProps}>\n {userName}\n </Link>\n );\n};\n\nexport const AuthorLink = (props: {\n entity: Question | Answer | Comment;\n linkProps?: LinkProps;\n}) => {\n const { entity, linkProps } = props;\n return <UserLink entityRef={entity.author} linkProps={linkProps} />;\n};\n\nexport const UpdatedByLink = (props: {\n entity: Question | Answer | Comment;\n linkProps?: LinkProps;\n}) => {\n const { entity, linkProps } = props;\n if (!entity.updatedBy) {\n return null;\n }\n return <UserLink entityRef={entity.updatedBy} linkProps={linkProps} />;\n};\n"],"names":[],"mappings":";;;;;;;AAYa,MAAA,QAAA,GAAW,CAAC,KAGnB,KAAA;AACJ,EAAM,MAAA,EAAE,SAAW,EAAA,SAAA,EAAc,GAAA,KAAA,CAAA;AACjC,EAAM,MAAA,SAAA,GAAY,YAAY,YAAY,CAAA,CAAA;AAC1C,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAC7B,EAAM,MAAA,EAAE,YAAc,EAAA,QAAA,EAAa,GAAA,qBAAA;AAAA,IACjC,UAAU,UAAW,CAAA,OAAO,CAAI,GAAA,SAAA,GAAY,QAAQ,SAAS,CAAA,CAAA;AAAA,GAC/D,CAAA;AACA,EAAA,IAAI,cAAc,WAAa,EAAA;AAC7B,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAG,CAAE,CAAA,oBAAoB,CAAE,CAAA,CAAA;AAAA,GACpC;AACA,EACE,uBAAA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