feat: add followers and following pages with API integration, enhance profile page with follower/following counts

This commit is contained in:
2025-09-06 22:22:44 +02:00
parent dc92945962
commit 8ddbf45a09
6 changed files with 183 additions and 13 deletions

View File

@@ -0,0 +1,38 @@
import Link from "next/link";
import { User } from "@/lib/api";
import { UserAvatar } from "./user-avatar";
import { Card, CardContent } from "./ui/card";
interface UserListCardProps {
users: User[];
}
export function UserListCard({ users }: UserListCardProps) {
if (users.length === 0) {
return (
<p className="text-center text-muted-foreground pt-8">
No users to display.
</p>
);
}
return (
<Card>
<CardContent className="divide-y">
{users.map((user) => (
<Link
href={`/users/${user.username}`}
key={user.id}
className="flex items-center gap-4 p-4 -mx-6 hover:bg-accent"
>
<UserAvatar src={user.avatarUrl} alt={user.displayName} />
<div>
<p className="font-bold">{user.displayName || user.username}</p>
<p className="text-sm text-muted-foreground">@{user.username}</p>
</div>
</Link>
))}
</CardContent>
</Card>
);
}