{
- const baseTabs = [
+ const tabs = useMemo((): TabDefinition[] => {
+ const baseTabs: TabDefinition[] = [
{ value: 'posts', label: 'Notes' },
{ value: 'postsAndReplies', label: 'Replies' }
]
if (showRssFeed) {
- baseTabs.push({ value: 'rss', label: 'RSS' })
+ baseTabs.push({ value: 'rss', label: 'RSS', icon: })
}
return baseTabs
diff --git a/src/components/Sidebar/RssButton.tsx b/src/components/Sidebar/RssButton.tsx
new file mode 100644
index 0000000..d09ac00
--- /dev/null
+++ b/src/components/Sidebar/RssButton.tsx
@@ -0,0 +1,35 @@
+import { usePrimaryPage, usePrimaryNoteView } from '@/PageManager'
+import { Rss } from 'lucide-react'
+import SidebarItem from './SidebarItem'
+import storage from '@/services/local-storage.service'
+
+export default function RssButton() {
+ const { navigate, current, display } = usePrimaryPage()
+ const { primaryViewType } = usePrimaryNoteView()
+ const showRssFeed = storage.getShowRssFeed()
+
+ // RSS is active when on home page and RSS tab would be active
+ // We can't directly check if RSS tab is active, so we'll just check if we're on home
+ const isActive = display && current === 'home' && primaryViewType === null && showRssFeed
+
+ const handleClick = () => {
+ // Navigate to home if not already there
+ if (current !== 'home' || primaryViewType !== null) {
+ navigate('home')
+ // Wait a bit for navigation to complete, then switch to RSS
+ setTimeout(() => {
+ window.dispatchEvent(new CustomEvent('switchToRssFeed'))
+ }, 100)
+ } else {
+ // Already on home, just switch to RSS tab
+ window.dispatchEvent(new CustomEvent('switchToRssFeed'))
+ }
+ }
+
+ return (
+
+
+
+ )
+}
+
diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx
index 760b520..122eaf6 100644
--- a/src/components/Sidebar/index.tsx
+++ b/src/components/Sidebar/index.tsx
@@ -8,11 +8,14 @@ import HomeButton from './HomeButton'
import NotificationsButton from './NotificationButton'
import PostButton from './PostButton'
import ProfileButton from './ProfileButton'
+import RssButton from './RssButton'
import SearchButton from './SearchButton'
import SettingsButton from './SettingsButton'
+import storage from '@/services/local-storage.service'
export default function PrimaryPageSidebar() {
const { isSmallScreen } = useScreenSize()
+ const showRssFeed = storage.getShowRssFeed()
if (isSmallScreen) return null
return (
@@ -33,6 +36,7 @@ export default function PrimaryPageSidebar() {
+ {showRssFeed && }
diff --git a/src/components/Tabs/index.tsx b/src/components/Tabs/index.tsx
index b7be7e0..806732b 100644
--- a/src/components/Tabs/index.tsx
+++ b/src/components/Tabs/index.tsx
@@ -3,9 +3,10 @@ import { useDeepBrowsing } from '@/providers/DeepBrowsingProvider'
import { ReactNode, useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-type TabDefinition = {
+export type TabDefinition = {
value: string
label: string
+ icon?: ReactNode
}
export default function Tabs({
@@ -134,13 +135,14 @@ export default function Tabs({
key={tab.value}
ref={(el) => (tabRefs.current[index] = el)}
className={cn(
- `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`,
+ `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 flex items-center gap-2 justify-center`,
value === tab.value ? '' : 'text-muted-foreground'
)}
onClick={() => {
onTabChange?.(tab.value)
}}
>
+ {tab.icon && {tab.icon}}
{t(tab.label)}
))}
diff --git a/src/pages/primary/NoteListPage/index.tsx b/src/pages/primary/NoteListPage/index.tsx
index b386609..7b7fa14 100644
--- a/src/pages/primary/NoteListPage/index.tsx
+++ b/src/pages/primary/NoteListPage/index.tsx
@@ -1,4 +1,3 @@
-import { usePrimaryNoteView } from '@/PageManager'
import BookmarkList from '@/components/BookmarkList'
import RelayInfo from '@/components/RelayInfo'
import VersionUpdateBanner from '@/components/VersionUpdateBanner'
@@ -9,7 +8,7 @@ import { useFeed } from '@/providers/FeedProvider'
import { useNostr } from '@/providers/NostrProvider'
import { useScreenSize } from '@/providers/ScreenSizeProvider'
import { TPageRef } from '@/types'
-import { Info } from 'lucide-react'
+import { Info, Rss } from 'lucide-react'
import {
Dispatch,
forwardRef,
@@ -26,6 +25,8 @@ import AccountButton from '@/components/Titlebar/AccountButton'
import FollowingFeed from './FollowingFeed'
import RelaysFeed from './RelaysFeed'
import logger from '@/lib/logger'
+import { usePrimaryPage, usePrimaryNoteView } from '@/PageManager'
+import storage from '@/services/local-storage.service'
const NoteListPage = forwardRef((_, ref) => {
logger.debug('NoteListPage component rendering')
@@ -130,6 +131,24 @@ function NoteListPageTitlebar({
}) {
const { isSmallScreen } = useScreenSize()
const { setPrimaryNoteView } = usePrimaryNoteView()
+ const { navigate, current } = usePrimaryPage()
+ const { primaryViewType } = usePrimaryNoteView()
+ const showRssFeed = storage.getShowRssFeed()
+
+ const handleRssClick = (e: React.MouseEvent) => {
+ e.stopPropagation()
+ // Navigate to home if not already there
+ if (current !== 'home' || primaryViewType !== null) {
+ navigate('home')
+ // Wait a bit for navigation to complete, then switch to RSS
+ setTimeout(() => {
+ window.dispatchEvent(new CustomEvent('switchToRssFeed'))
+ }, 100)
+ } else {
+ // Already on home, just switch to RSS tab
+ window.dispatchEvent(new CustomEvent('switchToRssFeed'))
+ }
+ }
return (
@@ -153,6 +172,16 @@ function NoteListPageTitlebar({
)}
+ {isSmallScreen && showRssFeed && (
+
+ )}
{setShowRelayDetails && (