Merge pull request 'Update dashboard components to reflect API-driven percentage values' (#64) from feat/booking-panel into master
Reviewed-on: http://35.207.46.142/ATTUNE-HEART-THERAPY/website/pulls/64
This commit is contained in:
commit
e14279f472
@ -117,16 +117,17 @@ export default function Dashboard() {
|
|||||||
return sum + amount;
|
return sum + amount;
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
// For now, use static trends (in a real app, you'd calculate these from historical data)
|
// Trends object kept for compatibility but not used for percentage badges
|
||||||
|
// All percentage badges now use API-provided _pct values
|
||||||
const trends = {
|
const trends = {
|
||||||
total_users: "+12%",
|
total_users: "0%",
|
||||||
active_users: "+8%",
|
active_users: "0%",
|
||||||
total_bookings: "+24%",
|
total_bookings: "0%",
|
||||||
upcoming_bookings: "+6",
|
upcoming_bookings: "0",
|
||||||
completed_bookings: "0%",
|
completed_bookings: "0%",
|
||||||
cancelled_bookings: "0%",
|
cancelled_bookings: "0%",
|
||||||
total_revenue: "+18%",
|
total_revenue: "0%",
|
||||||
monthly_revenue: "+32%",
|
monthly_revenue: "0%",
|
||||||
};
|
};
|
||||||
|
|
||||||
setStats({
|
setStats({
|
||||||
@ -196,14 +197,14 @@ export default function Dashboard() {
|
|||||||
title: "Active Users",
|
title: "Active Users",
|
||||||
value: stats?.active_users ?? 0,
|
value: stats?.active_users ?? 0,
|
||||||
icon: UserCheck,
|
icon: UserCheck,
|
||||||
trend: stats?.trends.active_users ?? "0%",
|
trend: undefined, // No _pct field from API for active users
|
||||||
trendUp: true,
|
trendUp: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Total Bookings",
|
title: "Total Bookings",
|
||||||
value: stats?.total_bookings ?? 0,
|
value: stats?.total_bookings ?? 0,
|
||||||
icon: Calendar,
|
icon: Calendar,
|
||||||
trend: stats?.trends.total_bookings ?? "0%",
|
trend: undefined, // No _pct field from API for total bookings
|
||||||
trendUp: true,
|
trendUp: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -158,6 +158,7 @@ export default function UserDashboard() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
// Fallback: calculate from appointments if stats not loaded yet
|
// 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 scheduled = appointments.filter(a => a.status === "scheduled").length;
|
||||||
const completed = appointments.filter(a => a.status === "completed").length;
|
const completed = appointments.filter(a => a.status === "completed").length;
|
||||||
const pending_review = appointments.filter(a => a.status === "pending_review").length;
|
const pending_review = appointments.filter(a => a.status === "pending_review").length;
|
||||||
@ -167,9 +168,13 @@ export default function UserDashboard() {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
scheduled,
|
scheduled,
|
||||||
|
scheduled_pct: undefined, // Only from API
|
||||||
completed,
|
completed,
|
||||||
|
completed_pct: undefined, // Only from API
|
||||||
pending_review,
|
pending_review,
|
||||||
|
pending_review_pct: undefined, // Only from API
|
||||||
rejected,
|
rejected,
|
||||||
|
rejected_pct: undefined, // Only from API
|
||||||
total_requests,
|
total_requests,
|
||||||
completion_rate,
|
completion_rate,
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user