diff --git a/src/PageManager.tsx b/src/PageManager.tsx index 40940f3..ee36795 100644 --- a/src/PageManager.tsx +++ b/src/PageManager.tsx @@ -86,10 +86,16 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { } ]) const [secondaryStack, setSecondaryStack] = useState([]) + const [isShared, setIsShared] = useState(false) const { isSmallScreen } = useScreenSize() useEffect(() => { if (window.location.pathname !== '/') { + if ( + ['/users', '/notes', '/relays'].some((path) => window.location.pathname.startsWith(path)) + ) { + setIsShared(true) + } const url = window.location.pathname + window.location.search + window.location.hash setSecondaryStack((prevStack) => { if (isCurrentPage(prevStack, url)) return prevStack @@ -206,6 +212,7 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { if (secondaryStack.length === 1) { // back to home page window.history.replaceState(null, '', '/') + setIsShared(false) setSecondaryStack([]) } else { window.history.go(-1) @@ -263,6 +270,38 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) { ) } + if (isShared && secondaryStack.length > 0) { + return ( + + + +
+ {secondaryStack.map((item, index) => ( +
+ {item.component} +
+ ))} +
+
+
+
+ ) + } + return ( -
+