Add visible dates for notifications in Notification column (#9423)

* add RelativeTimestamp elements

* style the elements properly with CSS
This commit is contained in:
Paweł Ngei 2018-12-05 05:08:43 +01:00 committed by Eugen Rochko
parent e88c6a5c3c
commit 9897cf0701
2 changed files with 16 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import StatusContainer from '../../../containers/status_container'; import StatusContainer from '../../../containers/status_container';
import AccountContainer from '../../../containers/account_container'; import AccountContainer from '../../../containers/account_container';
import RelativeTimestamp from '../../../components/relative_timestamp';
import { injectIntl, FormattedMessage } from 'react-intl'; import { injectIntl, FormattedMessage } from 'react-intl';
import Permalink from '../../../components/permalink'; import Permalink from '../../../components/permalink';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
@ -87,9 +88,11 @@ class Notification extends ImmutablePureComponent {
</div> </div>
<span title={notification.get('created_at')}> <span title={notification.get('created_at')}>
<FormattedMessage id='notification.follow' defaultMessage='{name} followed you' values={{ name: link }} /> <FormattedMessage id='notification.follow' defaultMessage='{name} followed you' values={{ name: link }} />
<span className='notification__relative_time'>
<RelativeTimestamp timestamp={notification.get('created_at')} />
</span>
</span> </span>
</div> </div>
<AccountContainer id={account.get('id')} withNote={false} hidden={this.props.hidden} /> <AccountContainer id={account.get('id')} withNote={false} hidden={this.props.hidden} />
</div> </div>
</HotKeys> </HotKeys>
@ -120,6 +123,9 @@ class Notification extends ImmutablePureComponent {
<i className='fa fa-fw fa-star star-icon' /> <i className='fa fa-fw fa-star star-icon' />
</div> </div>
<FormattedMessage id='notification.favourite' defaultMessage='{name} favourited your status' values={{ name: link }} /> <FormattedMessage id='notification.favourite' defaultMessage='{name} favourited your status' values={{ name: link }} />
<span className='notification__relative_time'>
<RelativeTimestamp className='notification__relative_time' timestamp={notification.get('created_at')} />
</span>
</div> </div>
<StatusContainer id={notification.get('status')} account={notification.get('account')} muted withDismiss hidden={!!this.props.hidden} /> <StatusContainer id={notification.get('status')} account={notification.get('account')} muted withDismiss hidden={!!this.props.hidden} />
@ -139,6 +145,9 @@ class Notification extends ImmutablePureComponent {
<i className='fa fa-fw fa-retweet' /> <i className='fa fa-fw fa-retweet' />
</div> </div>
<FormattedMessage id='notification.reblog' defaultMessage='{name} boosted your status' values={{ name: link }} /> <FormattedMessage id='notification.reblog' defaultMessage='{name} boosted your status' values={{ name: link }} />
<span className='notification__relative_time'>
<RelativeTimestamp className='notification__relative_time' timestamp={notification.get('created_at')} />
</span>
</div> </div>
<StatusContainer id={notification.get('status')} account={notification.get('account')} muted withDismiss hidden={this.props.hidden} /> <StatusContainer id={notification.get('status')} account={notification.get('account')} muted withDismiss hidden={this.props.hidden} />

View File

@ -1489,6 +1489,7 @@ a.account__display-name {
cursor: default; cursor: default;
color: $darker-text-color; color: $darker-text-color;
font-size: 15px; font-size: 15px;
line-height: 22px;
position: relative; position: relative;
.fa { .fa {
@ -1496,7 +1497,7 @@ a.account__display-name {
} }
> span { > span {
display: block; display: inline;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
@ -1526,6 +1527,10 @@ a.account__display-name {
} }
} }
.notification__relative_time {
float: right;
}
.display-name { .display-name {
display: block; display: block;
max-width: 100%; max-width: 100%;