diff --git a/src/components/BottomNavigationBar/index.tsx b/src/components/BottomNavigationBar/index.tsx index 2fdb298..5c16b13 100644 --- a/src/components/BottomNavigationBar/index.tsx +++ b/src/components/BottomNavigationBar/index.tsx @@ -8,7 +8,7 @@ export default function BottomNavigationBar({ visible = true }: { visible?: bool return (
- -
+
+ +
{hostname}
{title}
diff --git a/src/layouts/PrimaryPageLayout/index.tsx b/src/layouts/PrimaryPageLayout/index.tsx index d1da3e9..9136ea1 100644 --- a/src/layouts/PrimaryPageLayout/index.tsx +++ b/src/layouts/PrimaryPageLayout/index.tsx @@ -53,6 +53,17 @@ const PrimaryPageLayout = forwardRef( if (current !== pageName) return const handleScroll = () => { + const atBottom = isSmallScreen + ? window.innerHeight + window.scrollY >= document.body.offsetHeight - 20 + : scrollAreaRef.current + ? scrollAreaRef.current?.clientHeight + scrollAreaRef.current?.scrollTop >= + scrollAreaRef.current?.scrollHeight - 20 + : false + if (atBottom) { + setVisible(true) + return + } + const scrollTop = (isSmallScreen ? window.scrollY : scrollAreaRef.current?.scrollTop) || 0 const diff = scrollTop - lastScrollTop if (scrollTop <= 800) { @@ -99,7 +110,7 @@ const PrimaryPageLayout = forwardRef( {displayScrollToTopButton && ( 500} + visible={visible && lastScrollTop > 800} /> )} {isSmallScreen && } diff --git a/src/layouts/SecondaryPageLayout/index.tsx b/src/layouts/SecondaryPageLayout/index.tsx index 83f1b73..f2b5dea 100644 --- a/src/layouts/SecondaryPageLayout/index.tsx +++ b/src/layouts/SecondaryPageLayout/index.tsx @@ -39,9 +39,20 @@ export default function SecondaryPageLayout({ if (currentIndex !== index) return const handleScroll = () => { + const atBottom = isSmallScreen + ? window.innerHeight + window.scrollY >= document.body.offsetHeight - 20 + : scrollAreaRef.current + ? scrollAreaRef.current?.clientHeight + scrollAreaRef.current?.scrollTop >= + scrollAreaRef.current?.scrollHeight - 20 + : false + if (atBottom) { + setVisible(true) + return + } + const scrollTop = (isSmallScreen ? window.scrollY : scrollAreaRef.current?.scrollTop) || 0 const diff = scrollTop - lastScrollTop - if (scrollTop <= 100) { + if (scrollTop <= 800) { setVisible(true) setLastScrollTop(scrollTop) return @@ -75,7 +86,7 @@ export default function SecondaryPageLayout({ scrollBarClassName="sm:z-50" ref={scrollAreaRef} style={{ - paddingBottom: isSmallScreen ? 'env(safe-area-inset-bottom) + 3rem)' : '' + paddingBottom: isSmallScreen ? 'calc(env(safe-area-inset-bottom) + 3rem)' : '' }} >
{children}
{displayScrollToTopButton && ( - 500} /> + 800} /> )} {isSmallScreen && } diff --git a/src/pages/secondary/NoteListPage/index.tsx b/src/pages/secondary/NoteListPage/index.tsx index 450e39f..807b635 100644 --- a/src/pages/secondary/NoteListPage/index.tsx +++ b/src/pages/secondary/NoteListPage/index.tsx @@ -1,4 +1,5 @@ import NoteList from '@/components/NoteList' +import { SEARCHABLE_RELAY_URLS } from '@/constants' import { useSearchParams } from '@/hooks' import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' import { isWebsocketUrl, simplifyUrl } from '@/lib/url' @@ -27,7 +28,14 @@ export default function NoteListPage({ index }: { index?: number }) { } const search = searchParams.get('s') if (search) { - return { title: `${t('Search')}: ${search}`, filter: { search }, urls: searchableRelayUrls } + return { + title: `${t('Search')}: ${search}`, + filter: { search }, + urls: + searchableRelayUrls.length < 4 + ? searchableRelayUrls.concat(SEARCHABLE_RELAY_URLS).slice(0, 4) + : searchableRelayUrls + } } const relayUrl = searchParams.get('relay') if (relayUrl && isWebsocketUrl(relayUrl)) { @@ -38,7 +46,7 @@ export default function NoteListPage({ index }: { index?: number }) { if (filter?.search && searchableRelayUrls.length === 0) { return ( - +
{t('The relays you are connected to do not support search')}
@@ -47,7 +55,7 @@ export default function NoteListPage({ index }: { index?: number }) { } return ( - + ) diff --git a/src/pages/secondary/NotePage/index.tsx b/src/pages/secondary/NotePage/index.tsx index 825489b..8efb285 100644 --- a/src/pages/secondary/NotePage/index.tsx +++ b/src/pages/secondary/NotePage/index.tsx @@ -22,7 +22,7 @@ export default function NotePage({ id, index }: { id?: string; index?: number }) if (!event && isFetching) { return ( - +
@@ -32,7 +32,7 @@ export default function NotePage({ id, index }: { id?: string; index?: number }) if (!event) return return ( - +