2023-02-03 16:08:08 +03:00
|
|
|
import { useRef } from 'preact/hooks';
|
|
|
|
import { useSnapshot } from 'valtio';
|
|
|
|
|
|
|
|
import Timeline from '../components/timeline';
|
2023-02-05 19:17:19 +03:00
|
|
|
import { api } from '../utils/api';
|
2023-02-05 20:10:49 +03:00
|
|
|
import states from '../utils/states';
|
2023-02-03 16:08:08 +03:00
|
|
|
import useTitle from '../utils/useTitle';
|
|
|
|
|
|
|
|
const LIMIT = 20;
|
|
|
|
|
|
|
|
function Following() {
|
|
|
|
useTitle('Following', '/l/f');
|
2023-02-05 19:17:19 +03:00
|
|
|
const { masto } = api();
|
2023-02-03 16:08:08 +03:00
|
|
|
const snapStates = useSnapshot(states);
|
|
|
|
const homeIterator = useRef();
|
|
|
|
async function fetchHome(firstLoad) {
|
|
|
|
if (firstLoad || !homeIterator.current) {
|
|
|
|
homeIterator.current = masto.v1.timelines.listHome({ limit: LIMIT });
|
|
|
|
}
|
|
|
|
return await homeIterator.current.next();
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Timeline
|
|
|
|
title="Following"
|
|
|
|
id="following"
|
|
|
|
emptyText="Nothing to see here."
|
|
|
|
errorText="Unable to load posts."
|
|
|
|
fetchItems={fetchHome}
|
|
|
|
boostsCarousel={snapStates.settings.boostsCarousel}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Following;
|