mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
WIP
This commit is contained in:
parent
f7fbb6edcd
commit
8541ac58ca
1 changed files with 29 additions and 9 deletions
|
@ -8,6 +8,7 @@ import ActivityItem, {type Activity} from './activities/ActivityItem';
|
||||||
import ArticleModal from './feed/ArticleModal';
|
import ArticleModal from './feed/ArticleModal';
|
||||||
// import FollowButton from './global/FollowButton';
|
// import FollowButton from './global/FollowButton';
|
||||||
import MainNavigation from './navigation/MainNavigation';
|
import MainNavigation from './navigation/MainNavigation';
|
||||||
|
import ProfileSearchResultModal from './search/ProfileSearchResultModal';
|
||||||
|
|
||||||
import getUsername from '../utils/get-username';
|
import getUsername from '../utils/get-username';
|
||||||
import {useActivitiesForUser} from '../hooks/useActivityPubQueries';
|
import {useActivitiesForUser} from '../hooks/useActivityPubQueries';
|
||||||
|
@ -136,6 +137,33 @@ const Activities: React.FC<ActivitiesProps> = ({}) => {
|
||||||
// return followers.includes(id);
|
// 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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<MainNavigation title='Activities' />
|
<MainNavigation title='Activities' />
|
||||||
|
@ -162,15 +190,7 @@ const Activities: React.FC<ActivitiesProps> = ({}) => {
|
||||||
<ActivityItem
|
<ActivityItem
|
||||||
key={activity.id}
|
key={activity.id}
|
||||||
url={getActivityUrl(activity) || getActorUrl(activity)}
|
url={getActivityUrl(activity) || getActorUrl(activity)}
|
||||||
onClick={
|
onClick={() => handleActivityClick(activity)}
|
||||||
activity.type === ACTVITY_TYPE.CREATE ? () => {
|
|
||||||
NiceModal.show(ArticleModal, {
|
|
||||||
object: activity.object,
|
|
||||||
actor: activity.actor,
|
|
||||||
comments: activity.object.replies
|
|
||||||
});
|
|
||||||
} : undefined
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<APAvatar author={activity.actor} badge={getActivityBadge(activity)} />
|
<APAvatar author={activity.actor} badge={getActivityBadge(activity)} />
|
||||||
<div className='min-w-0'>
|
<div className='min-w-0'>
|
||||||
|
|
Loading…
Reference in a new issue