diff --git a/frontend/src/components/recipe/RecipeCard.tsx b/frontend/src/components/recipe/RecipeCard.tsx
index cbf74e5..15d3091 100644
--- a/frontend/src/components/recipe/RecipeCard.tsx
+++ b/frontend/src/components/recipe/RecipeCard.tsx
@@ -2,6 +2,7 @@ import { Link } from 'react-router'
import { Heart, Clock } from 'lucide-react'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { toggleFavorite } from '../../api/recipes'
+import { useAuth } from '../../context/AuthContext'
import type { Recipe } from '../../api/types'
const gradients = [
@@ -12,6 +13,7 @@ const gradients = [
]
export function RecipeCard({ recipe }: { recipe: Recipe }) {
+ const { isAuthenticated } = useAuth()
const qc = useQueryClient()
const favMutation = useMutation({
mutationFn: () => toggleFavorite(recipe.id),
@@ -36,22 +38,24 @@ export function RecipeCard({ recipe }: { recipe: Recipe }) {
{recipe.title}
-
- {totalTime > 0 && (
-
- {totalTime} min
-
- )}
-
-
+ {isAuthenticated && (
+
+ {totalTime > 0 && (
+
+ {totalTime} min
+
+ )}
+
+
+ )}
)
diff --git a/frontend/src/pages/HomePage.tsx b/frontend/src/pages/HomePage.tsx
index 9073048..70450cb 100644
--- a/frontend/src/pages/HomePage.tsx
+++ b/frontend/src/pages/HomePage.tsx
@@ -8,13 +8,14 @@ import { fetchRecipes, fetchRandomRecipe } from '../api/recipes'
import { fetchCategories } from '../api/categories'
import { fetchTags } from '../api/tags'
import { RecipeCard } from '../components/recipe/RecipeCard'
-import { RecipeCardSmall } from '../components/recipe/RecipeCardSmall'
import type { Recipe } from '../api/types'
import { Badge } from '../components/ui/Badge'
import { RecipeCardSkeleton } from '../components/ui/Skeleton'
import { EmptyState } from '../components/ui/EmptyState'
+import { useAuth } from '../context/AuthContext'
export function HomePage() {
+ const { isAuthenticated, user } = useAuth()
const [activeCategory, setActiveCategory] = useState()
const [activeTag, setActiveTag] = useState()
const navigate = useNavigate()
@@ -34,14 +35,8 @@ export function HomePage() {
queryFn: () => fetchRecipes({ category: activeCategory, sort: 'newest' }),
})
- const { data: favoritesData } = useQuery({
- queryKey: ['recipes', { favorite: true }],
- queryFn: () => fetchRecipes({ favorite: true }),
- })
-
const recipes = recipesData?.data ?? []
const totalCount = recipesData?.total ?? 0
- const favorites = favoritesData?.data ?? []
// Filter by tag client-side if active
const filteredRecipes = activeTag
@@ -69,11 +64,20 @@ export function HomePage() {
{/* TopBar */}
🧁 Luna Recipes
-
👤
+
- {/* Recipe Counter */}
- {totalCount > 0 && (
+ {/* Recipe Counter (logged in only) */}
+ {isAuthenticated && totalCount > 0 && (
)}
- {/* Random Recipe Buttons */}
- {totalCount > 1 && (
+ {/* Random Recipe Buttons (logged in only) */}
+ {isAuthenticated && totalCount > 1 && (