From 7a9c777744cd3620e6de0be81f8ff7b28098d239 Mon Sep 17 00:00:00 2001 From: codytseng Date: Thu, 1 Jan 2026 15:19:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=92=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/NormalFeed/index.tsx | 8 +++++++- src/components/Tabs/index.tsx | 8 ++++++-- src/components/TrustScoreFilter/index.tsx | 16 ++++++++++++---- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/components/NormalFeed/index.tsx b/src/components/NormalFeed/index.tsx index 5af6d32..ff9f2e4 100644 --- a/src/components/NormalFeed/index.tsx +++ b/src/components/NormalFeed/index.tsx @@ -35,6 +35,7 @@ export default function NormalFeed({ const showKindsFilter = useMemo(() => { return subRequests.every((req) => !req.filter.kinds?.length) }, [subRequests]) + const [trustFilterOpen, setTrustFilterOpen] = useState(false) const handleListModeChange = (mode: TNoteListMode) => { setListMode(mode) @@ -49,6 +50,10 @@ export default function NormalFeed({ noteListRef.current?.scrollToTop() } + const handleTrustFilterOpenChange = (open: boolean) => { + setTrustFilterOpen(open) + } + return ( <> )} - + {showKindsFilter && ( } + active={trustFilterOpen} />
{listMode === '24h' && !disable24hMode ? ( diff --git a/src/components/Tabs/index.tsx b/src/components/Tabs/index.tsx index fe97537..b139fce 100644 --- a/src/components/Tabs/index.tsx +++ b/src/components/Tabs/index.tsx @@ -14,13 +14,15 @@ export default function Tabs({ value, onTabChange, threshold = 800, - options = null + options = null, + active = false }: { tabs: TabDefinition[] value: string onTabChange?: (tab: string) => void threshold?: number options?: ReactNode + active?: boolean }) { const { t } = useTranslation() const { deepBrowsing, lastScrollTop } = useDeepBrowsing() @@ -88,7 +90,9 @@ export default function Tabs({ ref={containerRef} className={cn( 'sticky flex justify-between top-12 bg-background z-30 px-1 w-full transition-all duration-300 border-b', - deepBrowsing && lastScrollTop > threshold ? '-translate-y-[calc(100%+12rem)]' : '' + deepBrowsing && lastScrollTop > threshold && !active + ? '-translate-y-[calc(100%+12rem)]' + : '' )} > diff --git a/src/components/TrustScoreFilter/index.tsx b/src/components/TrustScoreFilter/index.tsx index ff31e45..5b88f94 100644 --- a/src/components/TrustScoreFilter/index.tsx +++ b/src/components/TrustScoreFilter/index.tsx @@ -27,7 +27,11 @@ function getDescription(score: number, t: (key: string, options?: any) => string } } -export default function TrustScoreFilter() { +export default function TrustScoreFilter({ + onOpenChange +}: { + onOpenChange?: (open: boolean) => void +}) { const { t } = useTranslation() const { isSmallScreen } = useScreenSize() const { minTrustScore, updateMinTrustScore } = useUserTrust() @@ -63,6 +67,12 @@ export default function TrustScoreFilter() { } }, []) + useEffect(() => { + if (onOpenChange) { + onOpenChange(open) + } + }, [open, onOpenChange]) + const description = getDescription(temporaryScore, t) const trigger = ( @@ -76,9 +86,7 @@ export default function TrustScoreFilter() { : 'text-primary hover:text-primary-hover' )} onClick={() => { - if (isSmallScreen) { - setOpen(true) - } + setOpen(true) }} > {minTrustScore < 100 ? : }