From 37eb7f07d73370335ad61ef28fdf0b19ea64de80 Mon Sep 17 00:00:00 2001 From: kurihada Date: Thu, 26 Feb 2026 16:32:00 +0800 Subject: [PATCH] =?UTF-8?q?ui:=20=E6=BB=91=E5=8D=A1=E4=BA=92=E5=8A=A8?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=20=E2=80=94=20like=20=E5=BE=BD=E7=AB=A0?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E3=80=81=E5=88=86=E7=B1=BB=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=8F=AF=E8=AF=BB=E6=80=A7=E3=80=81=E8=BF=9B=E5=BA=A6=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RestaurantCard: like 徽章实时弹跳动画,首次出现滑入效果 - RestaurantCard: 分类标签改为白底黑字,图片上始终清晰 - SwipeDeck: 进度数字加背景色块包裹,与用户名视觉分离 --- src/components/RestaurantCard.tsx | 44 +++++++++++++++++++++++++------ src/components/SwipeDeck.tsx | 13 ++++++--- 2 files changed, 45 insertions(+), 12 deletions(-) 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
{restaurant.category && ( - + {restaurant.category} )} - {likeCount > 0 && ( - - - {likeCount} 人想去 - - )} + + {likeCount > 0 && ( + + + {likeCount} 人想去 + + )} +
diff --git a/src/components/SwipeDeck.tsx b/src/components/SwipeDeck.tsx index 494d7a8..54b6779 100644 --- a/src/components/SwipeDeck.tsx +++ b/src/components/SwipeDeck.tsx @@ -34,11 +34,14 @@ function UserProgressBar({ return (
- + {myAvatar} - 你 {localIndex}/{total} + 你 + + {localIndex}/{total} + {others.map(([id, count]) => { const finished = count >= total; @@ -49,13 +52,15 @@ function UserProgressBar({ return ( {emoji} {label && {label}} - {count}/{total} + + {count}/{total} + {finished && } );