GUESTJOIN PAGE
IN THE NAVBAR OF OUR LANDING PAGE , I CREATED AN ANCHOR TAG THAT SAYS
JOIN AS GUEST
WHEN AN USER DO NOT WANT TO SIGNUP , HE CAN USE JOIN AS GUEST OPTION, WHEN CLICKED HE WILL BE DIRECTED TO A GUEST PAGE ON WHICH A CARD IS DISPLAYED THAT ASKS FOR MEETING CODE JUST LIKE THE JOIN BLOCK OF HOME PAGE.
BUT WE WILL USE THE SAME BACKEND ROUTE TO JOIN MEETING. AS WE INTRODUCED GUEST WE WILL INCLUDE A NEW PARAMETER IN THE ROUTE THAT SAYS isGuest
if (success) {
handleSuccess(message);
navigate(`/${meetingCode}`, {
state: { isHost: false, isGuest: true },
SO IN THE HOME PAGE TOO , WE INCLUDE THIS PARAMETER FOR CREATE AND JOIN MEETING ROUTES.
CREATE
const handleCreateMeeting = async () => {
try {
const { data } = await axios.post(
"http://localhost:8080/createMeeting",
{},
{
params: { token: localStorage.getItem("token") },
}
);
const { success, code, message } = data;
if (success) {
await addToHistory(code);
navigate(`/${code}`, { state: { isHost: true, isGuest: false } });
handleSuccess(message);
} else {
handleFailure(message);
}
} catch (e) {
console.log(e);
handleFailure("Something went Wrong!");
}
};
JOIN
const handleJoinMeeting = async () => {
if (!meetingCode || meetingCode.length !== 6) {
handleFailure("Please enter a valid meeting code.");
return;
}
try {
const { data } = await axios.post("http://localhost:8080/joinMeeting", {
meeting_code: meetingCode,
});
const { success, message } = data;
if (success) {
await addToHistory(meetingCode);
handleSuccess(message);
navigate(`/${meetingCode}`, {
state: { isHost: false, isGuest: false },
});
} else {
handleFailure(message);
console.log(message);
}
} catch (e) {
console.log(e);
handleFailure("Something went Wrong!");
}
};
ONCE THE GUEST ENDS THE MEETING HE SHOULD BE REDIRECTED BACK TO THE LANDING PAGE, HENCE IN THE VIDEO CONFERENCE PAGE,
let handleCallEnd = () => {
try {
let tracks = localVideoRef.current.srcObject.getTracks();
tracks.forEach((track) => track.stop());
} catch (e) {
console.log(e);
}
isGuest ? (window.location.href = "/") : (window.location.href = "/home");
};
STYLING
FOR THE GRADIENTS VISIT UIGRADIENTS.COM
GUEST.MODULE.CSS
body {
margin: 0;
padding: 0;
font-family: "DM Sans";
overflow-x: hidden;
scroll-snap-type: y mandatory;
scroll-behavior: smooth;
overflow-y: scroll;
}
.guestJoinContainer {
top: 0;
overflow: visible;
margin: 0;
position: absolute;
box-sizing: border-box;
padding: 0;
display: inline;
background: linear-gradient(
to right,
#000000,
#434343
) !important; /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
width: 100vw;
height: 100vh;
}
a {
text-decoration: none;
color: white;
padding: 0.5rem;
}
a:hover {
opacity: 0.5 !important;
}
.nav {
position: fixed;
top: 0;
width: 100vw;
height: 10vh;
background-color: #242424;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 2rem;
z-index: 100;
}
.navHeader {
display: flex;
align-items: center;
gap: 1rem;
}
.navLinks {
display: flex;
gap: 2rem;
width: 18rem;
}
.guestJoinCard {
padding: 2rem;
max-width: fit-content;
margin: auto;
background: linear-gradient(to right, #ece9e6, #ffffff)!important;
animation: popOut 500ms ease-out 100ms 1 forwards;
}
@keyframes popOut {
from {
transform: scale(0);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}
}
.joinBlock {
display: flex;
flex-direction: column;
gap: 1rem;
height: 100vh;
margin: auto;
}
.joinBlock input {
color: black;
}

Comments
Post a Comment