feat(orders): migrate orders to backend API
This commit is contained in:
@@ -5,7 +5,7 @@ import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { Card, CardContent, CardHeader } from "@/components/ui/card"
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { getOrderById, getPlayerById, getPostById } from "@/lib/api"
|
||||
import { getPostById } from "@/lib/api"
|
||||
import { roleLabels } from "@/lib/constants"
|
||||
import { ArrowLeft, Pin, Star } from "lucide-react"
|
||||
import Image from "next/image"
|
||||
@@ -17,9 +17,6 @@ export default async function PostDetailPage({ params }: { params: Promise<{ id:
|
||||
const post = await getPostById(id)
|
||||
if (!post) notFound()
|
||||
|
||||
const linkedOrder = post.linkedOrderId ? getOrderById(post.linkedOrderId) : null
|
||||
const linkedPlayer = linkedOrder ? await getPlayerById(linkedOrder.playerId) : null
|
||||
|
||||
return (
|
||||
<div className="container mx-auto max-w-2xl px-4 py-8 space-y-6">
|
||||
<Link
|
||||
@@ -65,17 +62,14 @@ export default async function PostDetailPage({ params }: { params: Promise<{ id:
|
||||
</div>
|
||||
)}
|
||||
|
||||
{linkedOrder && (
|
||||
<Link href={`/order/${linkedOrder.id}`}>
|
||||
{post.linkedOrderId && (
|
||||
<Link href={`/order/${post.linkedOrderId}`}>
|
||||
<div className="rounded-lg border bg-muted/30 p-3 text-sm hover:bg-muted/50 transition-colors">
|
||||
<div className="flex items-center gap-2 mb-1">
|
||||
<Star className="h-3.5 w-3.5 text-yellow-500" />
|
||||
<span className="font-medium">关联订单</span>
|
||||
</div>
|
||||
<p className="text-muted-foreground text-xs">
|
||||
{linkedOrder.service.gameName} · {linkedOrder.service.title} · 评分{" "}
|
||||
{linkedPlayer?.rating ?? "--"}
|
||||
</p>
|
||||
<p className="text-muted-foreground text-xs">点击查看订单详情</p>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user