feat: Implement sub-room functionality

- Added support for sub-rooms in the SpaceHierarchy component, allowing rooms to have nested child rooms.
- Introduced UnjoinedSubRoomItem component to display unjoined sub-rooms with a join button.
- Created SubRooms settings page for managing sub-rooms, including adding and removing sub-rooms.
- Updated RoomNavItem to include options for creating sub-rooms.
- Enhanced room fetching logic to filter out sub-rooms from the main room list.
- Added hooks for managing sub-rooms state and permissions.
- Updated relevant state management to handle sub-room creation and association with parent rooms.
This commit is contained in:
2026-03-15 16:25:53 +11:00
parent a0c0068997
commit c7bd376292
21 changed files with 917 additions and 111 deletions

View File

@@ -2,6 +2,8 @@ import { atom } from 'jotai';
export type CreateRoomModalState = {
spaceId?: string;
/** When set, the created room will be added as a sub-room to this room */
parentSubRoomId?: string;
};
export const createRoomModalAtom = atom<CreateRoomModalState | undefined>(undefined);

View File

@@ -32,3 +32,17 @@ export const useOpenCreateRoomModal = (): OpenCallback => {
return open;
};
type OpenSubRoomCallback = (parentRoomId: string) => void;
export const useOpenCreateSubRoomModal = (): OpenSubRoomCallback => {
const setSettings = useSetAtom(createRoomModalAtom);
const open: OpenSubRoomCallback = useCallback(
(parentSubRoomId) => {
setSettings({ parentSubRoomId });
},
[setSettings]
);
return open;
};

View File

@@ -4,6 +4,7 @@ export enum RoomSettingsPage {
GeneralPage,
MembersPage,
PermissionsPage,
SubRoomsPage,
EmojisStickersPage,
DeveloperToolsPage,
}