= {};
selectedDays.forEach(day => {
const timeSlots = dayTimeSlots[day];
if (timeSlots && timeSlots.length > 0) {
// Ensure only valid time slots and remove duplicates
const validSlots = timeSlots
- .filter(slot => ["morning", "afternoon", "evening"].includes(slot))
+ .filter((slot): slot is "morning" | "afternoon" | "evening" =>
+ ["morning", "afternoon", "evening"].includes(slot)
+ )
.filter((slot, index, self) => self.indexOf(slot) === index); // Remove duplicates
if (validSlots.length > 0) {
@@ -677,13 +679,19 @@ export default function Booking() {
|
- {appointment.preferred_dates && appointment.preferred_dates.length > 0 ? (
+ {appointment.preferred_dates ? (
- {appointment.preferred_dates.slice(0, 2).map((date, idx) => (
- {formatDate(date)}
- ))}
- {appointment.preferred_dates.length > 2 && (
- +{appointment.preferred_dates.length - 2} more
+ {Array.isArray(appointment.preferred_dates) ? (
+ <>
+ {(appointment.preferred_dates as string[]).slice(0, 2).map((date, idx) => (
+ {formatDate(date)}
+ ))}
+ {appointment.preferred_dates.length > 2 && (
+ +{appointment.preferred_dates.length - 2} more
+ )}
+ >
+ ) : (
+ {appointment.preferred_dates_display || appointment.preferred_dates}
)}
) : (
diff --git a/app/(admin)/admin/dashboard/page.tsx b/app/(admin)/admin/dashboard/page.tsx
index 2c3e3c8..d120681 100644
--- a/app/(admin)/admin/dashboard/page.tsx
+++ b/app/(admin)/admin/dashboard/page.tsx
@@ -272,7 +272,7 @@ export default function Dashboard() {
- {card.showTrend !== false && card.trend && (
+ {card.trend && (
{card.trendUp ? (
@@ -291,11 +291,9 @@ export default function Dashboard() {
{card.value}
- {card.showTrend !== false && (
-
- vs last month
-
- )}
+
+ vs last month
+
);
diff --git a/hooks/useAppointments.ts b/hooks/useAppointments.ts
index da49cba..0ab8800 100644
--- a/hooks/useAppointments.ts
+++ b/hooks/useAppointments.ts
@@ -138,11 +138,16 @@ export function useAppointments(options?: {
staleTime: 1 * 60 * 1000, // 1 minute
});
- // Get user appointment stats query
+ // Get user appointment stats query - disabled because it requires email parameter
+ // Use getUserAppointmentStats(email) directly where email is available
const userAppointmentStatsQuery = useQuery({
queryKey: ["appointments", "user", "stats"],
- queryFn: () => getUserAppointmentStats(),
- enabled: enableStats,
+ queryFn: async () => {
+ // This query is disabled - getUserAppointmentStats requires email parameter
+ // Use getUserAppointmentStats(email) directly in components where email is available
+ return {} as UserAppointmentStats;
+ },
+ enabled: false, // Disabled - requires email parameter which hook doesn't have access to
staleTime: 1 * 60 * 1000, // 1 minute
});
|