front
Gorji 4 years ago
parent 23d89c9322
commit 57e7269d23
  1. 2
      src/Redux/proxy.js
  2. 6
      src/views/ChatRoom/Body/Body.js
  3. 2
      src/views/ChatRoom/Body/Body.scss
  4. 1
      src/views/ChatRoom/Body/Message/DraggableMessage/DraggableMessage.js
  5. 17
      src/views/ChatRoom/Body/Message/Message.js
  6. 1
      src/views/ChatRoom/Body/Message/Message2D/Message2D.js
  7. 2
      src/views/ChatRoom/Body/Message/Message2D/Message2D.scss
  8. 121
      src/views/ChatRoom/Body/Message/NormalMessage/NormalMessage.js
  9. 49
      src/views/ChatRoom/Body/Message/NormalMessage/NormalMessage.scss
  10. 1
      src/views/ChatRoom/Body/Message/RadioMessage/RadioMessage.js
  11. 3
      src/views/ChatRoom/Body/Message/SliderMessage/SliderMessage.js
  12. 6
      src/views/ChatRoom/Header/Header.js
  13. 15
      src/views/Home/Header/NavbarDrawer/NavbarDrawer.scss

@ -1,6 +1,6 @@
import axios from 'axios'; import axios from 'axios';
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
const baseURL = 'https://chatstory.ir/api/v1'; //'https://chatstory.ir/api/v1'; const baseURL = 'http://localhost:4040/api/v1'; //'https://chatstory.ir/api/v1';
const token = ''; const token = '';
const loginURL = 'user/otp/login'; const loginURL = 'user/otp/login';
const logoutURL = 'user/logout'; const logoutURL = 'user/logout';

@ -350,12 +350,11 @@ class Body extends Component {
const { setPage, chatInfo, messageList, userId } = this.props; const { setPage, chatInfo, messageList, userId } = this.props;
const userIdx = {}; const userIdx = {};
chatInfo.users.map((e) => (userIdx[e.id] = { ...e, color: this.randomColor() })); chatInfo.users.map((e) => (userIdx[e.id] = { ...e, color: this.randomColor() }));
console.log({ userId });
return ( return (
<div className="chat-body d-flex flex-column"> <div className="chat-body d-flex flex-column">
<div className="chat-room__status d-flex flex-column" onClick={() => setPage('info')}> <div className="chat-room__status d-flex flex-column" onClick={() => setPage('info')}>
<h1>{chatInfo.title}</h1> <h1>{chatInfo.title}</h1>
<p>{chatInfo.subtitle}</p> <p>{chatInfo.subTitle}</p>
</div> </div>
<div <div
className="chat-body__content d-flex flex-column" className="chat-body__content d-flex flex-column"
@ -372,6 +371,8 @@ class Body extends Component {
this.state.music === null && this.state.music === null &&
this.state.video === null ? ( this.state.video === null ? (
<Message <Message
isActive={i == messageList.length - 1}
prevUserId={i > 0 ? messageList[i - 1].userId : 0}
isSelf={1 == item.userId} isSelf={1 == item.userId}
key={i} key={i}
file={this.state.image} file={this.state.image}
@ -446,7 +447,6 @@ class Body extends Component {
} }
export default connect( export default connect(
(state) => { (state) => {
console.log(state);
return { return {
chatInfo: state.chat.info, chatInfo: state.chat.info,
userId: state.user.isLogin.id, userId: state.user.isLogin.id,

@ -11,6 +11,7 @@
font-family: 'IRANSansNumeralBold'; font-family: 'IRANSansNumeralBold';
} }
} }
.chat-body { .chat-body {
background-color: rgb(210, 196, 214); background-color: rgb(210, 196, 214);
justify-content: flex-start; justify-content: flex-start;
@ -18,6 +19,7 @@
height: 100%; height: 100%;
border-top-left-radius: 40px; border-top-left-radius: 40px;
border-top-right-radius: 40px; border-top-right-radius: 40px;
&__content { &__content {
background: url(../../../assets/images/chat.png); background: url(../../../assets/images/chat.png);
background-size: cover; background-size: cover;

@ -24,6 +24,7 @@ export default class DraggableMessage extends Component {
style={{ style={{
marginRight: isSelf ? 0 : 70, marginRight: isSelf ? 0 : 70,
marginLeft: isSelf ? 70 : 0, marginLeft: isSelf ? 70 : 0,
maxWidth: 400,
}} }}
> >
<SortableList items={this.state.options} onSortEnd={this.onSortEnd} /> <SortableList items={this.state.options} onSortEnd={this.onSortEnd} />

@ -8,10 +8,11 @@ import RadioMessage from './RadioMessage/RadioMessage.js';
export default class Message extends Component { export default class Message extends Component {
render() { render() {
const { message, user, isSelf, file, document } = this.props; const { message, user, isSelf, file, document, prevUserId, isActive } = this.props;
return ( return (
<> <div style={{ marginTop: 5 }}>
<NormalMessage <NormalMessage
prevUserId={prevUserId}
message={message} message={message}
user={user} user={user}
isSelf={isSelf} isSelf={isSelf}
@ -19,17 +20,19 @@ export default class Message extends Component {
document={document} document={document}
/> />
{message.type === '2d' ? <Message2D message={message} user={user} isSelf={isSelf} /> : null} {message.type === '2d' ? (
<Message2D message={message} user={user} isSelf={isSelf} isActive={isActive} />
) : null}
{message.type === 'draggable' ? ( {message.type === 'draggable' ? (
<DraggableMessage message={message} user={user} isSelf={isSelf} /> <DraggableMessage message={message} user={user} isSelf={isSelf} isActive={isActive} />
) : null} ) : null}
{message.type === 'slider' ? ( {message.type === 'slider' ? (
<SliderMessage message={message} user={user} isSelf={isSelf} /> <SliderMessage message={message} user={user} isSelf={isSelf} isActive={isActive} />
) : null} ) : null}
{message.type === 'radio' ? ( {message.type === 'radio' ? (
<RadioMessage message={message} user={user} isSelf={isSelf} /> <RadioMessage message={message} user={user} isSelf={isSelf} isActive={isActive} />
) : null} ) : null}
</> </div>
); );
} }
} }

@ -12,6 +12,7 @@ export default class Message2D extends Component {
style={{ style={{
marginRight: isSelf ? 0 : 70, marginRight: isSelf ? 0 : 70,
marginLeft: isSelf ? 70 : 0, marginLeft: isSelf ? 70 : 0,
maxWidth: 400,
}} }}
> >
<div className="message-2d__options d-flex flex-column"> <div className="message-2d__options d-flex flex-column">

@ -47,7 +47,7 @@
span { span {
font-size: 16px; font-size: 16px;
color: black; color: black;
font-weight: 600; font-weight: 400;
} }
} }
} }

@ -9,19 +9,37 @@ import DoneAllIcon from '@material-ui/icons/DoneAll';
import EditIcon from '@material-ui/icons/Edit'; import EditIcon from '@material-ui/icons/Edit';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import './NormalMessage.scss'; import './NormalMessage.scss';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import ReplyIcon from '@material-ui/icons/Reply';
import ForwardIcon from '@material-ui/icons/Forward';
import DeleteIcon from '@material-ui/icons/Delete';
import FavoriteIcon from '@material-ui/icons/Favorite';
import TextsmsIcon from '@material-ui/icons/Textsms';
export default class NormalMessage extends Component { export default class NormalMessage extends Component {
state = { messageMenu: null };
handleClose = () => {
this.setState({
messageMenu: null,
});
};
handleClick = (event) => {
this.setState({
messageMenu: event.currentTarget,
});
};
render() { render() {
const { message, user, document, isSelf } = this.props; const { message, user, document, isSelf, prevUserId } = this.props;
const { messageMenu } = this.state;
const hasavatar = prevUserId != message.userId;
return ( return (
<div <div
className="normal-message d-flex flex-column d-flex" className="normal-message d-flex flex-column d-flex"
style={{ style={{
marginRight: isSelf ? 0 : 70,
marginLeft: isSelf ? 70 : 0,
filter: document !== null ? 'blur(16px)' : 'blur(0px)', filter: document !== null ? 'blur(16px)' : 'blur(0px)',
}} }}
> >
{hasavatar && (
<Avatar <Avatar
alt={user.name} alt={user.name}
src={window.baseURL + '/file/download/' + user.fileId} src={window.baseURL + '/file/download/' + user.fileId}
@ -33,11 +51,9 @@ export default class NormalMessage extends Component {
.map((e) => e.slice(0, 1)) .map((e) => e.slice(0, 1))
.join(' ')} .join(' ')}
</Avatar> </Avatar>
{/* <img )}
src={window.baseURL + '/file/download/' + user.fileId}
style={{ alignSelf: isSelf ? 'flex-end' : 'flex-start' }} <div className="d-flex" style={{ direction: isSelf ? 'rtl' : 'ltr' }}>
alt={message.id}
/> */}
<div <div
className={ className={
message.voice === null && message.voice === null &&
@ -45,10 +61,14 @@ export default class NormalMessage extends Component {
message.image === null && message.image === null &&
message.music === null && message.music === null &&
message.document === null message.document === null
? `normal-message__box d-flex` ? `normal-message__box `
: `normal-message__box d-flex normal-message__box--file` : `normal-message__box normal-message__box--file`
} }
style={{ backgroundColor: isSelf ? 'rgb(15, 93, 190)' : 'white' }} style={{
paddingTop: hasavatar ? 25 : 10,
backgroundColor: isSelf ? 'rgb(15, 93, 190)' : 'white',
width: 'calc(100%-70px)',
}}
> >
{message.voice === null && {message.voice === null &&
message.video === null && message.video === null &&
@ -61,14 +81,52 @@ export default class NormalMessage extends Component {
top: 0, top: 0,
direction: isSelf ? 'ltr' : 'rtl', direction: isSelf ? 'ltr' : 'rtl',
paddingRight: isSelf ? 60 : 0, paddingRight: isSelf ? 70 : 0,
paddingLeft: isSelf ? 15 : 70, paddingLeft: isSelf ? 0 : 70,
}} }}
> >
<div style={{ color: isSelf ? '#aaa' : 'gray' }}> <div style={{ color: isSelf ? '#aaa' : 'gray' }}>
<ExpandMoreIcon fontSize="small" /> <ExpandMoreIcon fontSize="small" onClick={this.handleClick} />
</div> </div>
<div style={{ color: isSelf ? '#aaa' : 'gray' }}>{user.name}</div> <Menu
id="simple-menu"
anchorEl={messageMenu}
keepMounted
open={Boolean(messageMenu)}
onClose={() => this.handleClose()}
style={{ direction: 'rtl', fontFamily: 'IRANSansNumeralLight' }}
>
<MenuItem
style={{ fontFamily: 'IRANSansNumeralLight' }}
onClick={() => this.handleClose()}
>
<ReplyIcon fontSize="samall" />
پاسخ
</MenuItem>
<MenuItem
style={{ fontFamily: 'IRANSansNumeralLight' }}
onClick={() => this.handleClose()}
>
<ForwardIcon fontSize="samall" />
باز ارسال به
</MenuItem>
<MenuItem
style={{ fontFamily: 'IRANSansNumeralLight' }}
onClick={() => this.handleClose()}
>
<EditIcon fontSize="samall" />
ویرایش
</MenuItem>
<MenuItem
style={{ fontFamily: 'IRANSansNumeralLight' }}
onClick={() => this.handleClose()}
>
<DeleteIcon fontSize="samall" />
حذف
</MenuItem>
</Menu>
{hasavatar && <div style={{ color: isSelf ? '#aaa' : 'gray' }}>{user.name}</div>}
</div> </div>
) : null} ) : null}
@ -87,7 +145,12 @@ export default class NormalMessage extends Component {
<a href={message.image} download> <a href={message.image} download>
<img src={message.image} download alt="" /> <img src={message.image} download alt="" />
</a> </a>
<p id="2" style={{ color: isSelf ? 'white' : 'black' }}> <p
id="2"
style={{
color: isSelf ? 'white' : 'black',
}}
>
{message.text} {message.text}
</p> </p>
</div> </div>
@ -97,7 +160,12 @@ export default class NormalMessage extends Component {
<a href={message.video} download> <a href={message.video} download>
<ReactPlayer url={message.video} controls width={'100%'} height={250} /> <ReactPlayer url={message.video} controls width={'100%'} height={250} />
</a> </a>
<p id="1" style={{ color: isSelf ? 'white' : 'black' }}> <p
id="1"
style={{
color: isSelf ? 'white' : 'black',
}}
>
{message.text} {message.text}
</p> </p>
</div> </div>
@ -124,7 +192,7 @@ export default class NormalMessage extends Component {
<div>{message.document.name}</div> <div>{message.document.name}</div>
</a> </a>
) : null} ) : null}
<div className="normal-message__box--dete d-flex"> <div className="normal-message__box--date d-flex">
<span style={{ color: isSelf ? '#aaa' : 'gray' }}> <span style={{ color: isSelf ? '#aaa' : 'gray' }}>
{message.status == 1 && <DoneIcon fontSize="small" />} {message.status == 1 && <DoneIcon fontSize="small" />}
{message.status == 2 && <DoneAllIcon fontSize="small" />} {message.status == 2 && <DoneAllIcon fontSize="small" />}
@ -140,6 +208,21 @@ export default class NormalMessage extends Component {
</span> </span>
</div> </div>
</div> </div>
<div className={isSelf ? 'icons self' : 'icons'}>
<div>
<FavoriteIcon fontSize="samall" color="primary" />
<span> {10}</span>
</div>
{/* <div>
<TextsmsIcon fontSize="samall" color="secondary" />
<span> {10}</span>
</div>
<div>
<span> {'+5 اعتماد به نفس'}</span>
</div> */}
</div>
</div>
</div> </div>
); );
} }

@ -1,8 +1,43 @@
@media screen and (max-width: 4500px) { @media screen and (max-width: 4500px) {
.icons {
//position: absolute;
width: 90px;
padding: 0 5px;
display: inline-block !important;
// top: 55px;
// right: -35px;
direction: ltr;
& .MuiSvgIcon-root {
font-size: 18px !important;
opacity: 0.8;
}
& span {
font-size: 11px !important;
opacity: 0.8;
}
}
.self {
direction: rtl;
text-align: right;
// left: -35px;
// right: none;
}
.MuiMenuItem-root {
min-height: 10px !important;
font-size: 12px !important;
color: grey;
padding: 5px 10px !important;
& .MuiSvgIcon-root {
font-size: 16px !important;
padding: 2px;
color: grey;
}
}
.normal-message { .normal-message {
// width: 100%; // width: 100%;
position: relative; position: relative;
margin-bottom: 5px; margin-bottom: 2px;
img { img {
width: 65px; width: 65px;
height: 65px; height: 65px;
@ -14,9 +49,12 @@
z-index: 50; z-index: 50;
} }
&__box { &__box {
line-height: 1em;
max-width: 400px;
display: flex;
justify-content: flex-end; justify-content: flex-end;
width: 100%; width: 100%;
padding: 35px 7px 5px; padding: 20px 7px 5px;
background-color: white; background-color: white;
border-radius: 15px; border-radius: 15px;
position: relative; position: relative;
@ -38,13 +76,12 @@
font-family: IRANSansNumeralLight; font-family: IRANSansNumeralLight;
} }
} }
&--dete { &--date {
position: absolute; position: absolute;
width: 100%; width: 100%;
padding-top: 20px; padding: 20px 50px 0;
padding-left: 20px;
bottom: 0px; bottom: 0px;
justify-content: space-between; justify-content: flex-end;
font-size: 11px; font-size: 11px;
span { span {
font-family: IRANSansNumeralLight; font-family: IRANSansNumeralLight;

@ -24,6 +24,7 @@ export default class RadioMessage extends Component {
style={{ style={{
marginRight: isSelf ? 0 : 70, marginRight: isSelf ? 0 : 70,
marginLeft: isSelf ? 70 : 0, marginLeft: isSelf ? 70 : 0,
maxWidth: 400,
}} }}
> >
<div className="message-2d__options d-flex flex-wrap justify-content-center"> <div className="message-2d__options d-flex flex-wrap justify-content-center">

@ -37,8 +37,11 @@ export default class SliderMessage extends Component {
<div <div
className="message-2d d-flex flex-column d-flex" className="message-2d d-flex flex-column d-flex"
style={{ style={{
marginTop: 5,
marginBottom: 5,
marginRight: isSelf ? 0 : 70, marginRight: isSelf ? 0 : 70,
marginLeft: isSelf ? 70 : 0, marginLeft: isSelf ? 70 : 0,
maxWidth: 400,
}} }}
> >
<Grid container spacing={2} alignItems="center"> <Grid container spacing={2} alignItems="center">

@ -59,19 +59,19 @@ export default class Header extends Component {
style={{ direction: 'rtl', fontFamily: 'IRANSansNumeralLight' }} style={{ direction: 'rtl', fontFamily: 'IRANSansNumeralLight' }}
> >
<MenuItem <MenuItem
style={{ color: 'white', fontFamily: 'IRANSansNumeralLight' }} style={{ fontFamily: 'IRANSansNumeralLight' }}
onClick={() => this.handleClose()} onClick={() => this.handleClose()}
> >
پروفایل پروفایل
</MenuItem> </MenuItem>
<MenuItem <MenuItem
style={{ color: 'white', fontFamily: 'IRANSansNumeralLight' }} style={{ fontFamily: 'IRANSansNumeralLight' }}
onClick={() => this.handleClose()} onClick={() => this.handleClose()}
> >
حساب کاربری حساب کاربری
</MenuItem> </MenuItem>
<MenuItem <MenuItem
style={{ color: 'white', fontFamily: 'IRANSansNumeralLight' }} style={{ fontFamily: 'IRANSansNumeralLight' }}
onClick={() => this.handleClose()} onClick={() => this.handleClose()}
> >
خروج خروج

@ -1,3 +1,10 @@
.MuiDrawer-paperAnchorRight {
background: linear-gradient(180deg, rgb(144, 73, 186) 20%, rgb(111, 108, 255) 72%) !important;
&::-webkit-scrollbar {
display: none;
width: 0px;
}
}
.navbar-drawer { .navbar-drawer {
// background: linear-gradient(180deg, rgb(144, 73, 186) 0%, rgb(111,108,255) 22%) !important; // background: linear-gradient(180deg, rgb(144, 73, 186) 0%, rgb(111,108,255) 22%) !important;
text-align: right !important; text-align: right !important;
@ -74,14 +81,6 @@
} }
} }
.MuiPaper-root {
background: linear-gradient(180deg, rgb(144, 73, 186) 20%, rgb(111, 108, 255) 72%) !important;
&::-webkit-scrollbar {
display: none;
width: 0px;
}
}
.navbar-drawer__bottom a { .navbar-drawer__bottom a {
width: 100%; width: 100%;
height: 100px; height: 100px;

Loading…
Cancel
Save