Updated Notifications follows tab to be ungrouped list
• Updated: - Notifications for new follows to be ungrouped, in a list when on the "Follows" tab
This commit is contained in:
parent
eedde4a4a7
commit
e37876aa86
@ -15,6 +15,7 @@ import NotificationContainer from '../containers/notification_container'
|
|||||||
import ScrollableList from '../components/scrollable_list'
|
import ScrollableList from '../components/scrollable_list'
|
||||||
import TimelineQueueButtonHeader from '../components/timeline_queue_button_header'
|
import TimelineQueueButtonHeader from '../components/timeline_queue_button_header'
|
||||||
import Block from '../components/block'
|
import Block from '../components/block'
|
||||||
|
import Account from '../components/account'
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = (state) => ({
|
||||||
notifications: state.getIn(['notifications', 'items']),
|
notifications: state.getIn(['notifications', 'items']),
|
||||||
@ -22,6 +23,7 @@ const mapStateToProps = (state) => ({
|
|||||||
isLoading: state.getIn(['notifications', 'isLoading'], true),
|
isLoading: state.getIn(['notifications', 'isLoading'], true),
|
||||||
hasMore: state.getIn(['notifications', 'hasMore']),
|
hasMore: state.getIn(['notifications', 'hasMore']),
|
||||||
totalQueuedNotificationsCount: state.getIn(['notifications', 'totalQueuedNotificationsCount'], 0),
|
totalQueuedNotificationsCount: state.getIn(['notifications', 'totalQueuedNotificationsCount'], 0),
|
||||||
|
selectedFilter: state.getIn(['notifications', 'filter', 'active']),
|
||||||
})
|
})
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
@ -51,6 +53,7 @@ class Notifications extends ImmutablePureComponent {
|
|||||||
onScrollTopNotifications: PropTypes.func.isRequired,
|
onScrollTopNotifications: PropTypes.func.isRequired,
|
||||||
sortedNotifications: ImmutablePropTypes.list.isRequired,
|
sortedNotifications: ImmutablePropTypes.list.isRequired,
|
||||||
totalQueuedNotificationsCount: PropTypes.number,
|
totalQueuedNotificationsCount: PropTypes.number,
|
||||||
|
selectedFilter: PropTypes.string.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@ -101,21 +104,38 @@ class Notifications extends ImmutablePureComponent {
|
|||||||
isLoading,
|
isLoading,
|
||||||
hasMore,
|
hasMore,
|
||||||
totalQueuedNotificationsCount,
|
totalQueuedNotificationsCount,
|
||||||
|
selectedFilter,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
let scrollableContent = null
|
let scrollableContent = null
|
||||||
|
|
||||||
// : todo : include follow requests
|
|
||||||
|
|
||||||
if (isLoading && this.scrollableContent) {
|
if (isLoading && this.scrollableContent) {
|
||||||
scrollableContent = this.scrollableContent
|
scrollableContent = this.scrollableContent
|
||||||
} else if (sortedNotifications.size > 0 || hasMore) {
|
} else if ((sortedNotifications.size > 0 || hasMore) && selectedFilter !== 'follow') {
|
||||||
scrollableContent = sortedNotifications.map((item, index) => (
|
scrollableContent = sortedNotifications.map((item, index) => (
|
||||||
<NotificationContainer
|
<NotificationContainer
|
||||||
key={`notification-${index}`}
|
key={`notification-${index}`}
|
||||||
notification={item}
|
notification={item}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
|
} else if ((sortedNotifications.size > 0 || hasMore) && selectedFilter === 'follow') {
|
||||||
|
const followNotifications = []
|
||||||
|
sortedNotifications.forEach((block) => {
|
||||||
|
block.get('follow').forEach((item) => {
|
||||||
|
followNotifications.push(item)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
scrollableContent = followNotifications.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<Account
|
||||||
|
compact
|
||||||
|
withBio
|
||||||
|
key={`account-${index}`}
|
||||||
|
id={item.get('account')}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.scrollableContent = scrollableContent
|
this.scrollableContent = scrollableContent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user