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

View File

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