Add a create room in space CTA to Space View
This commit is contained in:
parent
ab4b7b73ea
commit
a687b9883c
5 changed files with 51 additions and 1 deletions
|
@ -21,6 +21,8 @@ import {EventType} from "matrix-js-sdk/src/@types/event";
|
|||
import {calculateRoomVia} from "../utils/permalinks/Permalinks";
|
||||
import Modal from "../Modal";
|
||||
import SpaceSettingsDialog from "../components/views/dialogs/SpaceSettingsDialog";
|
||||
import CreateRoomDialog from "../components/views/dialogs/CreateRoomDialog";
|
||||
import createRoom, {IOpts} from "../createRoom";
|
||||
|
||||
export const shouldShowSpaceSettings = (cli: MatrixClient, space: Room) => {
|
||||
const userId = cli.getUserId();
|
||||
|
@ -46,3 +48,19 @@ export const showSpaceSettings = (cli: MatrixClient, space: Room) => {
|
|||
space,
|
||||
}, /*className=*/null, /*isPriority=*/false, /*isStatic=*/true);
|
||||
};
|
||||
|
||||
export const showCreateNewRoom = async (cli: MatrixClient, space: Room) => {
|
||||
const modal = Modal.createTrackedDialog<[boolean, IOpts]>(
|
||||
"Space Landing",
|
||||
"Create Room",
|
||||
CreateRoomDialog,
|
||||
{
|
||||
defaultPublic: space.getJoinRule() === "public",
|
||||
parentSpace: space,
|
||||
},
|
||||
);
|
||||
const [shouldCreate, opts] = await modal.finished;
|
||||
if (shouldCreate) {
|
||||
await createRoom(opts);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue