Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 034bd9c

Browse files
authored
Merge pull request #6029 from matrix-org/t3chguy/fix/17275
Show alternative button during space creation wizard if no rooms
2 parents 1aa09cf + 2f28de8 commit 034bd9c

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/components/structures/SpaceRoomView.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ interface IProps {
7878

7979
interface IState {
8080
phase: Phase;
81+
createdRooms?: boolean; // internal state for the creation wizard
8182
showRightPanel: boolean;
8283
myMembership: string;
8384
}
@@ -461,7 +462,8 @@ const SpaceSetupFirstRooms = ({ space, title, description, onFinished }) => {
461462
setError("");
462463
setBusy(true);
463464
try {
464-
await Promise.all(roomNames.map(name => name.trim()).filter(Boolean).map(name => {
465+
const filteredRoomNames = roomNames.map(name => name.trim()).filter(Boolean);
466+
await Promise.all(filteredRoomNames.map(name => {
465467
return createRoom({
466468
createOpts: {
467469
preset: space.getJoinRule() === "public" ? Preset.PublicChat : Preset.PrivateChat,
@@ -474,7 +476,7 @@ const SpaceSetupFirstRooms = ({ space, title, description, onFinished }) => {
474476
parentSpace: space,
475477
});
476478
}));
477-
onFinished();
479+
onFinished(filteredRoomNames.length > 0);
478480
} catch (e) {
479481
console.error("Failed to create initial space rooms", e);
480482
setError(_t("Failed to create initial space rooms"));
@@ -484,7 +486,7 @@ const SpaceSetupFirstRooms = ({ space, title, description, onFinished }) => {
484486

485487
let onClick = (ev) => {
486488
ev.preventDefault();
487-
onFinished();
489+
onFinished(false);
488490
};
489491
let buttonLabel = _t("Skip for now");
490492
if (roomNames.some(name => name.trim())) {
@@ -585,7 +587,7 @@ const SpaceAddExistingRooms = ({ space, onFinished }) => {
585587
</div>;
586588
};
587589

588-
const SpaceSetupPublicShare = ({ justCreatedOpts, space, onFinished }) => {
590+
const SpaceSetupPublicShare = ({ justCreatedOpts, space, onFinished, createdRooms }) => {
589591
return <div className="mx_SpaceRoomView_publicShare">
590592
<h1>{ _t("Share %(name)s", {
591593
name: justCreatedOpts?.createOpts?.name || space.name,
@@ -598,7 +600,7 @@ const SpaceSetupPublicShare = ({ justCreatedOpts, space, onFinished }) => {
598600

599601
<div className="mx_SpaceRoomView_buttons">
600602
<AccessibleButton kind="primary" onClick={onFinished}>
601-
{ _t("Go to my first room") }
603+
{ createdRooms ? _t("Go to my first room") : _t("Go to my space") }
602604
</AccessibleButton>
603605
</div>
604606
<SpaceFeedbackPrompt />
@@ -891,13 +893,14 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
891893
_t("Let's create a room for each of them.") + "\n" +
892894
_t("You can add more later too, including already existing ones.")
893895
}
894-
onFinished={() => this.setState({ phase: Phase.PublicShare })}
896+
onFinished={(createdRooms: boolean) => this.setState({ phase: Phase.PublicShare, createdRooms })}
895897
/>;
896898
case Phase.PublicShare:
897899
return <SpaceSetupPublicShare
898900
justCreatedOpts={this.props.justCreatedOpts}
899901
space={this.props.space}
900902
onFinished={this.goToFirstRoom}
903+
createdRooms={this.state.createdRooms}
901904
/>;
902905

903906
case Phase.PrivateScope:
@@ -919,7 +922,7 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
919922
title={_t("What projects are you working on?")}
920923
description={_t("We'll create rooms for each of them. " +
921924
"You can add more later too, including already existing ones.")}
922-
onFinished={() => this.setState({ phase: Phase.Landing })}
925+
onFinished={(createdRooms: boolean) => this.setState({ phase: Phase.Landing, createdRooms })}
923926
/>;
924927
case Phase.PrivateExistingRooms:
925928
return <SpaceAddExistingRooms

src/i18n/strings/en_EN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2711,6 +2711,7 @@
27112711
"Share %(name)s": "Share %(name)s",
27122712
"It's just you at the moment, it will be even better with others.": "It's just you at the moment, it will be even better with others.",
27132713
"Go to my first room": "Go to my first room",
2714+
"Go to my space": "Go to my space",
27142715
"Who are you working with?": "Who are you working with?",
27152716
"Make sure the right people have access to %(name)s": "Make sure the right people have access to %(name)s",
27162717
"Just me": "Just me",

0 commit comments

Comments
 (0)