Browse Source

fix contact

old_master
Andrew_dev 3 years ago
parent
commit
528220c70f
  1. BIN
      public/img/date_d.png
  2. 32
      src/containers/Contacts/components/DataUser/index.jsx
  3. 4
      src/containers/Layout/topbar/TopbarNotification/index.jsx

BIN
public/img/date_d.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

32
src/containers/Contacts/components/DataUser/index.jsx

@ -33,10 +33,8 @@ class DataUser extends Component { @@ -33,10 +33,8 @@ class DataUser extends Component {
};
}
componentDidMount(){
if(this.props.location.search){
const {users} = this.props;
openUserD(location, users){
if(location.search){
let params = (new URL(document.location)).searchParams;
let id = params.get('id')
console.log("🚀 ~ file: index.jsx ~ line 42 ~ DataUser ~ componentWillReceiveProps ~ id", id)
@ -54,23 +52,13 @@ class DataUser extends Component { @@ -54,23 +52,13 @@ class DataUser extends Component {
}
}
componentDidMount(){
this.openUserD(this.props.location, this.props.users)
}
componentWillReceiveProps(nextProps) {
if(this.props.location.search != nextProps.location.search){
const {users} = nextProps;
let params = (new URL(document.location)).searchParams;
let id = params.get('id')
console.log("🚀 ~ file: index.jsx ~ line 42 ~ DataUser ~ componentWillReceiveProps ~ id", id)
if(id){
const user = users.find(_i => _i.id == id);
console.log("🚀 ~ file: index.jsx ~ line 44 ~ DataUser ~ componentWillReceiveProps ~ user", user)
if(user){
this.setState({
showModal: Boolean(user),
selectedUser: {...user, date_of_birth: moment(user.date_of_birth).isValid() ? moment(user.date_of_birth).format('DD MMMM') : ''},
})
}
}
this.openUserD(nextProps.location, nextProps.users);
}
}
@ -125,16 +113,14 @@ class DataUser extends Component { @@ -125,16 +113,14 @@ class DataUser extends Component {
if (user.date_of_birth) {
const date = user.date_of_birth;
user.date_of_birth = moment(date).isValid() ? moment(date).format('DD MMMM') : '';
user.date_of_birth_mm = moment(date).isValid() ? moment(date).format('M') : '';
user.date_of_birth_dd = moment(date).isValid() ? moment(date).format('D') : '';
user.date_of_birth_unix = moment(date).isValid() ? moment(moment(date).format('MM-DD-2000')).toDate() : '';
}
return { ...user };
});
if(showUserD){
tmp_users = orderBy(tmp_users, ['date_of_birth_dd', 'date_of_birth_mm'], ['asc', 'asc']).filter(_i => _i.date_of_birth_mm >= moment().format('M') && _i.date_of_birth_dd >= moment().format('D'))
tmp_users = orderBy(tmp_users, ['date_of_birth_unix'], ['asc']).filter(_i => _i.date_of_birth_unix >= moment(moment().format('MM-DD-2000')).toDate())
}

4
src/containers/Layout/topbar/TopbarNotification/index.jsx

@ -115,10 +115,10 @@ class TopbarNotification extends PureComponent { @@ -115,10 +115,10 @@ class TopbarNotification extends PureComponent {
if(notification.type == 'date_of_birth'){
return <div className="topbar__collapse-item" key={notification.id}>
<div className="topbar__collapse-img-wrap" style={{borderRadius: 0}}>
<img src={'/img/6776819471549346311.svg'} style={{objectFit: 'cover'}} alt="" />
<img src={'/img/date_d.png'} style={{objectFit: 'cover'}} alt="" />
</div>
<p onClick={this.clickNotification.bind(this, notification)} className="topbar__collapse-message" style={{color: false ? '#c6c3c6' : '#646777'}}>
{notification.message}
Сьогодні день народження у: <span className="topbar__collapse-name">{notification.data && notification.data.name || ''} </span>
{/* {moment(notification.created_at).format('DD-MM-YYYY')} */}
</p>
<p className="topbar__collapse-date">{moment(notification.created_at).format('DD-MM-YYYY')}</p>

Loading…
Cancel
Save