import React from 'react'; import PropTypes from 'prop-types'; import { twemojify } from '../../../util/twemojify'; import initMatrix from '../../../client/initMatrix'; import { openInviteUser, openNavigation } from '../../../client/action/navigation'; import * as roomActions from '../../../client/action/room'; import { markAsRead } from '../../../client/action/notifications'; import { MenuHeader, MenuItem } from '../../atoms/context-menu/ContextMenu'; import RoomNotification from '../room-notification/RoomNotification'; import TickMarkIC from '../../../../public/res/ic/outlined/tick-mark.svg'; import AddUserIC from '../../../../public/res/ic/outlined/add-user.svg'; import LeaveArrowIC from '../../../../public/res/ic/outlined/leave-arrow.svg'; function RoomOptions({ roomId, afterOptionSelect }) { const mx = initMatrix.matrixClient; const room = mx.getRoom(roomId); const canInvite = room?.canInvite(mx.getUserId()); const handleMarkAsRead = () => { markAsRead(roomId); afterOptionSelect(); }; const handleInviteClick = () => { openInviteUser(roomId); afterOptionSelect(); }; const handleLeaveClick = () => { if (confirm('Are you sure that you want to leave this room?')) { roomActions.leave(roomId); afterOptionSelect(); openNavigation(); } }; return (
{twemojify(`Options for ${initMatrix.matrixClient.getRoom(roomId)?.name}`)} Mark as read Invite Leave Notification
); } RoomOptions.defaultProps = { afterOptionSelect: null, }; RoomOptions.propTypes = { roomId: PropTypes.string.isRequired, afterOptionSelect: PropTypes.func, }; export default RoomOptions;