@drodil/backstage-plugin-qeta-react 3.56.0 → 3.56.1
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/CollectionsContainer/CollectionsContainer.esm.js +2 -1
- package/dist/components/CollectionsContainer/CollectionsContainer.esm.js.map +1 -1
- package/dist/components/FaviconItem/FaviconItem.esm.js +20 -13
- package/dist/components/FaviconItem/FaviconItem.esm.js.map +1 -1
- package/dist/components/FollowedLists/FollowedUsersList.esm.js +1 -0
- package/dist/components/FollowedLists/FollowedUsersList.esm.js.map +1 -1
- package/dist/components/Links/Links.esm.js +1 -0
- package/dist/components/Links/Links.esm.js.map +1 -1
- package/dist/components/PostHighlightList/PostHighlightList.esm.js +1 -0
- package/dist/components/PostHighlightList/PostHighlightList.esm.js.map +1 -1
- package/dist/components/PostsContainer/PostsGridItem.esm.js +6 -11
- package/dist/components/PostsContainer/PostsGridItem.esm.js.map +1 -1
- package/dist/components/TagsAndEntities/UserChip.esm.js +1 -0
- package/dist/components/TagsAndEntities/UserChip.esm.js.map +1 -1
- package/dist/components/Timeline/TimelineItem.esm.js +1 -0
- package/dist/components/Timeline/TimelineItem.esm.js.map +1 -1
- package/dist/components/UsersContainer/UserListItem.esm.js +1 -0
- package/dist/components/UsersContainer/UserListItem.esm.js.map +1 -1
- package/dist/components/UsersContainer/UsersGridItem.esm.js +1 -0
- package/dist/components/UsersContainer/UsersGridItem.esm.js.map +1 -1
- package/dist/hooks/useCollectionsFollow.esm.js +21 -45
- package/dist/hooks/useCollectionsFollow.esm.js.map +1 -1
- package/dist/hooks/useEntityFollow.esm.js +25 -36
- package/dist/hooks/useEntityFollow.esm.js.map +1 -1
- package/dist/hooks/useFavicon.esm.js +52 -0
- package/dist/hooks/useFavicon.esm.js.map +1 -0
- package/dist/hooks/useFollow.esm.js +62 -0
- package/dist/hooks/useFollow.esm.js.map +1 -0
- package/dist/hooks/useTagsFollow.esm.js +22 -39
- package/dist/hooks/useTagsFollow.esm.js.map +1 -1
- package/dist/hooks/useUserFollow.esm.js +22 -39
- package/dist/hooks/useUserFollow.esm.js.map +1 -1
- package/dist/index.d.ts +29 -13
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,50 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
2
|
import { useApi } from '@backstage/core-plugin-api';
|
|
3
3
|
import { qetaApiRef } from '../api.esm.js';
|
|
4
|
+
import { useFollow } from './useFollow.esm.js';
|
|
4
5
|
|
|
5
|
-
let followedUsers = void 0;
|
|
6
6
|
const useUserFollow = () => {
|
|
7
|
-
const [users, setUsers] = useState(followedUsers ?? []);
|
|
8
|
-
const [loading, setLoading] = useState(followedUsers === void 0);
|
|
9
7
|
const qetaApi = useApi(qetaApiRef);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
const { items, follow, unfollow, isFollowing, loading } = useFollow(
|
|
9
|
+
"users",
|
|
10
|
+
{
|
|
11
|
+
fetchFollowed: useCallback(
|
|
12
|
+
() => qetaApi.getFollowedUsers().then((res) => res.followedUserRefs),
|
|
13
|
+
[qetaApi]
|
|
14
|
+
),
|
|
15
|
+
followItem: useCallback(
|
|
16
|
+
(user) => qetaApi.followUser(user),
|
|
17
|
+
[qetaApi]
|
|
18
|
+
),
|
|
19
|
+
unfollowItem: useCallback(
|
|
20
|
+
(user) => qetaApi.unfollowUser(user),
|
|
21
|
+
[qetaApi]
|
|
22
|
+
),
|
|
23
|
+
isEqual: (a, b) => a === b
|
|
19
24
|
}
|
|
20
|
-
}, [qetaApi]);
|
|
21
|
-
const followUser = useCallback(
|
|
22
|
-
(user) => {
|
|
23
|
-
qetaApi.followUser(user).then(() => {
|
|
24
|
-
setUsers((prev) => [...prev, user]);
|
|
25
|
-
followedUsers?.push(user);
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
[qetaApi]
|
|
29
|
-
);
|
|
30
|
-
const unfollowUser = useCallback(
|
|
31
|
-
(user) => {
|
|
32
|
-
qetaApi.unfollowUser(user).then(() => {
|
|
33
|
-
setUsers((prev) => prev.filter((t) => t !== user));
|
|
34
|
-
followedUsers = followedUsers?.filter((t) => t !== user);
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
[qetaApi]
|
|
38
|
-
);
|
|
39
|
-
const isFollowingUser = useCallback(
|
|
40
|
-
(user) => users.includes(user),
|
|
41
|
-
[users]
|
|
42
25
|
);
|
|
43
26
|
return {
|
|
44
|
-
users,
|
|
45
|
-
followUser,
|
|
46
|
-
unfollowUser,
|
|
47
|
-
isFollowingUser,
|
|
27
|
+
users: items,
|
|
28
|
+
followUser: follow,
|
|
29
|
+
unfollowUser: unfollow,
|
|
30
|
+
isFollowingUser: isFollowing,
|
|
48
31
|
loading
|
|
49
32
|
};
|
|
50
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUserFollow.esm.js","sources":["../../src/hooks/useUserFollow.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useUserFollow.esm.js","sources":["../../src/hooks/useUserFollow.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { qetaApiRef } from '../api';\nimport { useFollow } from './useFollow';\n\nexport const useUserFollow = () => {\n const qetaApi = useApi(qetaApiRef);\n\n const { items, follow, unfollow, isFollowing, loading } = useFollow<string>(\n 'users',\n {\n fetchFollowed: useCallback(\n () => qetaApi.getFollowedUsers().then(res => res.followedUserRefs),\n [qetaApi],\n ),\n followItem: useCallback(\n (user: string) => qetaApi.followUser(user),\n [qetaApi],\n ),\n unfollowItem: useCallback(\n (user: string) => qetaApi.unfollowUser(user),\n [qetaApi],\n ),\n isEqual: (a, b) => a === b,\n },\n );\n\n return {\n users: items,\n followUser: follow,\n unfollowUser: unfollow,\n isFollowingUser: isFollowing,\n loading,\n };\n};\n"],"names":[],"mappings":";;;;;AAKO,MAAM,gBAAgB,MAAM;AACjC,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA;AAEjC,EAAA,MAAM,EAAE,KAAO,EAAA,MAAA,EAAQ,QAAU,EAAA,WAAA,EAAa,SAAY,GAAA,SAAA;AAAA,IACxD,OAAA;AAAA,IACA;AAAA,MACE,aAAe,EAAA,WAAA;AAAA,QACb,MAAM,OAAQ,CAAA,gBAAA,GAAmB,IAAK,CAAA,CAAA,GAAA,KAAO,IAAI,gBAAgB,CAAA;AAAA,QACjE,CAAC,OAAO;AAAA,OACV;AAAA,MACA,UAAY,EAAA,WAAA;AAAA,QACV,CAAC,IAAA,KAAiB,OAAQ,CAAA,UAAA,CAAW,IAAI,CAAA;AAAA,QACzC,CAAC,OAAO;AAAA,OACV;AAAA,MACA,YAAc,EAAA,WAAA;AAAA,QACZ,CAAC,IAAA,KAAiB,OAAQ,CAAA,YAAA,CAAa,IAAI,CAAA;AAAA,QAC3C,CAAC,OAAO;AAAA,OACV;AAAA,MACA,OAAS,EAAA,CAAC,CAAG,EAAA,CAAA,KAAM,CAAM,KAAA;AAAA;AAC3B,GACF;AAEA,EAAO,OAAA;AAAA,IACL,KAAO,EAAA,KAAA;AAAA,IACP,UAAY,EAAA,MAAA;AAAA,IACZ,YAAc,EAAA,QAAA;AAAA,IACd,eAAiB,EAAA,WAAA;AAAA,IACjB;AAAA,GACF;AACF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -646,19 +646,33 @@ declare function useVoting(resp: PostResponse | AnswerResponse): {
|
|
|
646
646
|
|
|
647
647
|
declare const useListItemStyles: (props?: any) => _material_ui_styles.ClassNameMap<"root">;
|
|
648
648
|
|
|
649
|
+
interface UseFollowOptions<T> {
|
|
650
|
+
fetchFollowed: () => Promise<T[]>;
|
|
651
|
+
followItem: (item: T) => Promise<unknown>;
|
|
652
|
+
unfollowItem: (item: T) => Promise<unknown>;
|
|
653
|
+
isEqual: (a: T, b: T) => boolean;
|
|
654
|
+
}
|
|
655
|
+
declare const useFollow: <T>(key: string, options: UseFollowOptions<T>) => {
|
|
656
|
+
items: T[];
|
|
657
|
+
follow: (item: T) => void;
|
|
658
|
+
unfollow: (item: T) => void;
|
|
659
|
+
isFollowing: (item: T) => boolean;
|
|
660
|
+
loading: boolean;
|
|
661
|
+
};
|
|
662
|
+
|
|
649
663
|
declare const useTagsFollow: () => {
|
|
650
664
|
tags: string[];
|
|
651
|
-
followTag: (
|
|
652
|
-
unfollowTag: (
|
|
653
|
-
isFollowingTag: (
|
|
665
|
+
followTag: (item: string) => void;
|
|
666
|
+
unfollowTag: (item: string) => void;
|
|
667
|
+
isFollowingTag: (item: string) => boolean;
|
|
654
668
|
loading: boolean;
|
|
655
669
|
};
|
|
656
670
|
|
|
657
671
|
declare const useEntityFollow: () => {
|
|
658
672
|
entities: string[];
|
|
659
|
-
followEntity: (
|
|
660
|
-
unfollowEntity: (
|
|
661
|
-
isFollowingEntity: (
|
|
673
|
+
followEntity: (item: string) => void;
|
|
674
|
+
unfollowEntity: (item: string) => void;
|
|
675
|
+
isFollowingEntity: (item: string) => boolean;
|
|
662
676
|
loading: boolean;
|
|
663
677
|
};
|
|
664
678
|
|
|
@@ -681,9 +695,9 @@ declare const useEntityAuthor: (entity: PostResponse | AnswerResponse | Collecti
|
|
|
681
695
|
|
|
682
696
|
declare const useUserFollow: () => {
|
|
683
697
|
users: string[];
|
|
684
|
-
followUser: (
|
|
685
|
-
unfollowUser: (
|
|
686
|
-
isFollowingUser: (
|
|
698
|
+
followUser: (item: string) => void;
|
|
699
|
+
unfollowUser: (item: string) => void;
|
|
700
|
+
isFollowingUser: (item: string) => boolean;
|
|
687
701
|
loading: boolean;
|
|
688
702
|
};
|
|
689
703
|
|
|
@@ -691,9 +705,9 @@ declare function useIdentityApi<T>(f: (api: IdentityApi) => Promise<T>, deps?: a
|
|
|
691
705
|
|
|
692
706
|
declare const useCollectionsFollow: () => {
|
|
693
707
|
collections: Collection[];
|
|
694
|
-
followCollection: (
|
|
695
|
-
unfollowCollection: (
|
|
696
|
-
isFollowingCollection: (
|
|
708
|
+
followCollection: (item: Collection) => void;
|
|
709
|
+
unfollowCollection: (item: Collection) => void;
|
|
710
|
+
isFollowingCollection: (item: Collection) => boolean;
|
|
697
711
|
loading: boolean;
|
|
698
712
|
};
|
|
699
713
|
|
|
@@ -781,6 +795,8 @@ type UserSettingsHook = {
|
|
|
781
795
|
};
|
|
782
796
|
declare const useUserSettings: () => UserSettingsHook;
|
|
783
797
|
|
|
798
|
+
declare const useFavicon: (url?: string) => string | undefined;
|
|
799
|
+
|
|
784
800
|
/** @alpha */
|
|
785
801
|
declare const qetaTranslationRef: _backstage_frontend_plugin_api.TranslationRef<"qeta", {
|
|
786
802
|
readonly "answer.questionTitle": "Q: {{question}}";
|
|
@@ -1494,4 +1510,4 @@ type QetaOverrides = Overrides & {
|
|
|
1494
1510
|
[Name in keyof QetaComponentsNameToClassKey]?: Partial<StyleRules<QetaComponentsNameToClassKey[Name]>>;
|
|
1495
1511
|
};
|
|
1496
1512
|
|
|
1497
|
-
export { AIAnswerCard, AddToCollectionButton, AnswerCard, AnswerForm, AnswerListItem, AnswersContainer, AnswersGridItem, ArticleContent, AskQuestionButton, AuthorLink, BadgeChip, ButtonContainer, CollectionFollowButton, CollectionForm, CollectionsContainer, ContentHeader, ContentHeaderButton, ContentHeaderCard, type ContentHeaderCardProps, type ContentHeaderProps, CreateCollectionButton, CreateLinkButton, CreateTagModal, DeleteModal, DeletedBanner, DraftBanner, EditTagModal, EntitiesContainer, EntitiesGridItem, EntityFollowButton, EntityListItem, FaviconItem, type FilterChange, FilterPanel, FollowedCollectionsList, FollowedEntitiesList, FollowedTagsList, FollowedUsersList, type GridType, ImpactCard, LeftMenu, LeftMenuButton, LinkCard, MarkdownRenderer, ObsoleteBanner, ObsoleteModal, OpenLinkButton, PostForm, PostHighlightList, PostHighlightListContainer, PostHighlightListContent, PostListItem, PostsCard, PostsContainer, type PostsContainerProps, PostsGridItem, PostsTable, QetaContext, type QetaContextProps, type QetaEntitiesProps, type QetaOverrides, QetaProvider, QuestionCard, type QuestionFormValues, QuestionsTable, RankingButtons, RelativeTimeWithTooltip, SelectTemplateList, StatsChart, StatusChip, SuggestionsCard, type TagAndEntitiesFormValues, TagFollowButton, TagGridItem, TagListItem, TagsContainer, type TemplateFormValues, TemplateList, Timeline, TimelineItemCard, TopRankingUsers, TrophyIcon, UpdatedByLink, UserBadges, UserFollowButton, UserLink, UserListItem, type UserSettings, type UserSettingsHook, UsersContainer, UsersGridItem, ValidReviewModal, ViewToggle, type ViewType, WriteArticleButton, articleRouteRef, articlesRouteRef, askRouteRef, collectionCreateRouteRef, collectionEditRouteRef, collectionRouteRef, collectionsRouteRef, createLinkRouteRef, editArticleRouteRef, editLinkRouteRef, editQuestionRouteRef, entitiesRouteRef, entityRouteRef, favoriteQuestionsRouteRef, linkRouteRef, linksRouteRef, moderatorRouteRef, qetaApiRef, qetaRouteRef, qetaTranslationRef, qetaTranslations, questionRouteRef, questionsRouteRef, reviewRouteRef, settingsRouteRef, statisticsRouteRef, tagRouteRef, tagsRouteRef, useAI, useCanReview, useCollectionsFollow, useEntityAuthor, useEntityFollow, useGridPageSize, useIdentityApi, useIsModerator, useListItemStyles, useQetaApi, useQetaContext, useQetaEntities, useTagsFollow, useUserFollow, useUserInfo, useUserSettings, useVoting, userRouteRef, usersRouteRef, writeRouteRef };
|
|
1513
|
+
export { AIAnswerCard, AddToCollectionButton, AnswerCard, AnswerForm, AnswerListItem, AnswersContainer, AnswersGridItem, ArticleContent, AskQuestionButton, AuthorLink, BadgeChip, ButtonContainer, CollectionFollowButton, CollectionForm, CollectionsContainer, ContentHeader, ContentHeaderButton, ContentHeaderCard, type ContentHeaderCardProps, type ContentHeaderProps, CreateCollectionButton, CreateLinkButton, CreateTagModal, DeleteModal, DeletedBanner, DraftBanner, EditTagModal, EntitiesContainer, EntitiesGridItem, EntityFollowButton, EntityListItem, FaviconItem, type FilterChange, FilterPanel, FollowedCollectionsList, FollowedEntitiesList, FollowedTagsList, FollowedUsersList, type GridType, ImpactCard, LeftMenu, LeftMenuButton, LinkCard, MarkdownRenderer, ObsoleteBanner, ObsoleteModal, OpenLinkButton, PostForm, PostHighlightList, PostHighlightListContainer, PostHighlightListContent, PostListItem, PostsCard, PostsContainer, type PostsContainerProps, PostsGridItem, PostsTable, QetaContext, type QetaContextProps, type QetaEntitiesProps, type QetaOverrides, QetaProvider, QuestionCard, type QuestionFormValues, QuestionsTable, RankingButtons, RelativeTimeWithTooltip, SelectTemplateList, StatsChart, StatusChip, SuggestionsCard, type TagAndEntitiesFormValues, TagFollowButton, TagGridItem, TagListItem, TagsContainer, type TemplateFormValues, TemplateList, Timeline, TimelineItemCard, TopRankingUsers, TrophyIcon, UpdatedByLink, UserBadges, UserFollowButton, UserLink, UserListItem, type UserSettings, type UserSettingsHook, UsersContainer, UsersGridItem, ValidReviewModal, ViewToggle, type ViewType, WriteArticleButton, articleRouteRef, articlesRouteRef, askRouteRef, collectionCreateRouteRef, collectionEditRouteRef, collectionRouteRef, collectionsRouteRef, createLinkRouteRef, editArticleRouteRef, editLinkRouteRef, editQuestionRouteRef, entitiesRouteRef, entityRouteRef, favoriteQuestionsRouteRef, linkRouteRef, linksRouteRef, moderatorRouteRef, qetaApiRef, qetaRouteRef, qetaTranslationRef, qetaTranslations, questionRouteRef, questionsRouteRef, reviewRouteRef, settingsRouteRef, statisticsRouteRef, tagRouteRef, tagsRouteRef, useAI, useCanReview, useCollectionsFollow, useEntityAuthor, useEntityFollow, useFavicon, useFollow, useGridPageSize, useIdentityApi, useIsModerator, useListItemStyles, useQetaApi, useQetaContext, useQetaEntities, useTagsFollow, useUserFollow, useUserInfo, useUserSettings, useVoting, userRouteRef, usersRouteRef, writeRouteRef };
|
package/dist/index.esm.js
CHANGED
|
@@ -82,6 +82,7 @@ export { ViewToggle } from './components/ViewToggle/ViewToggle.esm.js';
|
|
|
82
82
|
export { useQetaApi } from './hooks/useQetaApi.esm.js';
|
|
83
83
|
export { useVoting } from './hooks/useVoting.esm.js';
|
|
84
84
|
export { useListItemStyles } from './hooks/useListItemStyles.esm.js';
|
|
85
|
+
export { useFollow } from './hooks/useFollow.esm.js';
|
|
85
86
|
export { useTagsFollow } from './hooks/useTagsFollow.esm.js';
|
|
86
87
|
export { useEntityFollow } from './hooks/useEntityFollow.esm.js';
|
|
87
88
|
export { useEntityAuthor, useUserInfo } from './hooks/useEntityAuthor.esm.js';
|
|
@@ -94,5 +95,6 @@ export { useCanReview } from './hooks/useCanReview.esm.js';
|
|
|
94
95
|
export { useGridPageSize } from './hooks/useGridPageSize.esm.js';
|
|
95
96
|
export { useQetaEntities } from './hooks/useQetaEntities.esm.js';
|
|
96
97
|
export { useUserSettings } from './hooks/useUserSettings.esm.js';
|
|
98
|
+
export { useFavicon } from './hooks/useFavicon.esm.js';
|
|
97
99
|
export { qetaTranslationRef, qetaTranslations } from './translation.esm.js';
|
|
98
100
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"frontend",
|
|
8
8
|
"backstage.io"
|
|
9
9
|
],
|
|
10
|
-
"version": "3.56.
|
|
10
|
+
"version": "3.56.1",
|
|
11
11
|
"main": "dist/index.esm.js",
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
13
|
"prepublishOnly": "yarn tsc && yarn build",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@backstage/plugin-permission-common": "^0.9.4",
|
|
58
58
|
"@backstage/plugin-permission-react": "^0.4.39",
|
|
59
59
|
"@backstage/plugin-signals-react": "^0.0.18",
|
|
60
|
-
"@drodil/backstage-plugin-qeta-common": "^3.56.
|
|
60
|
+
"@drodil/backstage-plugin-qeta-common": "^3.56.1",
|
|
61
61
|
"@jsdevtools/rehype-toc": "^3.0.2",
|
|
62
62
|
"@material-ui/core": "^4.12.2",
|
|
63
63
|
"@material-ui/icons": "^4.11.3",
|