feat: unread for mobile

This commit is contained in:
cha0s 2020-07-25 09:15:40 -05:00
parent 7fb8026e28
commit 4a802571f6
2 changed files with 17 additions and 0 deletions

View File

@ -2,6 +2,12 @@ import './chat--center.scss';
import PropTypes from 'prop-types';
import React from 'react';
import {useSelector} from 'react-redux';
import {
unreadChannelSelector,
unreadUserSelector,
} from '~/common/state/user';
import useChannel from '~/client/hooks/useChannel';
@ -10,6 +16,9 @@ import ChatMessages from './chat--messages';
export default function ChatCenter(props) {
const {onButton} = props;
const channel = useChannel();
const unreadChannel = useSelector(unreadChannelSelector);
const unreadUser = useSelector(unreadUserSelector);
const unread = unreadChannel + unreadUser;
return (
<div
className="center flexed"
@ -27,6 +36,7 @@ export default function ChatCenter(props) {
>
💬
</span>
{unread ? <span className="unread">{unread}</span> : null}
</button>
<div className="center__headerChannel">
<span className="tiny">

View File

@ -21,10 +21,17 @@
.center__headerButton {
border: none;
height: 3em;
position: relative;
width: 3em;
@include breakpoint(desktop) {
display: none;
}
.unread {
bottom: -0.2em;
position: absolute;
right: -0.8em;
z-index: 100;
}
}
.button--right {