From beb2c632bb7f90a4c304b1f67a8d65993e6118f9 Mon Sep 17 00:00:00 2001 From: kurihada Date: Fri, 27 Feb 2026 10:05:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E9=A1=B5=E9=9D=A2=E5=86=B3=E7=AD=96=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=EF=BC=8C=E7=BB=9F=E4=B8=80=E7=94=B1=E6=88=90=E5=B0=B1=E5=A2=99?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 决策记录已完整迁移至 /achievements 成就墙页面, 个人中心不再重复展示,减少冗余数据请求。 --- src/app/profile/page.tsx | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/app/profile/page.tsx b/src/app/profile/page.tsx index 1dc0121..317ab09 100644 --- a/src/app/profile/page.tsx +++ b/src/app/profile/page.tsx @@ -20,13 +20,12 @@ import { } from "lucide-react"; import Card from "@/components/Card"; import Input from "@/components/Input"; -import ProfileHistoryCard from "@/components/ProfileHistoryCard"; import ProfileFavoritesCard from "@/components/ProfileFavoritesCard"; import { useToast } from "@/hooks/useToast"; import { ProfileCardSkeleton, RecordItemSkeleton } from "@/components/Skeleton"; import { getUserId, getCachedProfile, setCachedProfile, setCachedPreferences, logout } from "@/lib/userId"; import { getAvatarBg, AVATARS } from "@/lib/avatars"; -import type { UserProfile, UserPreferences, DecisionRecord, FavoriteRecord } from "@/types"; +import type { UserProfile, UserPreferences, FavoriteRecord } from "@/types"; export default function ProfilePage() { const router = useRouter(); @@ -34,9 +33,7 @@ export default function ProfilePage() { const [profile, setProfile] = useState<(UserProfile & { email?: string; preferences?: UserPreferences; decisionCount?: number }) | null>(null); const [loading, setLoading] = useState(true); - const [history, setHistory] = useState([]); const [favorites, setFavorites] = useState([]); - const [historyLoading, setHistoryLoading] = useState(false); const [favLoading, setFavLoading] = useState(false); const [editingUsername, setEditingUsername] = useState(false); @@ -58,7 +55,6 @@ export default function ProfilePage() { const [emailSaving, setEmailSaving] = useState(false); const [emailMsg, setEmailMsg] = useState(""); - const [showHistory, setShowHistory] = useState(true); const [showFavorites, setShowFavorites] = useState(true); const toast = useToast(); @@ -93,13 +89,6 @@ export default function ProfilePage() { useEffect(() => { if (!userId) return; - setHistoryLoading(true); - fetch(`/api/user/history?userId=${userId}`) - .then((r) => { if (!r.ok) throw new Error(); return r.json(); }) - .then((data) => setHistory(Array.isArray(data) ? data : [])) - .catch(() => {}) - .finally(() => setHistoryLoading(false)); - setFavLoading(true); fetch(`/api/user/favorite?userId=${userId}`) .then((r) => { if (!r.ok) throw new Error(); return r.json(); }) @@ -500,15 +489,6 @@ export default function ProfilePage() { - setShowHistory((v) => !v)} - onEmpty={() => router.push("/blindbox")} - delay={0.2} - /> -