From e1b5a2aaa02fcec7cb39e60caa7d51a97fc58fbf Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Sun, 7 Sep 2025 13:37:39 +0200 Subject: [PATCH] feat: enhance profile and feed pages with friends display logic, update TopFriends component to support mode, and extend bio length in profile schema --- thoughts-frontend/app/(auth)/layout.tsx | 2 +- thoughts-frontend/app/page.tsx | 19 ++++++++++++++++--- .../app/users/[username]/page.tsx | 13 ++++++++++++- thoughts-frontend/components/header.tsx | 2 +- thoughts-frontend/components/top-friends.tsx | 10 ++++++---- thoughts-frontend/lib/api.ts | 2 +- 6 files changed, 37 insertions(+), 11 deletions(-) diff --git a/thoughts-frontend/app/(auth)/layout.tsx b/thoughts-frontend/app/(auth)/layout.tsx index 4867b37..d948319 100644 --- a/thoughts-frontend/app/(auth)/layout.tsx +++ b/thoughts-frontend/app/(auth)/layout.tsx @@ -5,7 +5,7 @@ export default function AuthLayout({ children: React.ReactNode; }) { return ( -
+
{children}
); diff --git a/thoughts-frontend/app/page.tsx b/thoughts-frontend/app/page.tsx index a00fce5..7a0b476 100644 --- a/thoughts-frontend/app/page.tsx +++ b/thoughts-frontend/app/page.tsx @@ -1,5 +1,12 @@ import { cookies } from "next/headers"; -import { getFeed, getMe, getUserProfile, Me, User } from "@/lib/api"; +import { + getFeed, + getFriends, + getMe, + getUserProfile, + Me, + User, +} from "@/lib/api"; import { PostThoughtForm } from "@/components/post-thought-form"; import { Button } from "@/components/ui/button"; import Link from "next/link"; @@ -39,11 +46,14 @@ async function FeedPage({ token }: { token: string }) { feedData.thoughts ); + const friends = (await getFriends(token)).users.map((user) => user.username); + const shouldDisplayTopFriends = me?.topFriends && me.topFriends.length > 8; + return (
diff --git a/thoughts-frontend/components/header.tsx b/thoughts-frontend/components/header.tsx index ced419c..020b080 100644 --- a/thoughts-frontend/components/header.tsx +++ b/thoughts-frontend/components/header.tsx @@ -25,7 +25,7 @@ export function Header() { ) : ( <> -