fix(pages): adapt all pages to backend-aligned types
Replace removed fields with available data sources throughout UI: - order pages: use service.title instead of consumer/player names - chat: look up sender from session.participants, remove readonly - community: simplify post cards, keep pinned icon - post detail: keep pinned/linkedOrderId display - shop rules: use string commissionValue - dashboard: parse string amounts for income display - dispute/review: remove initiator/avatar references
This commit is contained in:
@@ -141,9 +141,7 @@ export default function DashboardPage() {
|
||||
<div className="flex items-center justify-between rounded-md border p-3 hover:bg-muted/50 transition-colors">
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-sm font-medium truncate">{order.service.title}</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{order.consumerName} → {order.playerName}
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">{order.service.title}</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-3 shrink-0">
|
||||
<span className="text-sm font-medium">¥{order.totalPrice}</span>
|
||||
|
||||
@@ -158,12 +158,12 @@ export default function ShopIncomePage() {
|
||||
<TableRow key={transaction.id}>
|
||||
<TableCell>
|
||||
<div className="flex items-center gap-2">
|
||||
{transaction.amount > 0 ? (
|
||||
{Number(transaction.amount) > 0 ? (
|
||||
<ArrowDownLeft className="h-4 w-4 text-green-500" />
|
||||
) : (
|
||||
<ArrowUpRight className="h-4 w-4 text-red-500" />
|
||||
)}
|
||||
<Badge variant={transaction.amount > 0 ? "default" : "secondary"}>
|
||||
<Badge variant={Number(transaction.amount) > 0 ? "default" : "secondary"}>
|
||||
{transaction.type === "topup"
|
||||
? "充值"
|
||||
: transaction.type === "payment"
|
||||
@@ -178,9 +178,9 @@ export default function ShopIncomePage() {
|
||||
</TableCell>
|
||||
<TableCell>{transaction.description}</TableCell>
|
||||
<TableCell
|
||||
className={transaction.amount > 0 ? "text-green-600" : "text-red-600"}
|
||||
className={Number(transaction.amount) > 0 ? "text-green-600" : "text-red-600"}
|
||||
>
|
||||
{transaction.amount > 0 ? "+" : ""}
|
||||
{Number(transaction.amount) > 0 ? "+" : ""}
|
||||
{transaction.amount}
|
||||
</TableCell>
|
||||
<TableCell>{new Date(transaction.createdAt).toLocaleString()}</TableCell>
|
||||
|
||||
@@ -103,8 +103,8 @@ export default function ShopOrdersPage() {
|
||||
{shopOrders.map((order) => (
|
||||
<TableRow key={order.id}>
|
||||
<TableCell className="font-medium">{order.service.title}</TableCell>
|
||||
<TableCell>{order.consumerName}</TableCell>
|
||||
<TableCell>{order.playerName}</TableCell>
|
||||
<TableCell>{order.consumerId}</TableCell>
|
||||
<TableCell>{order.playerId}</TableCell>
|
||||
<TableCell>
|
||||
<Badge variant="outline">{statusLabels[order.status]}</Badge>
|
||||
</TableCell>
|
||||
|
||||
@@ -39,19 +39,19 @@ function ShopRulesForm({
|
||||
shop: Shop
|
||||
updateShop: (shopId: string, patch: Partial<Omit<Shop, "id" | "owner">>) => void
|
||||
}) {
|
||||
const [commissionType, setCommissionType] = useState<Shop["commissionType"]>(shop.commissionType)
|
||||
const [commissionValue, setCommissionValue] = useState(shop.commissionValue)
|
||||
const [allowMultiShop, setAllowMultiShop] = useState(shop.allowMultiShop)
|
||||
const [allowIndependentOrders, setAllowIndependentOrders] = useState(shop.allowIndependentOrders)
|
||||
const [dispatchMode, setDispatchMode] = useState<Shop["dispatchMode"]>(shop.dispatchMode)
|
||||
const [commissionType, setCommissionType] = useState<Shop["commissionType"]>(shop.commissionType)
|
||||
const [commissionValue, setCommissionValue] = useState(shop.commissionValue.toString())
|
||||
|
||||
const handleSave = () => {
|
||||
updateShop(shop.id, {
|
||||
commissionType,
|
||||
commissionValue,
|
||||
allowMultiShop,
|
||||
allowIndependentOrders,
|
||||
dispatchMode,
|
||||
commissionType,
|
||||
commissionValue: Number(commissionValue),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user