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

Delabs Spaces, iterate some copy and move communities/space toggle to preferences #6594

Merged
merged 34 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
065dbf3
Merge branch 't3chguy/fix/18092' of github.com:matrix-org/matrix-reac…
t3chguy Aug 10, 2021
1272b37
Tweak space panel new/cancel button colouring
t3chguy Aug 10, 2021
f98de18
Add blue beta dot to the space panel create button
t3chguy Aug 10, 2021
6efb699
Tweak copy in the space create menu
t3chguy Aug 10, 2021
013ccd4
Fix feedback form in space create menu exploding
t3chguy Aug 10, 2021
40cf05a
Fix space public share dialog showing atop the space invite dialog
t3chguy Aug 11, 2021
be85dcd
Delabs Spaces, keeping it as a default-on preference for the time being
t3chguy Aug 11, 2021
cbd6f2d
Tweak copy on space preview
t3chguy Aug 11, 2021
da11085
delint and remove groups-specific tests and setups
t3chguy Aug 11, 2021
6b9dc40
delint test
t3chguy Aug 11, 2021
d602dac
Add basic spaces tests to the e2e suite
t3chguy Aug 11, 2021
29e5a69
delint e2e test
t3chguy Aug 11, 2021
5f54abc
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Aug 11, 2021
38dbe89
Merge branch 't3chguy/fix/18092' of github.com:matrix-org/matrix-reac…
t3chguy Aug 11, 2021
4f47907
Show disabled spaces section in preferences regardless
t3chguy Aug 11, 2021
0ef9ea7
delint unused imports
t3chguy Aug 11, 2021
57bf64b
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Aug 12, 2021
03e3da8
i18n
t3chguy Aug 12, 2021
0414ea2
Iterate PR based on feedback
t3chguy Aug 12, 2021
4f0ae0a
Only show spaces blue flashy dot if user is in 0 spaces
t3chguy Aug 12, 2021
f2becd9
Fix e2e test
t3chguy Aug 12, 2021
5e38b8b
try fix tests s'more
t3chguy Aug 13, 2021
6ce518c
add more delay
t3chguy Aug 13, 2021
2509c86
tweak order of e2e tests
t3chguy Aug 13, 2021
9d909dc
tweaks
t3chguy Aug 13, 2021
8e7ef39
delint
t3chguy Aug 13, 2021
a688e5b
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Sep 6, 2021
911ca07
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Sep 8, 2021
29b4ba6
Use new SCSS vars
t3chguy Sep 8, 2021
41118b4
fix expected number of radios
t3chguy Sep 10, 2021
80fd960
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Sep 10, 2021
456de35
fix e2e test
t3chguy Sep 10, 2021
554c8ba
delint
t3chguy Sep 10, 2021
e17318a
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Sep 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions res/css/structures/_SpacePanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ $activeBorderColor: $secondary-fg-color;
}
}

.mx_SpaceItem_new {
position: relative;

.mx_BetaDot {
position: absolute;
left: 33px;
top: -5px;
}
}

.mx_SpaceItem:not(.hasSubSpaces) > .mx_SpaceButton {
margin-left: $gutterSize;
min-width: 40px;
Expand Down Expand Up @@ -192,22 +202,17 @@ $activeBorderColor: $secondary-fg-color;
}

&.mx_SpaceButton_new .mx_SpaceButton_icon {
background-color: $accent-color;
transition: all .1s ease-in-out; // TODO transition
background-color: $roomlist-button-bg-color;

&::before {
background-color: #ffffff;
background-color: $primary-fg-color;
mask-image: url('$(res)/img/element-icons/plus.svg');
transition: all .2s ease-in-out; // TODO transition
}
}

&.mx_SpaceButton_newCancel .mx_SpaceButton_icon {
background-color: $icon-button-color;

&::before {
transform: rotate(45deg);
}
&.mx_SpaceButton_newCancel .mx_SpaceButton_icon::before {
transform: rotate(45deg);
}

.mx_BaseAvatar_image {
Expand Down
7 changes: 4 additions & 3 deletions res/css/structures/_SpaceRoomView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@ $SpaceRoomViewInnerWidth: 428px;
}
}

> .mx_BaseAvatar_image,
> .mx_BaseAvatar > .mx_BaseAvatar_image {
border-radius: 12px;
> .mx_RoomAvatar_isSpaceRoom {
&.mx_BaseAvatar_image, .mx_BaseAvatar_image {
border-radius: 12px;
}
}

h1.mx_SpaceRoomView_preview_name {
Expand Down
1 change: 1 addition & 0 deletions res/css/views/beta/_BetaCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ $dot-size: 12px;
animation: mx_Beta_bluePulse 2s infinite;
animation-iteration-count: 20;
position: relative;
pointer-events: none;

&::after {
content: "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ limitations under the License.

.mx_SettingsTab_section {
margin-bottom: 30px;

> details {
> summary {
cursor: pointer;
color: $primary-fg-color;
}

& + .mx_SettingsFlag {
margin-top: 20px;
}
}
}

.mx_PreferencesUserSettingsTab_CommunityMigrator {
Expand Down
Empty file added res/img/betas/.gitkeep
Empty file.
Binary file removed res/img/betas/spaces.png
Binary file not shown.
10 changes: 2 additions & 8 deletions src/components/structures/GroupFilterPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,13 @@ class GroupFilterPanel extends React.Component {
mx_GroupFilterPanel_items_selected: itemsSelected,
});

let betaDot;
if (SettingsStore.getBetaInfo("feature_spaces") && !localStorage.getItem("mx_seenSpacesBeta")) {
betaDot = <div className="mx_BetaDot" />;
}

let createButton = (
<ActionButton
tooltip
label={_t("Communities")}
action="toggle_my_groups"
className="mx_TagTile mx_TagTile_plus">
{ betaDot }
</ActionButton>
className="mx_TagTile mx_TagTile_plus"
/>
);

if (SettingsStore.getValue("feature_communities_v2_prototypes")) {
Expand Down
116 changes: 116 additions & 0 deletions src/components/structures/LegacyCommunityPreview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
Copyright 2021 The Matrix.org Foundation C.I.C.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import React, { useContext } from "react";

import MatrixClientContext from "../../contexts/MatrixClientContext";
import { _t } from "../../languageHandler";
import AccessibleButton from "../views/elements/AccessibleButton";
import ErrorBoundary from "../views/elements/ErrorBoundary";
import { IGroupSummary } from "../views/dialogs/CreateSpaceFromCommunityDialog";
import { useAsyncMemo } from "../../hooks/useAsyncMemo";
import Spinner from "../views/elements/Spinner";
import GroupAvatar from "../views/avatars/GroupAvatar";
import { linkifyElement } from "../../HtmlUtils";
import defaultDispatcher from "../../dispatcher/dispatcher";
import { Action } from "../../dispatcher/actions";
import { UserTab } from "../views/dialogs/UserSettingsDialog";
import MainSplit from './MainSplit';

interface IProps {
groupId: string;
}

const onSwapClick = () => {
defaultDispatcher.dispatch({
action: Action.ViewUserSettings,
initialTabId: UserTab.Preferences,
});
};

// XXX: temporary community migration component, reuses SpaceRoomView & SpacePreview classes for simplicity
const LegacyCommunityPreview = ({ groupId }: IProps) => {
const cli = useContext(MatrixClientContext);

const groupSummary = useAsyncMemo<IGroupSummary>(() => cli.getGroupSummary(groupId), [cli, groupId]);

if (!groupSummary) {
return <main className="mx_SpaceRoomView">
<MainSplit>
<div className="mx_SpaceRoomView_preview">
<Spinner />
</div>
</MainSplit>
</main>;
}

let visibilitySection: JSX.Element;
if (groupSummary.profile.is_public) {
visibilitySection = <span className="mx_SpaceRoomView_info_public">
{ _t("Public community") }
</span>;
} else {
visibilitySection = <span className="mx_SpaceRoomView_info_private">
{ _t("Private community") }
</span>;
}

return <main className="mx_SpaceRoomView">
<ErrorBoundary>
<MainSplit>
<div className="mx_SpaceRoomView_preview">
<GroupAvatar
groupId={groupId}
groupName={groupSummary.profile.name}
groupAvatarUrl={groupSummary.profile.avatar_url}
height={80}
width={80}
resizeMethod='crop'
/>
<h1 className="mx_SpaceRoomView_preview_name">
{ groupSummary.profile.name }
</h1>
<div className="mx_SpaceRoomView_info">
{ visibilitySection }
</div>
<div className="mx_SpaceRoomView_preview_topic" ref={e => e && linkifyElement(e)}>
{ groupSummary.profile.short_description }
</div>
<div className="mx_SpaceRoomView_preview_spaceBetaPrompt">
{ groupSummary.user?.membership === "join"
? _t("To view %(communityName)s, swap to communities in your <a>preferences</a>", {
communityName: groupSummary.profile.name,
}, {
a: sub => (
<AccessibleButton onClick={onSwapClick} kind="link">{ sub }</AccessibleButton>
),
})
: _t("To join %(communityName)s, swap to communities in your <a>preferences</a>", {
communityName: groupSummary.profile.name,
}, {
a: sub => (
<AccessibleButton onClick={onSwapClick} kind="link">{ sub }</AccessibleButton>
),
})
}
</div>
</div>
</MainSplit>
</ErrorBoundary>
</main>;
};

export default LegacyCommunityPreview;
15 changes: 10 additions & 5 deletions src/components/structures/LoggedInView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import MyGroups from "./MyGroups";
import UserView from "./UserView";
import GroupView from "./GroupView";
import SpaceStore from "../../stores/SpaceStore";
import LegacyCommunityPreview from "./LegacyCommunityPreview";

// We need to fetch each pinned message individually (if we don't already have it)
// so each pinned message may trigger a request. Limit the number per room for sanity.
Expand Down Expand Up @@ -593,11 +594,15 @@ class LoggedInView extends React.Component<IProps, IState> {
pageElement = <UserView userId={this.props.currentUserId} resizeNotifier={this.props.resizeNotifier} />;
break;
case PageTypes.GroupView:
pageElement = <GroupView
groupId={this.props.currentGroupId}
isNew={this.props.currentGroupIsNew}
resizeNotifier={this.props.resizeNotifier}
/>;
if (SpaceStore.spacesEnabled) {
pageElement = <LegacyCommunityPreview groupId={this.props.currentGroupId} />;
} else {
pageElement = <GroupView
groupId={this.props.currentGroupId}
isNew={this.props.currentGroupIsNew}
resizeNotifier={this.props.resizeNotifier}
/>;
}
break;
}

Expand Down
5 changes: 0 additions & 5 deletions src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1796,11 +1796,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
subAction: params.action,
});
} else if (screen.indexOf('group/') === 0) {
if (SpaceStore.spacesEnabled) {
dis.dispatch({ action: "view_home_page" });
return;
}

const groupId = screen.substring(6);

// TODO: Check valid group ID
Expand Down
2 changes: 0 additions & 2 deletions src/components/structures/MyGroups.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import AccessibleButton from '../views/elements/AccessibleButton';
import MatrixClientContext from "../../contexts/MatrixClientContext";
import AutoHideScrollbar from "./AutoHideScrollbar";
import { replaceableComponent } from "../../utils/replaceableComponent";
import BetaCard from "../views/beta/BetaCard";

@replaceableComponent("structures.MyGroups")
export default class MyGroups extends React.Component {
Expand Down Expand Up @@ -138,7 +137,6 @@ export default class MyGroups extends React.Component {
</div>
</div>*/ }
</div>
<BetaCard featureId="feature_spaces" title={_t("Communities are changing to Spaces")} />
<div className="mx_MyGroups_content">
{ contentHeader }
{ content }
Expand Down
18 changes: 7 additions & 11 deletions src/components/structures/SpaceRoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ const SpaceInfo = ({ space }) => {
</div>;
};

const onBetaClick = () => {
const onPreferencesClick = () => {
defaultDispatcher.dispatch({
action: Action.ViewUserSettings,
initialTabId: UserTab.Labs,
initialTabId: UserTab.Preferences,
});
};

Expand Down Expand Up @@ -280,15 +280,11 @@ const SpacePreview = ({ space, onJoinButtonClicked, onRejectButtonClicked }: ISp
if (!spacesEnabled) {
footer = <div className="mx_SpaceRoomView_preview_spaceBetaPrompt">
{ myMembership === "join"
? _t("To view %(spaceName)s, turn on the <a>Spaces beta</a>", {
spaceName: space.name,
}, {
a: sub => <AccessibleButton onClick={onBetaClick} kind="link">{ sub }</AccessibleButton>,
? _t("To view this Space, hide communities in your <a>preferences</a>", {}, {
a: sub => <AccessibleButton onClick={onPreferencesClick} kind="link">{ sub }</AccessibleButton>,
})
: _t("To join %(spaceName)s, turn on the <a>Spaces beta</a>", {
spaceName: space.name,
}, {
a: sub => <AccessibleButton onClick={onBetaClick} kind="link">{ sub }</AccessibleButton>,
: _t("To join this Space, hide communities in your <a>preferences</a>", {}, {
a: sub => <AccessibleButton onClick={onPreferencesClick} kind="link">{ sub }</AccessibleButton>,
})
}
</div>;
Expand Down Expand Up @@ -717,7 +713,7 @@ const SpaceSetupPrivateInvite = ({ space, onFinished }) => {
</div>

<div className="mx_SpaceRoomView_inviteTeammates_betaDisclaimer">
<BetaPill onClick={onBetaClick} />
<BetaPill />
{ _t("<b>This is an experimental feature.</b> For now, " +
"new users receiving an invite will have to open the invite on <link/> to actually join.", {}, {
b: sub => <b>{ sub }</b>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { replaceableComponent } from "../../../../../utils/replaceableComponent"
import SettingsFlag from '../../../elements/SettingsFlag';
import * as KeyboardShortcuts from "../../../../../accessibility/KeyboardShortcuts";
import AccessibleButton from "../../../elements/AccessibleButton";
import SpaceStore from "../../../../../stores/SpaceStore";
import GroupAvatar from "../../../avatars/GroupAvatar";
import dis from "../../../../../dispatcher/dispatcher";
import GroupActions from "../../../../../actions/GroupActions";
Expand Down Expand Up @@ -145,7 +144,7 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
];

static COMMUNITIES_SETTINGS = [
// TODO: part of delabsing move the toggle here - https://github.com/vector-im/element-web/issues/18088
"showCommunitiesInsteadOfSpaces",
];

static KEYBINDINGS_SETTINGS = [
Expand Down Expand Up @@ -285,9 +284,17 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
SettingsStore.setValue("readMarkerOutOfViewThresholdMs", null, SettingLevel.DEVICE, e.target.value);
};

private renderGroup(settingIds: string[]): React.ReactNodeArray {
return settingIds.filter(SettingsStore.isEnabled).map(i => {
return <SettingsFlag key={i} name={i} level={SettingLevel.ACCOUNT} />;
private renderGroup(
settingIds: string[],
level = SettingLevel.ACCOUNT,
includeDisabled = false,
): React.ReactNodeArray {
if (!includeDisabled) {
settingIds = settingIds.filter(SettingsStore.isEnabled);
}

return settingIds.map(i => {
return <SettingsFlag key={i} name={i} level={level} />;
});
}

Expand Down Expand Up @@ -333,10 +340,10 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
{ this.renderGroup(PreferencesUserSettingsTab.ROOM_LIST_SETTINGS) }
</div>

{ SpaceStore.spacesEnabled && <div className="mx_SettingsTab_section">
<div className="mx_SettingsTab_section">
<span className="mx_SettingsTab_subheading">{ _t("Spaces") }</span>
{ this.renderGroup(PreferencesUserSettingsTab.SPACES_SETTINGS) }
</div> }
{ this.renderGroup(PreferencesUserSettingsTab.SPACES_SETTINGS, SettingLevel.ACCOUNT, true) }
</div>

<div className="mx_SettingsTab_section">
<span className="mx_SettingsTab_subheading">{ _t("Communities") }</span>
Expand All @@ -348,7 +355,7 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
<p>{ _t("If a community isn't shown you may not have permission to convert it.") }</p>
<CommunityMigrator onFinished={this.props.closeSettingsFn} />
</details>
{ this.renderGroup(PreferencesUserSettingsTab.COMMUNITIES_SETTINGS) }
{ this.renderGroup(PreferencesUserSettingsTab.COMMUNITIES_SETTINGS, SettingLevel.DEVICE) }
</div>

<div className="mx_SettingsTab_section">
Expand Down
Loading