-
+
);
@@ -154,13 +156,25 @@ function renderTimestamp(object: ObjectProperties) {
return (
{getRelativeTimestamp(date)});
}
+const truncateHTML = (html: string, maxLength: number) => {
+ const tempElement = document.createElement('div');
+ tempElement.innerHTML = html;
+
+ const textContent = tempElement.textContent || tempElement.innerText || '';
+
+ const truncatedText = textContent.substring(0, maxLength);
+
+ return `“${truncatedText}…”`;
+};
+
const FeedItemStats: React.FC<{
object: ObjectProperties;
likeCount: number;
commentCount: number;
+ layout: string;
onLikeClick: () => void;
onCommentClick: () => void;
-}> = ({object, likeCount, commentCount, onLikeClick, onCommentClick}) => {
+}> = ({object, likeCount, commentCount, layout, onLikeClick, onCommentClick}) => {
const [isClicked, setIsClicked] = useState(false);
const [isLiked, setIsLiked] = useState(object.liked);
const likeMutation = useLikeMutationForUser('index');
@@ -180,10 +194,10 @@ const FeedItemStats: React.FC<{
setTimeout(() => setIsClicked(false), 300);
};
- return (
+ return (
- {isLiked && {new Intl.NumberFormat().format(likeCount)}}
+ {isLiked && (layout !== 'inbox') && {new Intl.NumberFormat().format(likeCount)}}
- {commentCount > 0 && (
+ {commentCount > 0 && (layout !== 'inbox') && (
{new Intl.NumberFormat().format(commentCount)}
)}
@@ -281,10 +295,10 @@ const FeedItem: React.FC
= ({actor, object, layout, type, comment
const UserMenuTrigger = (
}
-
+
@@ -332,6 +346,7 @@ const FeedItem: React.FC
= ({actor, object, layout, type, comment
= ({actor, object, layout, type, comment
= ({actor, object, layout, type, comment
= ({actor, object, layout, type, comment
return (
<>
{object && (
-
-
-
-
-
- {author.name}
- {getUsername(author)}
- {getRelativeTimestamp(date)}
-
-
-
- {object.name &&
{object.name}}
-
+
+
+
+
+
+
+ {author.name}
+ {getUsername(author)}
+ {getRelativeTimestamp(date)}
- {renderInboxAttachment(object)}
-
-
-
-
+
{object.name ? object.name : {author.name}: }
+
+
+ {renderInboxAttachment(object)}
+
+
+
)}
@@ -486,4 +502,4 @@ const FeedItem: React.FC
= ({actor, object, layout, type, comment
return (<>>);
};
-export default FeedItem;
+export default FeedItem;
\ No newline at end of file
diff --git a/apps/admin-x-activitypub/src/components/global/APAvatar.tsx b/apps/admin-x-activitypub/src/components/global/APAvatar.tsx
index 533be74734..f0d7db2cc1 100644
--- a/apps/admin-x-activitypub/src/components/global/APAvatar.tsx
+++ b/apps/admin-x-activitypub/src/components/global/APAvatar.tsx
@@ -34,8 +34,8 @@ const APAvatar: React.FC = ({author, size, badge}) => {
switch (size) {
case 'xs':
iconSize = 12;
- containerClass = 'z-10 relative rounded bg-grey-100 shrink-0 flex items-center justify-center w-6 h-6';
- imageClass = 'z-10 rounded w-6 h-6 object-cover';
+ containerClass = 'z-10 relative rounded bg-grey-100 shrink-0 flex items-center justify-center w-5 h-5';
+ imageClass = 'z-10 rounded w-5 h-5 object-cover';
break;
case 'sm':
containerClass = 'z-10 relative rounded bg-grey-100 shrink-0 flex items-center justify-center w-10 h-10';
diff --git a/apps/admin-x-activitypub/src/components/search/ProfileSearchResultModal.tsx b/apps/admin-x-activitypub/src/components/search/ProfileSearchResultModal.tsx
index 55362e9e8b..be62347a22 100644
--- a/apps/admin-x-activitypub/src/components/search/ProfileSearchResultModal.tsx
+++ b/apps/admin-x-activitypub/src/components/search/ProfileSearchResultModal.tsx
@@ -2,7 +2,8 @@ import React, {useEffect, useRef, useState} from 'react';
import NiceModal, {useModal} from '@ebay/nice-modal-react';
import {Activity, ActorProperties} from '@tryghost/admin-x-framework/api/activitypub';
-import {Button, Heading, List, LoadingIndicator, Modal, NoValueLabel, Tab,TabView} from '@tryghost/admin-x-design-system';
+
+import {Button, Heading, Icon, List, LoadingIndicator, Modal, NoValueLabel, Tab,TabView} from '@tryghost/admin-x-design-system';
import {UseInfiniteQueryResult} from '@tanstack/react-query';
import {type GetFollowersForProfileResponse, type GetFollowingForProfileResponse} from '../../api/activitypub';
@@ -198,6 +199,21 @@ const ProfileSearchResultModal: React.FC = ({
}
].filter(Boolean) as Tab[];
+ const [isExpanded, setisExpanded] = useState(false);
+
+ const toggleExpand = () => {
+ setisExpanded(!isExpanded);
+ };
+
+ const contentRef = useRef(null);
+ const [isOverflowing, setIsOverflowing] = useState(false);
+
+ useEffect(() => {
+ if (contentRef.current) {
+ setIsOverflowing(contentRef.current.scrollHeight > 160); // Compare content height to max height
+ }
+ }, [isExpanded]);
+
return (
= ({
/>
{profile.actor.name}
-
{profile.handle}
-
- {attachments.map(attachment => (
-
- {attachment.name}
-
-
- ))}
+
{profile.handle}
+ {(profile.actor.summary || attachments.length > 0) && (
p]:mb-3 ${isExpanded ? 'max-h-none pb-7' : 'max-h-[160px] overflow-hidden'} relative`}>
+
+ {attachments.map(attachment => (
+
+ {attachment.name}
+
+
+ ))}
+ {!isExpanded && isOverflowing && (
+
+ )}
+ {isOverflowing &&
}
+
)}
+
Posts
+
+ {posts.map((post) => {
+ if (post.type === 'Announce') {
+ return null;
+ } else {
+ return (
+
{}}
+ />
+ );
+ }
+ })}
containerClassName='mt-6'
selectedTab={selectedTab}
diff --git a/apps/admin-x-design-system/src/assets/icons/play-fill.svg b/apps/admin-x-design-system/src/assets/icons/play-fill.svg
new file mode 100644
index 0000000000..228930ad01
--- /dev/null
+++ b/apps/admin-x-design-system/src/assets/icons/play-fill.svg
@@ -0,0 +1,4 @@
+
\ No newline at end of file