feat: unread for mobile
This commit is contained in:
parent
7fb8026e28
commit
4a802571f6
|
@ -2,6 +2,12 @@ import './chat--center.scss';
|
||||||
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import {useSelector} from 'react-redux';
|
||||||
|
|
||||||
|
import {
|
||||||
|
unreadChannelSelector,
|
||||||
|
unreadUserSelector,
|
||||||
|
} from '~/common/state/user';
|
||||||
|
|
||||||
import useChannel from '~/client/hooks/useChannel';
|
import useChannel from '~/client/hooks/useChannel';
|
||||||
|
|
||||||
|
@ -10,6 +16,9 @@ import ChatMessages from './chat--messages';
|
||||||
export default function ChatCenter(props) {
|
export default function ChatCenter(props) {
|
||||||
const {onButton} = props;
|
const {onButton} = props;
|
||||||
const channel = useChannel();
|
const channel = useChannel();
|
||||||
|
const unreadChannel = useSelector(unreadChannelSelector);
|
||||||
|
const unreadUser = useSelector(unreadUserSelector);
|
||||||
|
const unread = unreadChannel + unreadUser;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="center flexed"
|
className="center flexed"
|
||||||
|
@ -27,6 +36,7 @@ export default function ChatCenter(props) {
|
||||||
>
|
>
|
||||||
💬
|
💬
|
||||||
</span>
|
</span>
|
||||||
|
{unread ? <span className="unread">{unread}</span> : null}
|
||||||
</button>
|
</button>
|
||||||
<div className="center__headerChannel">
|
<div className="center__headerChannel">
|
||||||
<span className="tiny">
|
<span className="tiny">
|
||||||
|
|
|
@ -21,10 +21,17 @@
|
||||||
.center__headerButton {
|
.center__headerButton {
|
||||||
border: none;
|
border: none;
|
||||||
height: 3em;
|
height: 3em;
|
||||||
|
position: relative;
|
||||||
width: 3em;
|
width: 3em;
|
||||||
@include breakpoint(desktop) {
|
@include breakpoint(desktop) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
.unread {
|
||||||
|
bottom: -0.2em;
|
||||||
|
position: absolute;
|
||||||
|
right: -0.8em;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.button--right {
|
.button--right {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user