diff --git a/src/components/RestaurantCard.tsx b/src/components/RestaurantCard.tsx index e4a810a..e0ebeac 100644 --- a/src/components/RestaurantCard.tsx +++ b/src/components/RestaurantCard.tsx @@ -1,6 +1,7 @@ "use client"; -import { useCallback, useState, useEffect } from "react"; +import { useCallback, useState, useEffect, useRef } from "react"; +import { motion, AnimatePresence } from "framer-motion"; import { Star, MapPin, Clock, ExternalLink, Flame, Bookmark, ChevronLeft, ChevronRight } from "lucide-react"; import { Restaurant } from "@/types"; import { getUserId, isRegistered } from "@/lib/userId"; @@ -118,6 +119,17 @@ function ImageGallery({ images, name }: { images: string[]; name: string }) { export default function RestaurantCard({ restaurant, likeCount = 0 }: RestaurantCardProps) { const [favorited, setFavorited] = useState(false); + const [likeBounce, setLikeBounce] = useState(false); + const prevLikeRef = useRef(likeCount); + + useEffect(() => { + if (likeCount > prevLikeRef.current) { + setLikeBounce(true); + const t = setTimeout(() => setLikeBounce(false), 600); + return () => clearTimeout(t); + } + prevLikeRef.current = likeCount; + }, [likeCount]); const images = restaurant.images?.filter(Boolean); const hasImage = images && images.length > 0; @@ -156,16 +168,32 @@ export default function RestaurantCard({ restaurant, likeCount = 0 }: Restaurant