From 9237d987311663061facd56d6cd44b620516ecc5 Mon Sep 17 00:00:00 2001 From: Sergey Mankovsky Date: Wed, 5 Feb 2025 01:53:54 +0100 Subject: [PATCH 1/3] Update error message --- www/app/[roomName]/useRoomMeeting.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/www/app/[roomName]/useRoomMeeting.tsx b/www/app/[roomName]/useRoomMeeting.tsx index bf75fdfd..8dcd4f15 100644 --- a/www/app/[roomName]/useRoomMeeting.tsx +++ b/www/app/[roomName]/useRoomMeeting.tsx @@ -26,7 +26,7 @@ type SuccessMeeting = { }; const useRoomMeeting = ( - roomName: string | null | undefined, + roomName: string | null | undefined ): ErrorMeeting | LoadingMeeting | SuccessMeeting => { const [response, setResponse] = useState(null); const [loading, setLoading] = useState(true); @@ -53,7 +53,10 @@ const useRoomMeeting = ( .catch((error) => { const shouldShowHuman = shouldShowError(error); if (shouldShowHuman) { - setError(error, "There was an error loading the meeting"); + setError( + error, + "There was an error loading the meeting. Please try again by refreshing the page." + ); } else { setError(error); } From 405c7c5a609225443786b56c1ed580eb3dbf74d7 Mon Sep 17 00:00:00 2001 From: Sergey Mankovsky Date: Wed, 5 Feb 2025 02:23:29 +0100 Subject: [PATCH 2/3] Reload page on leave --- www/app/lib/WherebyEmbed.tsx | 19 +++++++++++++++++-- www/app/webinars/[title]/page.tsx | 21 ++++++++++++++------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/www/app/lib/WherebyEmbed.tsx b/www/app/lib/WherebyEmbed.tsx index c5abed44..6a7df0c7 100644 --- a/www/app/lib/WherebyEmbed.tsx +++ b/www/app/lib/WherebyEmbed.tsx @@ -1,13 +1,14 @@ "use client"; -import { useEffect, useRef } from "react"; +import { useCallback, useEffect, useRef } from "react"; import "@whereby.com/browser-sdk/embed"; import { Box, Button, HStack, useToast, Text } from "@chakra-ui/react"; interface WherebyEmbedProps { roomUrl: string; + onLeave?: () => void; } -export default function WherebyEmbed({ roomUrl }: WherebyEmbedProps) { +export default function WherebyEmbed({ roomUrl, onLeave }: WherebyEmbedProps) { const wherebyRef = useRef(null); const toast = useToast(); @@ -53,6 +54,20 @@ export default function WherebyEmbed({ roomUrl }: WherebyEmbedProps) { } }, [roomUrl, toast]); + const handleLeave = () => { + if (onLeave) { + onLeave(); + } + }; + + useEffect(() => { + wherebyRef.current?.addEventListener("leave", handleLeave); + + return () => { + wherebyRef.current?.removeEventListener("leave", handleLeave); + }; + }, [handleLeave]); + return ( import("../../lib/WherebyEmbed"), { import { FormEvent } from "react"; import { Input, FormControl } from "@chakra-ui/react"; import { VStack } from "@chakra-ui/react"; -import { Alert, AlertIcon } from "@chakra-ui/react"; +import { Alert } from "@chakra-ui/react"; import { Text } from "@chakra-ui/react"; -import { Button } from "@chakra-ui/react"; type FormData = { name: string; @@ -58,8 +57,8 @@ const WEBINARS: Webinar[] = [ }, { title: "ai-operational-assistant-dry-run", - startsAt: "2025-02-05T00:50:00Z", - endsAt: "2025-02-05T00:55:00Z", + startsAt: "2025-02-05T01:20:00Z", + endsAt: "2025-02-05T01:22:00Z", }, ]; @@ -142,10 +141,18 @@ export default function WebinarPage(details: WebinarDetails) { } }; - if (status === WebinarStatus.Live) { - return <>{roomUrl && }; - } + const handleLeave = () => { + const now = new Date(); + if (now > endDate) { + window.location.reload(); + } + }; + if (status === WebinarStatus.Live) { + return ( + <>{roomUrl && } + ); + } if (status === WebinarStatus.Ended) { return (
From 7982b7e0d32f6527494a55424e2e4eb98dc20392 Mon Sep 17 00:00:00 2001 From: Sergey Mankovsky Date: Wed, 5 Feb 2025 02:41:50 +0100 Subject: [PATCH 3/3] Third dry run --- www/app/webinars/[title]/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/app/webinars/[title]/page.tsx b/www/app/webinars/[title]/page.tsx index 08c9090b..bee8ddeb 100644 --- a/www/app/webinars/[title]/page.tsx +++ b/www/app/webinars/[title]/page.tsx @@ -57,8 +57,8 @@ const WEBINARS: Webinar[] = [ }, { title: "ai-operational-assistant-dry-run", - startsAt: "2025-02-05T01:20:00Z", - endsAt: "2025-02-05T01:22:00Z", + startsAt: "2025-02-05T01:55:00Z", + endsAt: "2025-02-05T01:58:00Z", }, ];