Less obstrusive "New posts"

This commit is contained in:
Lim Chee Aun 2023-01-03 00:52:16 +08:00
parent 72e3d96675
commit dbf9c22ea5

View file

@ -246,27 +246,30 @@ function Home({ hidden }) {
</a>
</div>
</header>
{snapStates.homeNew.length > 0 && (
<button
class="updates-button"
type="button"
onClick={() => {
const uniqueHomeNew = snapStates.homeNew.filter(
(status) => !states.home.some((s) => s.id === status.id),
);
states.home.unshift(...uniqueHomeNew);
loadStatuses(true);
states.homeNew = [];
{snapStates.homeNew.length > 0 &&
scrollDirection === 'up' &&
!nearReachTop &&
!nearReachBottom && (
<button
class="updates-button"
type="button"
onClick={() => {
const uniqueHomeNew = snapStates.homeNew.filter(
(status) => !states.home.some((s) => s.id === status.id),
);
states.home.unshift(...uniqueHomeNew);
loadStatuses(true);
states.homeNew = [];
scrollableRef.current?.scrollTo({
top: 0,
behavior: 'smooth',
});
}}
>
<Icon icon="arrow-up" /> New posts
</button>
)}
scrollableRef.current?.scrollTo({
top: 0,
behavior: 'smooth',
});
}}
>
<Icon icon="arrow-up" /> New posts
</button>
)}
{snapStates.home.length ? (
<>
<ul class="timeline">