From fb681b2c0e30b7f28d55cf1822291644c84cfc0d Mon Sep 17 00:00:00 2001 From: Silberengel Date: Wed, 12 Nov 2025 09:56:26 +0100 Subject: [PATCH] expand home feed refresh functionality make top bar fully visible on mobile --- .../HideUntrustedContentButton/index.tsx | 2 +- src/components/KindFilter/index.tsx | 8 ++--- src/components/NormalFeed/index.tsx | 34 +++++++++---------- src/components/NoteInteractions/ReplySort.tsx | 18 +++++----- src/components/NoteInteractions/Tabs.tsx | 9 ++--- src/components/NoteInteractions/index.tsx | 4 +-- src/components/RefreshButton/index.tsx | 2 +- src/components/Tabs/index.tsx | 8 ++--- 8 files changed, 42 insertions(+), 43 deletions(-) diff --git a/src/components/HideUntrustedContentButton/index.tsx b/src/components/HideUntrustedContentButton/index.tsx index 99e45cb..4496c88 100644 --- a/src/components/HideUntrustedContentButton/index.tsx +++ b/src/components/HideUntrustedContentButton/index.tsx @@ -40,7 +40,7 @@ export default function HideUntrustedContentButton({ return ( - ) diff --git a/src/components/NormalFeed/index.tsx b/src/components/NormalFeed/index.tsx index 412ff3c..6e8c579 100644 --- a/src/components/NormalFeed/index.tsx +++ b/src/components/NormalFeed/index.tsx @@ -1,7 +1,6 @@ import NoteList, { TNoteListRef } from '@/components/NoteList' import Tabs from '@/components/Tabs' import logger from '@/lib/logger' -import { isTouchDevice } from '@/lib/utils' import { useKindFilter } from '@/providers/KindFilterProvider' import { useUserTrust } from '@/providers/UserTrustProvider' import storage from '@/services/local-storage.service' @@ -38,7 +37,6 @@ const NormalFeed = forwardRef isTouchDevice(), []) const internalNoteListRef = useRef(null) const noteListRef = ref || internalNoteListRef const [showRssFeed, setShowRssFeed] = useState(() => storage.getShowRssFeed()) @@ -117,18 +115,10 @@ const NormalFeed = forwardRef - {!supportTouch && { - if (noteListRef && typeof noteListRef !== 'function') { - noteListRef.current?.refresh() - } - }} />} - - - ) : ( - <> - {!supportTouch && { + <> + { + if (activeTab === 'rss') { + // Refresh RSS feeds // Get feed URLs from event or use default let feedUrls: string[] = DEFAULT_RSS_FEEDS if (pubkey && rssFeedListEvent) { @@ -150,7 +140,7 @@ const NormalFeed = forwardRef { logger.error('[NormalFeed] Manual refresh: background refresh failed', { error: err }) @@ -163,9 +153,17 @@ const NormalFeed = forwardRef prev + 1) - }} />} - - ) + } else { + // Refresh Notes/Replies + if (noteListRef && typeof noteListRef !== 'function') { + noteListRef.current?.refresh() + } + } + }} /> + {activeTab !== 'rss' && ( + + )} + } /> {activeTab === 'rss' ? ( diff --git a/src/components/NoteInteractions/ReplySort.tsx b/src/components/NoteInteractions/ReplySort.tsx index f15f45f..9bb73a0 100644 --- a/src/components/NoteInteractions/ReplySort.tsx +++ b/src/components/NoteInteractions/ReplySort.tsx @@ -21,23 +21,23 @@ export default function ReplySort({ selectedSort, onSortChange }: { selectedSort return ( - - + {sortOptions.map(option => ( onSortChange(option.id)} - className="flex items-center gap-2" + className="flex items-center gap-1.5 text-xs py-0.5 px-1.5 [&_svg]:size-2.5" > - - {option.label} + + {option.label} {option.id === selectedSort && ( - + )} ))} diff --git a/src/components/NoteInteractions/Tabs.tsx b/src/components/NoteInteractions/Tabs.tsx index 082fb9a..7609ce4 100644 --- a/src/components/NoteInteractions/Tabs.tsx +++ b/src/components/NoteInteractions/Tabs.tsx @@ -45,7 +45,8 @@ export function Tabs({ // Calculate the indicator's top position relative to the container // Position it at the bottom of the active tab's row const relativeTop = tabTop - containerTop + offsetHeight - const padding = 32 // 16px padding on each side + // Responsive padding: smaller on mobile, larger on desktop + const padding = window.innerWidth < 640 ? 16 : window.innerWidth < 768 ? 32 : 48 setIndicatorStyle({ width: offsetWidth - padding, @@ -57,14 +58,14 @@ export function Tabs({ }, [selectedTab, visibleTabs]) return ( -
-
+
+
{visibleTabs.map((tab, index) => (
(tabRefs.current[index] = el)} className={cn( - `text-center px-4 py-2 font-semibold whitespace-nowrap clickable cursor-pointer rounded-lg`, + `text-center py-2 px-2 sm:px-4 md:px-6 font-semibold whitespace-nowrap clickable cursor-pointer rounded-lg text-xs sm:text-sm md:text-base shrink-0`, selectedTab === tab.value ? '' : 'text-muted-foreground' )} onClick={() => onTabChange(tab.value)} diff --git a/src/components/NoteInteractions/index.tsx b/src/components/NoteInteractions/index.tsx index ca76a10..5c20ade 100644 --- a/src/components/NoteInteractions/index.tsx +++ b/src/components/NoteInteractions/index.tsx @@ -64,8 +64,8 @@ export default function NoteInteractions({ )} -
- +
+
diff --git a/src/components/RefreshButton/index.tsx b/src/components/RefreshButton/index.tsx index 748920e..556f944 100644 --- a/src/components/RefreshButton/index.tsx +++ b/src/components/RefreshButton/index.tsx @@ -16,7 +16,7 @@ export function RefreshButton({ onClick }: { onClick: () => void }) { onClick() setTimeout(() => setRefreshing(false), 500) }} - className="text-muted-foreground focus:text-foreground [&_svg]:size-4" + className="text-muted-foreground focus:text-foreground [&_svg]:size-3 h-8 px-2 text-xs" > diff --git a/src/components/Tabs/index.tsx b/src/components/Tabs/index.tsx index 2d1aa57..b7be7e0 100644 --- a/src/components/Tabs/index.tsx +++ b/src/components/Tabs/index.tsx @@ -127,14 +127,14 @@ export default function Tabs({ deepBrowsing && lastScrollTop > threshold ? '-translate-y-[calc(100%+12rem)]' : '' )} > -
-
+
+
{tabs.map((tab, index) => (
(tabRefs.current[index] = el)} className={cn( - `text-center py-2 px-6 font-semibold whitespace-nowrap clickable cursor-pointer rounded-lg`, + `text-center py-2 px-2 sm:px-4 md:px-6 font-semibold whitespace-nowrap clickable cursor-pointer rounded-lg text-xs sm:text-sm md:text-base shrink-0`, value === tab.value ? '' : 'text-muted-foreground' )} onClick={() => { @@ -154,7 +154,7 @@ export default function Tabs({ />
- {options &&
{options}
} + {options &&
{options}
}
) }