feat: 新增「喝什么」场景,支持奶茶/咖啡/酒吧等饮品店搜索

引入场景系统(SceneType),首页增加「吃什么」「喝什么」切换 Tab,
不同场景使用不同的高德 POI 类型、热门标签、价格区间和全链路文案。
场景信息存储在房间数据中,邀请/分享/匹配结果等页面自动适配。
This commit is contained in:
2026-02-25 01:12:44 +08:00
parent 6866b70278
commit c86a6c0909
13 changed files with 197 additions and 47 deletions
+9 -6
View File
@@ -20,7 +20,7 @@ import {
Share2,
Zap,
} from "lucide-react";
import { Restaurant, MatchType, RunnerUp } from "@/types";
import { Restaurant, MatchType, RunnerUp, SceneType } from "@/types";
import { fireCelebration, playChime } from "@/lib/celebrate";
import { isRegistered } from "@/lib/userId";
@@ -36,6 +36,7 @@ interface MatchResultProps {
onReset: () => Promise<void>;
onNarrow: (restaurantIds: string[]) => Promise<void>;
resetting: boolean;
scene?: SceneType;
}
function buildNavUrl(restaurant: Restaurant): string {
@@ -85,7 +86,7 @@ function NoMatchResult({
animate={{ y: 0, opacity: 1 }}
transition={{ delay: 0.45 }}
>
</motion.p>
<motion.div
@@ -176,6 +177,7 @@ export default function MatchResult({
onReset,
onNarrow,
resetting,
scene = "eat",
}: MatchResultProps) {
const router = useRouter();
const [showRunnerUps, setShowRunnerUps] = useState(false);
@@ -220,10 +222,11 @@ export default function MatchResult({
}, [userId, roomId, restaurant, matchType, userCount]);
const handleShare = useCallback(async () => {
const verb = scene === "drink" ? "喝" : "吃";
const lines = [
isUnanimous
? `🎉 默契度 100%${userCount} 人全员一致选了同一家!`
: `🎉 我们用 NoWhatever 选好了!`,
: `🎉 我们用 NoWhatever 选好了去哪${verb}`,
``,
`📍 ${restaurant.name}`,
restaurant.rating ? `${restaurant.rating}` : "",
@@ -257,7 +260,7 @@ export default function MatchResult({
} catch {
showToast("复制失败,请手动复制");
}
}, [restaurant, showToast, isUnanimous, userCount]);
}, [restaurant, showToast, isUnanimous, userCount, scene]);
if (matchType === "no_match") {
return <NoMatchResult onReset={onReset} resetting={resetting} />;
@@ -515,7 +518,7 @@ export default function MatchResult({
className="flex items-center gap-1.5 text-sm font-medium text-amber-200 underline underline-offset-2 hover:text-white"
>
<RefreshCw size={13} />
</motion.button>
</>
) : (
@@ -536,7 +539,7 @@ export default function MatchResult({
}`}
>
<RefreshCw size={13} />
</motion.button>
</>
)}