diff --git a/src/v4/social/hooks/collections/useCommunityMembersCollection.tsx b/src/v4/social/hooks/collections/useCommunityMembersCollection.tsx deleted file mode 100644 index be566897..00000000 --- a/src/v4/social/hooks/collections/useCommunityMembersCollection.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { CommunityRepository } from '@amityco/ts-sdk'; -import useLiveCollection from '~/core/hooks/useLiveCollection'; - -export default function useCommunityMembersCollection(communityId?: string, limit: number = 5) { - const { items, ...rest } = useLiveCollection({ - fetcher: CommunityRepository.Membership.getMembers, - params: { communityId: communityId as string, limit, memberships: ['member'] }, - shouldCall: () => !!communityId, - }); - - return { - members: items, - ...rest, - }; -} diff --git a/src/v4/social/hooks/collections/useGlobalStoryTargets.tsx b/src/v4/social/hooks/collections/useGlobalStoryTargets.tsx deleted file mode 100644 index 127de2c3..00000000 --- a/src/v4/social/hooks/collections/useGlobalStoryTargets.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { StoryRepository } from '@amityco/ts-sdk'; -import useLiveCollection from '~/core/hooks/useLiveCollection'; - -export const useGlobalStoryTargets = ( - params: Amity.LiveCollectionParams, -) => { - const { items, hasMore, loadMore, ...rest } = useLiveCollection({ - fetcher: StoryRepository.getGlobalStoryTargets, - params, - shouldCall: () => true, - }); - - const loadMoreStories = () => { - if (hasMore) { - loadMore(); - } - }; - - return { - stories: items, - hasMore, - loadMoreStories, - ...rest, - }; -}; diff --git a/src/v4/social/hooks/collections/useReactionsCollection.tsx b/src/v4/social/hooks/collections/useReactionsCollection.tsx deleted file mode 100644 index e58c66f9..00000000 --- a/src/v4/social/hooks/collections/useReactionsCollection.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { ReactionRepository } from '@amityco/ts-sdk'; - -import useLiveCollection from '~/core/hooks/useLiveCollection'; - -type UseReactionsCollectionParams = Parameters[0]; - -export const useReactionsCollection = (params: UseReactionsCollectionParams) => { - const { items, ...rest } = useLiveCollection({ - fetcher: ReactionRepository.getReactions, - params, - shouldCall: () => !!params.referenceId && !!params.referenceType, - }); - - return { - reactions: items, - ...rest, - }; -}; diff --git a/src/v4/social/hooks/useCommentFlaggedByMe.tsx b/src/v4/social/hooks/useCommentFlaggedByMe.tsx deleted file mode 100644 index f318ebd3..00000000 --- a/src/v4/social/hooks/useCommentFlaggedByMe.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { CommentRepository } from '@amityco/ts-sdk'; -import { useQuery } from '@tanstack/react-query'; -import React, { useEffect, useState } from 'react'; -import { FormattedMessage } from 'react-intl'; -import { useNotifications } from '~/v4/core/providers/NotificationProvider'; - -export const useCommentFlaggedByMe = (commentId?: string) => { - const notification = useNotifications(); - const [isFlaggedByMe, setIsFlaggedByMe] = useState(false); - - const { data, isLoading, refetch } = useQuery({ - queryKey: ['asc-uikit', 'CommentRepository', 'isCommentFlaggedByMe', commentId], - queryFn: () => { - return CommentRepository.isCommentFlaggedByMe(commentId as string); - }, - enabled: commentId != null, - }); - - useEffect(() => { - if (data != null) { - setIsFlaggedByMe(data); - } - }, [data]); - - const flagComment = async () => { - if (commentId == null) return; - try { - setIsFlaggedByMe(true); - await CommentRepository.flagComment(commentId); - } catch (_error) { - setIsFlaggedByMe(false); - } finally { - refetch(); - } - }; - - const unflagComment = async () => { - if (commentId == null) return; - try { - setIsFlaggedByMe(false); - await CommentRepository.unflagComment(commentId); - } catch (_error) { - setIsFlaggedByMe(true); - } finally { - refetch(); - } - }; - - const toggleFlagComment = async () => { - if (commentId == null) return; - if (isFlaggedByMe) { - await unflagComment(); - notification.success({ - content: , - }); - } else { - await flagComment(); - notification.success({ - content: , - }); - } - }; - - return { - isLoading, - isFlaggedByMe, - flagComment, - unflagComment, - toggleFlagComment, - }; -}; diff --git a/src/v4/social/hooks/useGetStoryByStoryId.tsx b/src/v4/social/hooks/useGetStoryByStoryId.tsx deleted file mode 100644 index 403a6b91..00000000 --- a/src/v4/social/hooks/useGetStoryByStoryId.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { StoryRepository } from '@amityco/ts-sdk'; - -import useLiveObject from '~/core/hooks/useLiveObject'; - -const useGetStoryByStoryId = (storyId: string | undefined) => { - const story = useLiveObject({ - fetcher: StoryRepository.getStoryByStoryId, - params: storyId, - shouldCall: () => !!storyId, - }); - - return story; -}; - -export default useGetStoryByStoryId; diff --git a/src/v4/social/hooks/useVisibilitySensor.tsx b/src/v4/social/hooks/useVisibilitySensor.ts similarity index 100% rename from src/v4/social/hooks/useVisibilitySensor.tsx rename to src/v4/social/hooks/useVisibilitySensor.ts