Skip to content

Commit

Permalink
leave room
Browse files Browse the repository at this point in the history
  • Loading branch information
dendidibe committed Aug 11, 2023
1 parent 55e8c08 commit 2547e7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion client-web/src/components/Chat/LeaveRoomButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import LogoutIcon from "@mui/icons-material/Logout";
import { DeleteDialog } from "../DeleteDialog";
import xmpp from "../../xmpp";
import { useStoreState } from "../../store";
import { useHistory } from "react-router";

export interface ILeaveRoomButton {
roomJid: string;
Expand All @@ -12,6 +13,7 @@ export interface ILeaveRoomButton {
export const LeaveRoomButton: React.FC<ILeaveRoomButton> = ({ roomJid }) => {
const deleteUserChatRoom = useStoreState(s => s.deleteUserChatRoom)
const [showLeaveRoom, setShowLeaveRoom] = useState(false);
const history = useHistory()
const onButtonClick = () => {
setShowLeaveRoom(true);
};
Expand All @@ -22,7 +24,8 @@ export const LeaveRoomButton: React.FC<ILeaveRoomButton> = ({ roomJid }) => {
xmpp.leaveTheRoom(roomJid);
xmpp.unsubscribe(roomJid);
deleteUserChatRoom(roomJid)
closeLeaveRoomModal()
closeLeaveRoomModal();
history.push('/chat/none')
};
return (
<>
Expand Down
6 changes: 3 additions & 3 deletions client-web/src/pages/ChatInRoom/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,14 @@ export function ChatInRoom() {
handleCloseDeleteMessageDialog();
};

const roomLastSeen =
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),
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

0 comments on commit 2547e7a

Please sign in to comment.