-
Notifications
You must be signed in to change notification settings - Fork 12
/
WaitingToJoinScreen.js
79 lines (71 loc) · 2.1 KB
/
WaitingToJoinScreen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import React, { useEffect, useRef, useState } from "react";
import animationData from "../../../src/static/animations/join_meeting.json";
import Lottie from "lottie-react";
import useIsTab from "../../hooks/useIsTab";
import useIsMobile from "../../hooks/useIsMobile";
const WaitingToJoinScreen = () => {
const waitingMessages = [
{ index: 0, text: "Creating a room for you..." },
{ index: 1, text: "Almost there..." },
];
const [message, setMessage] = useState(waitingMessages[0]);
const intervalRef = useRef(null);
useEffect(() => {
intervalRef.current = setInterval(() => {
setMessage((s) =>
s.index === waitingMessages.length - 1
? s
: waitingMessages[s.index + 1]
);
}, 3000);
return () => {
clearInterval(intervalRef.current);
};
}, []);
const isTab = useIsTab();
const isMobile = useIsMobile();
const animationDefaultOptions = {
loop: true,
autoplay: true,
animationData: animationData,
rendererSettings: {
preserveAspectRatio: "xMidYMid slice",
},
};
return (
<div
className="bg-gray-800"
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
height: "100vh",
// backgroundColor: theme.palette.darkTheme.main,
}}
>
<div className="flex flex-col">
<div
style={{
height: isTab ? 200 : isMobile ? 200 : 250,
width: isTab ? 200 : isMobile ? 200 : 250,
}}
>
<Lottie
loop={animationDefaultOptions.loop}
autoplay={animationDefaultOptions.autoplay}
animationData={animationDefaultOptions.animationData}
rendererSettings={{
preserveAspectRatio:
animationDefaultOptions.rendererSettings.preserveAspectRatio,
}}
style={{ height: "100%", width: "100%" }}
/>
</div>
<h1 className="text-white text-center font-bold mt-1 text-xl">
{message.text}
</h1>
</div>
</div>
);
};
export default WaitingToJoinScreen;