|
|
|
@ -605,18 +605,8 @@ export function useSmartRelayNavigation() { |
|
|
|
// Build contextual URL based on current page
|
|
|
|
// Build contextual URL based on current page
|
|
|
|
const contextualUrl = buildRelayUrl(relayUrl, currentPrimaryPage) |
|
|
|
const contextualUrl = buildRelayUrl(relayUrl, currentPrimaryPage) |
|
|
|
|
|
|
|
|
|
|
|
if (isSmallScreen) { |
|
|
|
|
|
|
|
// Use primary note view on mobile
|
|
|
|
|
|
|
|
window.history.pushState(null, '', contextualUrl) |
|
|
|
|
|
|
|
setPrimaryNoteView( |
|
|
|
|
|
|
|
suspensePrimaryPage(<SecondaryRelayPageLazy url={relayUrl} index={0} hideTitlebar={true} />), |
|
|
|
|
|
|
|
'relay' |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// Desktop: always use secondary routing (will be rendered in drawer in single-pane, side panel in double-pane)
|
|
|
|
|
|
|
|
pushSecondaryPage(contextualUrl) |
|
|
|
pushSecondaryPage(contextualUrl) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return { navigateToRelay } |
|
|
|
return { navigateToRelay } |
|
|
|
} |
|
|
|
} |
|
|
|
@ -642,16 +632,8 @@ export function useSmartRelayNavigationOptional() { |
|
|
|
url.match(/\/relays\/(.+)$/) |
|
|
|
url.match(/\/relays\/(.+)$/) |
|
|
|
const relayUrl = relayUrlMatch ? decodeURIComponent(relayUrlMatch[relayUrlMatch.length - 1]) : decodeURIComponent(url.replace(/.*\/relays\//, '')) |
|
|
|
const relayUrl = relayUrlMatch ? decodeURIComponent(relayUrlMatch[relayUrlMatch.length - 1]) : decodeURIComponent(url.replace(/.*\/relays\//, '')) |
|
|
|
const contextualUrl = buildRelayUrl(relayUrl, currentPrimaryPage) |
|
|
|
const contextualUrl = buildRelayUrl(relayUrl, currentPrimaryPage) |
|
|
|
if (isSmallScreen) { |
|
|
|
|
|
|
|
window.history.pushState(null, '', contextualUrl) |
|
|
|
|
|
|
|
setPrimaryNoteView( |
|
|
|
|
|
|
|
suspensePrimaryPage(<SecondaryRelayPageLazy url={relayUrl} index={0} hideTitlebar={true} />), |
|
|
|
|
|
|
|
'relay' |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
pushSecondaryPage(contextualUrl) |
|
|
|
pushSecondaryPage(contextualUrl) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return { navigateToRelay } |
|
|
|
return { navigateToRelay } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1242,6 +1224,8 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { |
|
|
|
// Drawer handlers
|
|
|
|
// Drawer handlers
|
|
|
|
const [drawerInitialEvent, setDrawerInitialEvent] = useState<Event | null>(null) |
|
|
|
const [drawerInitialEvent, setDrawerInitialEvent] = useState<Event | null>(null) |
|
|
|
const openDrawer = useCallback((noteId: string, initialEvent?: Event) => { |
|
|
|
const openDrawer = useCallback((noteId: string, initialEvent?: Event) => { |
|
|
|
|
|
|
|
noteStatsService.setBackgroundStatsPaused(true) |
|
|
|
|
|
|
|
client.interruptBackgroundQueries() |
|
|
|
setDrawerNoteId(noteId) |
|
|
|
setDrawerNoteId(noteId) |
|
|
|
setDrawerInitialEvent(initialEvent ?? null) |
|
|
|
setDrawerInitialEvent(initialEvent ?? null) |
|
|
|
setDrawerOpen(true) |
|
|
|
setDrawerOpen(true) |
|
|
|
@ -1990,6 +1974,10 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { |
|
|
|
const navigatePrimaryPageStable = useEventCallback(navigatePrimaryPage) |
|
|
|
const navigatePrimaryPageStable = useEventCallback(navigatePrimaryPage) |
|
|
|
|
|
|
|
|
|
|
|
const goBack = () => { |
|
|
|
const goBack = () => { |
|
|
|
|
|
|
|
if (primaryViewType === 'relay') { |
|
|
|
|
|
|
|
setPrimaryNoteView(null) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
if (primaryViewType === 'settings-sub') { |
|
|
|
if (primaryViewType === 'settings-sub') { |
|
|
|
navigatePrimaryPage('settings') |
|
|
|
navigatePrimaryPage('settings') |
|
|
|
return |
|
|
|
return |
|
|
|
@ -2050,6 +2038,9 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { |
|
|
|
} |
|
|
|
} |
|
|
|
recentSecondaryPushRef.current = { url, at: now } |
|
|
|
recentSecondaryPushRef.current = { url, at: now } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
noteStatsService.setBackgroundStatsPaused(true) |
|
|
|
|
|
|
|
client.interruptBackgroundQueries() |
|
|
|
|
|
|
|
|
|
|
|
// Small screens render either the primary overlay OR the secondary stack — not both.
|
|
|
|
// Small screens render either the primary overlay OR the secondary stack — not both.
|
|
|
|
// Clear overlays (e.g. full-screen note) so pushes from Seen-on, settings deep links, etc. show the target page.
|
|
|
|
// Clear overlays (e.g. full-screen note) so pushes from Seen-on, settings deep links, etc. show the target page.
|
|
|
|
if (isSmallScreen && primaryNoteView) { |
|
|
|
if (isSmallScreen && primaryNoteView) { |
|
|
|
@ -2282,8 +2273,10 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { |
|
|
|
setSinglePaneSheetOpen(shouldBeOpen) |
|
|
|
setSinglePaneSheetOpen(shouldBeOpen) |
|
|
|
}, [panelMode, isSmallScreen, secondaryStack.length, drawerOpen]) |
|
|
|
}, [panelMode, isSmallScreen, secondaryStack.length, drawerOpen]) |
|
|
|
|
|
|
|
|
|
|
|
const primaryFrozen = |
|
|
|
const primaryObscured = |
|
|
|
secondaryStack.length > 0 && (isSmallScreen || panelMode === 'double') |
|
|
|
secondaryStack.length > 0 || drawerOpen || primaryNoteView != null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const primaryFrozen = primaryObscured |
|
|
|
|
|
|
|
|
|
|
|
useLayoutEffect(() => { |
|
|
|
useLayoutEffect(() => { |
|
|
|
noteStatsService.setBackgroundStatsPaused(primaryFrozen) |
|
|
|
noteStatsService.setBackgroundStatsPaused(primaryFrozen) |
|
|
|
@ -2298,7 +2291,8 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { |
|
|
|
navigate: navigatePrimaryPageStable, |
|
|
|
navigate: navigatePrimaryPageStable, |
|
|
|
current: currentPrimaryPage, |
|
|
|
current: currentPrimaryPage, |
|
|
|
currentPageProps, |
|
|
|
currentPageProps, |
|
|
|
display: isSmallScreen ? secondaryStack.length === 0 : true, |
|
|
|
/** Double-pane keeps the feed visible (frozen); single-pane / mobile unmount primary while a panel is open. */ |
|
|
|
|
|
|
|
display: panelMode === 'double' || !primaryObscured, |
|
|
|
frozen: primaryFrozen |
|
|
|
frozen: primaryFrozen |
|
|
|
}), |
|
|
|
}), |
|
|
|
[ |
|
|
|
[ |
|
|
|
@ -2306,7 +2300,8 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { |
|
|
|
currentPrimaryPage, |
|
|
|
currentPrimaryPage, |
|
|
|
currentPageProps, |
|
|
|
currentPageProps, |
|
|
|
isSmallScreen, |
|
|
|
isSmallScreen, |
|
|
|
secondaryStack.length, |
|
|
|
panelMode, |
|
|
|
|
|
|
|
primaryObscured, |
|
|
|
primaryFrozen |
|
|
|
primaryFrozen |
|
|
|
] |
|
|
|
] |
|
|
|
) |
|
|
|
) |
|
|
|
|