Skip to content

Commit

Permalink
added room joining
Browse files Browse the repository at this point in the history
  • Loading branch information
dendidibe committed Aug 16, 2023
1 parent 84808b6 commit 0021041
Showing 1 changed file with 33 additions and 9 deletions.
42 changes: 33 additions & 9 deletions client-web/src/pages/ChatInRoom/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
Stack,
Typography,
Divider,
Button,
} from "@mui/material";
import { useParams, useHistory } from "react-router-dom";
import { useDropzone } from "react-dropzone";
Expand Down Expand Up @@ -226,7 +227,11 @@ export function ChatInRoom() {
setProfile(result.data.result);
});
}, []);

const joinTheRoom = () => {
xmpp.subsribe(currentRoom);
xmpp.presenceInRoom(currentRoom);
chooseRoom(currentRoom)
}
const toggleTransferDialog = (
value: boolean,
message: TMessageHistory = null
Expand Down Expand Up @@ -550,14 +555,15 @@ export function ChatInRoom() {
handleCloseDeleteMessageDialog();
};

const roomLastSeen =mainWindowMessages.slice(-1)[0]?.date ?
messages.filter((item) => item.roomJID === currentRoom).length > 0 &&
"Active " +
formatDistance(
subDays(new Date(mainWindowMessages.slice(-1)[0]?.date), 0),
new Date(),
{ addSuffix: true }
) : '';
const roomLastSeen = mainWindowMessages.slice(-1)[0]?.date
? messages.filter((item) => item.roomJID === currentRoom).length > 0 &&
"Active " +
formatDistance(
subDays(new Date(mainWindowMessages.slice(-1)[0]?.date), 0),
new Date(),
{ addSuffix: true }
)
: "";
//Delete confirmation dialogue component

//component to render File upload dialog box
Expand Down Expand Up @@ -631,6 +637,24 @@ export function ChatInRoom() {
</ConversationHeader.Actions>
</ConversationHeader>
)}
{!roomData?.name && currentRoom !== NO_ROOM_PICKED && <ConversationHeader
style={{
height: "70px",
}}
>
<ConversationHeader.Back />

<ConversationHeader.Actions>

<IconButton
sx={{ color: "black" }}
onClick={() => setQrModalVisible(true)}
>
<QrCodeIcon />
</IconButton>
<Button onClick={joinTheRoom} variant="outlined">Join the room</Button>
</ConversationHeader.Actions>
</ConversationHeader>}
<MessageList
style={{
backgroundImage: currentPickedRoom?.room_background
Expand Down

0 comments on commit 0021041

Please sign in to comment.