diff --git a/apps/admin-x-activitypub/src/components/ListIndex.tsx b/apps/admin-x-activitypub/src/components/ListIndex.tsx index da6cf25995..4c785eead9 100644 --- a/apps/admin-x-activitypub/src/components/ListIndex.tsx +++ b/apps/admin-x-activitypub/src/components/ListIndex.tsx @@ -14,6 +14,13 @@ interface ViewArticleProps { onBackToList: () => void; } +type Activity = { + type: string, + object: { + type: string + } +} + function useBrowseInboxForUser(handle: string) { const site = useBrowseSite(); const siteData = site.data?.site; @@ -89,69 +96,127 @@ const ActivityPubComponent: React.FC = () => { const [selectedTab, setSelectedTab] = useState('inbox'); + const inboxTabActivities = activities.filter((activity: Activity) => { + const isCreate = activity.type === 'Create' && ['Article', 'Note'].includes(activity.object.type); + const isAnnounce = activity.type === 'Announce' && activity.object.type === 'Note'; + + return isCreate || isAnnounce; + }); + const activityTabActivities = activities.filter((activity: Activity) => activity.type === 'Create' && activity.object.type === 'Article'); + const likeTabActivies = activities.filter((activity: Activity) => activity.type === 'Like'); + const tabs: ViewTab[] = [ { id: 'inbox', title: 'Inbox', - contents:
-
} - - + )} + + ) }, { id: 'activity', title: 'Activity', - contents:
- -
+ contents: ( +
+ +
+ ) }, { id: 'likes', title: 'Likes', - contents:
- {activities && activities.slice().reverse().map(activity => ( - activity.type === 'Like' && } id='list-item' title={
{activity.actor.name} liked your post {activity.object.name}
}>
- ))} -
-
+ contents: ( +
+ + {likeTabActivies.reverse().map(activity => ( + } + id='list-item' + title={ +
+ {activity.actor.name} + liked your post + {activity.object.name} +
+ } + /> + ))} +
+
+ ) }, { id: 'profile', title: 'Profile', - contents:
-
-
-
updateRoute('/view-following')}> - {followingCount} - Following -
-
updateRoute('/view-followers')}> - {followersCount} - Followers + contents: ( +
+
+
+
+
updateRoute('/view-following')}> + {followingCount} + Following +
+
updateRoute('/view-followers')}> + {followersCount} + Followers +
+
-
+ ) } ];