import debounce from 'lodash/debounce'; import React, { useEffect } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { fetchScheduledStatuses, expandScheduledStatuses } from 'soapbox/actions/scheduled-statuses'; import ScrollableList from 'soapbox/components/scrollable-list'; import { useAppSelector, useAppDispatch } from 'soapbox/hooks'; import Column from '../ui/components/column'; import ScheduledStatus from './components/scheduled-status'; const messages = defineMessages({ heading: { id: 'column.scheduled_statuses', defaultMessage: 'Scheduled Posts' }, }); const handleLoadMore = debounce((dispatch) => { dispatch(expandScheduledStatuses()); }, 300, { leading: true }); const ScheduledStatuses = () => { const intl = useIntl(); const dispatch = useAppDispatch(); const statusIds = useAppSelector((state) => state.status_lists.get('scheduled_statuses')!.items); const isLoading = useAppSelector((state) => state.status_lists.get('scheduled_statuses')!.isLoading); const hasMore = useAppSelector((state) => !!state.status_lists.get('scheduled_statuses')!.next); useEffect(() => { dispatch(fetchScheduledStatuses()); }, []); const emptyMessage = ; return ( handleLoadMore(dispatch)} emptyMessage={emptyMessage} > {statusIds.map((id: string) => )} ); }; export default ScheduledStatuses;