fix: rework compact nav and centralized back routing
Use master-detail layout on skinny windows so server and channel lists share one screen, with back returning to the space list instead of redirect loops. Add useBackRoute for title-bar and page-header back buttons with view transitions.
This commit is contained in:
@@ -5,17 +5,24 @@ import { useSpace } from '../../../hooks/useSpace';
|
||||
import { shouldShowForumLobby } from '../../../utils/room';
|
||||
import { getSpaceDefaultPath } from '../../pathUtils';
|
||||
import { ForumFeedPage } from '../../../features/forum/ForumFeedPage';
|
||||
import { useCompactNav } from '../../../hooks/useCompactNav';
|
||||
|
||||
/** Sends /:spaceId/ to the forum feed or space lobby. */
|
||||
/** Sends /:spaceId/ to the forum feed or space lobby (desktop). On compact nav, stay on index for the channel list. */
|
||||
export function SpaceIndexRedirect() {
|
||||
const mx = useMatrixClient();
|
||||
const space = useSpace();
|
||||
const navigate = useNavigate();
|
||||
const compact = useCompactNav();
|
||||
const isForum = shouldShowForumLobby(space);
|
||||
|
||||
useEffect(() => {
|
||||
if (compact) return;
|
||||
navigate(getSpaceDefaultPath(mx, space.roomId), { replace: true });
|
||||
}, [mx, navigate, space.roomId]);
|
||||
}, [compact, mx, navigate, space.roomId]);
|
||||
|
||||
if (compact) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Avoid a blank main pane while redirecting forum spaces to /feed/.
|
||||
if (isForum) {
|
||||
|
||||
Reference in New Issue
Block a user