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:
-
- {activities && activities.some(activity => activity.type === 'Create' && (activity.object.type === 'Article' || activity.object.type === 'Note')) ? (activities.slice().reverse().map(activity => (
- activity.type === 'Create' && (activity.object.type === 'Article' || activity.object.type === 'Note') &&
- - handleViewContent(activity.object, activity.actor)}>
-
-
- ))) :
-
-
-
Welcome to ActivityPub
-
We’re so glad to have you on board! At the moment, you can follow other Ghost sites and enjoy their content right here inside Ghost.
-
You can see all of the users on the right—find your favorite ones and give them a follow.
-
+ )}
+
+ )
},
{
id: 'activity',
title: 'Activity',
- contents:
-
- {activities && activities.slice().reverse().map(activity => (
- activity.type === 'Create' && activity.object.type === 'Article' &&
- - handleViewContent(activity.object, activity.actor)}>
-
-
- ))}
-
-
+ contents: (
+
+
+ {activityTabActivities.reverse().map(activity => (
+ - handleViewContent(activity.object, activity.actor)}
+ >
+
+
+ ))}
+
+
+ )
},
{
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: