(FIX): Fixed profile display issue.

This commit is contained in:
Hayden Hargreaves 2026-01-31 10:18:36 -07:00
parent 62f56e5efd
commit 5179707d0f

View File

@ -115,8 +115,8 @@ export default function Profile() {
<p className="text-xs md:text-sm">{user?.Email}</p> <p className="text-xs md:text-sm">{user?.Email}</p>
</div> </div>
<div className="flex gap-x-4"> <div className="flex gap-x-4">
<p className="text-xs md:text-sm"><span className="font-bold">{recipes.length}</span> recipes</p> <p className="text-xs md:text-sm"><span className="font-bold">{recipes?.length ?? 0}</span> recipes</p>
<p className="text-xs md:text-sm"><span className="font-bold">{favorites.length}</span> favorites</p> <p className="text-xs md:text-sm"><span className="font-bold">{favorites?.length ?? 0}</span> favorites</p>
</div> </div>
</div> </div>
</div> </div>
@ -126,10 +126,10 @@ export default function Profile() {
<section className="p-8"> <section className="p-8">
<h2 className="text-2xl font-semibold text-gray-800">My Recipes</h2> <h2 className="text-2xl font-semibold text-gray-800">My Recipes</h2>
<ul className="w-full my-2"> <ul className="w-full my-2">
{recipes.length <= 4 ? ( {recipes?.length <= 4 ? (
recipes.map(recipe => <RecipeListItem key={recipe.Id} recipe={recipe} />) recipes?.map(recipe => <RecipeListItem key={recipe.Id} recipe={recipe} />)
) : ( ) : (
recipes.slice(0, 4).map(recipe => <RecipeListItem key={recipe.Id} recipe={recipe} />) recipes?.slice(0, 4).map(recipe => <RecipeListItem key={recipe.Id} recipe={recipe} />)
)} )}
<button onClick={seeAllRecipesHandler} className="w-full"> <button onClick={seeAllRecipesHandler} className="w-full">
<li className="w-full border-b border-gray-300 px-2 py-4 even:bg-gray-50 hover:bg-gray-100 hover:text-blue-600 duration-150 text-center"> <li className="w-full border-b border-gray-300 px-2 py-4 even:bg-gray-50 hover:bg-gray-100 hover:text-blue-600 duration-150 text-center">
@ -143,10 +143,10 @@ export default function Profile() {
<section className="p-8"> <section className="p-8">
<h2 className="text-2xl font-semibold text-gray-800">My Favorites</h2> <h2 className="text-2xl font-semibold text-gray-800">My Favorites</h2>
<ul className="w-full my-2"> <ul className="w-full my-2">
{favorites.length <= 4 ? ( {favorites?.length <= 4 ? (
favorites.map(recipe => <RecipeListItem key={recipe.Id} recipe={recipe} />) favorites?.map(recipe => <RecipeListItem key={recipe.Id} recipe={recipe} />)
) : ( ) : (
favorites.slice(0, 4).map(recipe => <RecipeListItem key={recipe.Id} recipe={recipe} />) favorites?.slice(0, 4).map(recipe => <RecipeListItem key={recipe.Id} recipe={recipe} />)
)} )}
<button onClick={seeAllFavoritesHandler} className="w-full"> <button onClick={seeAllFavoritesHandler} className="w-full">
<li className="w-full border-b border-gray-300 px-2 py-4 even:bg-gray-50 hover:bg-gray-100 hover:text-blue-600 duration-150 text-center"> <li className="w-full border-b border-gray-300 px-2 py-4 even:bg-gray-50 hover:bg-gray-100 hover:text-blue-600 duration-150 text-center">