import React, { useEffect } from 'react'; import { FormattedMessage } from 'react-intl'; import { useDispatch } from 'react-redux'; import { useParams } from 'react-router-dom'; import { fetchList } from 'soapbox/actions/lists'; import { openModal } from 'soapbox/actions/modals'; import { connectListStream } from 'soapbox/actions/streaming'; import { expandListTimeline } from 'soapbox/actions/timelines'; import MissingIndicator from 'soapbox/components/missing_indicator'; import { Button, Spinner } from 'soapbox/components/ui'; import Column from 'soapbox/features/ui/components/column'; import { useAppSelector } from 'soapbox/hooks'; import StatusListContainer from '../ui/containers/status_list_container'; // const messages = defineMessages({ // deleteHeading: { id: 'confirmations.delete_list.heading', defaultMessage: 'Delete list' }, // deleteMessage: { id: 'confirmations.delete_list.message', defaultMessage: 'Are you sure you want to permanently delete this list?' }, // deleteConfirm: { id: 'confirmations.delete_list.confirm', defaultMessage: 'Delete' }, // }); const ListTimeline: React.FC = () => { const dispatch = useDispatch(); const { id } = useParams<{ id: string }>(); // const intl = useIntl(); // const history = useHistory(); const list = useAppSelector((state) => state.lists.get(id)); // const hasUnread = useAppSelector((state) => state.timelines.getIn([`list:${props.params.id}`, 'unread']) > 0); useEffect(() => { const disconnect = handleConnect(id); return () => { disconnect(); }; }, [id]); const handleConnect = (id: string) => { dispatch(fetchList(id)); dispatch(expandListTimeline(id)); return dispatch(connectListStream(id)); }; const handleLoadMore = (maxId: string) => { dispatch(expandListTimeline(id, { maxId })); }; const handleEditClick = () => { dispatch(openModal('LIST_EDITOR', { listId: id })); }; // const handleDeleteClick = () => { // dispatch(openModal('CONFIRM', { // icon: require('@tabler/icons/icons/trash.svg'), // heading: intl.formatMessage(messages.deleteHeading), // message: intl.formatMessage(messages.deleteMessage), // confirm: intl.formatMessage(messages.deleteConfirm), // onConfirm: () => { // dispatch(deleteList(id)); // history.push('/lists'); // }, // })); // }; const title = list ? list.get('title') : id; if (typeof list === 'undefined') { return (
); } else if (list === false) { return ( ); } const emptyMessage = (


); return ( {/*

*/}
); }; export default ListTimeline;