Updated Notification timestamp to link to status/mention/comment

• Updated:
- Notification timestamp to link to status/mention/comment
This commit is contained in:
Developer 2021-02-25 10:40:52 -05:00
parent 0c1d84262f
commit 444263a8b2
2 changed files with 16 additions and 6 deletions

View File

@ -17,6 +17,7 @@ import Text from './text'
import DotTextSeperator from './dot_text_seperator'
import RelativeTimestamp from './relative_timestamp'
import DisplayName from './display_name'
import Dummy from './dummy'
class Notification extends ImmutablePureComponent {
@ -30,13 +31,14 @@ class Notification extends ImmutablePureComponent {
accounts,
createdAt,
type,
statusId,
status,
isHidden,
isUnread,
isDeckConnected,
} = this.props
const count = !!accounts ? accounts.size : 0
const statusId = !!status ? status.get('id') : undefined
let message
let icon
@ -91,6 +93,9 @@ class Notification extends ImmutablePureComponent {
)
}
const DateWrapperContainer = !!status ? NavLink : Dummy
const statusUrl = !!status ? status.get('uri') : '/'
const containerClasses = CX({
d: 1,
px10: !isDeckConnected,
@ -146,9 +151,14 @@ class Notification extends ImmutablePureComponent {
!!createdAt &&
<React.Fragment>
<DotTextSeperator />
<DateWrapperContainer
to={statusUrl}
className={[_s.noUnderline, _s.text].join(' ')}
>
<Text size='small' color='tertiary' className={_s.ml5}>
<RelativeTimestamp timestamp={createdAt} />
</Text>
</DateWrapperContainer>
</React.Fragment>
}
</div>

View File

@ -63,7 +63,7 @@ const makeMapStateToProps = () => {
accounts: accounts,
createdAt: lastUpdated,
isUnread: isUnread,
statusId: list.get('status'),
status: state.getIn(['statuses', list.get('status')], null),
isDeckConnected,
}
} else if (!isGrouped) {
@ -76,7 +76,7 @@ const makeMapStateToProps = () => {
accounts: !!account ? ImmutableList([account]) : ImmutableList(),
createdAt: notification.get('created_at'),
isUnread: lastReadId < notification.get('id'),
statusId: statusId || undefined,
status: state.getIn(['statuses', statusId], null),
isDeckConnected,
}
}