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:
17
src/app/state/mediaDrawer.ts
Normal file
17
src/app/state/mediaDrawer.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { atom } from 'jotai';
|
||||
|
||||
/** Session flag for the Shared Media side drawer (mutually exclusive with Members). */
|
||||
export const isMediaDrawerAtom = atom(false);
|
||||
|
||||
const scrollTops = new Map<string, number>();
|
||||
|
||||
export const getMediaDrawerScrollTop = (roomId: string): number | undefined =>
|
||||
scrollTops.get(roomId);
|
||||
|
||||
export const setMediaDrawerScrollTop = (roomId: string, top: number): void => {
|
||||
scrollTops.set(roomId, top);
|
||||
};
|
||||
|
||||
export const clearMediaDrawerScrollTop = (roomId: string): void => {
|
||||
scrollTops.delete(roomId);
|
||||
};
|
||||
@@ -30,3 +30,17 @@ export const saveRoomScrollState = (roomId: string, state: RoomScrollState): voi
|
||||
export const clearRoomScrollState = (roomId: string): void => {
|
||||
cache.delete(roomId);
|
||||
};
|
||||
|
||||
/** Survives RoomTimeline remounts (e.g. clearing an event permalink URL). */
|
||||
const returnAnchors = new Map<string, string>();
|
||||
|
||||
export const getRoomReturnAnchor = (roomId: string): string | undefined =>
|
||||
returnAnchors.get(roomId);
|
||||
|
||||
export const setRoomReturnAnchor = (roomId: string, eventId: string): void => {
|
||||
returnAnchors.set(roomId, eventId);
|
||||
};
|
||||
|
||||
export const clearRoomReturnAnchor = (roomId: string): void => {
|
||||
returnAnchors.delete(roomId);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user