From bdb6b421a9a08807e64222aa5a5fad59d1f11676 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Mon, 27 Oct 2025 11:58:08 +0100 Subject: [PATCH] get rid of secondary panel completely --- src/PageManager.tsx | 325 +++++++----------- .../BottomNavigationBar/SearchButton.tsx | 17 + .../BottomNavigationBar/WriteButton.tsx | 26 ++ src/components/BottomNavigationBar/index.tsx | 4 + src/components/ReplyNoteList/index.tsx | 52 ++- src/components/Sidebar/SettingsButton.tsx | 6 +- src/pages/primary/NoteListPage/index.tsx | 52 +-- src/pages/primary/SearchPage/index.tsx | 10 +- .../secondary/FollowingListPage/index.tsx | 3 +- .../secondary/GeneralSettingsPage/index.tsx | 18 +- src/pages/secondary/HomePage/index.tsx | 13 +- src/pages/secondary/MuteListPage/index.tsx | 3 +- src/pages/secondary/NotePage/index.tsx | 41 ++- .../OthersRelaySettingsPage/index.tsx | 3 +- src/pages/secondary/SearchPage/index.tsx | 17 +- src/providers/UserPreferencesProvider.tsx | 35 +- 16 files changed, 282 insertions(+), 343 deletions(-) create mode 100644 src/components/BottomNavigationBar/SearchButton.tsx create mode 100644 src/components/BottomNavigationBar/WriteButton.tsx diff --git a/src/PageManager.tsx b/src/PageManager.tsx index e7a33c4..7af1aa4 100644 --- a/src/PageManager.tsx +++ b/src/PageManager.tsx @@ -4,21 +4,22 @@ import { cn } from '@/lib/utils' import logger from '@/lib/logger' import { ChevronLeft } from 'lucide-react' import NoteListPage from '@/pages/primary/NoteListPage' -import HomePage from '@/pages/secondary/HomePage' -import NotePage from '@/pages/secondary/NotePage' +// Page imports needed for primary note view import SettingsPage from '@/pages/secondary/SettingsPage' import RelaySettingsPage from '@/pages/secondary/RelaySettingsPage' import WalletPage from '@/pages/secondary/WalletPage' import PostSettingsPage from '@/pages/secondary/PostSettingsPage' import GeneralSettingsPage from '@/pages/secondary/GeneralSettingsPage' import TranslationPage from '@/pages/secondary/TranslationPage' +import NotePage from '@/pages/secondary/NotePage' import SecondaryProfilePage from '@/pages/secondary/ProfilePage' import FollowingListPage from '@/pages/secondary/FollowingListPage' import MuteListPage from '@/pages/secondary/MuteListPage' import OthersRelaySettingsPage from '@/pages/secondary/OthersRelaySettingsPage' +import SecondaryRelayPage from '@/pages/secondary/RelayPage' import { CurrentRelaysProvider } from '@/providers/CurrentRelaysProvider' import { NotificationProvider } from '@/providers/NotificationProvider' -import { useUserPreferences } from '@/providers/UserPreferencesProvider' +// DEPRECATED: useUserPreferences removed - double-panel functionality disabled import { TPageRef } from '@/types' import { cloneElement, @@ -94,8 +95,8 @@ const PrimaryPageContext = createContext(undefi const SecondaryPageContext = createContext(undefined) const PrimaryNoteViewContext = createContext<{ - setPrimaryNoteView: (view: ReactNode | null, type?: 'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag') => void - primaryViewType: 'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag' | null + setPrimaryNoteView: (view: ReactNode | null, type?: 'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag' | 'relay') => void + primaryViewType: 'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag' | 'relay' | null } | undefined>(undefined) export function usePrimaryPage() { @@ -122,239 +123,188 @@ export function usePrimaryNoteView() { return context } -// Custom hook for intelligent note navigation +// Fixed: Note navigation now uses primary note view since secondary panel is disabled export function useSmartNoteNavigation() { - const { showRecommendedRelaysPanel } = useUserPreferences() - const { push: pushSecondary } = useSecondaryPage() const { setPrimaryNoteView } = usePrimaryNoteView() const navigateToNote = (url: string) => { - if (!showRecommendedRelaysPanel) { - // When right panel is hidden, show note in primary area - // Extract note ID from URL (e.g., "/notes/note1..." -> "note1...") - const noteId = url.replace('/notes/', '') - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'note') - } else { - // Normal behavior - use secondary navigation - pushSecondary(url) - } + // Use primary note view to show notes since secondary panel is disabled + // Extract note ID from URL (e.g., "/notes/note1..." -> "note1...") + const noteId = url.replace('/notes/', '') + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'note') } return { navigateToNote } } -// Custom hook for intelligent relay navigation +// Fixed: Relay navigation now uses primary note view since secondary panel is disabled export function useSmartRelayNavigation() { - const { showRecommendedRelaysPanel } = useUserPreferences() - const { push: pushSecondary } = useSecondaryPage() - const { navigate: navigatePrimary } = usePrimaryPage() + const { setPrimaryNoteView } = usePrimaryNoteView() const navigateToRelay = (url: string) => { - if (!showRecommendedRelaysPanel) { - // When right panel is hidden, navigate to relay page in primary area - // Extract relay URL from the path (e.g., "/relays/wss%3A%2F%2F..." -> "wss://...") - const relayUrl = url.startsWith('/relays/') ? decodeURIComponent(url.replace('/relays/', '')) : url - navigatePrimary('relay', { url: relayUrl }) - } else { - // Normal behavior - use secondary navigation - pushSecondary(url) - } + // Use primary note view to show relay pages since secondary panel is disabled + // Extract relay URL from the URL (e.g., "/relays/wss://..." -> "wss://...") + const relayUrl = url.replace('/relays/', '') + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'relay') } return { navigateToRelay } } -// Custom hook for intelligent profile navigation +// Fixed: Profile navigation now uses primary note view since secondary panel is disabled export function useSmartProfileNavigation() { - const { showRecommendedRelaysPanel } = useUserPreferences() - const { push: pushSecondary } = useSecondaryPage() const { setPrimaryNoteView } = usePrimaryNoteView() const navigateToProfile = (url: string) => { - if (showRecommendedRelaysPanel) { - // Secondary panel is available - show profile in secondary panel - pushSecondary(url) - } else { - // Secondary panel is not available - show profile in primary panel - const profileId = url.replace('/users/', '') - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'profile') - } + // Use primary note view to show profiles since secondary panel is disabled + const profileId = url.replace('/users/', '') + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'profile') } return { navigateToProfile } } -// Custom hook for intelligent hashtag navigation +// Fixed: Hashtag navigation now uses primary note view since secondary panel is disabled export function useSmartHashtagNavigation() { - const { showRecommendedRelaysPanel } = useUserPreferences() - const { push: pushSecondary } = useSecondaryPage() const { setPrimaryNoteView } = usePrimaryNoteView() const navigateToHashtag = (url: string) => { - if (!showRecommendedRelaysPanel) { - // When right panel is hidden, show hashtag feed in primary area - // Extract hashtag from URL (e.g., "/notes?t=hashtag" -> "hashtag") - const urlObj = new URL(url, window.location.origin) - const hashtag = urlObj.searchParams.get('t') - if (hashtag) { - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'hashtag') - } - } else { - // Normal behavior - use secondary navigation - pushSecondary(url) - } + // Use primary note view to show hashtag feed since secondary panel is disabled + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'hashtag') } return { navigateToHashtag } } -// Custom hook for intelligent following list navigation +// Fixed: Following list navigation now uses primary note view since secondary panel is disabled export function useSmartFollowingListNavigation() { - const { showRecommendedRelaysPanel } = useUserPreferences() - const { push: pushSecondary } = useSecondaryPage() const { setPrimaryNoteView } = usePrimaryNoteView() const navigateToFollowingList = (url: string) => { - if (!showRecommendedRelaysPanel) { - // When right panel is hidden, show following list in primary area - // Extract profile ID from URL (e.g., "/users/npub1.../following" -> "npub1...") - const profileId = url.replace('/users/', '').replace('/following', '') - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'profile') - } else { - // Normal behavior - use secondary navigation - pushSecondary(url) - } + // Use primary note view to show following list since secondary panel is disabled + const profileId = url.replace('/users/', '').replace('/following', '') + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'profile') } return { navigateToFollowingList } } -// Custom hook for intelligent mute list navigation +// Fixed: Mute list navigation now uses primary note view since secondary panel is disabled export function useSmartMuteListNavigation() { - const { showRecommendedRelaysPanel } = useUserPreferences() - const { push: pushSecondary } = useSecondaryPage() const { setPrimaryNoteView } = usePrimaryNoteView() const navigateToMuteList = (url: string) => { - if (!showRecommendedRelaysPanel) { - // When right panel is hidden, show mute list in primary area - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'settings') - } else { - // Normal behavior - use secondary navigation - pushSecondary(url) - } + // Use primary note view to show mute list since secondary panel is disabled + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'settings') } return { navigateToMuteList } } -// Custom hook for intelligent others relay settings navigation +// Fixed: Others relay settings navigation now uses primary note view since secondary panel is disabled export function useSmartOthersRelaySettingsNavigation() { - const { showRecommendedRelaysPanel } = useUserPreferences() - const { push: pushSecondary } = useSecondaryPage() const { setPrimaryNoteView } = usePrimaryNoteView() const navigateToOthersRelaySettings = (url: string) => { - if (!showRecommendedRelaysPanel) { - // When right panel is hidden, show others relay settings in primary area - // Extract profile ID from URL (e.g., "/users/npub1.../relays" -> "npub1...") - const profileId = url.replace('/users/', '').replace('/relays', '') - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'profile') - } else { - // Normal behavior - use secondary navigation - pushSecondary(url) - } + // Use primary note view to show others relay settings since secondary panel is disabled + const profileId = url.replace('/users/', '').replace('/relays', '') + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'profile') } return { navigateToOthersRelaySettings } } -// Custom hook for intelligent settings navigation +// Fixed: Settings navigation now uses primary note view since secondary panel is disabled export function useSmartSettingsNavigation() { - const { showRecommendedRelaysPanel } = useUserPreferences() - const { push: pushSecondary } = useSecondaryPage() const { setPrimaryNoteView } = usePrimaryNoteView() const navigateToSettings = (url: string) => { - if (!showRecommendedRelaysPanel) { - // When right panel is hidden, show settings page in primary area - if (url === '/settings') { - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'settings') - } else if (url === '/settings/relays') { - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'settings-sub') - } else if (url === '/settings/wallet') { - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'settings-sub') - } else if (url === '/settings/posts') { - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'settings-sub') - } else if (url === '/settings/general') { - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'settings-sub') - } else if (url === '/settings/translation') { - window.history.replaceState(null, '', url) - setPrimaryNoteView(, 'settings-sub') - } - } else { - // Normal behavior - use secondary navigation - pushSecondary(url) + // Use primary note view to show settings since secondary panel is disabled + if (url === '/settings') { + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'settings') + } else if (url === '/settings/relays') { + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'settings-sub') + } else if (url === '/settings/wallet') { + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'settings-sub') + } else if (url === '/settings/posts') { + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'settings-sub') + } else if (url === '/settings/general') { + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'settings-sub') + } else if (url === '/settings/translation') { + window.history.replaceState(null, '', url) + setPrimaryNoteView(, 'settings-sub') } } return { navigateToSettings } } -function ConditionalHomePage() { - const { showRecommendedRelaysPanel } = useUserPreferences() - - if (!showRecommendedRelaysPanel) { - return null +// DEPRECATED: ConditionalHomePage removed - double-panel functionality disabled + +// Helper function to get page title based on view type and URL +function getPageTitle(viewType: 'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag' | 'relay' | null, pathname: string): string { + if (viewType === 'settings') return 'Settings' + if (viewType === 'settings-sub') { + if (pathname.includes('/general')) return 'General Settings' + if (pathname.includes('/relays')) return 'Relay Settings' + if (pathname.includes('/wallet')) return 'Wallet Settings' + if (pathname.includes('/posts')) return 'Post Settings' + if (pathname.includes('/translation')) return 'Translation Settings' + return 'Settings' } - - return + if (viewType === 'profile') { + if (pathname.includes('/following')) return 'Following' + if (pathname.includes('/relays')) return 'Relay Settings' + return 'Profile' + } + if (viewType === 'hashtag') return 'Hashtag' + if (viewType === 'relay') return 'Relay' + if (viewType === 'note') { + // For now, return a generic "Note" - this could be enhanced to detect specific types + // by fetching the event and checking its kind + return 'Note' + } + return 'Page' } +// DEPRECATED: Double-panel functionality removed - simplified to single column layout function MainContentArea({ primaryPages, currentPrimaryPage, - secondaryStack, primaryNoteView, primaryViewType, setPrimaryNoteView }: { primaryPages: { name: TPrimaryPageName; element: ReactNode; props?: any }[] currentPrimaryPage: TPrimaryPageName - secondaryStack: { index: number; component: ReactNode }[] primaryNoteView: ReactNode | null - primaryViewType: 'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag' | null - setPrimaryNoteView: (view: ReactNode | null, type?: 'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag') => void + primaryViewType: 'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag' | 'relay' | null + setPrimaryNoteView: (view: ReactNode | null, type?: 'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag' | 'relay') => void }) { - const { showRecommendedRelaysPanel } = useUserPreferences() - logger.debug('MainContentArea rendering:', { currentPrimaryPage, primaryPages: primaryPages.map(p => p.name), - showRecommendedRelaysPanel, primaryNoteView: !!primaryNoteView }) - // If recommended relays panel is shown, use two-column layout - // Otherwise use single column layout - const gridClass = showRecommendedRelaysPanel ? "grid-cols-2" : "grid-cols-1" - + // Always use single column layout since double-panel is disabled return ( -
+
- {!showRecommendedRelaysPanel && primaryNoteView ? ( - // Show note view with back button when right panel is hidden + {primaryNoteView ? ( + // Show note view with back button
@@ -362,18 +312,30 @@ function MainContentArea({ className="flex gap-1 items-center w-fit max-w-full justify-start pl-2 pr-3" variant="ghost" size="titlebar-icon" - title="Back to feed" - onClick={() => setPrimaryNoteView(null)} + title="Back" + onClick={() => { + if (primaryViewType === 'settings-sub') { + // For settings sub-pages, navigate back to main settings page + window.history.replaceState(null, '', '/settings') + setPrimaryNoteView(, 'settings') + } else { + // For other pages, go back to feed + setPrimaryNoteView(null) + } + }} >
- {primaryViewType === 'settings' ? 'Settings' : - primaryViewType === 'settings-sub' ? 'Settings' : - primaryViewType === 'profile' ? 'Back' : - primaryViewType === 'hashtag' ? 'Hashtag' : 'Note'} + Back
+
+
+ {getPageTitle(primaryViewType, window.location.pathname)} +
+
+
{primaryNoteView} @@ -406,33 +368,14 @@ function MainContentArea({ }) )}
- {showRecommendedRelaysPanel && ( -
- {secondaryStack.map((item, index) => ( -
- {item.component} -
- ))} -
- -
-
- )} + {/* DEPRECATED: Secondary panel removed - double-panel functionality disabled */}
) } export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { const { isSmallScreen } = useScreenSize() - const { showRecommendedRelaysPanel } = useUserPreferences() + // DEPRECATED: showRecommendedRelaysPanel removed - double-panel functionality disabled const [currentPrimaryPage, setCurrentPrimaryPage] = useState('home') const [primaryPages, setPrimaryPages] = useState< { name: TPrimaryPageName; element: ReactNode; props?: any }[] @@ -444,10 +387,10 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { ]) const [secondaryStack, setSecondaryStack] = useState([]) const [primaryNoteView, setPrimaryNoteViewState] = useState(null) - const [primaryViewType, setPrimaryViewType] = useState<'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag' | null>(null) + const [primaryViewType, setPrimaryViewType] = useState<'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag' | 'relay' | null>(null) const [savedPrimaryPage, setSavedPrimaryPage] = useState(null) - const setPrimaryNoteView = (view: ReactNode | null, type?: 'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag') => { + const setPrimaryNoteView = (view: ReactNode | null, type?: 'note' | 'settings' | 'settings-sub' | 'profile' | 'hashtag' | 'relay') => { if (view && !primaryNoteView) { // Saving current primary page before showing overlay setSavedPrimaryPage(currentPrimaryPage) @@ -486,26 +429,21 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { if (window.location.pathname !== '/') { const url = window.location.pathname + window.location.search + window.location.hash - // If the side panel is off and we're on a settings page, don't add to secondary stack - // The settings navigation will handle it via primary view - if (!showRecommendedRelaysPanel && window.location.pathname.startsWith('/settings')) { - // Skip secondary stack handling for settings when side panel is off - } else { - setSecondaryStack((prevStack) => { - if (isCurrentPage(prevStack, url)) return prevStack - - const { newStack, newItem } = pushNewPageToStack( - prevStack, - url, - maxStackSize, - window.history.state?.index - ) - if (newItem) { - window.history.replaceState({ index: newItem.index, url }, '', url) - } - return newStack - }) - } + // DEPRECATED: Double-panel logic removed - always add to secondary stack + setSecondaryStack((prevStack) => { + if (isCurrentPage(prevStack, url)) return prevStack + + const { newStack, newItem } = pushNewPageToStack( + prevStack, + url, + maxStackSize, + window.history.state?.index + ) + if (newItem) { + window.history.replaceState({ index: newItem.index, url }, '', url) + } + return newStack + }) } else { const searchParams = new URLSearchParams(window.location.search) const r = searchParams.get('r') @@ -769,7 +707,6 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { navigate('search')} + > + + + ) +} diff --git a/src/components/BottomNavigationBar/WriteButton.tsx b/src/components/BottomNavigationBar/WriteButton.tsx new file mode 100644 index 0000000..2c1590e --- /dev/null +++ b/src/components/BottomNavigationBar/WriteButton.tsx @@ -0,0 +1,26 @@ +import PostEditor from '@/components/PostEditor' +import { useNostr } from '@/providers/NostrProvider' +import { PencilLine } from 'lucide-react' +import { useState } from 'react' +import BottomNavigationBarItem from './BottomNavigationBarItem' + +export default function WriteButton() { + const { checkLogin } = useNostr() + const [open, setOpen] = useState(false) + + return ( + <> + { + e.stopPropagation() + checkLogin(() => { + setOpen(true) + }) + }} + > + + + + + ) +} diff --git a/src/components/BottomNavigationBar/index.tsx b/src/components/BottomNavigationBar/index.tsx index 1b509ff..caf7999 100644 --- a/src/components/BottomNavigationBar/index.tsx +++ b/src/components/BottomNavigationBar/index.tsx @@ -2,6 +2,8 @@ import { cn } from '@/lib/utils' import HomeButton from './HomeButton' import NotificationsButton from './NotificationsButton' import DiscussionsButton from './DiscussionsButton' +import SearchButton from './SearchButton' +import WriteButton from './WriteButton' export default function BottomNavigationBar() { return ( @@ -14,8 +16,10 @@ export default function BottomNavigationBar() { paddingBottom: 'env(safe-area-inset-bottom)' }} > + +
) diff --git a/src/components/ReplyNoteList/index.tsx b/src/components/ReplyNoteList/index.tsx index 41da39f..1850ea8 100644 --- a/src/components/ReplyNoteList/index.tsx +++ b/src/components/ReplyNoteList/index.tsx @@ -20,7 +20,7 @@ import { useNostr } from '@/providers/NostrProvider' import { useReply } from '@/providers/ReplyProvider' import { useFeed } from '@/providers/FeedProvider' import { useUserTrust } from '@/providers/UserTrustProvider' -import { useUserPreferences } from '@/providers/UserPreferencesProvider' +// DEPRECATED: useUserPreferences removed - double-panel functionality disabled import client from '@/services/client.service' import noteStatsService from '@/services/note-stats.service' import { Filter, Event as NEvent, kinds } from 'nostr-tools' @@ -47,7 +47,7 @@ function ReplyNoteList({ index: _index, event, sort = 'oldest' }: { index?: numb const { hideContentMentioningMutedUsers } = useContentPolicy() const { relayList: userRelayList } = useNostr() const { relayUrls: currentFeedRelays } = useFeed() - const { showRecommendedRelaysPanel } = useUserPreferences() + // DEPRECATED: showRecommendedRelaysPanel removed - double-panel functionality disabled const [rootInfo, setRootInfo] = useState(undefined) const { repliesMap, addReplies } = useReply() @@ -561,7 +561,6 @@ function ReplyNoteList({ index: _index, event, sort = 'oldest' }: { index?: numb logger.debug('[ReplyNoteList] onClickParent called:', { parentEventHexId: parentEventHexId?.substring(0, 8), parentEventId: parentEventId?.substring(0, 8), - showRecommendedRelaysPanel, repliesCount: replies.length, parentInReplies: !replies.every((r) => r.id !== parentEventHexId) }) @@ -578,37 +577,28 @@ function ReplyNoteList({ index: _index, event, sort = 'oldest' }: { index?: numb return } - // If parent is not in current replies, we need to fetch it - // In single-panel mode, we should expand the thread to show the parent - // rather than navigating away from the current thread - if (!showRecommendedRelaysPanel) { - // Single-panel mode: fetch and add the parent to the thread - // This will expand the current thread to show the parent - logger.debug('[ReplyNoteList] Single-panel mode: fetching parent event') - const fetchAndAddParent = async () => { - try { - logger.debug('[ReplyNoteList] Fetching parent event:', parentEventId ?? parentEventHexId) - const parentEvent = await client.fetchEvent(parentEventId ?? parentEventHexId) - if (parentEvent) { - logger.debug('[ReplyNoteList] Parent event fetched, adding to replies:', parentEvent.id.substring(0, 8)) - addReplies([parentEvent]) - // Highlight the parent after it's added - setTimeout(() => highlightReply(parentEvent.id), 100) - } else { - logger.debug('[ReplyNoteList] Parent event not found') - } - } catch (error) { - logger.debug('[ReplyNoteList] Failed to fetch parent event:', error) - // Fallback to navigation if fetch fails - navigateToNote(toNote(parentEventId ?? parentEventHexId)) + // DEPRECATED: Double-panel logic removed - always expand thread to show parent + // Fetch and add the parent to the thread to expand the current thread + logger.debug('[ReplyNoteList] Fetching parent event to expand thread') + const fetchAndAddParent = async () => { + try { + logger.debug('[ReplyNoteList] Fetching parent event:', parentEventId ?? parentEventHexId) + const parentEvent = await client.fetchEvent(parentEventId ?? parentEventHexId) + if (parentEvent) { + logger.debug('[ReplyNoteList] Parent event fetched, adding to replies:', parentEvent.id.substring(0, 8)) + addReplies([parentEvent]) + // Highlight the parent after it's added + setTimeout(() => highlightReply(parentEvent.id), 100) + } else { + logger.debug('[ReplyNoteList] Parent event not found') } + } catch (error) { + logger.debug('[ReplyNoteList] Failed to fetch parent event:', error) + // Fallback to navigation if fetch fails + navigateToNote(toNote(parentEventId ?? parentEventHexId)) } - fetchAndAddParent() - } else { - // Double-panel mode: navigate to parent in secondary panel - logger.debug('[ReplyNoteList] Double-panel mode: navigating to parent') - navigateToNote(toNote(parentEventId ?? parentEventHexId)) } + fetchAndAddParent() }} highlight={highlightReplyId === reply.id} /> diff --git a/src/components/Sidebar/SettingsButton.tsx b/src/components/Sidebar/SettingsButton.tsx index 7b134a8..7a87510 100644 --- a/src/components/Sidebar/SettingsButton.tsx +++ b/src/components/Sidebar/SettingsButton.tsx @@ -1,13 +1,13 @@ import { toSettings } from '@/lib/link' import { useSmartSettingsNavigation, usePrimaryNoteView } from '@/PageManager' -import { useUserPreferences } from '@/providers/UserPreferencesProvider' +// DEPRECATED: useUserPreferences removed - double-panel functionality disabled import { Settings } from 'lucide-react' import SidebarItem from './SidebarItem' export default function SettingsButton() { const { navigateToSettings } = useSmartSettingsNavigation() const { primaryViewType } = usePrimaryNoteView() - const { showRecommendedRelaysPanel } = useUserPreferences() + // DEPRECATED: showRecommendedRelaysPanel removed - double-panel functionality disabled // Settings is active when: // 1. primaryViewType is 'settings' or 'settings-sub' (when side panel is off) @@ -16,7 +16,7 @@ export default function SettingsButton() { const isActive = primaryViewType === 'settings' || primaryViewType === 'settings-sub' || - (showRecommendedRelaysPanel && url.startsWith('/settings')) + url.startsWith('/settings') return ( navigateToSettings(toSettings())} active={isActive}> diff --git a/src/pages/primary/NoteListPage/index.tsx b/src/pages/primary/NoteListPage/index.tsx index d98b947..e69204e 100644 --- a/src/pages/primary/NoteListPage/index.tsx +++ b/src/pages/primary/NoteListPage/index.tsx @@ -1,16 +1,14 @@ -import { useSecondaryPage } from '@/PageManager' +import { usePrimaryPage } from '@/PageManager' import BookmarkList from '@/components/BookmarkList' -import PostEditor from '@/components/PostEditor' import RelayInfo from '@/components/RelayInfo' import { Button } from '@/components/ui/button' import PrimaryPageLayout from '@/layouts/PrimaryPageLayout' -import { toSearch } from '@/lib/link' import { useCurrentRelays } from '@/providers/CurrentRelaysProvider' import { useFeed } from '@/providers/FeedProvider' import { useNostr } from '@/providers/NostrProvider' import { useScreenSize } from '@/providers/ScreenSizeProvider' import { TPageRef } from '@/types' -import { Info, PencilLine, Search } from 'lucide-react' +import { Info } from 'lucide-react' import { Dispatch, forwardRef, @@ -129,6 +127,7 @@ function NoteListPageTitlebar({ setShowRelayDetails?: Dispatch> }) { const { isSmallScreen } = useScreenSize() + const { navigate } = usePrimaryPage() return (
@@ -138,9 +137,12 @@ function NoteListPageTitlebar({
{isSmallScreen && (
-
+
+
)}
@@ -161,47 +163,9 @@ function NoteListPageTitlebar({ )} - {isSmallScreen && ( - <> - - - - )}
) } -function PostButton() { - const { checkLogin } = useNostr() - const [open, setOpen] = useState(false) - - return ( - <> - - - - ) -} - -function SearchButton() { - const { push } = useSecondaryPage() - - return ( - - ) -} diff --git a/src/pages/primary/SearchPage/index.tsx b/src/pages/primary/SearchPage/index.tsx index d60c6d8..521ac56 100644 --- a/src/pages/primary/SearchPage/index.tsx +++ b/src/pages/primary/SearchPage/index.tsx @@ -39,12 +39,14 @@ const SearchPage = forwardRef((_, ref) => { - } displayScrollToTopButton > - +
+
Search Nostr
+ +
+ +
) }) diff --git a/src/pages/secondary/FollowingListPage/index.tsx b/src/pages/secondary/FollowingListPage/index.tsx index e218efb..481807a 100644 --- a/src/pages/secondary/FollowingListPage/index.tsx +++ b/src/pages/secondary/FollowingListPage/index.tsx @@ -4,7 +4,7 @@ import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' import { forwardRef } from 'react' import { useTranslation } from 'react-i18next' -const FollowingListPage = forwardRef(({ id, index }: { id?: string; index?: number }, ref) => { +const FollowingListPage = forwardRef(({ id, index, hideTitlebar = false }: { id?: string; index?: number; hideTitlebar?: boolean }, ref) => { const { t } = useTranslation() const { profile } = useFetchProfile(id) const { followings } = useFetchFollowings(profile?.pubkey) @@ -18,6 +18,7 @@ const FollowingListPage = forwardRef(({ id, index }: { id?: string; index?: numb ? t("username's following", { username: profile.username }) : t('Following') } + hideBackButton={hideTitlebar} displayScrollToTopButton > diff --git a/src/pages/secondary/GeneralSettingsPage/index.tsx b/src/pages/secondary/GeneralSettingsPage/index.tsx index 1004131..6449816 100644 --- a/src/pages/secondary/GeneralSettingsPage/index.tsx +++ b/src/pages/secondary/GeneralSettingsPage/index.tsx @@ -32,7 +32,7 @@ const GeneralSettingsPage = forwardRef(({ index, hideTitlebar = false }: { index setMediaAutoLoadPolicy } = useContentPolicy() const { hideUntrustedNotes, updateHideUntrustedNotes } = useUserTrust() - const { notificationListStyle, updateNotificationListStyle, showRecommendedRelaysPanel, updateShowRecommendedRelaysPanel } = useUserPreferences() + const { notificationListStyle, updateNotificationListStyle } = useUserPreferences() const handleLanguageChange = (value: TLanguage) => { i18n.changeLanguage(value) @@ -153,21 +153,7 @@ const GeneralSettingsPage = forwardRef(({ index, hideTitlebar = false }: { index - {!isSmallScreen && ( - - - - - )} + {/* DEPRECATED: Double-panel setting removed for technical debt reduction */} } controls={ - + // DEPRECATED: Close button removed - double-panel functionality disabled + null } hideBackButton hideTitlebarBottomBorder diff --git a/src/pages/secondary/MuteListPage/index.tsx b/src/pages/secondary/MuteListPage/index.tsx index a3a1594..388b0f9 100644 --- a/src/pages/secondary/MuteListPage/index.tsx +++ b/src/pages/secondary/MuteListPage/index.tsx @@ -12,7 +12,7 @@ import { forwardRef, useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import NotFoundPage from '../NotFoundPage' -const MuteListPage = forwardRef(({ index }: { index?: number }, ref) => { +const MuteListPage = forwardRef(({ index, hideTitlebar = false }: { index?: number; hideTitlebar?: boolean }, ref) => { const { t } = useTranslation() const { profile, pubkey } = useNostr() const { getMutePubkeys } = useMuteList() @@ -61,6 +61,7 @@ const MuteListPage = forwardRef(({ index }: { index?: number }, ref) => { ref={ref} index={index} title={t("username's muted", { username: profile.username })} + hideBackButton={hideTitlebar} displayScrollToTopButton >
diff --git a/src/pages/secondary/NotePage/index.tsx b/src/pages/secondary/NotePage/index.tsx index be1a62a..cd311eb 100644 --- a/src/pages/secondary/NotePage/index.tsx +++ b/src/pages/secondary/NotePage/index.tsx @@ -1,4 +1,5 @@ import { useSecondaryPage } from '@/PageManager' +import { ExtendedKind } from '@/constants' import ContentPreview from '@/components/ContentPreview' import Note from '@/components/Note' import NoteInteractions from '@/components/NoteInteractions' @@ -7,7 +8,6 @@ import UserAvatar from '@/components/UserAvatar' import { Card } from '@/components/ui/card' import { Separator } from '@/components/ui/separator' import { Skeleton } from '@/components/ui/skeleton' -import { ExtendedKind } from '@/constants' import { useFetchEvent } from '@/hooks' import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' import { getParentBech32Id, getParentETag, getRootBech32Id } from '@/lib/event' @@ -70,8 +70,45 @@ const NotePage = forwardRef(({ id, index, hideTitlebar = false }: { id?: string; ) } + const getNoteTypeTitle = (kind: number): string => { + switch (kind) { + case 1: // kinds.ShortTextNote + return 'Note: Text Post' + case 30023: // kinds.LongFormArticle + return 'Note: Longform Article' + case 20: // ExtendedKind.PICTURE + return 'Note: Picture' + case 21: // ExtendedKind.VIDEO + return 'Note: Video' + case 22: // ExtendedKind.SHORT_VIDEO + return 'Note: Short Video' + case 11: // ExtendedKind.DISCUSSION + return 'Note: Discussion Thread' + case 9802: // kinds.Highlights + return 'Note: Highlight' + case 1068: // ExtendedKind.POLL + return 'Note: Poll' + case 31987: // ExtendedKind.RELAY_REVIEW + return 'Note: Relay Review' + case 9735: // ExtendedKind.ZAP_RECEIPT + return 'Note: Zap Receipt' + case 6: // kinds.Repost + return 'Note: Repost' + case 7: // kinds.Reaction + return 'Note: Reaction' + case 1111: // ExtendedKind.COMMENT + return 'Note: Comment' + case 1222: // ExtendedKind.VOICE + return 'Note: Voice Post' + case 1244: // ExtendedKind.VOICE_COMMENT + return 'Note: Voice Comment' + default: + return 'Note' + } + } + return ( - +
{rootITag && } {rootEventId && rootEventId !== parentEventId && ( diff --git a/src/pages/secondary/OthersRelaySettingsPage/index.tsx b/src/pages/secondary/OthersRelaySettingsPage/index.tsx index ae4d1ac..31a8eca 100644 --- a/src/pages/secondary/OthersRelaySettingsPage/index.tsx +++ b/src/pages/secondary/OthersRelaySettingsPage/index.tsx @@ -4,7 +4,7 @@ import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' import { forwardRef } from 'react' import { useTranslation } from 'react-i18next' -const RelaySettingsPage = forwardRef(({ id, index }: { id?: string; index?: number }, ref) => { +const RelaySettingsPage = forwardRef(({ id, index, hideTitlebar = false }: { id?: string; index?: number; hideTitlebar?: boolean }, ref) => { const { t } = useTranslation() const { profile } = useFetchProfile(id) @@ -17,6 +17,7 @@ const RelaySettingsPage = forwardRef(({ id, index }: { id?: string; index?: numb ref={ref} index={index} title={t("username's used relays", { username: profile.username })} + hideBackButton={hideTitlebar} >
diff --git a/src/pages/secondary/SearchPage/index.tsx b/src/pages/secondary/SearchPage/index.tsx index d2ae053..b5951dc 100644 --- a/src/pages/secondary/SearchPage/index.tsx +++ b/src/pages/secondary/SearchPage/index.tsx @@ -50,17 +50,16 @@ const SearchPage = forwardRef(({ index, hideTitlebar = false }: { index?: number ref={ref} index={index} title={hideTitlebar ? undefined : "Search"} - titlebar={hideTitlebar ? undefined : ( -
- - -
- )} + hideBackButton={hideTitlebar} displayScrollToTopButton > - +
+
Search Nostr
+ +
+
Trending Notes
+ +
) }) diff --git a/src/providers/UserPreferencesProvider.tsx b/src/providers/UserPreferencesProvider.tsx index 44f8ebe..d8957ee 100644 --- a/src/providers/UserPreferencesProvider.tsx +++ b/src/providers/UserPreferencesProvider.tsx @@ -1,6 +1,6 @@ import storage from '@/services/local-storage.service' import { TNotificationStyle } from '@/types' -import { createContext, useContext, useEffect, useState } from 'react' +import { createContext, useContext, useState } from 'react' type TUserPreferencesContext = { notificationListStyle: TNotificationStyle @@ -23,39 +23,20 @@ export function UserPreferencesProvider({ children }: { children: React.ReactNod const [notificationListStyle, setNotificationListStyle] = useState( storage.getNotificationListStyle() ) - const [showRecommendedRelaysPanel, setShowRecommendedRelaysPanel] = useState( - storage.getShowRecommendedRelaysPanel() - ) + // DEPRECATED: Double-panel functionality removed for technical debt reduction + // Keeping for backward compatibility in case we miss any references + const [showRecommendedRelaysPanel] = useState(false) - // Force showRecommendedRelaysPanel to true on mobile - useEffect(() => { - const handleResize = () => { - const isMobile = window.innerWidth <= 768 - if (isMobile && !showRecommendedRelaysPanel) { - setShowRecommendedRelaysPanel(true) - storage.setShowRecommendedRelaysPanel(true) - } - } - - // Check on mount and on resize - handleResize() - window.addEventListener('resize', handleResize) - return () => window.removeEventListener('resize', handleResize) - }, [showRecommendedRelaysPanel]) + // DEPRECATED: Mobile panel forcing removed - double-panel functionality disabled const updateNotificationListStyle = (style: TNotificationStyle) => { setNotificationListStyle(style) storage.setNotificationListStyle(style) } - const updateShowRecommendedRelaysPanel = (show: boolean) => { - // Don't allow turning off the panel on mobile - const isMobile = window.innerWidth <= 768 - if (isMobile && !show) { - return - } - setShowRecommendedRelaysPanel(show) - storage.setShowRecommendedRelaysPanel(show) + // DEPRECATED: Double-panel functionality disabled - always returns false + const updateShowRecommendedRelaysPanel = (_show: boolean) => { + // No-op: double-panel functionality has been removed } return (