feat: 场景细分为餐厅/咖啡奶茶/甜品 + 附近搜索优先 + 美食多选标签
This commit is contained in:
@@ -115,7 +115,7 @@ export const POST = apiHandler(async (req) => {
|
||||
scene = "eat" as SceneType,
|
||||
} = body;
|
||||
|
||||
const sceneConfig = getSceneConfig(scene === "drink" ? "drink" : "eat");
|
||||
const sceneConfig = getSceneConfig(scene);
|
||||
|
||||
const numLat = Number(lat);
|
||||
const numLng = Number(lng);
|
||||
|
||||
@@ -4,12 +4,10 @@ import { useEffect, useState } from "react";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { motion } from "framer-motion";
|
||||
import {
|
||||
Utensils,
|
||||
Users,
|
||||
Heart,
|
||||
Sparkles,
|
||||
ChevronRight,
|
||||
Coffee,
|
||||
} from "lucide-react";
|
||||
import { getUserId } from "@/lib/userId";
|
||||
import { joinRoom } from "@/lib/room";
|
||||
@@ -108,7 +106,7 @@ export default function InvitePage() {
|
||||
transition={{ duration: 0.5 }}
|
||||
>
|
||||
<div className="flex h-16 w-16 items-center justify-center rounded-2xl bg-accent shadow-lg shadow-accent/20">
|
||||
{scene === "drink" ? <Coffee size={28} className="text-white" /> : <Utensils size={28} className="text-white" />}
|
||||
<span className="text-3xl leading-none">{sceneConfig.emoji}</span>
|
||||
</div>
|
||||
|
||||
<h1 className="mt-5 text-3xl font-black tracking-tight text-heading">
|
||||
|
||||
@@ -206,7 +206,7 @@ export default function PanicPage() {
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="text-2xl font-black tracking-tight text-heading">
|
||||
⚡ 极速救场
|
||||
极速救场
|
||||
</h1>
|
||||
<p className="text-xs font-medium tracking-widest text-muted">
|
||||
10秒内出结果
|
||||
@@ -256,11 +256,12 @@ export default function PanicPage() {
|
||||
</motion.div>
|
||||
|
||||
<motion.div
|
||||
className="mt-4 flex items-center justify-center gap-2"
|
||||
className="mt-4 w-full max-w-xs overflow-x-auto scrollbar-none py-1"
|
||||
initial={{ y: 10, opacity: 0 }}
|
||||
animate={{ y: 0, opacity: 1 }}
|
||||
transition={{ duration: 0.4, delay: 0.12 }}
|
||||
>
|
||||
<div className="flex gap-2 px-1 pb-0.5">
|
||||
{SCENES.map((s) => {
|
||||
const cfg = getSceneConfig(s);
|
||||
const active = scene === s;
|
||||
@@ -269,7 +270,7 @@ export default function PanicPage() {
|
||||
key={s}
|
||||
onClick={() => handleSceneChange(s)}
|
||||
disabled={loading}
|
||||
className={`flex items-center gap-1.5 rounded-full px-3.5 py-1.5 text-xs font-semibold transition-all disabled:opacity-50 ${
|
||||
className={`flex shrink-0 items-center gap-1.5 rounded-full px-3.5 py-1.5 text-xs font-semibold transition-all disabled:opacity-50 ${
|
||||
active
|
||||
? "bg-orange-500 text-white shadow-md shadow-orange-500/25"
|
||||
: "bg-surface text-muted ring-1 ring-border hover:bg-elevated"
|
||||
@@ -280,6 +281,7 @@ export default function PanicPage() {
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</motion.div>
|
||||
|
||||
<motion.div
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Star, MapPin, Zap } from "lucide-react";
|
||||
import { QRCodeSVG } from "qrcode.react";
|
||||
import type { Restaurant, MatchType, SceneType } from "@/types";
|
||||
import { getSceneConfig } from "@/lib/sceneConfig";
|
||||
|
||||
export interface RestaurantShareData {
|
||||
type: "restaurant";
|
||||
@@ -22,7 +23,7 @@ export default function RestaurantShareCard({
|
||||
}) {
|
||||
const { restaurant, matchType, matchLikes, userCount, scene } = data;
|
||||
const isUnanimous = matchType === "unanimous";
|
||||
const verb = scene === "drink" ? "喝" : "吃";
|
||||
const verb = getSceneConfig(scene ?? "eat").verb;
|
||||
const shareUrl =
|
||||
typeof window !== "undefined" ? window.location.origin : "nowhatever.app";
|
||||
const accentFrom = isUnanimous ? "#059669" : "#b45309";
|
||||
|
||||
+43
-15
@@ -4,6 +4,7 @@ export interface SceneConfig {
|
||||
key: SceneType;
|
||||
label: string;
|
||||
emoji: string;
|
||||
verb: string;
|
||||
poiTypes: string;
|
||||
defaultImage: string;
|
||||
hotTags: readonly string[];
|
||||
@@ -22,56 +23,83 @@ export interface SceneConfig {
|
||||
const SCENE_CONFIGS: Record<SceneType, SceneConfig> = {
|
||||
eat: {
|
||||
key: "eat",
|
||||
label: "吃什么",
|
||||
label: "餐厅",
|
||||
emoji: "🍜",
|
||||
verb: "吃",
|
||||
poiTypes: "050000",
|
||||
defaultImage:
|
||||
"https://images.unsplash.com/photo-1517248135467-4c7edcad34c4?w=800&q=80",
|
||||
hotTags: ["火锅", "日料", "烧烤", "西餐", "川菜", "咖啡甜品", "小吃快餐"],
|
||||
hotTags: ["火锅", "日料", "烧烤", "西餐", "川菜", "粤菜", "小吃快餐"],
|
||||
priceOptions: [
|
||||
{ label: "不限", value: "any" },
|
||||
{ label: "¥50以下", value: "under50" },
|
||||
{ label: "¥50-100", value: "50to100" },
|
||||
{ label: "¥100+", value: "over100" },
|
||||
],
|
||||
tagLabel: "美食",
|
||||
tagLabel: "口味",
|
||||
tagPlaceholder: "想吃什么?(留空则不限)",
|
||||
loadingText: "正在搜索周边美食...",
|
||||
emptyError: "附近没有找到餐厅,试试扩大搜索范围或换个菜系",
|
||||
loadingText: "正在搜索周边餐厅...",
|
||||
emptyError: "附近没有找到餐厅,试试扩大搜索范围或换个口味",
|
||||
subtitle: "和朋友一起滑卡片,再也不用纠结吃什么",
|
||||
inviteText: "有人邀请你一起选餐厅",
|
||||
shareTitle: "别说随便啦,来滑卡片决定吃什么!",
|
||||
shareText: "我建好房间了,快点开链接一起选餐厅,滑中同一家就去吃!",
|
||||
qrSubtitle: "让朋友扫码加入房间,一起滑卡片选餐厅",
|
||||
},
|
||||
drink: {
|
||||
key: "drink",
|
||||
label: "喝什么",
|
||||
drinks: {
|
||||
key: "drinks",
|
||||
label: "咖啡/奶茶",
|
||||
emoji: "🧋",
|
||||
verb: "喝",
|
||||
poiTypes: "050301|050302|050303|050400",
|
||||
defaultImage:
|
||||
"https://images.unsplash.com/photo-1556679343-c7306c1976bc?w=800&q=80",
|
||||
hotTags: ["奶茶", "咖啡", "酒吧", "果茶", "甜品", "茶馆", "鸡尾酒"],
|
||||
hotTags: ["咖啡", "奶茶", "拿铁", "美式", "水果茶", "冷萃", "芋泥"],
|
||||
priceOptions: [
|
||||
{ label: "不限", value: "any" },
|
||||
{ label: "¥20以下", value: "under20" },
|
||||
{ label: "¥20-50", value: "20to50" },
|
||||
{ label: "¥50+", value: "over50" },
|
||||
],
|
||||
tagLabel: "饮品",
|
||||
tagLabel: "类型",
|
||||
tagPlaceholder: "想喝什么?(留空则不限)",
|
||||
loadingText: "正在搜索周边饮品店...",
|
||||
emptyError: "附近没有找到饮品店,试试扩大搜索范围或换个类型",
|
||||
emptyError: "附近没有找到饮品店,试试扩大搜索范围",
|
||||
subtitle: "和朋友一起滑卡片,再也不用纠结喝什么",
|
||||
inviteText: "有人邀请你一起选饮品店",
|
||||
shareTitle: "别说随便啦,来滑卡片决定喝什么!",
|
||||
shareText: "我建好房间了,快点开链接一起选店,滑中同一家就去喝!",
|
||||
qrSubtitle: "让朋友扫码加入房间,一起滑卡片选店",
|
||||
qrSubtitle: "让朋友扫码加入房间,一起滑卡片选饮品店",
|
||||
},
|
||||
dessert: {
|
||||
key: "dessert",
|
||||
label: "甜品",
|
||||
emoji: "🍰",
|
||||
verb: "吃",
|
||||
poiTypes: "050403|050404|050400",
|
||||
defaultImage:
|
||||
"https://images.unsplash.com/photo-1488477181946-6428a0291777?w=800&q=80",
|
||||
hotTags: ["蛋糕", "冰淇淋", "芋圆", "麻薯", "草莓", "班戟"],
|
||||
priceOptions: [
|
||||
{ label: "不限", value: "any" },
|
||||
{ label: "¥20以下", value: "under20" },
|
||||
{ label: "¥20-50", value: "20to50" },
|
||||
{ label: "¥50+", value: "over50" },
|
||||
],
|
||||
tagLabel: "类型",
|
||||
tagPlaceholder: "想吃什么甜品?(留空则不限)",
|
||||
loadingText: "正在搜索周边甜品店...",
|
||||
emptyError: "附近没有找到甜品店,试试扩大搜索范围",
|
||||
subtitle: "和朋友一起滑卡片,选一家甜蜜蜜的甜品店",
|
||||
inviteText: "有人邀请你一起选甜品店",
|
||||
shareTitle: "别说随便啦,来滑卡片决定吃什么甜品!",
|
||||
shareText: "我建好房间了,快点开链接一起选甜品店,滑中同一家就去吃!",
|
||||
qrSubtitle: "让朋友扫码加入房间,一起滑卡片选甜品店",
|
||||
},
|
||||
};
|
||||
|
||||
export const SCENES: SceneType[] = ["eat", "drink"];
|
||||
export const SCENES: SceneType[] = ["eat", "drinks", "dessert"];
|
||||
|
||||
export function getSceneConfig(scene: SceneType): SceneConfig {
|
||||
return SCENE_CONFIGS[scene];
|
||||
export function getSceneConfig(scene: string): SceneConfig {
|
||||
return SCENE_CONFIGS[scene as SceneType] ?? SCENE_CONFIGS.eat;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
export type SceneType = "eat" | "drink";
|
||||
export type SceneType = "eat" | "drinks" | "dessert";
|
||||
|
||||
export interface Restaurant {
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user