From f823ef4db026657496c0716be5593f6d95cf8ff0 Mon Sep 17 00:00:00 2001 From: codytseng Date: Thu, 27 Feb 2025 22:45:36 +0800 Subject: [PATCH] style: show new button --- src/components/NoteList/index.tsx | 39 ++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/components/NoteList/index.tsx b/src/components/NoteList/index.tsx index 2a04a94..49f7cf9 100644 --- a/src/components/NoteList/index.tsx +++ b/src/components/NoteList/index.tsx @@ -161,6 +161,7 @@ export default function NoteList({ }, [loadMore]) const showNewEvents = () => { + topRef.current?.scrollIntoView({ behavior: 'smooth', block: 'end' }) setEvents((oldEvents) => [...newEvents, ...oldEvents]) setNewEvents([]) } @@ -177,6 +178,13 @@ export default function NoteList({ }} />
+ {events.length > 0 && + newEvents.filter((event: Event) => { + return ( + (!filterMutedNotes || !mutePubkeys.includes(event.pubkey)) && + (listMode !== 'posts' || !isReplyNoteEvent(event)) + ) + }).length > 0 && } { setRefreshCount((count) => count + 1) @@ -185,19 +193,6 @@ export default function NoteList({ pullingContent="" >
- {events.length > 0 && - newEvents.filter((event: Event) => { - return ( - (!filterMutedNotes || !mutePubkeys.includes(event.pubkey)) && - (listMode !== 'posts' || !isReplyNoteEvent(event)) - ) - }).length > 0 && ( -
- -
- )} {isPictures ? ( void }) { + const { t } = useTranslation() + const { deepBrowsing, lastScrollTop } = useDeepBrowsing() + + return ( +
800 ? '-translate-y-10' : '' + )} + > + +
+ ) +} + function ListModeSwitch({ listMode, setListMode