"use client"; import { useState, useMemo } from "react"; import Link from "next/link"; import HeroSection from "./components/HeroSection"; import FilterBar from "./components/FilterBar"; import CityCard from "./components/CityCard"; import { cities } from "./data/cities"; /* ===== Avatar photos ===== */ const memberPhotos = [ { name: "林晓", photo: "https://i.pravatar.cc/150?img=5" }, { name: "张浩", photo: "https://i.pravatar.cc/150?img=3" }, { name: "陈悦", photo: "https://i.pravatar.cc/150?img=9" }, { name: "周杰", photo: "https://i.pravatar.cc/150?img=7" }, { name: "吴婷", photo: "https://i.pravatar.cc/150?img=1" }, { name: "杨帅", photo: "https://i.pravatar.cc/150?img=12" }, { name: "赵琪", photo: "https://i.pravatar.cc/150?img=16" }, { name: "黄磊", photo: "https://i.pravatar.cc/150?img=11" }, { name: "孙莉", photo: "https://i.pravatar.cc/150?img=20" }, ]; const travelingNow = [ { name: "小明", photo: "https://i.pravatar.cc/150?img=52", dest: "大理" }, { name: "雨晴", photo: "https://i.pravatar.cc/150?img=44", dest: "成都" }, { name: "阿杰", photo: "https://i.pravatar.cc/150?img=53", dest: "深圳" }, { name: "小燕", photo: "https://i.pravatar.cc/150?img=47", dest: "杭州" }, { name: "大伟", photo: "https://i.pravatar.cc/150?img=55", dest: "厦门" }, { name: "佳琪", photo: "https://i.pravatar.cc/150?img=48", dest: "昆明" }, { name: "志远", photo: "https://i.pravatar.cc/150?img=57", dest: "丽江" }, { name: "心怡", photo: "https://i.pravatar.cc/150?img=49", dest: "三亚" }, { name: "凯文", photo: "https://i.pravatar.cc/150?img=59", dest: "上海" }, { name: "子豪", photo: "https://i.pravatar.cc/150?img=60", dest: "北京" }, { name: "浩然", photo: "https://i.pravatar.cc/150?img=61", dest: "广州" }, { name: "雅琪", photo: "https://i.pravatar.cc/150?img=21", dest: "南京" }, { name: "天翔", photo: "https://i.pravatar.cc/150?img=67", dest: "长沙" }, { name: "美玲", photo: "https://i.pravatar.cc/150?img=23", dest: "苏州" }, { name: "俊杰", photo: "https://i.pravatar.cc/150?img=68", dest: "青岛" }, { name: "晓华", photo: "https://i.pravatar.cc/150?img=26", dest: "珠海" }, ]; const meetups = [ { city: "大理", emoji: "🏯", date: "3月9日", count: 12 }, { city: "成都", emoji: "🐼", date: "3月12日", count: 8 }, { city: "深圳", emoji: "🌃", date: "3月14日", count: 15 }, { city: "厦门", emoji: "🌊", date: "3月16日", count: 6 }, { city: "杭州", emoji: "⛲", date: "3月20日", count: 23 }, ]; const hotTopics = [ { title: "大理最佳共享办公空间推荐 Top 10", views: 2340 }, { title: "2026年数字游民友好城市排名", views: 1890 }, { title: "远程工作者的税务规划指南", views: 1560 }, { title: "成都 vs 大理:哪个更适合游民?", views: 1230 }, { title: "新手游民必备工具与装备清单", views: 980 }, ]; function safetyOrder(s: string): number { const o: Record = { 极好: 5, 很好: 4, 好: 3, 一般: 2, 差: 1 }; return o[s] || 0; } export default function Home() { const [activeFilter, setActiveFilter] = useState("全部"); const [sortBy, setSortBy] = useState("score"); const filteredCities = useMemo(() => { let result = [...cities]; if (activeFilter !== "全部") { result = result.filter((c) => c.tags.includes(activeFilter)); } result.sort((a, b) => { switch (sortBy) { case "cost-asc": return a.costPerMonth - b.costPerMonth; case "cost-desc": return b.costPerMonth - a.costPerMonth; case "internet": return b.internetSpeed - a.internetSpeed; case "safety": return safetyOrder(b.safety) - safetyOrder(a.safety); case "nomads": return b.nomadsNow - a.nomadsNow; case "temperature": return b.temperature - a.temperature; default: return b.overallScore - a.overallScore; } }); return result; }, [activeFilter, sortBy]); return (
{/* Stats Strip */}
18

个城市

5,000+

位游民

8+

场聚会/月

¥3,000

起/月生活费

{/* Filter Bar */}
{/* Mixed Grid */}
加入社群
💬

加入数字游民微信社群

3,200+ 在线成员

加入社群 →
新成员
{memberPhotos.map((m) => ( {m.name} ))}
本月 86 人加入
最新活动
🗓 3月15日
📍 深圳南山
👥 12人
{memberPhotos.slice(0, 5).map((m) => ( ))}
{filteredCities.map((city, i) => ( ))}
{/* Empty State */} {filteredCities.length === 0 && (
🏜️

没有找到匹配的城市

)} {/* Popular Routes */}

热门路线

{[ { title: "云南慢生活线", cities: ["昆明", "大理", "丽江"], emojis: ["🌸", "🏯", "🏔️"], duration: "3-6个月", cost: "¥3,200/月起", desc: "从春城昆明出发,沿着滇西北一路感受最纯粹的慢生活", gradient: "from-purple-500 to-pink-500", }, { title: "科技创业线", cities: ["深圳", "杭州", "上海"], emojis: ["🌃", "⛲", "🏙️"], duration: "2-4个月", cost: "¥7,000/月起", desc: "穿越中国三大科技中心,连接最前沿的创业生态", gradient: "from-blue-500 to-cyan-500", }, { title: "美食文化线", cities: ["成都", "重庆", "长沙"], emojis: ["🐼", "🌶️", "🎪"], duration: "2-3个月", cost: "¥4,000/月起", desc: "巴蜀到湘楚,用味蕾丈量中国最火辣的城市", gradient: "from-orange-500 to-red-500", }, ].map((route) => (

{route.title}

{route.duration}
{route.cities.map((city, i) => ( {route.emojis[i]} {city} {i < route.cities.length - 1 && ( )} ))}

{route.desc}

{route.cost} 查看详情 →
))}
{/* Community Section */}

社区动态

{/* 近期聚会 */}

🍹 近期聚会

8场/月
{meetups.map((m) => (
{m.emoji}

{m.city}

{m.date}

{m.count}人
))}
查看全部聚会 →
{/* 正在旅行 */}

🛩️ 正在旅行

{travelingNow.length}人
{travelingNow.map((m) => ( {m.name} ))}
{/* 热门讨论 */}

🔥 热门讨论

{/* 全球旅行保险 */}
🛡️

旅行保险

数字游民定制方案

覆盖全国 + 境外,远程工作专属条款,¥15/天起

{/* 社区聊天 */}
💬

社区聊天

本月 3,200+ 条消息

{memberPhotos.slice(0, 6).map((m) => ( ))}
在线中
{/* 签证/落户 */}
🏛️

落地指南

租房 · 共享办公 · 本地攻略

{["🏯 大理", "🐼 成都", "🌃 深圳", "⛲ 杭州"].map((tag) => ( {tag} ))}
{/* Footer */}
); }