fix: feed card follow ui

This commit is contained in:
gosangam
2026-06-18 00:21:06 +05:30
parent 071eb4d58a
commit 84cb273941
4 changed files with 59 additions and 19 deletions
+25 -10
View File
@@ -33,6 +33,7 @@ import { AtSign, ImageIcon, Repeat2 } from "lucide-react";
import { cn } from "@/lib/utils";
import type { Post, PostImage } from "@/lib/social";
import { displaySourceLabel } from "@/lib/source-reference";
import { timeAgo } from "@/lib/time";
import { useMediaQuery } from "@/components/selection-toolbar/shared";
import { UserAvatar } from "@/components/ui/user-avatar";
import { useAuth } from "@/components/auth/auth-provider";
@@ -125,11 +126,25 @@ export function PostScrollCard({
on the right (Delete for author, Block/Report for everyone
else; PostCardMenu hides itself when there are no items). */}
<header className="flex items-center gap-3 px-4 py-3">
<UserAvatar
src={post.author_avatar_url}
name={post.author_name ?? "Unknown"}
className="size-9"
/>
{post.author_handle ? (
<Link
href={`/u/${post.author_handle}`}
aria-label={`View ${post.author_name || post.author_handle}'s profile`}
className="shrink-0"
>
<UserAvatar
src={post.author_avatar_url}
name={post.author_name ?? "Unknown"}
className="size-9"
/>
</Link>
) : (
<UserAvatar
src={post.author_avatar_url}
name={post.author_name ?? "Unknown"}
className="size-9"
/>
)}
<div className="min-w-0 flex-1">
<Link
href={
@@ -139,16 +154,16 @@ export function PostScrollCard({
>
{post.author_name || "Unknown"}
</Link>
{post.author_handle ? (
<span className="block text-xs text-muted-foreground truncate">
@{post.author_handle}
</span>
) : null}
<span className="block text-xs text-muted-foreground truncate">
{post.author_handle ? <>@{post.author_handle} · </> : null}
{timeAgo(post.created_at)}
</span>
</div>
{enableFollow && post.author_handle && !post.viewer_follows_author ? (
<FeedFollowButton
handle={post.author_handle}
followsYou={!!post.author_follows_viewer}
requested={!!post.viewer_follow_requested}
/>
) : null}
<PostCardMenu