import React, { useEffect } from 'react'; import { FormattedMessage } from 'react-intl'; import { useParams } from 'react-router-dom'; import { fetchList } from 'soapbox/actions/lists'; import { openModal } from 'soapbox/actions/modals'; import { expandListTimeline } from 'soapbox/actions/timelines'; import { useListStream } from 'soapbox/api/hooks'; import MissingIndicator from 'soapbox/components/missing-indicator'; import { Column, Button, Spinner } from 'soapbox/components/ui'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import Timeline from '../ui/components/timeline'; const ListTimeline: React.FC = () => { const dispatch = useAppDispatch(); const { id } = useParams<{ id: string }>(); const list = useAppSelector((state) => state.lists.get(id)); const next = useAppSelector(state => state.timelines.get(`list:${id}`)?.next); useListStream(id); useEffect(() => { dispatch(fetchList(id)); dispatch(expandListTimeline(id)); }, [id]); const handleLoadMore = (maxId: string) => { dispatch(expandListTimeline(id, { url: next, maxId })); }; const handleEditClick = () => { dispatch(openModal('LIST_EDITOR', { listId: id })); }; const title = list ? list.title : id; if (typeof list === 'undefined') { return (
); } else if (list === false) { return ( ); } const emptyMessage = (


); return ( ); }; export default ListTimeline;