diff --git a/app/(admin)/admin/booking/[id]/page.tsx b/app/(admin)/admin/booking/[id]/page.tsx index 8f1023a..d8be267 100644 --- a/app/(admin)/admin/booking/[id]/page.tsx +++ b/app/(admin)/admin/booking/[id]/page.tsx @@ -598,7 +598,11 @@ export default function AppointmentDetailPage() {
- {appointment.can_join_as_moderator ? "Meeting is active - You can join as moderator" : "Meeting would be available shortly"} + {appointment.can_join_as_moderator + ? "Meeting is active - You can join as moderator" + : appointment.scheduled_datetime + ? `Meeting would be available to join starting at ${formatTime(appointment.scheduled_datetime)}` + : "Meeting would be available shortly"}
- Click the "Start Meeting" button below to begin the session. Once started, participants can join using the meeting link. You can also use the moderator link above to join directly. + Up to 10 minutes before the meeting is scheduled to begin, click the "Start Meeting" button below to begin the session. Once started, participants can join using the meeting link. You can also use the moderator link near the bottom of the page to join directly.
@@ -722,13 +726,16 @@ export default function AppointmentDetailPage() { // If can_join_as_moderator != true, display "Meeting would be available shortly" if (!canJoinAsModerator) { + const meetingTime = appointment.scheduled_datetime + ? formatTime(appointment.scheduled_datetime) + : "the scheduled time"; return ( ); } diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index 935a9a6..abca082 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -103,8 +103,8 @@ function LoginContent() { const timer = setTimeout(() => { // Always redirect based on user role, ignore redirect parameter if user is admin const redirectParam = searchParams.get("redirect"); - const defaultRedirect = isAdmin ? "/admin/dashboard" : "/user/dashboard"; - const finalRedirect = isAdmin ? "/admin/dashboard" : (redirectParam || defaultRedirect); + const defaultRedirect = isAdmin ? "/admin/booking" : "/user/dashboard"; + const finalRedirect = isAdmin ? "/admin/booking" : (redirectParam || defaultRedirect); // Use window.location.href to ensure full page reload and cookie reading window.location.href = finalRedirect; @@ -155,12 +155,12 @@ function LoginContent() { // Wait longer for cookies to be set and middleware to process setTimeout(() => { // Always redirect based on user role, ignore redirect parameter if user is admin - // This ensures admins always go to admin dashboard - const defaultRedirect = userIsAdmin ? "/admin/dashboard" : "/user/dashboard"; + // This ensures admins always go to admin booking page + const defaultRedirect = userIsAdmin ? "/admin/booking" : "/user/dashboard"; // Only use redirect parameter if user is NOT admin const redirectParam = searchParams.get("redirect"); - const finalRedirect = userIsAdmin ? "/admin/dashboard" : (redirectParam || defaultRedirect); + const finalRedirect = userIsAdmin ? "/admin/booking" : (redirectParam || defaultRedirect); // Use window.location.href instead of router.push to ensure full page reload // This ensures cookies are read correctly by middleware diff --git a/app/(auth)/signup/page.tsx b/app/(auth)/signup/page.tsx index eef70e7..e91400a 100644 --- a/app/(auth)/signup/page.tsx +++ b/app/(auth)/signup/page.tsx @@ -44,7 +44,7 @@ function SignupContent() { // Redirect if already authenticated useEffect(() => { if (isAuthenticated) { - const redirect = searchParams.get("redirect") || "/admin/dashboard"; + const redirect = searchParams.get("redirect") || "/admin/booking"; router.push(redirect); } }, [isAuthenticated, router, searchParams]); diff --git a/app/(user)/user/appointments/[id]/page.tsx b/app/(user)/user/appointments/[id]/page.tsx index af204a4..45c8782 100644 --- a/app/(user)/user/appointments/[id]/page.tsx +++ b/app/(user)/user/appointments/[id]/page.tsx @@ -531,7 +531,7 @@ export default function UserAppointmentDetailPage() { How to Access:- Click the "Join Now" button below when the meeting becomes available. The meeting will be accessible shortly before the scheduled start time. + {`Up to 10 minutes before the meeting is scheduled to begin, click the "Join Now" button below when the meeting becomes available. The meeting will be accessible starting at ${formatTime(appointment.scheduled_datetime)}.`}
diff --git a/components/LoginDialog.tsx b/components/LoginDialog.tsx index 78237b4..c826422 100644 --- a/components/LoginDialog.tsx +++ b/components/LoginDialog.tsx @@ -94,7 +94,7 @@ export function LoginDialog({ open, onOpenChange, onLoginSuccess, prefillEmail, // Only redirect if skipRedirect is false and we're not on the booking page if (!skipRedirect && pathname !== "/book-now") { // Redirect based on user role - const redirectPath = userIsAdmin ? "/admin/dashboard" : "/user/dashboard"; + const redirectPath = userIsAdmin ? "/admin/booking" : "/user/dashboard"; setTimeout(() => { window.location.href = redirectPath; }, 200); diff --git a/components/Navbar.tsx b/components/Navbar.tsx index 614babe..bc7e911 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -42,7 +42,7 @@ export function Navbar() { // Check if user is admin/staff/superuser and redirect accordingly // Note: user might not be immediately available, so we check isAdmin from hook // which is computed from the user data - const redirectPath = isAdmin ? "/admin/dashboard" : "/user/dashboard"; + const redirectPath = isAdmin ? "/admin/booking" : "/user/dashboard"; router.push(redirectPath); setMobileMenuOpen(false); }; diff --git a/middleware.ts b/middleware.ts index 884c367..165340c 100644 --- a/middleware.ts +++ b/middleware.ts @@ -50,13 +50,13 @@ export function middleware(request: NextRequest) { // Redirect authenticated users away from auth routes if (isAuthRoute && isAuthenticated) { // Redirect based on user role - const redirectPath = isAdmin ? "/admin/dashboard" : "/user/dashboard"; + const redirectPath = isAdmin ? "/admin/booking" : "/user/dashboard"; return NextResponse.redirect(new URL(redirectPath, request.url)); } // Redirect admin users away from user routes if (isUserRoute && isAuthenticated && isAdmin) { - return NextResponse.redirect(new URL("/admin/dashboard", request.url)); + return NextResponse.redirect(new URL("/admin/booking", request.url)); } // Redirect non-admin users away from admin routes