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

Commit 9d3569a

Browse files
committed
Iterate PR based on feedback
1 parent 54d85a3 commit 9d3569a

File tree

5 files changed

+49
-8
lines changed

5 files changed

+49
-8
lines changed

res/css/structures/_GroupView.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,11 @@ limitations under the License.
400400
background-color: $secondary-fg-color;
401401
}
402402

403-
.mx_AccessibleButton {
403+
.mx_AccessibleButton_kind_link {
404+
padding: 0;
405+
}
406+
407+
.mx_GroupView_spaceUpgradePrompt_close {
404408
width: 16px;
405409
height: 16px;
406410
border-radius: 8px;

res/css/views/dialogs/_CreateSpaceFromCommunityDialog.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ limitations under the License.
5959
.mx_JoinRuleDropdown .mx_Dropdown_menu {
6060
width: auto !important; // override fixed width
6161
}
62+
63+
.mx_CreateSpaceFromCommunityDialog_nonPublicSpacer {
64+
height: 63px; // balance the height of the missing room alias field to prevent modal bouncing
65+
}
6266
}
6367

6468
.mx_CreateSpaceFromCommunityDialog_footer {

src/components/structures/GroupView.js

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ import RightPanelStore from "../../stores/RightPanelStore";
4141
import AutoHideScrollbar from "./AutoHideScrollbar";
4242
import { mediaFromMxc } from "../../customisations/Media";
4343
import { replaceableComponent } from "../../utils/replaceableComponent";
44+
import { createSpaceFromCommunity } from "../../utils/space";
45+
import { Action } from "../../dispatcher/actions";
46+
import { RightPanelPhases } from "../../stores/RightPanelStorePhases";
4447

4548
const LONG_DESC_PLACEHOLDER = _td(
4649
`<h1>HTML for your community's page</h1>
@@ -815,6 +818,17 @@ export default class GroupView extends React.Component {
815818
this.setState({ showUpgradeNotice: false });
816819
}
817820

821+
_onCreateSpaceClick = () => {
822+
createSpaceFromCommunity(this._matrixClient, this.props.groupId);
823+
};
824+
825+
_onAdminsLinkClick = () => {
826+
dis.dispatch({
827+
action: Action.SetRightPanelPhase,
828+
phase: RightPanelPhases.GroupMemberList,
829+
});
830+
};
831+
818832
_getGroupSection() {
819833
const groupSettingsSectionClasses = classnames({
820834
"mx_GroupView_group": this.state.editing,
@@ -854,17 +868,35 @@ export default class GroupView extends React.Component {
854868

855869
let communitiesUpgradeNotice;
856870
if (this.state.showUpgradeNotice) {
871+
let text;
872+
if (this.state.isUserPrivileged) {
873+
text = _t("You can create a Space from this community <a>here</a>.", {}, {
874+
a: sub => <AccessibleButton onClick={this._onCreateSpaceClick} kind="link">
875+
{ sub }
876+
</AccessibleButton>,
877+
});
878+
} else {
879+
text = _t("Ask the <a>admins</a> of this community to make it into a Space " +
880+
"and keep a look out for the invite.", {}, {
881+
a: sub => <AccessibleButton onClick={this._onAdminsLinkClick} kind="link">
882+
{ sub }
883+
</AccessibleButton>,
884+
});
885+
}
886+
857887
communitiesUpgradeNotice = <div className="mx_GroupView_spaceUpgradePrompt">
858888
<h2>{ _t("Communities can now be made into Spaces") }</h2>
859889
<p>
860890
{ _t("Spaces are a new way to make a community, with new features coming.") }
861891
&nbsp;
862-
{ _t("Ask the admins of this community to make it into a Space " +
863-
"and keep a look out for the invite.") }
892+
{ text }
864893
&nbsp;
865894
{ _t("Communities won't receive further updates.") }
866895
</p>
867-
<AccessibleButton onClick={this._dismissUpgradeNotice} />
896+
<AccessibleButton
897+
className="mx_GroupView_spaceUpgradePrompt_close"
898+
onClick={this._dismissUpgradeNotice}
899+
/>
868900
</div>;
869901
}
870902

src/components/views/dialogs/CreateSpaceFromCommunityDialog.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ const CreateSpaceFromCommunityDialog: React.FC<IProps> = ({ matrixClient: cli, g
286286
>
287287
<div className="mx_CreateSpaceFromCommunityDialog_content">
288288
<p>
289-
{ _t("Spaces are the new version of communities - with new features coming.") }
290-
&nbsp;
291289
{ _t("A link to the Space will be put in your community description.") }
292290
&nbsp;
293291
{ _t("All rooms will be added and all community members will be invited.") }
@@ -326,6 +324,9 @@ const CreateSpaceFromCommunityDialog: React.FC<IProps> = ({ matrixClient: cli, g
326324
? _t("Open space for anyone, best for communities")
327325
: _t("Invite only, best for yourself or teams")
328326
}</p>
327+
{ joinRule !== JoinRule.Public &&
328+
<div className="mx_CreateSpaceFromCommunityDialog_nonPublicSpacer" />
329+
}
329330
</SpaceCreateForm>
330331
</div>
331332

src/i18n/strings/en_EN.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,7 +2237,6 @@
22372237
"To create a Space from another community, just pick the community in Preferences.": "To create a Space from another community, just pick the community in Preferences.",
22382238
"Failed to migrate community": "Failed to migrate community",
22392239
"Create Space from community": "Create Space from community",
2240-
"Spaces are the new version of communities - with new features coming.": "Spaces are the new version of communities - with new features coming.",
22412240
"A link to the Space will be put in your community description.": "A link to the Space will be put in your community description.",
22422241
"All rooms will be added and all community members will be invited.": "All rooms will be added and all community members will be invited.",
22432242
"Flair won't be available in Spaces for the foreseeable future.": "Flair won't be available in Spaces for the foreseeable future.",
@@ -2727,9 +2726,10 @@
27272726
"Community Settings": "Community Settings",
27282727
"Want more than a community? <a>Get your own server</a>": "Want more than a community? <a>Get your own server</a>",
27292728
"Changes made to your community <bold1>name</bold1> and <bold2>avatar</bold2> might not be seen by other users for up to 30 minutes.": "Changes made to your community <bold1>name</bold1> and <bold2>avatar</bold2> might not be seen by other users for up to 30 minutes.",
2729+
"You can create a Space from this community <a>here</a>.": "You can create a Space from this community <a>here</a>.",
2730+
"Ask the <a>admins</a> of this community to make it into a Space and keep a look out for the invite.": "Ask the <a>admins</a> of this community to make it into a Space and keep a look out for the invite.",
27302731
"Communities can now be made into Spaces": "Communities can now be made into Spaces",
27312732
"Spaces are a new way to make a community, with new features coming.": "Spaces are a new way to make a community, with new features coming.",
2732-
"Ask the admins of this community to make it into a Space and keep a look out for the invite.": "Ask the admins of this community to make it into a Space and keep a look out for the invite.",
27332733
"Communities won't receive further updates.": "Communities won't receive further updates.",
27342734
"These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.": "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.",
27352735
"Featured Rooms:": "Featured Rooms:",

0 commit comments

Comments
 (0)