Skip to content

Commit

Permalink
fix: chat bugs
Browse files Browse the repository at this point in the history
Signed-off-by: SohamRatnaparkhi <[email protected]>
  • Loading branch information
SohamRatnaparkhi committed Oct 6, 2023
1 parent cb48456 commit 2291b41
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
17 changes: 12 additions & 5 deletions frontend/app/meeting/lobby/[slug]/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const MeetLobby = ({ params }) => {
const [isPeerHost, setIsPeerHost] = React.useState(false);

const { initialize, me } = useHuddle01();
const { isRoomJoined } = useRoom();
const { isRoomJoined, error } = useRoom();
const { peers } = usePeers();
const { joinLobby, leaveLobby, isLoading, isLobbyJoined } = useLobby();
const [accessDenied, setAccessDenied] = React.useState(false);
Expand All @@ -48,7 +48,7 @@ const MeetLobby = ({ params }) => {
const {
fetchVideoStream,
stopVideoStream,
error,
// error,
} = useVideo();
const { joinRoom } = useRoom();
// const { setDisplayName } = useAppUtils();
Expand Down Expand Up @@ -87,6 +87,8 @@ const MeetLobby = ({ params }) => {
}
}

console.log(error)

const checkLobbyConditions = async () => {
var { address } = await getWalletDetails();
setMyEthAddress(address);
Expand Down Expand Up @@ -149,15 +151,19 @@ const MeetLobby = ({ params }) => {
if (isRoomJoined) {
push(`/meeting/room/${params.slug}`);
}
console.log(isRoomJoined)
console.log("abcd")
}, [isRoomJoined]);



console.log(isRoomJoined)
const handleMeetStart = () => {
console.log("is lobby joined", isLobbyJoined)
if (!isLobbyJoined) return;
// if (!isLobbyJoined) return;
setMyPeerId(me.meId);
console.log("joining room")
joinRoom();
console.log("joining room done")
}

if (isLoading) return (<div><iframe src="https://lottie.host/?file=307fb28b-48a0-477a-8c49-a9ba66f14a79/clHpsh7QES.json"></iframe></div>)
Expand All @@ -167,6 +173,7 @@ const MeetLobby = ({ params }) => {
<Navbar />
{/* {isLobbyJoined}
{JSON.stringify(peers)} */}
{isRoomJoined}
<h2 className="text-3xl font-bold m-5">READY TO JOIN?</h2>

<div className='flex flex-col items-center bg-[#5D8BF436] h-3/5 w-1/2 rounded-[20px]'>
Expand Down Expand Up @@ -281,7 +288,7 @@ const MeetLobby = ({ params }) => {
}}

>
{`JOIN MEET`}
{`JOIN MEET ${joinRoom.isCallable}`}
</Button>
</div>
</div>
Expand Down
10 changes: 7 additions & 3 deletions frontend/app/meeting/room/[slug]/components/ChatBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ const ChatBox = ({ chatBox, peers }) => {
}
};

console.log(roomMessages)

return (
<div className={cn(chatBox ? "w-25%" : "0", "ease-in-out duration-300")}>
{chatBox && (
Expand Down Expand Up @@ -190,7 +192,7 @@ const ChatBox = ({ chatBox, peers }) => {
);
})}
</div>

{/* Individual messages */}
<div
className={cn(
Expand All @@ -213,7 +215,7 @@ const ChatBox = ({ chatBox, peers }) => {
{
roomMessages.filter(
(message) =>
message.sender?.meId == talkTo || message.receiver == talkTo
message.sender?.meId == talkTo || message.receiver == talkTo || message.receivers?.includes(talkTo)
).length > 0
? roomMessages
.filter(
Expand Down Expand Up @@ -358,13 +360,15 @@ const ChatBox = ({ chatBox, peers }) => {
message: groupMessage,
kind: "private",
receiver: peerId,
receivers: peerIdsToSend,
timeStamp: formatTime(new Date().getTime()),
});
addRoomMessage([peerId], {
addRoomMessage({
sender: me,
message: groupMessage,
kind: "private",
receiver: peerId,
receivers: peerIdsToSend,
timeStamp: formatTime(new Date().getTime()),
});
console.log(
Expand Down

0 comments on commit 2291b41

Please sign in to comment.