refactor(pages): migrate app data reads to api adapters
This commit is contained in:
@@ -6,17 +6,17 @@ import { Badge } from "@/components/ui/badge"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Progress } from "@/components/ui/progress"
|
||||
import { listOrders, listPlayers, listServices, listShops } from "@/lib/api"
|
||||
import { statusLabels } from "@/lib/constants"
|
||||
import { mockOrders, mockPlayers, mockServices, mockShops } from "@/lib/mock"
|
||||
import { useAuthStore } from "@/store/auth"
|
||||
|
||||
export default function DashboardPage() {
|
||||
const { currentRole } = useAuthStore()
|
||||
const isOwner = currentRole === "owner"
|
||||
|
||||
const player = mockPlayers[0]
|
||||
const shop = mockShops[0]
|
||||
const recentOrders = mockOrders.slice(0, 3)
|
||||
const player = listPlayers()[0]
|
||||
const shop = listShops()[0]
|
||||
const recentOrders = listOrders().slice(0, 3)
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
@@ -76,7 +76,7 @@ export default function DashboardPage() {
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-2xl font-bold">
|
||||
{isOwner ? "¥12,800" : mockServices.filter((s) => s.playerId === player.id).length}
|
||||
{isOwner ? "¥12,800" : listServices().filter((s) => s.playerId === player.id).length}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user