diff --git a/app/(admin)/admin/booking/[id]/page.tsx b/app/(admin)/admin/booking/[id]/page.tsx index 03c1075..cc4e38d 100644 --- a/app/(admin)/admin/booking/[id]/page.tsx +++ b/app/(admin)/admin/booking/[id]/page.tsx @@ -695,11 +695,14 @@ export default function AppointmentDetailPage() {
{(() => { - const canJoin = appointment.can_join_as_moderator === true || appointment.can_join_as_moderator === "true"; + // Check if can join as moderator (handle both boolean and string values) + const canJoinAsModerator = appointment.can_join_as_moderator === true || appointment.can_join_as_moderator === "true"; + // Check if meeting has started (handle both field names) const startedAt = appointment.started_at || appointment.meeting_started_at; const hasStarted = startedAt != null && startedAt !== ""; - if (!canJoin) { + // If can_join_as_moderator != true, display "Meeting Not Available" + if (!canJoinAsModerator) { return ( - )} + {(() => { + // Check if can join as participant (handle both boolean and string values) + const canJoinAsParticipant = appointment.can_join_as_participant === true || appointment.can_join_as_participant === "true"; + // Check if meeting has started (handle both field names) + const startedAt = appointment.started_at || appointment.meeting_started_at; + const hasStarted = startedAt != null && startedAt !== ""; + + // If can_join_as_participant != true, display "Meeting Not Available" + if (!canJoinAsParticipant) { + return ( + + ); + } + + // If can_join_as_participant == true && started_at != null, show "Join Now" button + if (hasStarted) { + return ( + + + ); + } + + // If can_join_as_participant == true && started_at == null, show "Meeting Not Available" + return ( + + ); + })()}
)}