From: Ajay Bura Date: Fri, 14 Jan 2022 04:13:35 +0000 (+0530) Subject: Fix typo in room-options X-Git-Tag: v1.7.0~25 X-Git-Url: https://git.wafflesoft.org/?a=commitdiff_plain;h=871a25364dd293b97a62d73267747ddfdcf55f8b;p=rainny.git Fix typo in room-options Signed-off-by: Ajay Bura --- diff --git a/src/app/molecules/room-options/RoomOptions.jsx b/src/app/molecules/room-options/RoomOptions.jsx new file mode 100644 index 0000000..83a9482 --- /dev/null +++ b/src/app/molecules/room-options/RoomOptions.jsx @@ -0,0 +1,67 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +import { twemojify } from '../../../util/twemojify'; + +import initMatrix from '../../../client/initMatrix'; +import { openInviteUser } from '../../../client/action/navigation'; +import * as roomActions from '../../../client/action/room'; + +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 = () => { + afterOptionSelect(); + if (!room) return; + const events = room.getLiveTimeline().getEvents(); + mx.sendReadReceipt(events[events.length - 1]); + }; + + const handleInviteClick = () => { + openInviteUser(roomId); + afterOptionSelect(); + }; + const handleLeaveClick = () => { + if (confirm('Are you really want to leave this room?')) { + roomActions.leave(roomId); + afterOptionSelect(); + } + }; + + 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; diff --git a/src/app/molecules/room-optons/RoomOptions.jsx b/src/app/molecules/room-optons/RoomOptions.jsx deleted file mode 100644 index 83a9482..0000000 --- a/src/app/molecules/room-optons/RoomOptions.jsx +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -import { twemojify } from '../../../util/twemojify'; - -import initMatrix from '../../../client/initMatrix'; -import { openInviteUser } from '../../../client/action/navigation'; -import * as roomActions from '../../../client/action/room'; - -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 = () => { - afterOptionSelect(); - if (!room) return; - const events = room.getLiveTimeline().getEvents(); - mx.sendReadReceipt(events[events.length - 1]); - }; - - const handleInviteClick = () => { - openInviteUser(roomId); - afterOptionSelect(); - }; - const handleLeaveClick = () => { - if (confirm('Are you really want to leave this room?')) { - roomActions.leave(roomId); - afterOptionSelect(); - } - }; - - 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; diff --git a/src/app/organisms/navigation/Selector.jsx b/src/app/organisms/navigation/Selector.jsx index e321db8..555ed14 100644 --- a/src/app/organisms/navigation/Selector.jsx +++ b/src/app/organisms/navigation/Selector.jsx @@ -10,7 +10,7 @@ import { getEventCords, abbreviateNumber } from '../../../util/common'; import IconButton from '../../atoms/button/IconButton'; import RoomSelector from '../../molecules/room-selector/RoomSelector'; -import RoomOptions from '../../molecules/room-optons/RoomOptions'; +import RoomOptions from '../../molecules/room-options/RoomOptions'; import HashIC from '../../../../public/res/ic/outlined/hash.svg'; import HashGlobeIC from '../../../../public/res/ic/outlined/hash-globe.svg'; diff --git a/src/app/organisms/room/RoomViewHeader.jsx b/src/app/organisms/room/RoomViewHeader.jsx index 9c12a7e..2f5e434 100644 --- a/src/app/organisms/room/RoomViewHeader.jsx +++ b/src/app/organisms/room/RoomViewHeader.jsx @@ -18,7 +18,7 @@ import RawIcon from '../../atoms/system-icons/RawIcon'; import IconButton from '../../atoms/button/IconButton'; import Header, { TitleWrapper } from '../../atoms/header/Header'; import Avatar from '../../atoms/avatar/Avatar'; -import RoomOptions from '../../molecules/room-optons/RoomOptions'; +import RoomOptions from '../../molecules/room-options/RoomOptions'; import UserIC from '../../../../public/res/ic/outlined/user.svg'; import ChevronBottomIC from '../../../../public/res/ic/outlined/chevron-bottom.svg';