Merge pull request #6029 from matrix-org/t3chguy/fix/17275
Show alternative button during space creation wizard if no rooms
This commit is contained in:
commit
034bd9cb02
2 changed files with 11 additions and 7 deletions
|
@ -78,6 +78,7 @@ interface IProps {
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
phase: Phase;
|
phase: Phase;
|
||||||
|
createdRooms?: boolean; // internal state for the creation wizard
|
||||||
showRightPanel: boolean;
|
showRightPanel: boolean;
|
||||||
myMembership: string;
|
myMembership: string;
|
||||||
}
|
}
|
||||||
|
@ -461,7 +462,8 @@ const SpaceSetupFirstRooms = ({ space, title, description, onFinished }) => {
|
||||||
setError("");
|
setError("");
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
try {
|
try {
|
||||||
await Promise.all(roomNames.map(name => name.trim()).filter(Boolean).map(name => {
|
const filteredRoomNames = roomNames.map(name => name.trim()).filter(Boolean);
|
||||||
|
await Promise.all(filteredRoomNames.map(name => {
|
||||||
return createRoom({
|
return createRoom({
|
||||||
createOpts: {
|
createOpts: {
|
||||||
preset: space.getJoinRule() === "public" ? Preset.PublicChat : Preset.PrivateChat,
|
preset: space.getJoinRule() === "public" ? Preset.PublicChat : Preset.PrivateChat,
|
||||||
|
@ -474,7 +476,7 @@ const SpaceSetupFirstRooms = ({ space, title, description, onFinished }) => {
|
||||||
parentSpace: space,
|
parentSpace: space,
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
onFinished();
|
onFinished(filteredRoomNames.length > 0);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to create initial space rooms", e);
|
console.error("Failed to create initial space rooms", e);
|
||||||
setError(_t("Failed to create initial space rooms"));
|
setError(_t("Failed to create initial space rooms"));
|
||||||
|
@ -484,7 +486,7 @@ const SpaceSetupFirstRooms = ({ space, title, description, onFinished }) => {
|
||||||
|
|
||||||
let onClick = (ev) => {
|
let onClick = (ev) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
onFinished();
|
onFinished(false);
|
||||||
};
|
};
|
||||||
let buttonLabel = _t("Skip for now");
|
let buttonLabel = _t("Skip for now");
|
||||||
if (roomNames.some(name => name.trim())) {
|
if (roomNames.some(name => name.trim())) {
|
||||||
|
@ -585,7 +587,7 @@ const SpaceAddExistingRooms = ({ space, onFinished }) => {
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SpaceSetupPublicShare = ({ justCreatedOpts, space, onFinished }) => {
|
const SpaceSetupPublicShare = ({ justCreatedOpts, space, onFinished, createdRooms }) => {
|
||||||
return <div className="mx_SpaceRoomView_publicShare">
|
return <div className="mx_SpaceRoomView_publicShare">
|
||||||
<h1>{ _t("Share %(name)s", {
|
<h1>{ _t("Share %(name)s", {
|
||||||
name: justCreatedOpts?.createOpts?.name || space.name,
|
name: justCreatedOpts?.createOpts?.name || space.name,
|
||||||
|
@ -598,7 +600,7 @@ const SpaceSetupPublicShare = ({ justCreatedOpts, space, onFinished }) => {
|
||||||
|
|
||||||
<div className="mx_SpaceRoomView_buttons">
|
<div className="mx_SpaceRoomView_buttons">
|
||||||
<AccessibleButton kind="primary" onClick={onFinished}>
|
<AccessibleButton kind="primary" onClick={onFinished}>
|
||||||
{ _t("Go to my first room") }
|
{ createdRooms ? _t("Go to my first room") : _t("Go to my space") }
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
</div>
|
</div>
|
||||||
<SpaceFeedbackPrompt />
|
<SpaceFeedbackPrompt />
|
||||||
|
@ -891,13 +893,14 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
|
||||||
_t("Let's create a room for each of them.") + "\n" +
|
_t("Let's create a room for each of them.") + "\n" +
|
||||||
_t("You can add more later too, including already existing ones.")
|
_t("You can add more later too, including already existing ones.")
|
||||||
}
|
}
|
||||||
onFinished={() => this.setState({ phase: Phase.PublicShare })}
|
onFinished={(createdRooms: boolean) => this.setState({ phase: Phase.PublicShare, createdRooms })}
|
||||||
/>;
|
/>;
|
||||||
case Phase.PublicShare:
|
case Phase.PublicShare:
|
||||||
return <SpaceSetupPublicShare
|
return <SpaceSetupPublicShare
|
||||||
justCreatedOpts={this.props.justCreatedOpts}
|
justCreatedOpts={this.props.justCreatedOpts}
|
||||||
space={this.props.space}
|
space={this.props.space}
|
||||||
onFinished={this.goToFirstRoom}
|
onFinished={this.goToFirstRoom}
|
||||||
|
createdRooms={this.state.createdRooms}
|
||||||
/>;
|
/>;
|
||||||
|
|
||||||
case Phase.PrivateScope:
|
case Phase.PrivateScope:
|
||||||
|
@ -919,7 +922,7 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
|
||||||
title={_t("What projects are you working on?")}
|
title={_t("What projects are you working on?")}
|
||||||
description={_t("We'll create rooms for each of them. " +
|
description={_t("We'll create rooms for each of them. " +
|
||||||
"You can add more later too, including already existing ones.")}
|
"You can add more later too, including already existing ones.")}
|
||||||
onFinished={() => this.setState({ phase: Phase.Landing })}
|
onFinished={(createdRooms: boolean) => this.setState({ phase: Phase.Landing, createdRooms })}
|
||||||
/>;
|
/>;
|
||||||
case Phase.PrivateExistingRooms:
|
case Phase.PrivateExistingRooms:
|
||||||
return <SpaceAddExistingRooms
|
return <SpaceAddExistingRooms
|
||||||
|
|
|
@ -2711,6 +2711,7 @@
|
||||||
"Share %(name)s": "Share %(name)s",
|
"Share %(name)s": "Share %(name)s",
|
||||||
"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.",
|
"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.",
|
||||||
"Go to my first room": "Go to my first room",
|
"Go to my first room": "Go to my first room",
|
||||||
|
"Go to my space": "Go to my space",
|
||||||
"Who are you working with?": "Who are you working with?",
|
"Who are you working with?": "Who are you working with?",
|
||||||
"Make sure the right people have access to %(name)s": "Make sure the right people have access to %(name)s",
|
"Make sure the right people have access to %(name)s": "Make sure the right people have access to %(name)s",
|
||||||
"Just me": "Just me",
|
"Just me": "Just me",
|
||||||
|
|
Loading…
Reference in a new issue