Compare commits

..

No commits in common. "e14279f4725e720fd809808bea8fc4166e7cb71e" and "423d339affceb140e88a82e902b4c54450e571ff" have entirely different histories.

2 changed files with 9 additions and 15 deletions

View File

@ -117,17 +117,16 @@ export default function Dashboard() {
return sum + amount;
}, 0);
// Trends object kept for compatibility but not used for percentage badges
// All percentage badges now use API-provided _pct values
// For now, use static trends (in a real app, you'd calculate these from historical data)
const trends = {
total_users: "0%",
active_users: "0%",
total_bookings: "0%",
upcoming_bookings: "0",
total_users: "+12%",
active_users: "+8%",
total_bookings: "+24%",
upcoming_bookings: "+6",
completed_bookings: "0%",
cancelled_bookings: "0%",
total_revenue: "0%",
monthly_revenue: "0%",
total_revenue: "+18%",
monthly_revenue: "+32%",
};
setStats({
@ -197,14 +196,14 @@ export default function Dashboard() {
title: "Active Users",
value: stats?.active_users ?? 0,
icon: UserCheck,
trend: undefined, // No _pct field from API for active users
trend: stats?.trends.active_users ?? "0%",
trendUp: true,
},
{
title: "Total Bookings",
value: stats?.total_bookings ?? 0,
icon: Calendar,
trend: undefined, // No _pct field from API for total bookings
trend: stats?.trends.total_bookings ?? "0%",
trendUp: true,
},
{

View File

@ -158,7 +158,6 @@ export default function UserDashboard() {
};
}
// Fallback: calculate from appointments if stats not loaded yet
// Note: Percentage values (_pct) are only available from API, not calculated
const scheduled = appointments.filter(a => a.status === "scheduled").length;
const completed = appointments.filter(a => a.status === "completed").length;
const pending_review = appointments.filter(a => a.status === "pending_review").length;
@ -168,13 +167,9 @@ export default function UserDashboard() {
return {
scheduled,
scheduled_pct: undefined, // Only from API
completed,
completed_pct: undefined, // Only from API
pending_review,
pending_review_pct: undefined, // Only from API
rejected,
rejected_pct: undefined, // Only from API
total_requests,
completion_rate,
};