Add Shared Media drawer and harden same-room navigation.
Widen the media panel, support skinny full-page mode, keep jump-to-latest and return-to-previous reliable, and stop same-room event jumps from remounting the outlet or yanking the sidebar.
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
DIRECT_CREATE_PATH,
|
||||
DIRECT_PATH,
|
||||
DIRECT_ROOM_PATH,
|
||||
DIRECT_SEARCH_PATH,
|
||||
DIRECT_NOTIFICATIONS_PATH,
|
||||
DIRECT_INVITES_PATH,
|
||||
EXPLORE_FEATURED_PATH,
|
||||
@@ -121,6 +122,7 @@ export const getHomeRoomPath = (roomIdOrAlias: string, eventId?: string): string
|
||||
|
||||
export const getDirectPath = (): string => DIRECT_PATH;
|
||||
export const getDirectCreatePath = (): string => DIRECT_CREATE_PATH;
|
||||
export const getDirectSearchPath = (): string => DIRECT_SEARCH_PATH;
|
||||
export const getDirectRoomPath = (roomIdOrAlias: string, eventId?: string): string => {
|
||||
const params = {
|
||||
roomIdOrAlias,
|
||||
@@ -180,6 +182,28 @@ export const getSpaceRoomPath = (
|
||||
return generatePath(SPACE_ROOM_PATH, params);
|
||||
};
|
||||
|
||||
/**
|
||||
* Keep the current room URL (home / direct / space) and only add, replace, or clear
|
||||
* the optional `$eventId` segment. Used so same-room jumps (media, permalinks) don't
|
||||
* re-home the room into a different sidebar section.
|
||||
*/
|
||||
export const withRoomEventId = (pathname: string, eventId?: string): string => {
|
||||
const parts = pathname.split('/').filter(Boolean);
|
||||
|
||||
if (parts.length > 0) {
|
||||
const lastDecoded = decodeRouteParam(parts[parts.length - 1]);
|
||||
if (lastDecoded?.startsWith('$')) {
|
||||
parts.pop();
|
||||
}
|
||||
}
|
||||
|
||||
if (eventId) {
|
||||
parts.push(encodeURIComponent(eventId));
|
||||
}
|
||||
|
||||
return `/${parts.join('/')}/`;
|
||||
};
|
||||
|
||||
export const getExplorePath = (): string => EXPLORE_PATH;
|
||||
export const getExploreFeaturedPath = (): string => EXPLORE_FEATURED_PATH;
|
||||
export const getExploreServerPath = (server: string): string => {
|
||||
|
||||
Reference in New Issue
Block a user