Improve jump to unread button (#396)
* Improve jump to unread button Signed-off-by: Ajay Bura <ajbura@gmail.com> * Remove unused cod Signed-off-by: Ajay Bura <ajbura@gmail.com> * Fix mark as read not hidding jump to unread btn Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add notification mark as read action Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add esc as hotkey to mark room as read Signed-off-by: Ajay Bura <ajbura@gmail.com> * Add message icons Signed-off-by: Ajay Bura <ajbura@gmail.com> * Change jump to unread icon Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
@@ -5,11 +5,13 @@ import './RoomViewFloating.scss';
|
||||
|
||||
import initMatrix from '../../../client/initMatrix';
|
||||
import cons from '../../../client/state/cons';
|
||||
import { markAsRead } from '../../../client/action/notifications';
|
||||
|
||||
import Text from '../../atoms/text/Text';
|
||||
import Button from '../../atoms/button/Button';
|
||||
import IconButton from '../../atoms/button/IconButton';
|
||||
|
||||
import MessageUnreadIC from '../../../../public/res/ic/outlined/message-unread.svg';
|
||||
import ChevronBottomIC from '../../../../public/res/ic/outlined/chevron-bottom.svg';
|
||||
import TickMarkIC from '../../../../public/res/ic/outlined/tick-mark.svg';
|
||||
|
||||
@@ -23,7 +25,7 @@ function useJumpToEvent(roomTimeline) {
|
||||
};
|
||||
|
||||
const cancelJumpToEvent = () => {
|
||||
roomTimeline.markAllAsRead();
|
||||
markAsRead(roomTimeline.roomId);
|
||||
setEventId(null);
|
||||
};
|
||||
|
||||
@@ -36,11 +38,12 @@ function useJumpToEvent(roomTimeline) {
|
||||
setEventId(readEventId);
|
||||
}
|
||||
|
||||
const { notifications } = initMatrix;
|
||||
const handleMarkAsRead = () => setEventId(null);
|
||||
roomTimeline.on(cons.events.roomTimeline.MARKED_AS_READ, handleMarkAsRead);
|
||||
notifications.on(cons.events.notifications.FULL_READ, handleMarkAsRead);
|
||||
|
||||
return () => {
|
||||
roomTimeline.removeListener(cons.events.roomTimeline.MARKED_AS_READ, handleMarkAsRead);
|
||||
notifications.removeListener(cons.events.notifications.FULL_READ, handleMarkAsRead);
|
||||
setEventId(null);
|
||||
};
|
||||
}, [roomTimeline]);
|
||||
@@ -96,17 +99,12 @@ function RoomViewFloating({
|
||||
return (
|
||||
<>
|
||||
<div className={`room-view__unread ${isJumpToEvent ? 'room-view__unread--open' : ''}`}>
|
||||
<Button onClick={jumpToEvent} variant="primary">
|
||||
<Text variant="b2">Jump to unread</Text>
|
||||
<Button iconSrc={MessageUnreadIC} onClick={jumpToEvent} variant="primary">
|
||||
<Text variant="b3" weight="medium">Jump to unread messages</Text>
|
||||
</Button>
|
||||
<Button iconSrc={TickMarkIC} onClick={cancelJumpToEvent} variant="primary">
|
||||
<Text variant="b3" weight="bold">Mark as read</Text>
|
||||
</Button>
|
||||
<IconButton
|
||||
onClick={cancelJumpToEvent}
|
||||
variant="primary"
|
||||
size="extra-small"
|
||||
src={TickMarkIC}
|
||||
tooltipPlacement="bottom"
|
||||
tooltip="Mark as read"
|
||||
/>
|
||||
</div>
|
||||
<div className={`room-view__typing${typingMembers.size > 0 ? ' room-view__typing--open' : ''}`}>
|
||||
<div className="bouncing-loader"><div /></div>
|
||||
|
||||
Reference in New Issue
Block a user