From 8541ac58ca0c813a5f01e40d239151fcc645ed86 Mon Sep 17 00:00:00 2001 From: Djordje Vlaisavljevic Date: Tue, 22 Oct 2024 12:52:33 +0100 Subject: [PATCH] WIP --- .../src/components/Activities.tsx | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/apps/admin-x-activitypub/src/components/Activities.tsx b/apps/admin-x-activitypub/src/components/Activities.tsx index 249d20940d..18ee08f3c1 100644 --- a/apps/admin-x-activitypub/src/components/Activities.tsx +++ b/apps/admin-x-activitypub/src/components/Activities.tsx @@ -8,6 +8,7 @@ import ActivityItem, {type Activity} from './activities/ActivityItem'; import ArticleModal from './feed/ArticleModal'; // import FollowButton from './global/FollowButton'; import MainNavigation from './navigation/MainNavigation'; +import ProfileSearchResultModal from './search/ProfileSearchResultModal'; import getUsername from '../utils/get-username'; import {useActivitiesForUser} from '../hooks/useActivityPubQueries'; @@ -136,6 +137,33 @@ const Activities: React.FC = ({}) => { // return followers.includes(id); // }; + const handleActivityClick = (activity: Activity) => { + if (activity.type === ACTVITY_TYPE.CREATE) { + NiceModal.show(ArticleModal, { + object: activity.object, + actor: activity.actor, + comments: activity.object.replies + }); + } else if (activity.type === ACTVITY_TYPE.FOLLOW) { + NiceModal.show(ProfileSearchResultModal, { + profile: { + actor: activity.actor, + handle: getUsername(activity.actor), + followerCount: activity.actor.followers?.totalItems || 0, + followingCount: activity.actor.following?.totalItems || 0, + isFollowing: false, // You might need to determine this + posts: [] // You might need to fetch this separately + }, + onFollow: () => { + // Implement follow logic + }, + onUnfollow: () => { + // Implement unfollow logic + } + }); + } + }; + return ( <> @@ -162,15 +190,7 @@ const Activities: React.FC = ({}) => { { - NiceModal.show(ArticleModal, { - object: activity.object, - actor: activity.actor, - comments: activity.object.replies - }); - } : undefined - } + onClick={() => handleActivityClick(activity)} >