fix: 🐛

This commit is contained in:
codytseng 2025-05-16 23:35:12 +08:00
parent fa5e198b8a
commit 4b09276943
4 changed files with 122 additions and 82 deletions

View file

@ -31,7 +31,8 @@ export default function NoteList({
className,
filterMutedNotes = true,
needCheckAlgoRelay = false,
isMainFeed = false
isMainFeed = false,
topSpace = 0
}: {
relayUrls?: string[]
filter?: Filter
@ -40,6 +41,7 @@ export default function NoteList({
filterMutedNotes?: boolean
needCheckAlgoRelay?: boolean
isMainFeed?: boolean
topSpace?: number
}) {
const { t } = useTranslation()
const { isLargeScreen } = useScreenSize()
@ -315,6 +317,7 @@ export default function NoteList({
topRef.current?.scrollIntoView({ behavior: 'smooth', block: 'start' })
}, 0)
}}
threshold={Math.max(800, topSpace)}
/>
{filteredNewEvents.length > 0 && (
<NewNotesButton newEvents={filteredNewEvents} onClick={showNewEvents} />

View file

@ -26,7 +26,7 @@ export default function ScrollToTopButton({
return (
<div
className={cn(
`fixed sm:sticky z-20 flex justify-end w-full pr-3 pointer-events-none transition-opacity duration-700 ${visible ? '' : 'opacity-0'}`,
`fixed sm:sticky z-30 flex justify-end w-full pr-3 pointer-events-none transition-opacity duration-700 ${visible ? '' : 'opacity-0'}`,
className
)}
style={{

View file

@ -12,12 +12,14 @@ export default function TabSwitcher({
tabs,
value,
className,
onTabChange
onTabChange,
threshold = 800
}: {
tabs: TabDefinition[]
value: string
className?: string
onTabChange?: (tab: string) => void
threshold?: number
}) {
const { t } = useTranslation()
const { deepBrowsing, lastScrollTop } = useDeepBrowsing()
@ -27,7 +29,7 @@ export default function TabSwitcher({
<div
className={cn(
'sticky top-12 bg-background z-30 w-full transition-transform',
deepBrowsing && lastScrollTop > 800 ? '-translate-y-[calc(100%+12rem)]' : '',
deepBrowsing && lastScrollTop > threshold ? '-translate-y-[calc(100%+12rem)]' : '',
className
)}
>