diff --git a/thoughts-frontend/components/all-friends-card.tsx b/thoughts-frontend/components/all-friends-card.tsx new file mode 100644 index 0000000..e386581 --- /dev/null +++ b/thoughts-frontend/components/all-friends-card.tsx @@ -0,0 +1,82 @@ +import Link from "next/link"; +import { User, RemoteActor } from "@/lib/api"; +import { UserAvatar } from "./user-avatar"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; + +interface AllFriendsCardProps { + localFriends: User[]; + remoteFriends: RemoteActor[]; +} + +export function AllFriendsCard({ localFriends, remoteFriends }: AllFriendsCardProps) { + const total = localFriends.length + remoteFriends.length; + if (total === 0) return null; + + const localSlice = localFriends.slice(0, 6); + const remoteSlice = remoteFriends.slice(0, Math.max(0, 6 - localSlice.length)); + + return ( + + + + Friends + + + + {localSlice.map((friend) => ( + + +
+ + {friend.displayName || friend.username} + + + @{friend.username} + +
+ + ))} + {remoteSlice.map((actor) => ( + + +
+ + {actor.displayName || actor.handle} + + + @{actor.handle} + +
+ + federated + +
+ ))} + {total > 6 && ( + + See all {total} friends → + + )} +
+
+ ); +}