refactor(pages): migrate app data reads to api adapters
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user