-
- {author.charAt(0).toUpperCase()}
+
+
+
+
{post?.category || "News"}
);
@@ -464,6 +485,7 @@ export default function PostDetailModal({ post, onClose, onPostUpdated, onPostDe
});
const [liked, setLiked] = useState(false);
const [truth, setTruth] = useState({ score: 50, count: 0 });
+ const [authorAvatar, setAuthorAvatar] = useState("");
const [comments, setComments] = useState([]);
const [commentInput, setCommentInput] = useState("");
const [commentSending, setCommentSending] = useState(false);
@@ -504,6 +526,15 @@ export default function PostDetailModal({ post, onClose, onPostUpdated, onPostDe
fetchPostTruth(postId).then(res => { if (res) setTruth({ score: res.truth_score ?? res.user_score ?? 50, count: res.vote_count ?? 0 }); });
}, [postId]);
+ // Fetch author avatar
+ useEffect(() => {
+ const authorName = post?.author || post?.username;
+ if (!authorName) return;
+ fetchProfile(authorName).then(res => {
+ if (res?.avatar_url) setAuthorAvatar(res.avatar_url);
+ });
+ }, [post?.author, post?.username]);
+
// Fetch comments
const refreshComments = useCallback(async (autoOpen = false) => {
if (!postId) return;
@@ -659,8 +690,12 @@ export default function PostDetailModal({ post, onClose, onPostUpdated, onPostDe
{/* Author Row */}
- {author.charAt(0).toUpperCase()}
+ text-white font-bold text-base sm:text-lg shadow-lg overflow-hidden`}>
+ {authorAvatar ? (
+

+ ) : (
+ author.charAt(0).toUpperCase()
+ )}