diff --git a/app/soapbox/features/notifications/index.js b/app/soapbox/features/notifications/index.js index 05fed79a7..168a013f8 100644 --- a/app/soapbox/features/notifications/index.js +++ b/app/soapbox/features/notifications/index.js @@ -1,3 +1,4 @@ +import classNames from 'classnames'; import { List as ImmutableList } from 'immutable'; import { debounce } from 'lodash'; import PropTypes from 'prop-types'; @@ -5,11 +6,9 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; -import { Virtuoso } from 'react-virtuoso'; import { createSelector } from 'reselect'; import { getSettings } from 'soapbox/actions/settings'; -import PullToRefresh from 'soapbox/components/pull-to-refresh'; import PlaceholderNotification from 'soapbox/features/placeholder/components/placeholder_notification'; import { @@ -17,8 +16,9 @@ import { scrollTopNotifications, dequeueNotifications, } from '../../actions/notifications'; +import ScrollableList from '../../components/scrollable_list'; import TimelineQueueButtonHeader from '../../components/timeline_queue_button_header'; -import { Column, Text } from '../../components/ui'; +import { Column } from '../../components/ui'; import FilterBarContainer from './containers/filter_bar_container'; import NotificationContainer from './containers/notification_container'; @@ -28,16 +28,6 @@ const messages = defineMessages({ queue: { id: 'notifications.queue_label', defaultMessage: 'Click to see {count} new {count, plural, one {notification} other {notifications}}' }, }); -const Footer = ({ context }) => ( - context.hasMore ? ( - - ) : null -); - -const Item = ({ context, ...rest }) => ( -
-); - const getNotifications = createSelector([ state => getSettings(state).getIn(['notifications', 'quickFilter', 'show']), state => getSettings(state).getIn(['notifications', 'quickFilter', 'active']), @@ -157,44 +147,49 @@ class Notifications extends React.PureComponent { const { intl, notifications, isLoading, hasMore, showFilterBar, totalQueuedNotificationsCount } = this.props; const emptyMessage = ; + let scrollableContent = null; + const filterBarContainer = showFilterBar ? () : null; - const showLoading = isLoading && !notifications || notifications.isEmpty(); - - const scrollContainer = ( - - isScrolling && this.handleScroll()} - itemContent={(_index, notification) => ( - showLoading ? ( - - ) : ( - - ) - )} - context={{ - hasMore, - }} - components={{ - ScrollSeekPlaceholder: PlaceholderNotification, - Footer, - EmptyPlaceholder: () => {emptyMessage}, - Item, - }} + if (isLoading && this.scrollableContent) { + scrollableContent = this.scrollableContent; + } else if (notifications.size > 0 || hasMore) { + scrollableContent = notifications.map((item, index) => ( + - + )); + } else { + scrollableContent = null; + } + + this.scrollableContent = scrollableContent; + + const scrollContainer = ( + 0, + 'space-y-2': notifications.size === 0, + })} + > + {scrollableContent} + ); return (