"use client"; import { useEffect, useState } from "react"; import { Link, useLocale } from "@/i18n/navigation"; import { useParams } from "next/navigation"; import Footer from "@/app/components/Footer"; import SocialGreetButton from "@/app/components/SocialGreetButton"; import { mediaUrl } from "@/app/lib/media"; import { fetchPublicProfile, type PublicProfile } from "@/app/lib/social"; const INTENT_LABELS: Record = { friends: "🤝 交友", dating: "🌹 约会", partner: "👥 搭档", roommate: "🏠 室友", cofounder: "🚀 合伙人", explore: "🍜 探店", }; export default function MemberProfilePage() { const params = useParams(); const profileId = String(params?.id || ""); const locale = useLocale(); const [profile, setProfile] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { if (!profileId) return; fetchPublicProfile(profileId) .then(setProfile) .finally(() => setLoading(false)); }, [profileId]); if (loading) { return (
); } if (!profile) { return (

{locale === "zh" ? "成员资料不存在" : "Profile not found"}

{locale === "zh" ? "去智能匹配" : "Go to matching"}
); } const lookingFor = Array.isArray(profile.lookingFor) ? profile.lookingFor : []; return (
{profile.name

{profile.name} {profile.age ? `,${profile.age}` : ""}

📍 {profile.location || (locale === "zh" ? "远程" : "Remote")}

{profile.bio ? (

{locale === "zh" ? "自我介绍" : "About"}

{profile.bio}

) : null} {lookingFor.length > 0 ? (

{locale === "zh" ? "正在寻找" : "Looking for"}

{lookingFor.map((intent) => ( {INTENT_LABELS[intent] || intent} ))}
) : null} {profile.tags?.length ? (

{locale === "zh" ? "标签" : "Tags"}

{profile.tags.map((tag) => ( {tag} ))}
) : null}
{locale === "zh" ? "在匹配里找 TA" : "Find in matching"}
); }