@drodil/backstage-plugin-qeta 2.5.3 → 2.7.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 +9 -8
- 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 +74 -46
- package/dist/components/AskForm/AskForm.esm.js.map +1 -1
- package/dist/components/AskForm/EntitiesInput.esm.js +8 -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 +53 -36
- 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 +58 -37
- 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 +13 -10
- 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 +20 -4
- 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/dist/utils/utils.esm.js +13 -15
- package/dist/utils/utils.esm.js.map +1 -1
- package/package.json +3 -3
|
@@ -6,12 +6,14 @@ import { TextField } from '@material-ui/core';
|
|
|
6
6
|
import React, { useMemo, useEffect } from 'react';
|
|
7
7
|
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
8
8
|
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
9
|
+
import { useTranslation } from '../../utils/hooks.esm.js';
|
|
9
10
|
|
|
10
11
|
const EntitiesInput = (props) => {
|
|
11
12
|
const { control, entityRef } = props;
|
|
12
13
|
const configApi = useApi(configApiRef);
|
|
13
14
|
const catalogApi = useApi(catalogApiRef);
|
|
14
15
|
const [availableEntities, setAvailableEntities] = React.useState([]);
|
|
16
|
+
const { t } = useTranslation();
|
|
15
17
|
const entityKinds = useMemo(() => {
|
|
16
18
|
let kinds = configApi.getOptionalStringArray("qeta.entityKinds");
|
|
17
19
|
if (!kinds) {
|
|
@@ -38,6 +40,7 @@ const EntitiesInput = (props) => {
|
|
|
38
40
|
}
|
|
39
41
|
if (entityKinds && entityKinds.length > 0) {
|
|
40
42
|
catalogApi.getEntities({
|
|
43
|
+
order: { field: "kind", order: "asc" },
|
|
41
44
|
filter: { kind: entityKinds },
|
|
42
45
|
fields: [
|
|
43
46
|
"kind",
|
|
@@ -79,9 +82,11 @@ const EntitiesInput = (props) => {
|
|
|
79
82
|
...params,
|
|
80
83
|
variant: "outlined",
|
|
81
84
|
margin: "normal",
|
|
82
|
-
label: "
|
|
83
|
-
placeholder: "
|
|
84
|
-
helperText:
|
|
85
|
+
label: t("entitiesInput.label"),
|
|
86
|
+
placeholder: t("entitiesInput.placeholder"),
|
|
87
|
+
helperText: t("entitiesInput.helperText", {
|
|
88
|
+
max: max.toString(10)
|
|
89
|
+
})
|
|
85
90
|
}
|
|
86
91
|
)
|
|
87
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntitiesInput.esm.js","sources":["../../../src/components/AskForm/EntitiesInput.tsx"],"sourcesContent":["import { Control, Controller } from 'react-hook-form';\nimport { QuestionForm } from './types';\nimport { Autocomplete } from '@material-ui/lab';\nimport { getEntityTitle } from '../../utils/utils';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { TextField } from '@material-ui/core';\nimport React, { useEffect, useMemo } from 'react';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\n\nexport const EntitiesInput = (props: {\n control: Control<QuestionForm>;\n entityRef?: string;\n}) => {\n const { control, entityRef } = props;\n const configApi = useApi(configApiRef);\n const catalogApi = useApi(catalogApiRef);\n const [availableEntities, setAvailableEntities] = React.useState<\n Entity[] | null\n >([]);\n\n const entityKinds: string[] = useMemo(() => {\n let kinds = configApi.getOptionalStringArray('qeta.entityKinds');\n if (!kinds) {\n kinds = configApi.getOptionalStringArray('qeta.entities.kinds');\n }\n return kinds || ['Component', 'System'];\n }, [configApi]);\n const max = useMemo(\n () => configApi.getOptionalNumber('qeta.entities.max') ?? 3,\n [configApi],\n );\n\n useEffect(() => {\n if (entityRef) {\n catalogApi.getEntityByRef(entityRef).then(data => {\n if (data) {\n setAvailableEntities([data]);\n }\n });\n }\n }, [catalogApi, entityRef]);\n\n useEffect(() => {\n if (entityRef) {\n return;\n }\n\n if (entityKinds && entityKinds.length > 0) {\n catalogApi\n .getEntities({\n filter: { kind: entityKinds },\n fields: [\n 'kind',\n 'metadata.name',\n 'metadata.namespace',\n 'metadata.title',\n ],\n })\n .catch(_ => setAvailableEntities(null))\n .then(data =>\n data ? setAvailableEntities(data.items) : setAvailableEntities(null),\n );\n }\n }, [catalogApi, entityRef, configApi, entityKinds]);\n\n if (!availableEntities || availableEntities.length === 0) {\n return null;\n }\n\n return (\n <Controller\n control={control}\n render={({ field: { onChange, value } }) => (\n <Autocomplete\n multiple\n className=\"qetaAskFormEntities\"\n value={value}\n groupBy={entityKinds.length > 1 ? option => option.kind : undefined}\n id=\"entities-select\"\n options={availableEntities}\n getOptionLabel={getEntityTitle}\n getOptionSelected={(o, v) =>\n stringifyEntityRef(o) === stringifyEntityRef(v)\n }\n onChange={(_e, newValue) => {\n if (!value || value.length < max) {\n onChange(newValue);\n }\n }}\n renderInput={params => (\n <TextField\n {...params}\n variant=\"outlined\"\n margin=\"normal\"\n label
|
|
1
|
+
{"version":3,"file":"EntitiesInput.esm.js","sources":["../../../src/components/AskForm/EntitiesInput.tsx"],"sourcesContent":["import { Control, Controller } from 'react-hook-form';\nimport { QuestionForm } from './types';\nimport { Autocomplete } from '@material-ui/lab';\nimport { getEntityTitle } from '../../utils/utils';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { TextField } from '@material-ui/core';\nimport React, { useEffect, useMemo } from 'react';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { useTranslation } from '../../utils/hooks';\n\nexport const EntitiesInput = (props: {\n control: Control<QuestionForm>;\n entityRef?: string;\n}) => {\n const { control, entityRef } = props;\n const configApi = useApi(configApiRef);\n const catalogApi = useApi(catalogApiRef);\n const [availableEntities, setAvailableEntities] = React.useState<\n Entity[] | null\n >([]);\n const { t } = useTranslation();\n\n const entityKinds: string[] = useMemo(() => {\n let kinds = configApi.getOptionalStringArray('qeta.entityKinds');\n if (!kinds) {\n kinds = configApi.getOptionalStringArray('qeta.entities.kinds');\n }\n return kinds || ['Component', 'System'];\n }, [configApi]);\n const max = useMemo(\n () => configApi.getOptionalNumber('qeta.entities.max') ?? 3,\n [configApi],\n );\n\n useEffect(() => {\n if (entityRef) {\n catalogApi.getEntityByRef(entityRef).then(data => {\n if (data) {\n setAvailableEntities([data]);\n }\n });\n }\n }, [catalogApi, entityRef]);\n\n useEffect(() => {\n if (entityRef) {\n return;\n }\n\n if (entityKinds && entityKinds.length > 0) {\n catalogApi\n .getEntities({\n order: { field: 'kind', order: 'asc' },\n filter: { kind: entityKinds },\n fields: [\n 'kind',\n 'metadata.name',\n 'metadata.namespace',\n 'metadata.title',\n ],\n })\n .catch(_ => setAvailableEntities(null))\n .then(data =>\n data ? setAvailableEntities(data.items) : setAvailableEntities(null),\n );\n }\n }, [catalogApi, entityRef, configApi, entityKinds]);\n\n if (!availableEntities || availableEntities.length === 0) {\n return null;\n }\n\n return (\n <Controller\n control={control}\n render={({ field: { onChange, value } }) => (\n <Autocomplete\n multiple\n className=\"qetaAskFormEntities\"\n value={value}\n groupBy={entityKinds.length > 1 ? option => option.kind : undefined}\n id=\"entities-select\"\n options={availableEntities}\n getOptionLabel={getEntityTitle}\n getOptionSelected={(o, v) =>\n stringifyEntityRef(o) === stringifyEntityRef(v)\n }\n onChange={(_e, newValue) => {\n if (!value || value.length < max) {\n onChange(newValue);\n }\n }}\n renderInput={params => (\n <TextField\n {...params}\n variant=\"outlined\"\n margin=\"normal\"\n label={t('entitiesInput.label')}\n placeholder={t('entitiesInput.placeholder')}\n helperText={t('entitiesInput.helperText', {\n max: max.toString(10),\n })}\n />\n )}\n />\n )}\n name=\"entities\"\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAWa,MAAA,aAAA,GAAgB,CAAC,KAGxB,KAAA;AACJ,EAAM,MAAA,EAAE,OAAS,EAAA,SAAA,EAAc,GAAA,KAAA,CAAA;AAC/B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA,CAAA;AACrC,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA,CAAA;AACvC,EAAA,MAAM,CAAC,iBAAmB,EAAA,oBAAoB,IAAI,KAAM,CAAA,QAAA,CAEtD,EAAE,CAAA,CAAA;AACJ,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAM,MAAA,WAAA,GAAwB,QAAQ,MAAM;AAC1C,IAAI,IAAA,KAAA,GAAQ,SAAU,CAAA,sBAAA,CAAuB,kBAAkB,CAAA,CAAA;AAC/D,IAAA,IAAI,CAAC,KAAO,EAAA;AACV,MAAQ,KAAA,GAAA,SAAA,CAAU,uBAAuB,qBAAqB,CAAA,CAAA;AAAA,KAChE;AACA,IAAO,OAAA,KAAA,IAAS,CAAC,WAAA,EAAa,QAAQ,CAAA,CAAA;AAAA,GACxC,EAAG,CAAC,SAAS,CAAC,CAAA,CAAA;AACd,EAAA,MAAM,GAAM,GAAA,OAAA;AAAA,IACV,MAAM,SAAA,CAAU,iBAAkB,CAAA,mBAAmB,CAAK,IAAA,CAAA;AAAA,IAC1D,CAAC,SAAS,CAAA;AAAA,GACZ,CAAA;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAW,EAAA;AACb,MAAA,UAAA,CAAW,cAAe,CAAA,SAAS,CAAE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'@backstage/core-plugin-api';
|
|
7
7
|
import { filterTags } from '@drodil/backstage-plugin-qeta-common';
|
|
8
|
+
import { useTranslation } from '../../utils/hooks.esm.js';
|
|
8
9
|
|
|
9
10
|
const TagInput = (props) => {
|
|
10
11
|
const { control } = props;
|
|
11
12
|
const qetaApi = useApi(qetaApiRef);
|
|
12
13
|
const config = useApi(configApiRef);
|
|
14
|
+
const { t } = useTranslation();
|
|
13
15
|
const allowCreation = useMemo(
|
|
14
16
|
() => config.getOptionalBoolean("qeta.tags.allowCreation") ?? true,
|
|
15
17
|
[config]
|
|
@@ -60,9 +62,11 @@ const TagInput = (props) => {
|
|
|
60
62
|
...params,
|
|
61
63
|
variant: "outlined",
|
|
62
64
|
margin: "normal",
|
|
63
|
-
label: "
|
|
64
|
-
placeholder: "
|
|
65
|
-
helperText:
|
|
65
|
+
label: t("tagsInput.label"),
|
|
66
|
+
placeholder: t("tagsInput.placeholder"),
|
|
67
|
+
helperText: t("tagsInput.helperText", {
|
|
68
|
+
max: maximumTags.toString(10)
|
|
69
|
+
}),
|
|
66
70
|
error: error !== void 0
|
|
67
71
|
}
|
|
68
72
|
)
|
|
@@ -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,CAAA,yBAAyB,CAAK,IAAA,IAAA;AAAA,IAC9D,CAAC,MAAM,CAAA;AAAA,GACT,CA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AAA,CAAA,aAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,QAAQ,EAAA,IAAA;AAAA,UACR,EAAG,EAAA,aAAA;AAAA,UACH,SAAU,EAAA,iBAAA;AAAA,UACV,KAAA;AAAA,UACA,OAAA,EAAS,iBAAiB,EAAC;AAAA,UAC3B,QAAU,EAAA,aAAA;AAAA,UACV,QAAA,EAAU,CAAC,EAAA,EAAI,QAAa,KAAA;AAC1B,YAAM,MAAA,IAAA,GAAO,WAAW,QAAQ,CAAA,CAAA;AAChC,YAAA,IACE,QACA,IAAK,CAAA,MAAA,IAAU,eACf,IAAK,CAAA,MAAA,KAAW,SAAS,MACzB,EAAA;AACA,cAAA,QAAA,CAAS,QAAQ,CAAA,CAAA;AAAA,aACnB;AAAA,WACF;AAAA,UACA,aAAa,CACX,MAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,YAAC,SAAA;AAAA,YAAA;AAAA,cACE,GAAG,MAAA;AAAA,cACJ,OAAQ,EAAA,UAAA;AAAA,cACR,MAAO,EAAA,QAAA;AAAA,cACP,KAAA,EAAO,EAAE,iBAAiB,CAAA;AAAA,cAC1B,WAAA,EAAa,EAAE,uBAAuB,CAAA;AAAA,cACtC,UAAA,EAAY,EAAE,sBAAwB,EAAA;AAAA,gBACpC,GAAA,EAAK,WAAY,CAAA,QAAA,CAAS,EAAE,CAAA;AAAA,eAC7B,CAAA;AAAA,cACD,OAAO,KAAU,KAAA,KAAA,CAAA;AAAA,aAAA;AAAA,WACnB;AAAA,SAAA;AAAA,OAEJ;AAAA,MAEF,IAAK,EAAA,MAAA;AAAA,KAAA;AAAA,GACP,CAAA;AAEJ;;;;"}
|
|
@@ -6,6 +6,7 @@ import { useParams, useSearchParams } from 'react-router-dom';
|
|
|
6
6
|
import { BackToQuestionsButton } from '../Buttons/BackToQuestionsButton.esm.js';
|
|
7
7
|
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,EAAG,EAAA,GAAI,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,CAAC,YAAY,CAAA,GAAI,eA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,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":";;;;;;;;;AASa,MAAA,iBAAA,GAAoB,CAAC,KAI5B,KAAA;AACJ,EAAA,MAAM,EAA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
|
@@ -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,CAAA,CAAA,CAAA,KAAK,eAAgB,CAAA,CAAC,CAAC,CAAA,CAAA;AAAA,GACjC,CAAA;A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AA;AAEJ;;;;"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { Box, Grid, TextField, Button } from '@material-ui/core';
|
|
3
3
|
import { Link } from '@backstage/core-components';
|
|
4
4
|
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';
|
|
9
|
+
import { confirmNavigationIfEdited } from '../../utils/utils.esm.js';
|
|
8
10
|
|
|
9
11
|
const CommentSection = (props) => {
|
|
10
12
|
const { answer, question, onCommentPost, onCommentDelete } = props;
|
|
@@ -12,6 +14,8 @@ const CommentSection = (props) => {
|
|
|
12
14
|
const qetaApi = useApi(qetaApiRef);
|
|
13
15
|
const [posting, setPosting] = React.useState(false);
|
|
14
16
|
const [formVisible, setFormVisible] = useState(false);
|
|
17
|
+
const [edited, setEdited] = React.useState(false);
|
|
18
|
+
const { t } = useTranslation();
|
|
15
19
|
const {
|
|
16
20
|
handleSubmit,
|
|
17
21
|
control,
|
|
@@ -38,6 +42,9 @@ const CommentSection = (props) => {
|
|
|
38
42
|
onCommentPost(q);
|
|
39
43
|
});
|
|
40
44
|
};
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
confirmNavigationIfEdited(edited);
|
|
47
|
+
}, [edited]);
|
|
41
48
|
return /* @__PURE__ */ React.createElement(Box, { marginLeft: 9, className: "qetaCommentSection" }, /* @__PURE__ */ React.createElement(
|
|
42
49
|
CommentList,
|
|
43
50
|
{
|
|
@@ -53,44 +60,54 @@ const CommentSection = (props) => {
|
|
|
53
60
|
className: "qetaAddCommentBtn",
|
|
54
61
|
onClick: () => setFormVisible(true)
|
|
55
62
|
},
|
|
56
|
-
"
|
|
57
|
-
), formVisible && /* @__PURE__ */ React.createElement(
|
|
58
|
-
|
|
63
|
+
t("commentSection.addComment")
|
|
64
|
+
), formVisible && /* @__PURE__ */ React.createElement(
|
|
65
|
+
"form",
|
|
59
66
|
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
required: true
|
|
67
|
+
onSubmit: handleSubmit(postComment),
|
|
68
|
+
onChange: () => {
|
|
69
|
+
setEdited(true);
|
|
64
70
|
},
|
|
65
|
-
|
|
66
|
-
TextField,
|
|
67
|
-
{
|
|
68
|
-
id: "comment",
|
|
69
|
-
multiline: true,
|
|
70
|
-
minRows: 2,
|
|
71
|
-
fullWidth: true,
|
|
72
|
-
className: "qetaCommentInput",
|
|
73
|
-
value,
|
|
74
|
-
placeholder: "Your commment",
|
|
75
|
-
onChange,
|
|
76
|
-
variant: "outlined",
|
|
77
|
-
error: "content" in errors
|
|
78
|
-
}
|
|
79
|
-
),
|
|
80
|
-
name: "content"
|
|
81
|
-
}
|
|
82
|
-
)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 1 }, /* @__PURE__ */ React.createElement(
|
|
83
|
-
Button,
|
|
84
|
-
{
|
|
85
|
-
variant: "contained",
|
|
86
|
-
size: "small",
|
|
87
|
-
className: "qetaCommentBtn",
|
|
88
|
-
type: "submit",
|
|
89
|
-
color: "primary",
|
|
90
|
-
disabled: posting
|
|
71
|
+
className: "qetaCommentForm"
|
|
91
72
|
},
|
|
92
|
-
|
|
93
|
-
|
|
73
|
+
/* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 11 }, /* @__PURE__ */ React.createElement(
|
|
74
|
+
Controller,
|
|
75
|
+
{
|
|
76
|
+
control,
|
|
77
|
+
defaultValue: "",
|
|
78
|
+
rules: {
|
|
79
|
+
required: true
|
|
80
|
+
},
|
|
81
|
+
render: ({ field: { onChange, value } }) => /* @__PURE__ */ React.createElement(
|
|
82
|
+
TextField,
|
|
83
|
+
{
|
|
84
|
+
id: "comment",
|
|
85
|
+
multiline: true,
|
|
86
|
+
minRows: 2,
|
|
87
|
+
fullWidth: true,
|
|
88
|
+
className: "qetaCommentInput",
|
|
89
|
+
value,
|
|
90
|
+
placeholder: t("commentSection.input.placeholder"),
|
|
91
|
+
onChange,
|
|
92
|
+
variant: "outlined",
|
|
93
|
+
error: "content" in errors
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
name: "content"
|
|
97
|
+
}
|
|
98
|
+
)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 1 }, /* @__PURE__ */ React.createElement(
|
|
99
|
+
Button,
|
|
100
|
+
{
|
|
101
|
+
variant: "contained",
|
|
102
|
+
size: "small",
|
|
103
|
+
className: "qetaCommentBtn",
|
|
104
|
+
type: "submit",
|
|
105
|
+
color: "primary",
|
|
106
|
+
disabled: posting
|
|
107
|
+
},
|
|
108
|
+
t("commentSection.post")
|
|
109
|
+
)))
|
|
110
|
+
));
|
|
94
111
|
};
|
|
95
112
|
|
|
96
113
|
export { CommentSection };
|
|
@@ -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, useEffect } 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';\nimport { confirmNavigationIfEdited } from '../../utils/utils';\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 [edited, setEdited] = React.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 useEffect(() => {\n confirmNavigationIfEdited(edited);\n }, [edited]);\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\n onSubmit={handleSubmit(postComment)}\n onChange={() => {\n setEdited(true);\n }}\n className=\"qetaCommentForm\"\n >\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":";;;;;;;;;;AAca,MAAA,cAAA,GAAiB,CAAC,KAQzB,KAAA;AACJ,EAAA,MAAM,EAAE,M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'@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,U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AA,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;;;;"}
|