mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-21 13:19:22 +01:00
Less obstrusive "New posts"
This commit is contained in:
parent
72e3d96675
commit
dbf9c22ea5
1 changed files with 23 additions and 20 deletions
|
@ -246,27 +246,30 @@ function Home({ hidden }) {
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
{snapStates.homeNew.length > 0 && (
|
{snapStates.homeNew.length > 0 &&
|
||||||
<button
|
scrollDirection === 'up' &&
|
||||||
class="updates-button"
|
!nearReachTop &&
|
||||||
type="button"
|
!nearReachBottom && (
|
||||||
onClick={() => {
|
<button
|
||||||
const uniqueHomeNew = snapStates.homeNew.filter(
|
class="updates-button"
|
||||||
(status) => !states.home.some((s) => s.id === status.id),
|
type="button"
|
||||||
);
|
onClick={() => {
|
||||||
states.home.unshift(...uniqueHomeNew);
|
const uniqueHomeNew = snapStates.homeNew.filter(
|
||||||
loadStatuses(true);
|
(status) => !states.home.some((s) => s.id === status.id),
|
||||||
states.homeNew = [];
|
);
|
||||||
|
states.home.unshift(...uniqueHomeNew);
|
||||||
|
loadStatuses(true);
|
||||||
|
states.homeNew = [];
|
||||||
|
|
||||||
scrollableRef.current?.scrollTo({
|
scrollableRef.current?.scrollTo({
|
||||||
top: 0,
|
top: 0,
|
||||||
behavior: 'smooth',
|
behavior: 'smooth',
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon icon="arrow-up" /> New posts
|
<Icon icon="arrow-up" /> New posts
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{snapStates.home.length ? (
|
{snapStates.home.length ? (
|
||||||
<>
|
<>
|
||||||
<ul class="timeline">
|
<ul class="timeline">
|
||||||
|
|
Loading…
Reference in a new issue