refactor(pages): migrate app data reads to api adapters

This commit is contained in:
zetaloop
2026-02-22 08:30:21 +08:00
parent 43a0cf7a73
commit 4beb610f23
13 changed files with 97 additions and 66 deletions
+10 -7
View File
@@ -15,24 +15,27 @@ import {
} from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { mockFavorites, mockPlayers, mockReviews, mockServices } from "@/lib/mock"
import {
isFavorited as checkFavorited,
listPlayers,
listReviewsByTargetUser,
listServicesByPlayer,
} from "@/lib/api"
export default async function PlayerDetailPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params
const player = mockPlayers.find((p) => p.id === id)
const player = listPlayers().find((p) => p.id === id)
if (!player) {
notFound()
}
const playerReviews = mockReviews.filter((r) => r.toUserId === player.id)
const playerReviews = listReviewsByTargetUser(player.id)
const playerServices =
player.services && player.services.length > 0
? player.services
: mockServices.filter((s) => s.playerId === player.id)
const isFavorited = mockFavorites.some(
(f) => f.userId === "u1" && f.targetType === "player" && f.targetId === player.id,
)
: listServicesByPlayer(player.id)
const isFavorited = checkFavorited("u1", "player", player.id)
return (
<div className="container mx-auto py-8 px-4 max-w-5xl">