Commit bbee5a38 authored by Shehan Liyanage's avatar Shehan Liyanage

add sweetAlert

parent f2b1cb43
import React, { useEffect, useRef, useState } from 'react' import React, { useEffect, useRef, useState } from 'react'
import { Box } from '@mui/material' import { Box } from '@mui/material'
import { useTheme, Theme } from '@mui/material/styles' import { useTheme, Theme } from '@mui/material/styles'
import Swal from 'sweetalert2' // Import SweetAlert2
import { useRemoteUsers, usePublish, useRTCClient, useClientEvent } from 'agora-rtc-react' import { useRemoteUsers, usePublish, useRTCClient, useClientEvent } from 'agora-rtc-react'
import SymmetricGrid from '../SymmetricGrid/SymmetricGrid' import SymmetricGrid from '../SymmetricGrid/SymmetricGrid'
import PinnedGrid from '../PinnedGrid/PinnedGrid' import PinnedGrid from '../PinnedGrid/PinnedGrid'
...@@ -33,6 +34,7 @@ const MeetingLayout = ({ setJoined, localCameraTrack, localMicrophoneTrack }: Pr ...@@ -33,6 +34,7 @@ const MeetingLayout = ({ setJoined, localCameraTrack, localMicrophoneTrack }: Pr
const [isPinned, setIsPinned] = useState(false) const [isPinned, setIsPinned] = useState(false)
const [pinnedUser, setPinnedUser] = useState<IAgoraRTCRemoteUser | null>(null) const [pinnedUser, setPinnedUser] = useState<IAgoraRTCRemoteUser | null>(null)
const [isCaptionEnable, setIsCaptionEnable] = useState(false) const [isCaptionEnable, setIsCaptionEnable] = useState(false)
const [isMeetingStarted, setIsMeetingStarted] = useState(false)
useEffect(() => { useEffect(() => {
setTotalUsers(remoteUsers.length + 1) setTotalUsers(remoteUsers.length + 1)
...@@ -53,6 +55,22 @@ const MeetingLayout = ({ setJoined, localCameraTrack, localMicrophoneTrack }: Pr ...@@ -53,6 +55,22 @@ const MeetingLayout = ({ setJoined, localCameraTrack, localMicrophoneTrack }: Pr
useClientEvent(agoraEngine, 'user-left', handleUserLeft) useClientEvent(agoraEngine, 'user-left', handleUserLeft)
// Show a popup when the meeting starts
useEffect(() => {
if (!isMeetingStarted) {
void Swal.fire({
title: 'Meeting Started',
text: 'Sign language prediction might be delayed due to the live meeting.',
icon: 'info',
timer: 5000, // Display the popup for 5 seconds
timerProgressBar: true,
willClose: () => {
setIsMeetingStarted(true)
},
})
}
}, [isMeetingStarted])
return ( return (
<Box <Box
sx={{ sx={{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment