about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaweł Ngei <github@alxd.org>2018-12-05 05:08:43 +0100
committerEugen Rochko <eugen@zeonfederated.com>2018-12-05 05:08:43 +0100
commit9897cf0701d1fb588f9b0defcbd78d0a2095230a (patch)
tree98f555051b39ea84771f859ad6c4da619b8672c7
parente88c6a5c3c188731f7784141b8835c410163cbeb (diff)
Add visible dates for notifications in Notification column (#9423)
* add RelativeTimestamp elements

* style the elements properly with CSS
-rw-r--r--app/javascript/mastodon/features/notifications/components/notification.js11
-rw-r--r--app/javascript/styles/mastodon/components.scss7
2 files changed, 16 insertions, 2 deletions
diff --git a/app/javascript/mastodon/features/notifications/components/notification.js b/app/javascript/mastodon/features/notifications/components/notification.js
index 8df6830c5..e79bd1a3c 100644
--- a/app/javascript/mastodon/features/notifications/components/notification.js
+++ b/app/javascript/mastodon/features/notifications/components/notification.js
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
 import ImmutablePropTypes from 'react-immutable-proptypes';
 import StatusContainer from '../../../containers/status_container';
 import AccountContainer from '../../../containers/account_container';
+import RelativeTimestamp from '../../../components/relative_timestamp';
 import { injectIntl, FormattedMessage } from 'react-intl';
 import Permalink from '../../../components/permalink';
 import ImmutablePureComponent from 'react-immutable-pure-component';
@@ -87,9 +88,11 @@ class Notification extends ImmutablePureComponent {
             </div>
             <span title={notification.get('created_at')}>
               <FormattedMessage id='notification.follow' defaultMessage='{name} followed you' values={{ name: link }} />
+              <span className='notification__relative_time'>
+                <RelativeTimestamp timestamp={notification.get('created_at')} />
+              </span>
             </span>
           </div>
-
           <AccountContainer id={account.get('id')} withNote={false} hidden={this.props.hidden} />
         </div>
       </HotKeys>
@@ -120,6 +123,9 @@ class Notification extends ImmutablePureComponent {
               <i className='fa fa-fw fa-star star-icon' />
             </div>
             <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>
 
           <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' />
             </div>
             <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>
 
           <StatusContainer id={notification.get('status')} account={notification.get('account')} muted withDismiss hidden={this.props.hidden} />
diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss
index 5765829a4..b2e9bd1df 100644
--- a/app/javascript/styles/mastodon/components.scss
+++ b/app/javascript/styles/mastodon/components.scss
@@ -1489,6 +1489,7 @@ a.account__display-name {
   cursor: default;
   color: $darker-text-color;
   font-size: 15px;
+  line-height: 22px;
   position: relative;
 
   .fa {
@@ -1496,7 +1497,7 @@ a.account__display-name {
   }
 
   > span {
-    display: block;
+    display: inline;
     overflow: hidden;
     text-overflow: ellipsis;
   }
@@ -1526,6 +1527,10 @@ a.account__display-name {
   }
 }
 
+.notification__relative_time {
+  float: right;
+}
+
 .display-name {
   display: block;
   max-width: 100%;