@drodil/backstage-plugin-qeta-react 3.9.3 → 3.10.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/AIAnswerCard/AIAnswerCard.esm.js +32 -22
- package/dist/components/AIAnswerCard/AIAnswerCard.esm.js.map +1 -1
- package/dist/components/AnswerCard/AnswerCard.esm.js +28 -23
- package/dist/components/AnswerCard/AnswerCard.esm.js.map +1 -1
- package/dist/components/AnswerForm/AnswerForm.esm.js +16 -15
- package/dist/components/AnswerForm/AnswerForm.esm.js.map +1 -1
- package/dist/components/AnswersContainer/AnswerList.esm.js +14 -9
- package/dist/components/AnswersContainer/AnswerList.esm.js.map +1 -1
- package/dist/components/AnswersContainer/AnswerListItem.esm.js +14 -12
- package/dist/components/AnswersContainer/AnswerListItem.esm.js.map +1 -1
- package/dist/components/AnswersContainer/AnswersContainer.esm.js +28 -30
- package/dist/components/AnswersContainer/AnswersContainer.esm.js.map +1 -1
- package/dist/components/ArticleContent/ArticleButtons.esm.js +20 -16
- package/dist/components/ArticleContent/ArticleButtons.esm.js.map +1 -1
- package/dist/components/ArticleContent/ArticleContent.esm.js +13 -10
- package/dist/components/ArticleContent/ArticleContent.esm.js.map +1 -1
- package/dist/components/AuthorBox/AuthorBox.esm.js +8 -4
- package/dist/components/AuthorBox/AuthorBox.esm.js.map +1 -1
- package/dist/components/Buttons/AddToCollectionButton.esm.js +17 -12
- package/dist/components/Buttons/AddToCollectionButton.esm.js.map +1 -1
- package/dist/components/Buttons/AskQuestionButton.esm.js +4 -4
- package/dist/components/Buttons/AskQuestionButton.esm.js.map +1 -1
- package/dist/components/Buttons/CollectionFollowButton.esm.js +7 -6
- package/dist/components/Buttons/CollectionFollowButton.esm.js.map +1 -1
- package/dist/components/Buttons/CreateCollectionButton.esm.js +4 -4
- package/dist/components/Buttons/CreateCollectionButton.esm.js.map +1 -1
- package/dist/components/Buttons/EntityFollowButton.esm.js +7 -6
- package/dist/components/Buttons/EntityFollowButton.esm.js.map +1 -1
- package/dist/components/Buttons/FavoriteButton.esm.js +10 -9
- package/dist/components/Buttons/FavoriteButton.esm.js.map +1 -1
- package/dist/components/Buttons/LinkButton.esm.js +6 -5
- package/dist/components/Buttons/LinkButton.esm.js.map +1 -1
- package/dist/components/Buttons/TagFollowButton.esm.js +7 -6
- package/dist/components/Buttons/TagFollowButton.esm.js.map +1 -1
- package/dist/components/Buttons/UserFollowButton.esm.js +7 -6
- package/dist/components/Buttons/UserFollowButton.esm.js.map +1 -1
- package/dist/components/Buttons/VoteButtons.esm.js +16 -11
- package/dist/components/Buttons/VoteButtons.esm.js.map +1 -1
- package/dist/components/Buttons/WriteArticleButton.esm.js +4 -4
- package/dist/components/Buttons/WriteArticleButton.esm.js.map +1 -1
- package/dist/components/CollectionCard/CollectionCard.esm.js +14 -11
- package/dist/components/CollectionCard/CollectionCard.esm.js.map +1 -1
- package/dist/components/CollectionForm/CollectionForm.esm.js +26 -20
- package/dist/components/CollectionForm/CollectionForm.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/CollectionsGrid.esm.js +23 -23
- package/dist/components/CollectionsGrid/CollectionsGrid.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/CollectionsGridContent.esm.js +8 -14
- package/dist/components/CollectionsGrid/CollectionsGridContent.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js +13 -6
- package/dist/components/CollectionsGrid/CollectionsGridItem.esm.js.map +1 -1
- package/dist/components/CollectionsGrid/NoCollectionsCard.esm.js +7 -4
- package/dist/components/CollectionsGrid/NoCollectionsCard.esm.js.map +1 -1
- package/dist/components/CommentSection/CommentList.esm.js +9 -6
- package/dist/components/CommentSection/CommentList.esm.js.map +1 -1
- package/dist/components/CommentSection/CommentSection.esm.js +16 -14
- package/dist/components/CommentSection/CommentSection.esm.js.map +1 -1
- package/dist/components/DeleteModal/DeleteModal.esm.js +15 -14
- package/dist/components/DeleteModal/DeleteModal.esm.js.map +1 -1
- package/dist/components/EntitiesGrid/EntitiesGrid.esm.js +16 -19
- package/dist/components/EntitiesGrid/EntitiesGrid.esm.js.map +1 -1
- package/dist/components/EntitiesGrid/EntitiesGridContent.esm.js +6 -15
- package/dist/components/EntitiesGrid/EntitiesGridContent.esm.js.map +1 -1
- package/dist/components/EntitiesGrid/EntitiesGridItem.esm.js +17 -8
- package/dist/components/EntitiesGrid/EntitiesGridItem.esm.js.map +1 -1
- package/dist/components/EntitiesGrid/NoEntitiesCard.esm.js +7 -4
- package/dist/components/EntitiesGrid/NoEntitiesCard.esm.js.map +1 -1
- package/dist/components/FilterPanel/DateRangeFilter.esm.js +40 -46
- package/dist/components/FilterPanel/DateRangeFilter.esm.js.map +1 -1
- package/dist/components/FilterPanel/FilterPanel.esm.js +47 -34
- package/dist/components/FilterPanel/FilterPanel.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedCollectionsList.esm.js +11 -7
- package/dist/components/FollowedLists/FollowedCollectionsList.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedEntitiesList.esm.js +11 -7
- package/dist/components/FollowedLists/FollowedEntitiesList.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedTagsList.esm.js +11 -7
- package/dist/components/FollowedLists/FollowedTagsList.esm.js.map +1 -1
- package/dist/components/HeaderImageInput/HeaderImageInput.esm.js +8 -5
- package/dist/components/HeaderImageInput/HeaderImageInput.esm.js.map +1 -1
- package/dist/components/HomePageCards/ImpactCard.esm.js +6 -3
- package/dist/components/HomePageCards/ImpactCard.esm.js.map +1 -1
- package/dist/components/HomePageCards/PostsCard.esm.js +45 -15
- package/dist/components/HomePageCards/PostsCard.esm.js.map +1 -1
- package/dist/components/LeftMenu/LeftMenu.esm.js +39 -27
- package/dist/components/LeftMenu/LeftMenu.esm.js.map +1 -1
- package/dist/components/LeftMenu/LeftMenuButton.esm.js +16 -12
- package/dist/components/LeftMenu/LeftMenuButton.esm.js.map +1 -1
- package/dist/components/Links/Links.esm.js +5 -5
- package/dist/components/Links/Links.esm.js.map +1 -1
- package/dist/components/LoadingGrid/LoadingGrid.esm.js +5 -4
- package/dist/components/LoadingGrid/LoadingGrid.esm.js.map +1 -1
- package/dist/components/MarkdownEditor/MarkdownEditor.esm.js +5 -5
- package/dist/components/MarkdownEditor/MarkdownEditor.esm.js.map +1 -1
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js +12 -12
- package/dist/components/MarkdownRenderer/MarkdownRenderer.esm.js.map +1 -1
- package/dist/components/PostAnonymouslyCheckbox/PostAnonymouslyCheckbox.esm.js +8 -5
- package/dist/components/PostAnonymouslyCheckbox/PostAnonymouslyCheckbox.esm.js.map +1 -1
- package/dist/components/PostForm/EntitiesInput.esm.js +10 -9
- package/dist/components/PostForm/EntitiesInput.esm.js.map +1 -1
- package/dist/components/PostForm/PostForm.esm.js +22 -21
- package/dist/components/PostForm/PostForm.esm.js.map +1 -1
- package/dist/components/PostForm/TagInput.esm.js +11 -10
- package/dist/components/PostForm/TagInput.esm.js.map +1 -1
- package/dist/components/PostHighlightList/PostHighlightList.esm.js +23 -13
- package/dist/components/PostHighlightList/PostHighlightList.esm.js.map +1 -1
- package/dist/components/PostsContainer/NoPostsCard.esm.js +11 -8
- package/dist/components/PostsContainer/NoPostsCard.esm.js.map +1 -1
- package/dist/components/PostsContainer/PostList.esm.js +21 -17
- package/dist/components/PostsContainer/PostList.esm.js.map +1 -1
- package/dist/components/PostsContainer/PostListItem.esm.js +26 -26
- package/dist/components/PostsContainer/PostListItem.esm.js.map +1 -1
- package/dist/components/PostsContainer/PostsContainer.esm.js +37 -31
- package/dist/components/PostsContainer/PostsContainer.esm.js.map +1 -1
- package/dist/components/PostsGrid/PostsGrid.esm.js +37 -31
- package/dist/components/PostsGrid/PostsGrid.esm.js.map +1 -1
- package/dist/components/PostsGrid/PostsGridContent.esm.js +9 -17
- package/dist/components/PostsGrid/PostsGridContent.esm.js.map +1 -1
- package/dist/components/PostsGrid/PostsGridItem.esm.js +22 -14
- package/dist/components/PostsGrid/PostsGridItem.esm.js.map +1 -1
- package/dist/components/QetaPagination/QetaPagination.esm.js +15 -11
- package/dist/components/QetaPagination/QetaPagination.esm.js.map +1 -1
- package/dist/components/QuestionCard/QuestionCard.esm.js +23 -18
- package/dist/components/QuestionCard/QuestionCard.esm.js.map +1 -1
- package/dist/components/QuestionsTable/QuestionTableRow.esm.js +4 -3
- package/dist/components/QuestionsTable/QuestionTableRow.esm.js.map +1 -1
- package/dist/components/QuestionsTable/QuestionsTable.esm.js +27 -17
- package/dist/components/QuestionsTable/QuestionsTable.esm.js.map +1 -1
- package/dist/components/RelativeTimeWithTooltip/RelativeTimeWithTooltip.esm.js +4 -4
- package/dist/components/RelativeTimeWithTooltip/RelativeTimeWithTooltip.esm.js.map +1 -1
- package/dist/components/SearchBar/SearchBar.esm.js +58 -0
- package/dist/components/SearchBar/SearchBar.esm.js.map +1 -0
- package/dist/components/SelectTemplateList/SelectTemplateList.esm.js +13 -6
- package/dist/components/SelectTemplateList/SelectTemplateList.esm.js.map +1 -1
- package/dist/components/StatsChart/StatsChart.esm.js +33 -27
- package/dist/components/StatsChart/StatsChart.esm.js.map +1 -1
- package/dist/components/SummaryStatsGrid/SummaryStatsGrid.esm.js +15 -12
- package/dist/components/SummaryStatsGrid/SummaryStatsGrid.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/CollectionChip.esm.js +12 -9
- package/dist/components/TagsAndEntities/CollectionChip.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/EntityChip.esm.js +20 -25
- package/dist/components/TagsAndEntities/EntityChip.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/TagChip.esm.js +20 -25
- package/dist/components/TagsAndEntities/TagChip.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/TagsAndEntities.esm.js +3 -3
- package/dist/components/TagsAndEntities/TagsAndEntities.esm.js.map +1 -1
- package/dist/components/TagsGrid/EditTagModal.esm.js +17 -14
- package/dist/components/TagsGrid/EditTagModal.esm.js.map +1 -1
- package/dist/components/TagsGrid/NoTagsCard.esm.js +7 -4
- package/dist/components/TagsGrid/NoTagsCard.esm.js.map +1 -1
- package/dist/components/TagsGrid/TagGridItem.esm.js +16 -8
- package/dist/components/TagsGrid/TagGridItem.esm.js.map +1 -1
- package/dist/components/TagsGrid/TagsGrid.esm.js +16 -20
- package/dist/components/TagsGrid/TagsGrid.esm.js.map +1 -1
- package/dist/components/TagsGrid/TagsGridContent.esm.js +6 -15
- package/dist/components/TagsGrid/TagsGridContent.esm.js.map +1 -1
- package/dist/components/TemplateList/TemplateForm.esm.js +19 -18
- package/dist/components/TemplateList/TemplateForm.esm.js.map +1 -1
- package/dist/components/TemplateList/TemplateList.esm.js +22 -15
- package/dist/components/TemplateList/TemplateList.esm.js.map +1 -1
- package/dist/components/TopRankingUsersCard/TopRankingUsersCard.esm.js +23 -18
- package/dist/components/TopRankingUsersCard/TopRankingUsersCard.esm.js.map +1 -1
- package/dist/components/TopRankingUsersCard/TrophyIcon.esm.js +4 -4
- package/dist/components/TopRankingUsersCard/TrophyIcon.esm.js.map +1 -1
- package/dist/components/TopRankingUsersCard/styles.esm.js +1 -1
- package/dist/components/TopRankingUsersCard/styles.esm.js.map +1 -1
- package/dist/components/UsersGrid/NoUsersCard.esm.js +7 -4
- package/dist/components/UsersGrid/NoUsersCard.esm.js.map +1 -1
- package/dist/components/UsersGrid/UsersGrid.esm.js +15 -18
- package/dist/components/UsersGrid/UsersGrid.esm.js.map +1 -1
- package/dist/components/UsersGrid/UsersGridContent.esm.js +6 -15
- package/dist/components/UsersGrid/UsersGridContent.esm.js.map +1 -1
- package/dist/components/UsersGrid/UsersGridItem.esm.js +17 -8
- package/dist/components/UsersGrid/UsersGridItem.esm.js.map +1 -1
- package/dist/hooks/useAI.esm.js +9 -9
- package/dist/hooks/useAI.esm.js.map +1 -1
- package/dist/hooks/useCollectionsFollow.esm.js +3 -3
- package/dist/hooks/useCollectionsFollow.esm.js.map +1 -1
- package/dist/hooks/useEntityAuthor.esm.js +5 -5
- package/dist/hooks/useEntityAuthor.esm.js.map +1 -1
- package/dist/hooks/useEntityFollow.esm.js +3 -3
- package/dist/hooks/useEntityFollow.esm.js.map +1 -1
- package/dist/hooks/useEntityQueryParameter.esm.js +2 -2
- package/dist/hooks/useEntityQueryParameter.esm.js.map +1 -1
- package/dist/hooks/useFormStyles.esm.js +1 -1
- package/dist/hooks/useFormStyles.esm.js.map +1 -1
- package/dist/hooks/usePaginatedPosts.esm.js +11 -11
- package/dist/hooks/usePaginatedPosts.esm.js.map +1 -1
- package/dist/hooks/useStyles.esm.js +4 -5
- package/dist/hooks/useStyles.esm.js.map +1 -1
- package/dist/hooks/useTagsFollow.esm.js +3 -3
- package/dist/hooks/useTagsFollow.esm.js.map +1 -1
- package/dist/hooks/useUserFollow.esm.js +3 -3
- package/dist/hooks/useUserFollow.esm.js.map +1 -1
- package/dist/hooks/useVoting.esm.js +3 -3
- package/dist/hooks/useVoting.esm.js.map +1 -1
- package/dist/index.d.ts +31 -31
- package/dist/translation.esm.js +11 -11
- package/dist/translation.esm.js.map +1 -1
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaginatedPosts.esm.js","sources":["../../src/hooks/usePaginatedPosts.ts"],"sourcesContent":["import { useAnalytics } from '@backstage/core-plugin-api';\nimport React, { useEffect } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport {\n FilterKey,\n filterKeys,\n PostFilters,\n} from '../components/FilterPanel/FilterPanel';\nimport useDebounce from 'react-use/lib/useDebounce';\nimport { getFiltersWithDateRange } from '../utils';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\nimport { useQetaApi } from './useQetaApi';\n\nexport type PaginatedPostsProps = PostFilters & {\n author?: string;\n showFilters?: boolean;\n showTitle?: boolean;\n title?: string;\n favorite?: boolean;\n showAskButton?: boolean;\n showWriteButton?: boolean;\n showNoQuestionsBtn?: boolean;\n initialPageSize?: number;\n collectionId?: number;\n};\n\nexport type PostFilterChange = {\n key: keyof PostFilters;\n value?: PostFilters[keyof PostFilters];\n};\n\nconst EXPANDED_LOCAL_STORAGE_KEY = 'qeta-post-filters-expanded';\n\nexport function usePaginatedPosts(props: PaginatedPostsProps) {\n const { type, tags, author, entities, entity, favorite, initialPageSize } =\n props;\n const analytics = useAnalytics();\n const [page, setPage] = React.useState(1);\n const [pageCount, setPageCount] = React.useState(1);\n const [postsPerPage, setPostsPerPage] = React.useState(initialPageSize ?? 10);\n const [showFilterPanel, setShowFilterPanel] = React.useState(\n localStorage.getItem(EXPANDED_LOCAL_STORAGE_KEY) === 'true',\n );\n const [searchParams, setSearchParams] = useSearchParams();\n const [searchQuery, setSearchQuery] = React.useState('');\n const [filters, setFilters] = React.useState<PostFilters>({\n order: props.order ?? 'desc',\n orderBy: props.orderBy ?? 'created',\n noAnswers: props.noAnswers ?? 'false',\n noCorrectAnswer: props.noCorrectAnswer ?? 'false',\n noVotes: props.noVotes ?? 'false',\n searchQuery: props.searchQuery ?? '',\n entities: entities ?? (entity ? [entity] : undefined),\n tags: tags,\n dateRange: '',\n collectionId: props.collectionId,\n type,\n });\n\n useEffect(() => {\n localStorage.setItem(\n EXPANDED_LOCAL_STORAGE_KEY,\n showFilterPanel ? 'true' : 'false',\n );\n }, [showFilterPanel]);\n\n const onPageChange = (value: number) => {\n setPage(value);\n setSearchParams(prev => {\n const newValue = prev;\n newValue.set('page', String(value));\n return newValue;\n });\n };\n\n const loadNextPage = () => {\n setPage(prev => prev + 1);\n };\n\n const onFilterChange = (changes: PostFilterChange | PostFilterChange[]) => {\n const changesArray = Array.isArray(changes) ? changes : [changes];\n setPage(1);\n setFilters(prev => {\n const newValue = { ...prev };\n for (const { key, value } of changesArray) {\n (newValue as any)[key] = value;\n }\n return newValue;\n });\n setSearchParams(prev => {\n const newValue = prev;\n for (const { key, value } of changesArray) {\n if (!filterKeys.includes(key as FilterKey)) {\n continue;\n }\n if (!value || value === 'false') {\n newValue.delete(key);\n } else if (Array.isArray(value)) {\n if (value.length === 0) {\n newValue.delete(key);\n } else {\n newValue.set(key, value.join(','));\n }\n } else if (typeof value === 'number') {\n newValue.set(key, String(value));\n } else if (value.length > 0) {\n newValue.set(key, value);\n } else {\n newValue.delete(key);\n }\n }\n return newValue;\n });\n };\n\n const onSearchQueryChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onPageChange(1);\n if (event.target.value) {\n analytics.captureEvent('qeta_search', event.target.value);\n }\n setSearchQuery(event.target.value);\n };\n\n useDebounce(\n () => {\n if (filters.searchQuery !== searchQuery) {\n setFilters({ ...filters, searchQuery: searchQuery });\n }\n },\n 400,\n [searchQuery],\n );\n\n useEffect(() => {\n let filtersApplied = false;\n searchParams.forEach((value, key) => {\n try {\n if (key === 'page') {\n const pv = Number.parseInt(value, 10);\n if (pv > 0) {\n setPage(pv);\n } else {\n setPage(1);\n }\n } else if (key === 'postsPerPage') {\n const qpp = Number.parseInt(value, 10);\n if (qpp > 0) setPostsPerPage(qpp);\n } else if (filterKeys.includes(key as FilterKey)) {\n filtersApplied = true;\n if (key === 'tags') {\n filters.tags = filterTags(value) ?? [];\n } else {\n (filters as any)[key] = value;\n }\n }\n } catch (_e) {\n // NOOP\n }\n });\n setFilters(filters);\n if (filtersApplied) {\n setShowFilterPanel(true);\n }\n }, [searchParams, filters]);\n\n const {\n value: response,\n loading,\n error,\n retry,\n } = useQetaApi(\n api => {\n return api.getPosts({\n type,\n limit: postsPerPage,\n offset: (page - 1) * postsPerPage,\n includeEntities: true,\n author,\n favorite,\n ...(getFiltersWithDateRange(filters) as any),\n });\n },\n [type, page, filters, postsPerPage],\n );\n\n useEffect(() => {\n if (response) {\n setPageCount(Math.ceil(response.total / postsPerPage));\n }\n }, [response, postsPerPage]);\n\n const onPageSizeChange = (value: number) => {\n if (response) {\n let newPage = page;\n while (newPage * value > response.total) {\n newPage -= 1;\n }\n onPageChange(Math.max(1, newPage));\n }\n setPostsPerPage(value);\n setSearchParams(prev => {\n const newValue = prev;\n newValue.set('postsPerPage', String(value));\n return newValue;\n });\n };\n\n return {\n page,\n setPage,\n postsPerPage,\n setPostsPerPage,\n showFilterPanel,\n setShowFilterPanel,\n searchParams,\n setSearchParams,\n searchQuery,\n setSearchQuery,\n filters,\n setFilters,\n onPageChange,\n onPageSizeChange,\n onFilterChange,\n onSearchQueryChange,\n response,\n loading,\n error,\n loadNextPage,\n pageCount,\n retry,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;AA+BA,MAAM,0BAA6B,GAAA,4BAAA,CAAA;AAE5B,SAAS,kBAAkB,KAA4B,EAAA;AAC5D,EAAM,MAAA,EAAE,MAAM,IAAM,EAAA,MAAA,EAAQ,UAAU,MAAQ,EAAA,QAAA,EAAU,iBACtD,GAAA,KAAA,CAAA;AACF,EAAA,MAAM,YAAY,YAAa,EAAA,CAAA;AAC/B,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAA,KAAA,CAAM,SAAS,CAAC,CAAA,CAAA;AACxC,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAA,KAAA,CAAM,SAAS,CAAC,CAAA,CAAA;AAClD,EAAA,MAAM,CAAC,YAAc,EAAA,eAAe,IAAI,KAAM,CAAA,QAAA,CAAS,mBAAmB,EAAE,CAAA,CAAA;AAC5E,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,KAAM,CAAA,QAAA;AAAA,IAClD,YAAA,CAAa,OAAQ,CAAA,0BAA0B,CAAM,KAAA,MAAA;AAAA,GACvD,CAAA;AACA,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,eAAgB,EAAA,CAAA;AACxD,EAAA,MAAM,CAAC,WAAa,EAAA,cAAc,CAAI,GAAA,KAAA,CAAM,SAAS,EAAE,CAAA,CAAA;AACvD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,MAAM,QAAsB,CAAA;AAAA,IACxD,KAAA,EAAO,MAAM,KAAS,IAAA,MAAA;AAAA,IACtB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,CAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"usePaginatedPosts.esm.js","sources":["../../src/hooks/usePaginatedPosts.ts"],"sourcesContent":["import { useAnalytics } from '@backstage/core-plugin-api';\nimport React, { useEffect } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport {\n FilterKey,\n filterKeys,\n PostFilters,\n} from '../components/FilterPanel/FilterPanel';\nimport useDebounce from 'react-use/lib/useDebounce';\nimport { getFiltersWithDateRange } from '../utils';\nimport { filterTags } from '@drodil/backstage-plugin-qeta-common';\nimport { useQetaApi } from './useQetaApi';\n\nexport type PaginatedPostsProps = PostFilters & {\n author?: string;\n showFilters?: boolean;\n showTitle?: boolean;\n title?: string;\n favorite?: boolean;\n showAskButton?: boolean;\n showWriteButton?: boolean;\n showNoQuestionsBtn?: boolean;\n initialPageSize?: number;\n collectionId?: number;\n};\n\nexport type PostFilterChange = {\n key: keyof PostFilters;\n value?: PostFilters[keyof PostFilters];\n};\n\nconst EXPANDED_LOCAL_STORAGE_KEY = 'qeta-post-filters-expanded';\n\nexport function usePaginatedPosts(props: PaginatedPostsProps) {\n const { type, tags, author, entities, entity, favorite, initialPageSize } =\n props;\n const analytics = useAnalytics();\n const [page, setPage] = React.useState(1);\n const [pageCount, setPageCount] = React.useState(1);\n const [postsPerPage, setPostsPerPage] = React.useState(initialPageSize ?? 10);\n const [showFilterPanel, setShowFilterPanel] = React.useState(\n localStorage.getItem(EXPANDED_LOCAL_STORAGE_KEY) === 'true',\n );\n const [searchParams, setSearchParams] = useSearchParams();\n const [searchQuery, setSearchQuery] = React.useState('');\n const [filters, setFilters] = React.useState<PostFilters>({\n order: props.order ?? 'desc',\n orderBy: props.orderBy ?? 'created',\n noAnswers: props.noAnswers ?? 'false',\n noCorrectAnswer: props.noCorrectAnswer ?? 'false',\n noVotes: props.noVotes ?? 'false',\n searchQuery: props.searchQuery ?? '',\n entities: entities ?? (entity ? [entity] : undefined),\n tags: tags,\n dateRange: '',\n collectionId: props.collectionId,\n type,\n });\n\n useEffect(() => {\n localStorage.setItem(\n EXPANDED_LOCAL_STORAGE_KEY,\n showFilterPanel ? 'true' : 'false',\n );\n }, [showFilterPanel]);\n\n const onPageChange = (value: number) => {\n setPage(value);\n setSearchParams(prev => {\n const newValue = prev;\n newValue.set('page', String(value));\n return newValue;\n });\n };\n\n const loadNextPage = () => {\n setPage(prev => prev + 1);\n };\n\n const onFilterChange = (changes: PostFilterChange | PostFilterChange[]) => {\n const changesArray = Array.isArray(changes) ? changes : [changes];\n setPage(1);\n setFilters(prev => {\n const newValue = { ...prev };\n for (const { key, value } of changesArray) {\n (newValue as any)[key] = value;\n }\n return newValue;\n });\n setSearchParams(prev => {\n const newValue = prev;\n for (const { key, value } of changesArray) {\n if (!filterKeys.includes(key as FilterKey)) {\n continue;\n }\n if (!value || value === 'false') {\n newValue.delete(key);\n } else if (Array.isArray(value)) {\n if (value.length === 0) {\n newValue.delete(key);\n } else {\n newValue.set(key, value.join(','));\n }\n } else if (typeof value === 'number') {\n newValue.set(key, String(value));\n } else if (value.length > 0) {\n newValue.set(key, value);\n } else {\n newValue.delete(key);\n }\n }\n return newValue;\n });\n };\n\n const onSearchQueryChange = (query: string) => {\n onPageChange(1);\n if (query) {\n analytics.captureEvent('qeta_search', query);\n }\n setSearchQuery(query);\n };\n\n useDebounce(\n () => {\n if (filters.searchQuery !== searchQuery) {\n setFilters({ ...filters, searchQuery: searchQuery });\n }\n },\n 400,\n [searchQuery],\n );\n\n useEffect(() => {\n let filtersApplied = false;\n searchParams.forEach((value, key) => {\n try {\n if (key === 'page') {\n const pv = Number.parseInt(value, 10);\n if (pv > 0) {\n setPage(pv);\n } else {\n setPage(1);\n }\n } else if (key === 'postsPerPage') {\n const qpp = Number.parseInt(value, 10);\n if (qpp > 0) setPostsPerPage(qpp);\n } else if (filterKeys.includes(key as FilterKey)) {\n filtersApplied = true;\n if (key === 'tags') {\n filters.tags = filterTags(value) ?? [];\n } else {\n (filters as any)[key] = value;\n }\n }\n } catch (_e) {\n // NOOP\n }\n });\n setFilters(filters);\n if (filtersApplied) {\n setShowFilterPanel(true);\n }\n }, [searchParams, filters]);\n\n const {\n value: response,\n loading,\n error,\n retry,\n } = useQetaApi(\n api => {\n return api.getPosts({\n type,\n limit: postsPerPage,\n offset: (page - 1) * postsPerPage,\n includeEntities: true,\n author,\n favorite,\n ...(getFiltersWithDateRange(filters) as any),\n });\n },\n [type, page, filters, postsPerPage],\n );\n\n useEffect(() => {\n if (response) {\n setPageCount(Math.ceil(response.total / postsPerPage));\n }\n }, [response, postsPerPage]);\n\n const onPageSizeChange = (value: number) => {\n if (response) {\n let newPage = page;\n while (newPage * value > response.total) {\n newPage -= 1;\n }\n onPageChange(Math.max(1, newPage));\n }\n setPostsPerPage(value);\n setSearchParams(prev => {\n const newValue = prev;\n newValue.set('postsPerPage', String(value));\n return newValue;\n });\n };\n\n return {\n page,\n setPage,\n postsPerPage,\n setPostsPerPage,\n showFilterPanel,\n setShowFilterPanel,\n searchParams,\n setSearchParams,\n searchQuery,\n setSearchQuery,\n filters,\n setFilters,\n onPageChange,\n onPageSizeChange,\n onFilterChange,\n onSearchQueryChange,\n response,\n loading,\n error,\n loadNextPage,\n pageCount,\n retry,\n };\n}\n"],"names":["React"],"mappings":";;;;;;;;;AA+BA,MAAM,0BAA6B,GAAA,4BAAA,CAAA;AAE5B,SAAS,kBAAkB,KAA4B,EAAA;AAC5D,EAAM,MAAA,EAAE,MAAM,IAAM,EAAA,MAAA,EAAQ,UAAU,MAAQ,EAAA,QAAA,EAAU,iBACtD,GAAA,KAAA,CAAA;AACF,EAAA,MAAM,YAAY,YAAa,EAAA,CAAA;AAC/B,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAAA,cAAA,CAAM,SAAS,CAAC,CAAA,CAAA;AACxC,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAAA,cAAA,CAAM,SAAS,CAAC,CAAA,CAAA;AAClD,EAAA,MAAM,CAAC,YAAc,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OAAA,QAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAAA,GACH,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,eAAA;AAAA,IACA,kBAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,gBAAA;AAAA,IACA,cAAA;AAAA,IACA,mBAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA,YAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
2
2
|
|
|
3
3
|
const useStyles = makeStyles(
|
|
4
4
|
(theme) => {
|
|
@@ -14,7 +14,6 @@ const useStyles = makeStyles(
|
|
|
14
14
|
questionCardVote: {
|
|
15
15
|
textAlign: "center",
|
|
16
16
|
width: "32px",
|
|
17
|
-
marginRight: "20px",
|
|
18
17
|
marginLeft: "5px",
|
|
19
18
|
display: "inline-block",
|
|
20
19
|
verticalAlign: "top"
|
|
@@ -25,7 +24,7 @@ const useStyles = makeStyles(
|
|
|
25
24
|
},
|
|
26
25
|
questionListItem: {
|
|
27
26
|
padding: "0.7rem",
|
|
28
|
-
paddingBottom: "1.
|
|
27
|
+
paddingBottom: "1.0rem"
|
|
29
28
|
},
|
|
30
29
|
questionListItemStats: {
|
|
31
30
|
width: "70px",
|
|
@@ -88,10 +87,10 @@ const useStyles = makeStyles(
|
|
|
88
87
|
marginTop: theme.spacing(3)
|
|
89
88
|
},
|
|
90
89
|
marginRight: {
|
|
91
|
-
marginRight: theme.spacing(
|
|
90
|
+
marginRight: `${theme.spacing(2)} !important`
|
|
92
91
|
},
|
|
93
92
|
marginLeft: {
|
|
94
|
-
marginLeft: theme.spacing(
|
|
93
|
+
marginLeft: `${theme.spacing(2)} !important`
|
|
95
94
|
},
|
|
96
95
|
questionCardActions: {
|
|
97
96
|
marginTop: theme.spacing(2),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStyles.esm.js","sources":["../../src/hooks/useStyles.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"useStyles.esm.js","sources":["../../src/hooks/useStyles.ts"],"sourcesContent":["import makeStyles from '@mui/styles/makeStyles';\n\nexport const useStyles = makeStyles(\n theme => {\n return {\n questionDivider: {\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n },\n questionCard: {\n marginBottom: theme.spacing(1),\n position: 'relative',\n },\n questionCardVote: {\n textAlign: 'center',\n width: '32px',\n marginLeft: '5px',\n display: 'inline-block',\n verticalAlign: 'top',\n },\n questionCardContent: {\n minHeight: '160px',\n flexGrow: 1,\n },\n questionListItem: {\n padding: '0.7rem',\n paddingBottom: '1.0rem',\n },\n questionListItemStats: {\n width: '70px',\n textAlign: 'right',\n marginRight: '5px',\n display: 'inline-block',\n verticalAlign: 'top',\n },\n questionListItemContent: {\n display: 'inline-block',\n width: 'calc(100% - 80px)',\n },\n questionListItemAuthor: {\n display: 'inline',\n float: 'right',\n },\n questionListItemAvatar: {\n display: 'inline-flex !important',\n marginRight: '0.25rem',\n fontSize: '1rem',\n maxWidth: '1rem',\n maxHeight: '1rem',\n },\n answerCardContent: {\n display: 'inline-block',\n width: 'calc(100% - 70px)',\n },\n questionListPagination: {\n marginTop: theme.spacing(2),\n },\n questionsPerPageInput: {\n paddingTop: '10px',\n paddingBottom: '10px',\n },\n questionsPerPage: {\n marginRight: theme.spacing(3),\n },\n postHighlightListContainer: {\n width: '100%',\n backgroundColor: theme.palette.background.paper,\n border: `1px solid ${theme.palette.action.selected}`,\n borderRadius: theme.shape.borderRadius,\n '&:not(:first-child)': {\n marginTop: theme.spacing(2),\n },\n },\n postHighlightList: {\n paddingBottom: '0px',\n '& p': {\n marginTop: '0',\n marginBottom: '0',\n },\n },\n filterPanel: {\n border: `1px solid ${theme.palette.action.selected}`,\n borderRadius: theme.shape.borderRadius,\n padding: theme.spacing(3),\n },\n questionCardMetadata: {\n marginTop: theme.spacing(3),\n },\n marginRight: {\n marginRight: `${theme.spacing(2)} !important`,\n },\n marginLeft: {\n marginLeft: `${theme.spacing(2)} !important`,\n },\n questionCardActions: {\n marginTop: theme.spacing(2),\n '& a': {\n marginRight: theme.spacing(1),\n },\n },\n noPadding: {\n padding: `0 !important`,\n },\n deleteModal: {\n position: 'absolute',\n top: '20%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n width: 400,\n backgroundColor: theme.palette.background.default,\n border: `1px solid ${theme.palette.action.selected}`,\n borderRadius: theme.shape.borderRadius,\n padding: theme.spacing(2),\n '& button': {\n marginTop: theme.spacing(2),\n float: 'right',\n },\n },\n highlight: {\n animation: '$highlight 2s',\n },\n '@keyframes highlight': {\n '0%': {\n boxShadow: `0px 0px 0px 3px ${theme.palette.secondary.light}`,\n },\n '100%': {\n boxShadow: 'none',\n },\n },\n dateFilter: {\n minWidth: '200px',\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n },\n };\n },\n { name: 'Qeta' },\n);\n"],"names":[],"mappings":";;AAEO,MAAM,SAAY,GAAA,UAAA;AAAA,EACvB,CAAS,KAAA,KAAA;AACP,IAAO,OAAA;AAAA,MACL,eAAiB,EAAA;AAAA,QACf,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,QAC1B,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,OAC/B;AAAA,MACA,YAAc,EAAA;AAAA,QACZ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,QAC7B,QAAU,EAAA,UAAA;AAAA,OACZ;AAAA,MACA,gBAAkB,EAAA;AAAA,QAChB,SAA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AAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,OAC/B;AAAA,KACF,CAAA;AAAA,GACF;AAAA,EACA,EAAE,MAAM,MAAO,EAAA;AACjB;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { useEffect, useCallback } from 'react';
|
|
2
2
|
import { useApi } from '@backstage/core-plugin-api';
|
|
3
3
|
import { qetaApiRef } from '../api.esm.js';
|
|
4
4
|
|
|
5
5
|
let followedTags = void 0;
|
|
6
6
|
const useTagsFollow = () => {
|
|
7
|
-
const [tags, setTags] =
|
|
8
|
-
const [loading, setLoading] =
|
|
7
|
+
const [tags, setTags] = React__default.useState(followedTags ?? []);
|
|
8
|
+
const [loading, setLoading] = React__default.useState(followedTags === void 0);
|
|
9
9
|
const qetaApi = useApi(qetaApiRef);
|
|
10
10
|
useEffect(() => {
|
|
11
11
|
if (followedTags === void 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTagsFollow.esm.js","sources":["../../src/hooks/useTagsFollow.ts"],"sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { qetaApiRef } from '../api';\n\nlet followedTags: string[] | undefined = undefined;\n\nexport const useTagsFollow = () => {\n const [tags, setTags] = React.useState<string[]>(followedTags ?? []);\n const [loading, setLoading] = React.useState(followedTags === undefined);\n const qetaApi = useApi(qetaApiRef);\n\n useEffect(() => {\n if (followedTags === undefined) {\n qetaApi.getFollowedTags().then(res => {\n followedTags = res.tags;\n setTags(res.tags);\n setLoading(false);\n });\n } else {\n setTags(followedTags);\n }\n }, [qetaApi]);\n\n const followTag = useCallback(\n (tag: string) => {\n qetaApi.followTag(tag).then(() => {\n setTags(prev => [...prev, tag]);\n followedTags?.push(tag);\n });\n },\n [qetaApi],\n );\n\n const unfollowTag = useCallback(\n (tag: string) => {\n qetaApi.unfollowTag(tag).then(() => {\n setTags(prev => prev.filter(t => t !== tag));\n followedTags = followedTags?.filter(t => t !== tag);\n });\n },\n [qetaApi],\n );\n\n const isFollowingTag = useCallback(\n (tag: string) => tags.includes(tag),\n [tags],\n );\n return {\n tags,\n followTag,\n unfollowTag,\n isFollowingTag,\n loading,\n };\n};\n"],"names":[],"mappings":";;;;AAIA,IAAI,YAAqC,GAAA,KAAA,CAAA,CAAA;AAElC,MAAM,gBAAgB,MAAM;AACjC,EAAM,MAAA,CAAC,MAAM,OAAO,CAAA,
|
|
1
|
+
{"version":3,"file":"useTagsFollow.esm.js","sources":["../../src/hooks/useTagsFollow.ts"],"sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { qetaApiRef } from '../api';\n\nlet followedTags: string[] | undefined = undefined;\n\nexport const useTagsFollow = () => {\n const [tags, setTags] = React.useState<string[]>(followedTags ?? []);\n const [loading, setLoading] = React.useState(followedTags === undefined);\n const qetaApi = useApi(qetaApiRef);\n\n useEffect(() => {\n if (followedTags === undefined) {\n qetaApi.getFollowedTags().then(res => {\n followedTags = res.tags;\n setTags(res.tags);\n setLoading(false);\n });\n } else {\n setTags(followedTags);\n }\n }, [qetaApi]);\n\n const followTag = useCallback(\n (tag: string) => {\n qetaApi.followTag(tag).then(() => {\n setTags(prev => [...prev, tag]);\n followedTags?.push(tag);\n });\n },\n [qetaApi],\n );\n\n const unfollowTag = useCallback(\n (tag: string) => {\n qetaApi.unfollowTag(tag).then(() => {\n setTags(prev => prev.filter(t => t !== tag));\n followedTags = followedTags?.filter(t => t !== tag);\n });\n },\n [qetaApi],\n );\n\n const isFollowingTag = useCallback(\n (tag: string) => tags.includes(tag),\n [tags],\n );\n return {\n tags,\n followTag,\n unfollowTag,\n isFollowingTag,\n loading,\n };\n};\n"],"names":["React"],"mappings":";;;;AAIA,IAAI,YAAqC,GAAA,KAAA,CAAA,CAAA;AAElC,MAAM,gBAAgB,MAAM;AACjC,EAAM,MAAA,CAAC,MAAM,OAAO,CAAA,GAAIA,eAAM,Q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AAC,CAAA,CAAA;AAC3C,QAAA,YAAA,GAAe,YAAc,EAAA,MAAA,CAAO,CAAK,CAAA,KAAA,CAAA,KAAM,GAAG,CAAA,CAAA;AAAA,OACnD,CAAA,CAAA;AAAA,KACH;AAAA,IACA,CAAC,OAAO,CAAA;AAAA,GACV,CAAA;AAEA,EAAA,MAAM,cAAiB,GAAA,WAAA;AAAA,IACrB,CAAC,GAAA,KAAgB,IAAK,CAAA,QAAA,CAAS,GAAG,CAAA;AAAA,IAClC,CAAC,IAAI,CAAA;AAAA,GACP,CAAA;AACA,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,OAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { useEffect, useCallback } from 'react';
|
|
2
2
|
import { useApi } from '@backstage/core-plugin-api';
|
|
3
3
|
import { qetaApiRef } from '../api.esm.js';
|
|
4
4
|
|
|
5
5
|
let followedUsers = void 0;
|
|
6
6
|
const useUserFollow = () => {
|
|
7
|
-
const [users, setUsers] =
|
|
8
|
-
const [loading, setLoading] =
|
|
7
|
+
const [users, setUsers] = React__default.useState(followedUsers ?? []);
|
|
8
|
+
const [loading, setLoading] = React__default.useState(followedUsers === void 0);
|
|
9
9
|
const qetaApi = useApi(qetaApiRef);
|
|
10
10
|
useEffect(() => {
|
|
11
11
|
if (followedUsers === void 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUserFollow.esm.js","sources":["../../src/hooks/useUserFollow.ts"],"sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { qetaApiRef } from '../api';\n\nlet followedUsers: string[] | undefined = undefined;\n\nexport const useUserFollow = () => {\n const [users, setUsers] = React.useState<string[]>(followedUsers ?? []);\n const [loading, setLoading] = React.useState(followedUsers === undefined);\n const qetaApi = useApi(qetaApiRef);\n\n useEffect(() => {\n if (followedUsers === undefined) {\n qetaApi.getFollowedUsers().then(res => {\n followedUsers = res.followedUserRefs;\n setUsers(res.followedUserRefs);\n setLoading(false);\n });\n } else {\n setUsers(followedUsers);\n }\n }, [qetaApi]);\n\n const followUser = useCallback(\n (user: string) => {\n qetaApi.followUser(user).then(() => {\n setUsers(prev => [...prev, user]);\n followedUsers?.push(user);\n });\n },\n [qetaApi],\n );\n\n const unfollowUser = useCallback(\n (user: string) => {\n qetaApi.unfollowUser(user).then(() => {\n setUsers(prev => prev.filter(t => t !== user));\n followedUsers = followedUsers?.filter(t => t !== user);\n });\n },\n [qetaApi],\n );\n\n const isFollowingUser = useCallback(\n (user: string) => users.includes(user),\n [users],\n );\n return {\n users,\n followUser,\n unfollowUser,\n isFollowingUser,\n loading,\n };\n};\n"],"names":[],"mappings":";;;;AAIA,IAAI,aAAsC,GAAA,KAAA,CAAA,CAAA;AAEnC,MAAM,gBAAgB,MAAM;AACjC,EAAM,MAAA,CAAC,OAAO,QAAQ,CAAA,
|
|
1
|
+
{"version":3,"file":"useUserFollow.esm.js","sources":["../../src/hooks/useUserFollow.ts"],"sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { qetaApiRef } from '../api';\n\nlet followedUsers: string[] | undefined = undefined;\n\nexport const useUserFollow = () => {\n const [users, setUsers] = React.useState<string[]>(followedUsers ?? []);\n const [loading, setLoading] = React.useState(followedUsers === undefined);\n const qetaApi = useApi(qetaApiRef);\n\n useEffect(() => {\n if (followedUsers === undefined) {\n qetaApi.getFollowedUsers().then(res => {\n followedUsers = res.followedUserRefs;\n setUsers(res.followedUserRefs);\n setLoading(false);\n });\n } else {\n setUsers(followedUsers);\n }\n }, [qetaApi]);\n\n const followUser = useCallback(\n (user: string) => {\n qetaApi.followUser(user).then(() => {\n setUsers(prev => [...prev, user]);\n followedUsers?.push(user);\n });\n },\n [qetaApi],\n );\n\n const unfollowUser = useCallback(\n (user: string) => {\n qetaApi.unfollowUser(user).then(() => {\n setUsers(prev => prev.filter(t => t !== user));\n followedUsers = followedUsers?.filter(t => t !== user);\n });\n },\n [qetaApi],\n );\n\n const isFollowingUser = useCallback(\n (user: string) => users.includes(user),\n [users],\n );\n return {\n users,\n followUser,\n unfollowUser,\n isFollowingUser,\n loading,\n };\n};\n"],"names":["React"],"mappings":";;;;AAIA,IAAI,aAAsC,GAAA,KAAA,CAAA,CAAA;AAEnC,MAAM,gBAAgB,MAAM;AACjC,EAAM,MAAA,CAAC,OAAO,QAAQ,CAAA,GAAIA,eAAM,QAAmB,CAAA,aAAA,IAAiB,EAAE,CAAA,CAAA;AACtE,EAAA,MAAM,CAAC,OAAS,EAAA,UAAU,IAAIA,cAAM,CAAA,QAAA,CAAS,kBAAkB,KAAS,CAAA,CAAA,CAAA;AACxE,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA,CAAA;AAEjC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,kBAAkB,KAAW,CAAA,EAAA;AAC/B,MAAQ,OAAA,CAAA,gBAAA,EAAmB,CAAA,IAAA,CAAK,CAAO,GAAA,KAAA;AACrC,QAAA,aAAA,GAAgB,GAAI,CAAA,gBAAA,CAAA;AACpB,QAAA,QAAA,CAAS,IAAI,gBAAgB,CAAA,CAAA;AAC7B,QAAA,UAAA,CAAW,KAAK,CAAA,CAAA;AAAA,OACjB,CAAA,CAAA;AAAA,KACI,MAAA;AACL,MAAA,QAAA,CAAS,aAAa,CAAA,CAAA;AAAA,KACxB;AAAA,GACF,EAAG,CAAC,OAAO,CAAC,CAAA,CAAA;AAEZ,EAAA,MAAM,UAAa,GAAA,WAAA;AAAA,IACjB,CAAC,IAAiB,KAAA;AAChB,MAAA,OAAA,CAAQ,UAAW,CAAA,IAAI,CAAE,CAAA,IAAA,CAAK,MAAM;AAClC,QAAA,QAAA,CAAS,CAAQ,IAAA,KAAA,CAAC,GAAG,IAAA,EAAM,IAAI,CAAC,CAAA,CAAA;AAChC,QAAA,aAAA,EAAe,KAAK,IAAI,CAAA,CAAA;AAAA,OACzB,CAAA,CAAA;AAAA,KACH;AAAA,IACA,CAAC,OAAO,CAAA;AAAA,GACV,CAAA;AAEA,EAAA,MAAM,YAAe,GAAA,WAAA;AAAA,IACnB,CAAC,IAAiB,KAAA;AAChB,MAAA,OAAA,CAAQ,YAAa,CAAA,IAAI,CAAE,CAAA,IAAA,CAAK,MAAM;AACpC,QAAA,QAAA,CAAS,UAAQ,IAAK,CAAA,MAAA,CAAO,CAAK,CAAA,KAAA,CAAA,KAAM,IAAI,CAAC,CAAA,CAAA;AAC7C,QAAA,aAAA,GAAgB,aAAe,EAAA,MAAA,CAAO,CAAK,CAAA,KAAA,CAAA,KAAM,IAAI,CAAA,CAAA;AAAA,OACtD,CAAA,CAAA;AAAA,KACH;AAAA,IACA,CAAC,OAAO,CAAA;AAAA,GACV,CAAA;AAEA,EAAA,MAAM,eAAkB,GAAA,WAAA;AAAA,IACtB,CAAC,IAAA,KAAiB,KAAM,CAAA,QAAA,CAAS,IAAI,CAAA;AAAA,IACrC,CAAC,KAAK,CAAA;AAAA,GACR,CAAA;AACA,EAAO,OAAA;AAAA,IACL,KAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { useState, useEffect } from 'react';
|
|
2
2
|
import { useAnalytics, useApi } from '@backstage/core-plugin-api';
|
|
3
3
|
import { qetaApiRef } from '../api.esm.js';
|
|
4
4
|
import { useTranslation } from './useTranslation.esm.js';
|
|
5
5
|
import { useSignal } from '@backstage/plugin-signals-react';
|
|
6
6
|
|
|
7
7
|
function useVoting(resp) {
|
|
8
|
-
const [entity, setEntity] =
|
|
8
|
+
const [entity, setEntity] = React__default.useState(
|
|
9
9
|
resp
|
|
10
10
|
);
|
|
11
|
-
const [ownVote, setOwnVote] =
|
|
11
|
+
const [ownVote, setOwnVote] = React__default.useState(entity.ownVote ?? 0);
|
|
12
12
|
const [correctAnswer, setCorrectAnswer] = useState(
|
|
13
13
|
"postId" in entity ? entity.correct : false
|
|
14
14
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoting.esm.js","sources":["../../src/hooks/useVoting.ts"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { qetaApiRef } from '../api';\nimport { useTranslation } from './useTranslation';\nimport { useSignal } from '@backstage/plugin-signals-react';\nimport {\n AnswerResponse,\n PostResponse,\n QetaSignal,\n} from '@drodil/backstage-plugin-qeta-common';\n\nexport function useVoting(resp: PostResponse | AnswerResponse) {\n const [entity, setEntity] = React.useState<PostResponse | AnswerResponse>(\n resp,\n );\n const [ownVote, setOwnVote] = React.useState(entity.ownVote ?? 0);\n const [correctAnswer, setCorrectAnswer] = useState(\n 'postId' in entity ? entity.correct : false,\n );\n const [score, setScore] = useState(entity.score);\n const analytics = useAnalytics();\n const qetaApi = useApi(qetaApiRef);\n const { t } = useTranslation();\n\n const isQuestion = 'title' in entity;\n const own = entity.own ?? false;\n\n const { lastSignal } = useSignal<QetaSignal>(\n isQuestion ? `qeta:question_${entity.id}` : `qeta:answer_${entity.id}`,\n );\n\n useEffect(() => {\n if (entity) {\n setScore(entity.score);\n }\n }, [entity]);\n\n useEffect(() => {\n if (\n lastSignal?.type === 'post_stats' ||\n lastSignal?.type === 'answer_stats'\n ) {\n setCorrectAnswer(lastSignal.correctAnswer);\n setScore(lastSignal.score);\n }\n }, [lastSignal]);\n\n const deletePostVote = (id: number) => {\n qetaApi.deletePostVote(id).then(response => {\n setOwnVote(0);\n analytics.captureEvent('vote', 'question', { value: 0 });\n setEntity(response);\n });\n };\n\n const deleteAnswerVote = (postId: number, id: number) => {\n qetaApi.deleteAnswerVote(postId, id).then(response => {\n setOwnVote(0);\n analytics.captureEvent('vote', 'answer', { value: 0 });\n setEntity(response);\n });\n };\n\n const voteUp = () => {\n if (isQuestion) {\n if (ownVote > 0) {\n deletePostVote(entity.id);\n return;\n }\n qetaApi.votePostUp(entity.id).then(response => {\n setOwnVote(1);\n analytics.captureEvent('vote', 'question', { value: 1 });\n setEntity(response);\n });\n } else if ('postId' in entity) {\n if (ownVote > 0) {\n deleteAnswerVote(entity.postId, entity.id);\n return;\n }\n qetaApi.voteAnswerUp(entity.postId, entity.id).then(response => {\n setOwnVote(1);\n analytics.captureEvent('vote', 'answer', { value: 1 });\n setEntity(response);\n });\n }\n };\n\n const voteDown = () => {\n if (isQuestion) {\n if (ownVote < 0) {\n deletePostVote(entity.id);\n return;\n }\n qetaApi.votePostDown(entity.id).then(response => {\n setOwnVote(-1);\n analytics.captureEvent('vote', 'question', { value: -1 });\n setEntity(response);\n });\n } else if ('postId' in entity) {\n if (ownVote < 0) {\n deleteAnswerVote(entity.postId, entity.id);\n return;\n }\n qetaApi.voteAnswerDown(entity.postId, entity.id).then(response => {\n setOwnVote(-1);\n analytics.captureEvent('vote', 'answer', { value: -1 });\n setEntity(response);\n });\n }\n };\n\n let correctTooltip: string = correctAnswer\n ? t('voteButtons.answer.markIncorrect')\n : t('voteButtons.answer.markCorrect');\n if (!entity?.own) {\n correctTooltip = correctAnswer ? t('voteButtons.answer.marked') : '';\n }\n\n let voteUpTooltip: string = isQuestion\n ? t('voteButtons.question.good')\n : t('voteButtons.answer.good');\n if (own) {\n voteUpTooltip = isQuestion\n ? t('voteButtons.question.own')\n : t('voteButtons.answer.own');\n }\n\n let voteDownTooltip: string = isQuestion\n ? t('voteButtons.question.bad')\n : t('voteButtons.answer.bad');\n if (own) {\n voteDownTooltip = voteUpTooltip;\n }\n\n const toggleCorrectAnswer = () => {\n if (!('postId' in entity)) {\n return;\n }\n if (correctAnswer) {\n qetaApi.markAnswerIncorrect(entity.postId, entity.id).then(response => {\n if (response) {\n setCorrectAnswer(false);\n }\n });\n } else {\n qetaApi.markAnswerCorrect(entity.postId, entity.id).then(response => {\n if (response) {\n setCorrectAnswer(true);\n }\n });\n }\n };\n\n return {\n entity,\n ownVote,\n correctAnswer,\n score,\n voteUp,\n voteDown,\n toggleCorrectAnswer,\n voteUpTooltip,\n voteDownTooltip,\n correctTooltip,\n };\n}\n"],"names":[],"mappings":";;;;;;AAWO,SAAS,UAAU,IAAqC,EAAA;AAC7D,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,
|
|
1
|
+
{"version":3,"file":"useVoting.esm.js","sources":["../../src/hooks/useVoting.ts"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { useAnalytics, useApi } from '@backstage/core-plugin-api';\nimport { qetaApiRef } from '../api';\nimport { useTranslation } from './useTranslation';\nimport { useSignal } from '@backstage/plugin-signals-react';\nimport {\n AnswerResponse,\n PostResponse,\n QetaSignal,\n} from '@drodil/backstage-plugin-qeta-common';\n\nexport function useVoting(resp: PostResponse | AnswerResponse) {\n const [entity, setEntity] = React.useState<PostResponse | AnswerResponse>(\n resp,\n );\n const [ownVote, setOwnVote] = React.useState(entity.ownVote ?? 0);\n const [correctAnswer, setCorrectAnswer] = useState(\n 'postId' in entity ? entity.correct : false,\n );\n const [score, setScore] = useState(entity.score);\n const analytics = useAnalytics();\n const qetaApi = useApi(qetaApiRef);\n const { t } = useTranslation();\n\n const isQuestion = 'title' in entity;\n const own = entity.own ?? false;\n\n const { lastSignal } = useSignal<QetaSignal>(\n isQuestion ? `qeta:question_${entity.id}` : `qeta:answer_${entity.id}`,\n );\n\n useEffect(() => {\n if (entity) {\n setScore(entity.score);\n }\n }, [entity]);\n\n useEffect(() => {\n if (\n lastSignal?.type === 'post_stats' ||\n lastSignal?.type === 'answer_stats'\n ) {\n setCorrectAnswer(lastSignal.correctAnswer);\n setScore(lastSignal.score);\n }\n }, [lastSignal]);\n\n const deletePostVote = (id: number) => {\n qetaApi.deletePostVote(id).then(response => {\n setOwnVote(0);\n analytics.captureEvent('vote', 'question', { value: 0 });\n setEntity(response);\n });\n };\n\n const deleteAnswerVote = (postId: number, id: number) => {\n qetaApi.deleteAnswerVote(postId, id).then(response => {\n setOwnVote(0);\n analytics.captureEvent('vote', 'answer', { value: 0 });\n setEntity(response);\n });\n };\n\n const voteUp = () => {\n if (isQuestion) {\n if (ownVote > 0) {\n deletePostVote(entity.id);\n return;\n }\n qetaApi.votePostUp(entity.id).then(response => {\n setOwnVote(1);\n analytics.captureEvent('vote', 'question', { value: 1 });\n setEntity(response);\n });\n } else if ('postId' in entity) {\n if (ownVote > 0) {\n deleteAnswerVote(entity.postId, entity.id);\n return;\n }\n qetaApi.voteAnswerUp(entity.postId, entity.id).then(response => {\n setOwnVote(1);\n analytics.captureEvent('vote', 'answer', { value: 1 });\n setEntity(response);\n });\n }\n };\n\n const voteDown = () => {\n if (isQuestion) {\n if (ownVote < 0) {\n deletePostVote(entity.id);\n return;\n }\n qetaApi.votePostDown(entity.id).then(response => {\n setOwnVote(-1);\n analytics.captureEvent('vote', 'question', { value: -1 });\n setEntity(response);\n });\n } else if ('postId' in entity) {\n if (ownVote < 0) {\n deleteAnswerVote(entity.postId, entity.id);\n return;\n }\n qetaApi.voteAnswerDown(entity.postId, entity.id).then(response => {\n setOwnVote(-1);\n analytics.captureEvent('vote', 'answer', { value: -1 });\n setEntity(response);\n });\n }\n };\n\n let correctTooltip: string = correctAnswer\n ? t('voteButtons.answer.markIncorrect')\n : t('voteButtons.answer.markCorrect');\n if (!entity?.own) {\n correctTooltip = correctAnswer ? t('voteButtons.answer.marked') : '';\n }\n\n let voteUpTooltip: string = isQuestion\n ? t('voteButtons.question.good')\n : t('voteButtons.answer.good');\n if (own) {\n voteUpTooltip = isQuestion\n ? t('voteButtons.question.own')\n : t('voteButtons.answer.own');\n }\n\n let voteDownTooltip: string = isQuestion\n ? t('voteButtons.question.bad')\n : t('voteButtons.answer.bad');\n if (own) {\n voteDownTooltip = voteUpTooltip;\n }\n\n const toggleCorrectAnswer = () => {\n if (!('postId' in entity)) {\n return;\n }\n if (correctAnswer) {\n qetaApi.markAnswerIncorrect(entity.postId, entity.id).then(response => {\n if (response) {\n setCorrectAnswer(false);\n }\n });\n } else {\n qetaApi.markAnswerCorrect(entity.postId, entity.id).then(response => {\n if (response) {\n setCorrectAnswer(true);\n }\n });\n }\n };\n\n return {\n entity,\n ownVote,\n correctAnswer,\n score,\n voteUp,\n voteDown,\n toggleCorrectAnswer,\n voteUpTooltip,\n voteDownTooltip,\n correctTooltip,\n };\n}\n"],"names":["React"],"mappings":";;;;;;AAWO,SAAS,UAAU,IAAqC,EAAA;AAC7D,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAIA,cAAM,CAAA,QAAA;AAAA,IAChC,IAAA;AAAA,GACF,CAAA;AACA,EAAM,MAAA,CAAC,SAAS,UAAU,CAAA,GAAIA,eAAM,QAAS,CAAA,MAAA,CAAO,WAAW,CAAC,CAAA,CAAA;AAChE,EAAM,MAAA,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAA,QAAA;AAAA,IACxC,QAAA,IAAY,MAAS,GAAA,MAAA,CAAO,OAAU,GAAA,KAAA;AAAA,GACxC,CAAA;AACA,EAAA,MAAM,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAA,QAAA,CAAS,OAAO,KAAK,CAAA,CAAA;AAC/C,EAAA,MAAM,YAAY,YAAa,EAAA,CAAA;AAC/B,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA,CAAA;AACjC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA,CAAA;AAE7B,EAAA,MAAM,aAAa,OAAW,IAAA,MAAA,CAAA;AAC9B,EAAM,MAAA,GAAA,GAAM,OAAO,GAAO,IAAA,KAAA,CAAA;AAE1B,EAAM,MAAA,EAAE,YAAe,GAAA,SAAA;AAAA,IACrB,aAAa,CAAiB,cAAA,EAAA,MAAA,CAAO,EAAE,CAAK,CAAA,GAAA,CAAA,YAAA,EAA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,GAAA,CAAA,CAAE,0BAA0B,CAAA,GAC5B,EAAE,wBAAwB,CAAA,CAAA;AAC9B,EAAA,IAAI,GAAK,EAAA;AACP,IAAkB,eAAA,GAAA,aAAA,CAAA;AAAA,GACpB;AAEA,EAAA,MAAM,sBAAsB,MAAM;AAChC,IAAI,IAAA,EAAE,YAAY,MAAS,CAAA,EAAA;AACzB,MAAA,OAAA;AAAA,KACF;AACA,IAAA,IAAI,aAAe,EAAA;AACjB,MAAA,OAAA,CAAQ,oBAAoB,MAAO,CAAA,MAAA,EAAQ,OAAO,EAAE,CAAA,CAAE,KAAK,CAAY,QAAA,KAAA;AACrE,QAAA,IAAI,QAAU,EAAA;AACZ,UAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAAA,SACxB;AAAA,OACD,CAAA,CAAA;AAAA,KACI,MAAA;AACL,MAAA,OAAA,CAAQ,kBAAkB,MAAO,CAAA,MAAA,EAAQ,OAAO,EAAE,CAAA,CAAE,KAAK,CAAY,QAAA,KAAA;AACnE,QAAA,IAAI,QAAU,EAAA;AACZ,UAAA,gBAAA,CAAiB,IAAI,CAAA,CAAA;AAAA,SACvB;AAAA,OACD,CAAA,CAAA;AAAA,KACH;AAAA,GACF,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,MAAA;AAAA,IACA,OAAA;AAAA,IACA,aAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA,mBAAA;AAAA,IACA,aAAA;AAAA,IACA,eAAA;AAAA,IACA,cAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ import { QetaApi, PostType, PostResponse, Template, PostsResponse, AnswersRespon
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Entity } from '@backstage/catalog-model';
|
|
7
7
|
import { LinkProps } from '@backstage/core-components';
|
|
8
|
-
import { SvgIconProps } from '@material
|
|
8
|
+
import { SvgIconProps } from '@mui/material/SvgIcon';
|
|
9
9
|
import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
|
|
10
|
-
import * as
|
|
10
|
+
import * as _mui_styles_withStyles from '@mui/styles/withStyles';
|
|
11
11
|
import * as react_use_lib_useAsyncFn from 'react-use/lib/useAsyncFn';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { ComponentsOverrides } from '@mui/material/styles';
|
|
13
|
+
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
14
14
|
|
|
15
15
|
declare const qetaRouteRef: _backstage_core_plugin_api.RouteRef<undefined>;
|
|
16
16
|
declare const askRouteRef: _backstage_core_plugin_api.SubRouteRef<undefined>;
|
|
@@ -126,7 +126,7 @@ declare const PostList: (props: {
|
|
|
126
126
|
showNoQuestionsBtn?: boolean;
|
|
127
127
|
entityPage?: boolean;
|
|
128
128
|
type?: PostType;
|
|
129
|
-
}) => React.JSX.Element
|
|
129
|
+
}) => React.JSX.Element;
|
|
130
130
|
|
|
131
131
|
interface PostListItemProps {
|
|
132
132
|
post: PostResponse;
|
|
@@ -329,7 +329,7 @@ type QetaLeftMenuClassKey = 'leftMenu' | 'inPopup' | 'outsidePopup' | 'selectedM
|
|
|
329
329
|
declare const LeftMenu: (props: {
|
|
330
330
|
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
331
331
|
autoFocusItem?: boolean;
|
|
332
|
-
onClick?: (event: React.MouseEvent<EventTarget>) => void;
|
|
332
|
+
onClick?: (event: MouseEvent | TouchEvent | React.MouseEvent<EventTarget>) => void;
|
|
333
333
|
inPopup?: boolean;
|
|
334
334
|
}) => React.JSX.Element;
|
|
335
335
|
|
|
@@ -390,7 +390,7 @@ declare const useTranslation: () => {
|
|
|
390
390
|
readonly "favorite.add": "Mark this post as favorite";
|
|
391
391
|
readonly "favorite.remove": "Remove this post from favorites";
|
|
392
392
|
readonly "statistics.errorLoading": "Could not load statistics";
|
|
393
|
-
readonly "statistics.ranking": "
|
|
393
|
+
readonly "statistics.ranking": "User ranking 🏆";
|
|
394
394
|
readonly "statistics.notAvailable": "Statistics are unavailable";
|
|
395
395
|
readonly "statistics.mostQuestions.title": "Most questions";
|
|
396
396
|
readonly "statistics.mostQuestions.description": "People who have posted most questions";
|
|
@@ -404,17 +404,17 @@ declare const useTranslation: () => {
|
|
|
404
404
|
readonly "statistics.topVotedCorrectAnswers.description": "People who have the highest rated correct answers";
|
|
405
405
|
readonly "answer.questionTitle": "Q: {{question}}";
|
|
406
406
|
readonly "answer.answeredTime": "answered";
|
|
407
|
-
readonly "link.answer": "Copy link to this answer to clipboard";
|
|
408
407
|
readonly "link.post": "Copy link to this post to clipboard";
|
|
408
|
+
readonly "link.answer": "Copy link to this answer to clipboard";
|
|
409
409
|
readonly "link.aria": "Copy link to clipboard";
|
|
410
410
|
readonly pluginName: "Q&A";
|
|
411
411
|
readonly "answerList.noAnswers": "No answers";
|
|
412
412
|
readonly "answerList.errorLoading": "Could not load answers";
|
|
413
413
|
readonly "answerList.limitSelect": "Answers per page";
|
|
414
|
+
readonly "common.post": "post";
|
|
414
415
|
readonly "common.question": "question";
|
|
415
416
|
readonly "common.article": "article";
|
|
416
417
|
readonly "common.score": "{{score}} score";
|
|
417
|
-
readonly "common.post": "post";
|
|
418
418
|
readonly "common.comments": "Comments";
|
|
419
419
|
readonly "common.anonymousAuthor": "Anonymous";
|
|
420
420
|
readonly "common.answers_zero": "No answers";
|
|
@@ -441,7 +441,7 @@ declare const useTranslation: () => {
|
|
|
441
441
|
readonly "answerContainer.title.answersBy": "Answers by";
|
|
442
442
|
readonly "answerContainer.title.answersAbout": "Answers about";
|
|
443
443
|
readonly "answerContainer.title.answersTagged": "Answers tagged with {{tags}}";
|
|
444
|
-
readonly "answerContainer.search.label": "Search
|
|
444
|
+
readonly "answerContainer.search.label": "Search answer";
|
|
445
445
|
readonly "answerContainer.search.placeholder": "Search...";
|
|
446
446
|
readonly "anonymousCheckbox.tooltip": "By enabling this, other users won't be able to see you as an author";
|
|
447
447
|
readonly "anonymousCheckbox.answerAnonymously": "Answer anonymously";
|
|
@@ -486,18 +486,18 @@ declare const useTranslation: () => {
|
|
|
486
486
|
readonly "addToCollectionButton.manage": "Add or remove this post from collections";
|
|
487
487
|
readonly "addToCollectionButton.close": "Close";
|
|
488
488
|
readonly "writeArticleButton.title": "Write an article";
|
|
489
|
-
readonly "createCollectionButton.title": "Create collection";
|
|
489
|
+
readonly "createCollectionButton.title": "Create a collection";
|
|
490
490
|
readonly "commentList.deleteLink": "delete";
|
|
491
|
-
readonly "commentSection.input.placeholder": "Your comment";
|
|
492
491
|
readonly "commentSection.post": "Post";
|
|
492
|
+
readonly "commentSection.input.placeholder": "Your comment";
|
|
493
493
|
readonly "commentSection.addComment": "Add a comment";
|
|
494
494
|
readonly "editTagModal.title": "Edit tag {{tag}}";
|
|
495
495
|
readonly "editTagModal.errorPosting": "Failed to edit";
|
|
496
496
|
readonly "editTagModal.description": "Tag description";
|
|
497
497
|
readonly "editTagModal.saveButton": "Save";
|
|
498
498
|
readonly "editTagModal.cancelButton": "Cancel";
|
|
499
|
-
readonly "deleteModal.title.question": "Are you sure you want to delete this post?";
|
|
500
499
|
readonly "deleteModal.title.answer": "Are you sure you want to delete this answer?";
|
|
500
|
+
readonly "deleteModal.title.question": "Are you sure you want to delete this post?";
|
|
501
501
|
readonly "deleteModal.title.collection": "Are you sure you want to delete this collection?";
|
|
502
502
|
readonly "deleteModal.cancelButton": "Cancel";
|
|
503
503
|
readonly "deleteModal.errorDeleting": "Failed to delete";
|
|
@@ -568,7 +568,7 @@ declare const useTranslation: () => {
|
|
|
568
568
|
readonly "templateSelectList.genericQuestionDescription": "Create a generic question";
|
|
569
569
|
readonly "pagination.defaultTooltip": "Number of items";
|
|
570
570
|
readonly "collectionsPage.title": "Collections";
|
|
571
|
-
readonly "collectionsPage.search.label": "Search
|
|
571
|
+
readonly "collectionsPage.search.label": "Search collection";
|
|
572
572
|
readonly "collectionsPage.search.placeholder": "Search...";
|
|
573
573
|
readonly "collectionPage.description": "Description";
|
|
574
574
|
readonly "collectionPage.info": "You can add questions and articles to the collection from question and article pages";
|
|
@@ -590,15 +590,15 @@ declare const useTranslation: () => {
|
|
|
590
590
|
readonly "authorBox.postedAtTime": "Posted";
|
|
591
591
|
readonly "authorBox.updatedAtTime": "Updated";
|
|
592
592
|
readonly "authorBox.updatedBy": "by";
|
|
593
|
-
readonly "voteButtons.question.own": "You cannot vote your own post";
|
|
594
|
-
readonly "voteButtons.question.good": "This post is good";
|
|
595
|
-
readonly "voteButtons.question.bad": "This post is not good";
|
|
596
593
|
readonly "voteButtons.answer.own": "You cannot vote your own answer";
|
|
597
594
|
readonly "voteButtons.answer.markCorrect": "Mark this answer correct";
|
|
598
595
|
readonly "voteButtons.answer.markIncorrect": "Mark this answer incorrect";
|
|
599
596
|
readonly "voteButtons.answer.marked": "This answer has been marked as correct";
|
|
600
597
|
readonly "voteButtons.answer.good": "This answer is good";
|
|
601
598
|
readonly "voteButtons.answer.bad": "This answer is not good";
|
|
599
|
+
readonly "voteButtons.question.own": "You cannot vote your own post";
|
|
600
|
+
readonly "voteButtons.question.good": "This post is good";
|
|
601
|
+
readonly "voteButtons.question.bad": "This post is not good";
|
|
602
602
|
readonly "datePicker.range.default": "Select";
|
|
603
603
|
readonly "datePicker.range.label": "Date range";
|
|
604
604
|
readonly "datePicker.range.last7days": "Last 7 days";
|
|
@@ -646,7 +646,7 @@ declare const useTranslation: () => {
|
|
|
646
646
|
readonly "postsContainer.title.about": "{{itemType}}s about";
|
|
647
647
|
readonly "postsContainer.title.by": "{{itemType}}s by";
|
|
648
648
|
readonly "postsContainer.title.tagged": "{{itemType}} tagged with {{tags}}";
|
|
649
|
-
readonly "postsContainer.search.label": "Search
|
|
649
|
+
readonly "postsContainer.search.label": "Search {{itemType}}";
|
|
650
650
|
readonly "postsContainer.search.placeholder": "Search...";
|
|
651
651
|
readonly "postsContainer.createButton": "Go ahead and create one!";
|
|
652
652
|
readonly "postsContainer.noItems": "No {{itemType}}s";
|
|
@@ -663,15 +663,15 @@ declare const useTranslation: () => {
|
|
|
663
663
|
readonly "tagPage.errorLoading": "Could not load tags";
|
|
664
664
|
readonly "tagPage.defaultTitle": "Tags";
|
|
665
665
|
readonly "tagPage.tags_zero": "No tags";
|
|
666
|
-
readonly "tagPage.tags_one": "
|
|
667
|
-
readonly "tagPage.tags_other": "
|
|
666
|
+
readonly "tagPage.tags_one": "{{count}} tag";
|
|
667
|
+
readonly "tagPage.tags_other": "{{count}} tags";
|
|
668
668
|
readonly "entitiesPage.search.label": "Search entity";
|
|
669
669
|
readonly "entitiesPage.search.placeholder": "Search...";
|
|
670
670
|
readonly "entitiesPage.errorLoading": "Could not load entities";
|
|
671
671
|
readonly "entitiesPage.defaultTitle": "Entities";
|
|
672
672
|
readonly "entitiesPage.entities_zero": "No entities";
|
|
673
|
-
readonly "entitiesPage.entities_one": "
|
|
674
|
-
readonly "entitiesPage.entities_other": "
|
|
673
|
+
readonly "entitiesPage.entities_one": "{{count}} entity";
|
|
674
|
+
readonly "entitiesPage.entities_other": "{{count}} entities";
|
|
675
675
|
readonly "aiAnswerCard.answer": "Answer from {{name}}";
|
|
676
676
|
readonly "aiAnswerCard.summary": "Summary by {{name}}";
|
|
677
677
|
readonly "aiAnswerCard.hide": "Hide";
|
|
@@ -684,8 +684,8 @@ declare const useTranslation: () => {
|
|
|
684
684
|
readonly "usersPage.errorLoading": "Could not load users";
|
|
685
685
|
readonly "usersPage.defaultTitle": "users";
|
|
686
686
|
readonly "usersPage.users_zero": "No users";
|
|
687
|
-
readonly "usersPage.users_one": "
|
|
688
|
-
readonly "usersPage.users_other": "
|
|
687
|
+
readonly "usersPage.users_one": "{{count}} user";
|
|
688
|
+
readonly "usersPage.users_other": "{{count}} users";
|
|
689
689
|
readonly "userPage.questions": "Questions";
|
|
690
690
|
readonly "userPage.statistics": "Statistics";
|
|
691
691
|
readonly "userPage.collections": "Collections";
|
|
@@ -734,7 +734,7 @@ declare const useUserFollow: () => {
|
|
|
734
734
|
loading: boolean;
|
|
735
735
|
};
|
|
736
736
|
|
|
737
|
-
declare const useStyles: (props?: any) =>
|
|
737
|
+
declare const useStyles: (props?: any) => _mui_styles_withStyles.ClassNameMap<"marginLeft" | "marginRight" | "deleteModal" | "filterPanel" | "questionDivider" | "questionCard" | "questionCardVote" | "questionCardContent" | "questionListItem" | "questionListItemStats" | "questionListItemContent" | "questionListItemAuthor" | "questionListItemAvatar" | "answerCardContent" | "questionListPagination" | "questionsPerPageInput" | "questionsPerPage" | "postHighlightListContainer" | "postHighlightList" | "questionCardMetadata" | "questionCardActions" | "noPadding" | "highlight" | "@keyframes highlight" | "dateFilter">;
|
|
738
738
|
|
|
739
739
|
declare function useIdentityApi<T>(f: (api: IdentityApi) => Promise<T>, deps?: any[]): react_use_lib_useAsyncFn.AsyncState<T>;
|
|
740
740
|
|
|
@@ -751,10 +751,10 @@ declare const useIsModerator: () => {
|
|
|
751
751
|
};
|
|
752
752
|
|
|
753
753
|
declare const useAI: () => {
|
|
754
|
-
isAIEnabled: boolean
|
|
755
|
-
isArticleSummaryEnabled: boolean
|
|
756
|
-
isExistingQuestionsEnabled: boolean
|
|
757
|
-
isNewQuestionsEnabled: boolean
|
|
754
|
+
isAIEnabled: boolean;
|
|
755
|
+
isArticleSummaryEnabled: boolean;
|
|
756
|
+
isExistingQuestionsEnabled: boolean;
|
|
757
|
+
isNewQuestionsEnabled: boolean;
|
|
758
758
|
answerExistingQuestion: (questionId: number, options?: AIQuery) => Promise<_drodil_backstage_plugin_qeta_common.AIResponse | null>;
|
|
759
759
|
answerDraftQuestion: (draft: {
|
|
760
760
|
title: string;
|
|
@@ -785,8 +785,8 @@ type QetaComponentsNameToClassKey = {
|
|
|
785
785
|
QetaForm: QetaFormClassKey;
|
|
786
786
|
QetaAIAnswerCard: QetaAIAnswerCardClassKey;
|
|
787
787
|
};
|
|
788
|
-
type QetaOverrides =
|
|
789
|
-
[Name in keyof QetaComponentsNameToClassKey]?: Partial<
|
|
788
|
+
type QetaOverrides = ComponentsOverrides & {
|
|
789
|
+
[Name in keyof QetaComponentsNameToClassKey]?: Partial<OverridesStyleRules<QetaComponentsNameToClassKey[Name]>>;
|
|
790
790
|
};
|
|
791
791
|
|
|
792
792
|
export { AIAnswerCard, AddToCollectionButton, AnswerCard, AnswerForm, AnswerList, AnswerListItem, AnswersContainer, ArticleContent, AskQuestionButton, AuthorLink, CollectionCard, CollectionFollowButton, CollectionForm, CollectionsGrid, CreateCollectionButton, DeleteModal, EntitiesGrid, EntityFollowButton, FilterPanel, FollowedCollectionsList, FollowedEntitiesList, FollowedTagsList, ImpactCard, LeftMenu, LeftMenuButton, MarkdownRenderer, PostForm, PostHighlightList, PostList, PostListItem, PostsCard, PostsContainer, PostsGrid, type QetaLeftMenuClassKey, type QetaOverrides, QuestionCard, QuestionsTable, RelativeTimeWithTooltip, SelectTemplateList, StatsChart, SummaryStatsGrid, TagFollowButton, TagsGrid, TemplateList, TopRankingUsers, TrophyIcon, UpdatedByLink, UserFollowButton, UserLink, UsersGrid, WriteArticleButton, articleRouteRef, articlesRouteRef, askRouteRef, collectionCreateRouteRef, collectionEditRouteRef, collectionRouteRef, collectionsRouteRef, editArticleRouteRef, editQuestionRouteRef, entitiesRouteRef, entityRouteRef, favoriteQuestionsRouteRef, moderatorRouteRef, qetaApiRef, qetaRouteRef, questionRouteRef, questionsRouteRef, statisticsRouteRef, tagRouteRef, tagsRouteRef, useAI, useCollectionsFollow, useEntityFollow, useIdentityApi, useIsModerator, useQetaApi, useStyles, useTagsFollow, useTranslation, useUserFollow, userRouteRef, usersRouteRef, writeRouteRef };
|
package/dist/translation.esm.js
CHANGED
|
@@ -49,7 +49,7 @@ const qetaTranslationRef = createTranslationRef({
|
|
|
49
49
|
answersTagged: `Answers tagged with {{tags}}`
|
|
50
50
|
},
|
|
51
51
|
search: {
|
|
52
|
-
label: "Search
|
|
52
|
+
label: "Search answer",
|
|
53
53
|
placeholder: "Search..."
|
|
54
54
|
}
|
|
55
55
|
},
|
|
@@ -145,7 +145,7 @@ const qetaTranslationRef = createTranslationRef({
|
|
|
145
145
|
title: "Write an article"
|
|
146
146
|
},
|
|
147
147
|
createCollectionButton: {
|
|
148
|
-
title: "Create collection"
|
|
148
|
+
title: "Create a collection"
|
|
149
149
|
},
|
|
150
150
|
commentList: {
|
|
151
151
|
deleteLink: "delete"
|
|
@@ -290,7 +290,7 @@ const qetaTranslationRef = createTranslationRef({
|
|
|
290
290
|
collectionsPage: {
|
|
291
291
|
title: "Collections",
|
|
292
292
|
search: {
|
|
293
|
-
label: "Search
|
|
293
|
+
label: "Search collection",
|
|
294
294
|
placeholder: "Search..."
|
|
295
295
|
}
|
|
296
296
|
},
|
|
@@ -435,7 +435,7 @@ const qetaTranslationRef = createTranslationRef({
|
|
|
435
435
|
favorite: "Your favorite {{itemType}}s"
|
|
436
436
|
},
|
|
437
437
|
search: {
|
|
438
|
-
label: "Search
|
|
438
|
+
label: "Search {{itemType}}",
|
|
439
439
|
placeholder: "Search..."
|
|
440
440
|
},
|
|
441
441
|
noItems: "No {{itemType}}s",
|
|
@@ -456,7 +456,7 @@ const qetaTranslationRef = createTranslationRef({
|
|
|
456
456
|
statistics: {
|
|
457
457
|
errorLoading: "Could not load statistics",
|
|
458
458
|
notAvailable: "Statistics are unavailable",
|
|
459
|
-
ranking: "
|
|
459
|
+
ranking: "User ranking \u{1F3C6}",
|
|
460
460
|
mostQuestions: {
|
|
461
461
|
title: "Most questions",
|
|
462
462
|
description: "People who have posted most questions"
|
|
@@ -486,8 +486,8 @@ const qetaTranslationRef = createTranslationRef({
|
|
|
486
486
|
placeholder: "Search..."
|
|
487
487
|
},
|
|
488
488
|
tags_zero: "No tags",
|
|
489
|
-
tags_one: "
|
|
490
|
-
tags_other: "
|
|
489
|
+
tags_one: "{{count}} tag",
|
|
490
|
+
tags_other: "{{count}} tags"
|
|
491
491
|
},
|
|
492
492
|
entitiesPage: {
|
|
493
493
|
errorLoading: "Could not load entities",
|
|
@@ -497,8 +497,8 @@ const qetaTranslationRef = createTranslationRef({
|
|
|
497
497
|
placeholder: "Search..."
|
|
498
498
|
},
|
|
499
499
|
entities_zero: "No entities",
|
|
500
|
-
entities_one: "
|
|
501
|
-
entities_other: "
|
|
500
|
+
entities_one: "{{count}} entity",
|
|
501
|
+
entities_other: "{{count}} entities"
|
|
502
502
|
},
|
|
503
503
|
aiAnswerCard: {
|
|
504
504
|
regenerate: "Regenerate this answer",
|
|
@@ -517,8 +517,8 @@ const qetaTranslationRef = createTranslationRef({
|
|
|
517
517
|
placeholder: "Search..."
|
|
518
518
|
},
|
|
519
519
|
users_zero: "No users",
|
|
520
|
-
users_one: "
|
|
521
|
-
users_other: "
|
|
520
|
+
users_one: "{{count}} user",
|
|
521
|
+
users_other: "{{count}} users"
|
|
522
522
|
},
|
|
523
523
|
userPage: {
|
|
524
524
|
profileTab: "Profile",
|