From ccc4a523244b20e24d84998e2b02d441994e1a4e Mon Sep 17 00:00:00 2001 From: heyhiru Date: Sun, 12 Nov 2023 23:32:37 +0530 Subject: [PATCH] improved style & turned off remaining sockets Signed-off-by: heyhiru --- client/src/components/Lobby.jsx | 8 ++--- client/src/pages/room/[slug].jsx | 40 +++++++++++++++--------- client/src/styles/globals.css | 52 +++++++++++++++----------------- 3 files changed, 55 insertions(+), 45 deletions(-) diff --git a/client/src/components/Lobby.jsx b/client/src/components/Lobby.jsx index 9bb2c05..602ea86 100644 --- a/client/src/components/Lobby.jsx +++ b/client/src/components/Lobby.jsx @@ -28,9 +28,9 @@ const LobbyScreen = () => { }, [socket, handleJoinRoom]); return ( -
-

Lobby

-
+
+

Lobby

+
@@ -52,7 +52,7 @@ const LobbyScreen = () => { onChange={(e) => setRoom(e.target.value)} />
-
diff --git a/client/src/pages/room/[slug].jsx b/client/src/pages/room/[slug].jsx index ca2ecf8..a36b1e5 100644 --- a/client/src/pages/room/[slug].jsx +++ b/client/src/pages/room/[slug].jsx @@ -114,6 +114,10 @@ const RoomPage = () => { setRemoteSocketId(null); } }); + + return () => { + socket.off("call:end"); + } }, [remoteSocketId, myStream, socket]); //* for disappearing call button @@ -123,6 +127,10 @@ const RoomPage = () => { setCallButton(false); } }); + + return () => { + socket.off("call:initiated"); + } }, [socket, remoteSocketId]); @@ -149,9 +157,10 @@ const RoomPage = () => { // set my stream setMyStream(stream); - // hide the call button + //* hide the call button setCallButton(false); - // Inform the remote user to hide their "CALL" button + + //* Inform the remote user to hide their "CALL" button socket.emit("call:initiated", { to: remoteSocketId }); }, [remoteSocketId, socket, isAudioMute, isVideoOnHold, callButton]); @@ -187,12 +196,12 @@ const RoomPage = () => {

RoomPage

{remoteSocketId ? "Connected" : "No One In Room"}

{(myStream || remoteStream) && - } {(remoteSocketId && callButton) && - } @@ -229,16 +238,19 @@ const RoomPage = () => {
{myStream && ( -
- - - +
+
+ + + +
)}
diff --git a/client/src/styles/globals.css b/client/src/styles/globals.css index 436ad3a..95d0b55 100644 --- a/client/src/styles/globals.css +++ b/client/src/styles/globals.css @@ -4,39 +4,37 @@ label{ color: #333; - margin-right: 0.5rem; + margin-bottom: 0.5rem; + font-size: 1.125rem; + line-height: 1.75rem; + font-weight: 500; } input{ - border: 1px solid #ccc; - border-radius: 4px; - padding: 0.1rem; - margin-bottom: 0.3rem; + margin-bottom: 1rem; + padding: 0.5rem; + border-radius: 0.25rem; + outline: 2px solid transparent; + outline-offset: 2px; + border-width: 1px; + border-color: rgb(170, 170, 170); + &:focus{ + outline: 2px solid transparent; + outline-offset: 2px; + --tw-border-opacity: 1; + border-color: rgb(59 130 246 / var(--tw-border-opacity)); + } + } button{ - font-weight: 500; - border-radius: 1rem; - font-size: 0.875rem; - padding: 0.5rem 1rem; - text-align: center; - margin-bottom: 1rem; -} - -.joinButton{ - color: #fff; - background-color: #7c3aed; - &:hover{ - background-color: #6a28b7; - } -} - - -.callButton{ - color: #fff; - background-color: limegreen; + color: white; + padding: 0.5rem 1rem 0.5rem 1rem; + border-radius: 0.25rem; transition: background-color 250ms ease-in-out; - &:hover{ - background-color: forestgreen; + + &:focus{ + outline: 2px solid transparent; + outline-offset: 2px; } } \ No newline at end of file