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"; restaurant: Restaurant; matchType: MatchType; matchLikes: number; userCount: number; scene?: SceneType; } export default function RestaurantShareCard({ data, cardRef, imageDataUrl, }: { data: RestaurantShareData; cardRef: React.RefObject; imageDataUrl: string | null; }) { const { restaurant, matchType, matchLikes, userCount, scene } = data; const isUnanimous = matchType === "unanimous"; const verb = getSceneConfig(scene ?? "eat").verb; const shareUrl = typeof window !== "undefined" ? window.location.origin : "nowhatever.app"; const accentFrom = isUnanimous ? "#059669" : "#b45309"; const accentTo = isUnanimous ? "#34d399" : "#fbbf24"; const accentText = isUnanimous ? "#6ee7b7" : "#fcd34d"; const accentBg = isUnanimous ? "rgba(16, 185, 129, 0.12)" : "rgba(245, 158, 11, 0.12)"; return (
{/* Decorative glows */}
{/* Brand header */}
NoWhatever
别说随便 · PANIC MODE
{/* Thin accent line */}
{/* Hero section */}
{isUnanimous ? "🎉" : "🏆"}
就去这{verb}!
{isUnanimous && ( )} {isUnanimous ? `默契度 100% · ${userCount}人全员一致` : `${matchLikes}/${userCount} 人选了这家`} {isUnanimous && ( )}
{/* Restaurant card */}
{imageDataUrl && ( {restaurant.name} )}
{restaurant.name}
{restaurant.category && ( {restaurant.category} )}
{restaurant.rating > 0 && ( {restaurant.rating} )} {restaurant.price && restaurant.price !== "未知" && ( {restaurant.price} )} {restaurant.distance && ( {restaurant.distance} )}
{restaurant.address && (
📍 {restaurant.address}
)} {restaurant.tag && (
{restaurant.tag .split(",") .slice(0, 4) .map((t) => ( {t.trim()} ))}
)}
{/* QR footer */}
扫码一起「别说随便」
{shareUrl.replace(/^https?:\/\//, "")}
); }