This commit is contained in:
root
2026-06-08 10:02:16 +08:00
parent 934b9a4a23
commit b65908e328
24 changed files with 1216 additions and 93 deletions

View File

@@ -5,6 +5,7 @@ import { useTranslation } from "@/i18n/navigation";
import Footer from "@/app/components/Footer";
import { apiFetch } from "@/app/lib/api-client";
import { mediaUrl } from "@/app/lib/media";
import { avatarForIndex, avatarForName } from "@/app/data/avatars";
interface Topic {
id: string;
@@ -37,7 +38,7 @@ const FALLBACK_TOPICS: Topic[] = [
id: "1",
title: "大理最佳共享办公空间推荐 Top 10",
author: "林晓",
avatar: "https://i.pravatar.cc/150?img=5",
avatar: avatarForIndex(0),
views: 2340,
replies: 56,
likes: 128,
@@ -49,7 +50,7 @@ const FALLBACK_TOPICS: Topic[] = [
id: "2",
title: "2026年数字游民友好城市排名",
author: "张浩",
avatar: "https://i.pravatar.cc/150?img=3",
avatar: avatarForIndex(4),
views: 1890,
replies: 42,
likes: 95,
@@ -61,7 +62,7 @@ const FALLBACK_TOPICS: Topic[] = [
id: "3",
title: "远程工作者的税务规划指南",
author: "陈悦",
avatar: "https://i.pravatar.cc/150?img=9",
avatar: avatarForIndex(2),
views: 1560,
replies: 38,
likes: 87,
@@ -73,7 +74,7 @@ const FALLBACK_TOPICS: Topic[] = [
id: "4",
title: "成都 vs 大理:哪个更适合游民?",
author: "周杰",
avatar: "https://i.pravatar.cc/150?img=7",
avatar: avatarForIndex(10),
views: 1230,
replies: 67,
likes: 54,
@@ -85,7 +86,7 @@ const FALLBACK_TOPICS: Topic[] = [
id: "5",
title: "新手游民必备工具与装备清单",
author: "吴婷",
avatar: "https://i.pravatar.cc/150?img=1",
avatar: avatarForIndex(12),
views: 980,
replies: 29,
likes: 76,
@@ -97,7 +98,7 @@ const FALLBACK_TOPICS: Topic[] = [
id: "6",
title: "如何在泰国办理长期签证?",
author: "杨帅",
avatar: "https://i.pravatar.cc/150?img=12",
avatar: avatarForIndex(28),
views: 2150,
replies: 89,
likes: 156,
@@ -109,7 +110,7 @@ const FALLBACK_TOPICS: Topic[] = [
id: "7",
title: "数字游民保险选择指南",
author: "赵琪",
avatar: "https://i.pravatar.cc/150?img=16",
avatar: avatarForIndex(6),
views: 1780,
replies: 45,
likes: 112,
@@ -121,7 +122,7 @@ const FALLBACK_TOPICS: Topic[] = [
id: "8",
title: "东南亚最佳数字游民目的地",
author: "黄磊",
avatar: "https://i.pravatar.cc/150?img=11",
avatar: avatarForIndex(30),
views: 3210,
replies: 78,
likes: 234,
@@ -149,7 +150,7 @@ function mapDiscussion(topic: DiscussionRecord, index: number): Topic {
id: topic.id,
title: topic.title,
author,
avatar: `https://api.dicebear.com/7.x/initials/svg?seed=${encodeURIComponent(author)}`,
avatar: avatarForName(author),
views: Number(topic.views || 0),
replies: Number(topic.replies || 0),
likes: Math.max(3, Math.round(Number(topic.views || 0) / 30) + Number(topic.replies || 0)),