From 9c7fa71a4afe4e46d9f3f30a1258a9f068ebfef6 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 23 Jul 2021 14:34:29 +0100
Subject: [PATCH 01/11] Remove spaces beta feedback prompts except a couple
more strategic ones
---
res/css/structures/_SpaceRoomDirectory.scss | 1 +
res/css/structures/_SpaceRoomView.scss | 15 ++++---
src/components/structures/SpaceRoomView.tsx | 42 +++++--------------
.../dialogs/AddExistingToSpaceDialog.tsx | 3 --
.../views/spaces/SpaceCreateMenu.tsx | 35 ++++++++++------
.../views/spaces/SpaceSettingsGeneralTab.tsx | 3 --
src/i18n/strings/en_EN.json | 3 +-
7 files changed, 47 insertions(+), 55 deletions(-)
diff --git a/res/css/structures/_SpaceRoomDirectory.scss b/res/css/structures/_SpaceRoomDirectory.scss
index 7925686bf1..20a19ea2bb 100644
--- a/res/css/structures/_SpaceRoomDirectory.scss
+++ b/res/css/structures/_SpaceRoomDirectory.scss
@@ -61,6 +61,7 @@ limitations under the License.
.mx_AccessibleButton_kind_link {
padding: 0;
+ font-size: inherit;
}
.mx_SearchBox {
diff --git a/res/css/structures/_SpaceRoomView.scss b/res/css/structures/_SpaceRoomView.scss
index 48b565be7f..b1c09350cf 100644
--- a/res/css/structures/_SpaceRoomView.scss
+++ b/res/css/structures/_SpaceRoomView.scss
@@ -342,12 +342,17 @@ $SpaceRoomViewInnerWidth: 428px;
margin: 0 0 20px;
}
- .mx_SpaceFeedbackPrompt {
- margin-bottom: 16px;
+ .mx_SpaceFeedbackPrompt_topRight {
+ padding: 7px; // 8px - 1px border
+ border: 1px solid $menu-border-color;
+ border-radius: 8px;
+ color: $secondary-fg-color;
+ font-size: $font-15px;
+ line-height: $font-24px;
+ float: right;
- // hide the HR as we have our own
- & + hr {
- display: none;
+ & + .mx_BaseAvatar {
+ clear: both;
}
}
}
diff --git a/src/components/structures/SpaceRoomView.tsx b/src/components/structures/SpaceRoomView.tsx
index 36b4d8d549..699c42c871 100644
--- a/src/components/structures/SpaceRoomView.tsx
+++ b/src/components/structures/SpaceRoomView.tsx
@@ -92,26 +92,6 @@ enum Phase {
PrivateExistingRooms,
}
-// XXX: Temporary for the Spaces Beta only
-export const SpaceFeedbackPrompt = ({ onClick }: { onClick?: () => void }) => {
- if (!SdkConfig.get().bug_report_endpoint_url) return null;
-
- return
-
-
-
{ _t("Spaces are a beta feature.") }
-
{
- if (onClick) onClick();
- Modal.createTrackedDialog("Beta Feedback", "feature_spaces", BetaFeedbackDialog, {
- featureId: "feature_spaces",
- });
- }}>
- { _t("Feedback") }
-
-
-
;
-};
-
const RoomMemberCount = ({ room, children }) => {
const members = useRoomMembers(room);
const count = members.length;
@@ -414,6 +394,16 @@ const SpaceLanding = ({ space }) => {
};
return
+
+ { _t("Spaces are a new feature.") }
+
{
+ Modal.createTrackedDialog("Beta Feedback", "feature_spaces", BetaFeedbackDialog, {
+ featureId: "feature_spaces",
+ });
+ }}>
+ { _t("Give feedback.") }
+
+
@@ -438,7 +428,6 @@ const SpaceLanding = ({ space }) => {
) }
-
{
value={buttonLabel}
/>
-
;
};
@@ -550,11 +538,6 @@ const SpaceAddExistingRooms = ({ space, onFinished }) => {
}
onFinished={onFinished}
/>
-
-
-
-
-
;
};
@@ -574,7 +557,6 @@ const SpaceSetupPublicShare = ({ justCreatedOpts, space, onFinished, createdRoom
{ createdRooms ? _t("Go to my first room") : _t("Go to my space") }
-
;
};
@@ -603,9 +585,8 @@ const SpaceSetupPrivateScope = ({ space, justCreatedOpts, onFinished }) => {
{ _t("Teammates might not be able to view or join any private rooms you make.") }
-
{ _t("We're working on this as part of the beta, but just want to let you know.") }
+
{ _t("We're working on this, but just want to let you know.") }
-
;
};
@@ -728,7 +709,6 @@ const SpaceSetupPrivateInvite = ({ space, onFinished }) => {
value={buttonLabel}
/>
-
;
};
diff --git a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx
index 01dc729a83..e86b9c3164 100644
--- a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx
+++ b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx
@@ -35,7 +35,6 @@ import StyledCheckbox from "../elements/StyledCheckbox";
import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { sortRooms } from "../../../stores/room-list/algorithms/tag-sorting/RecentAlgorithm";
import ProgressBar from "../elements/ProgressBar";
-import { SpaceFeedbackPrompt } from "../../structures/SpaceRoomView";
import DecoratedRoomAvatar from "../avatars/DecoratedRoomAvatar";
import QueryMatcher from "../../../autocomplete/QueryMatcher";
import TruncatedList from "../elements/TruncatedList";
@@ -354,8 +353,6 @@ const AddExistingToSpaceDialog: React.FC = ({ space, onCreateRoomClick,
>}
/>
-
- onFinished(false)} />
;
};
diff --git a/src/components/views/spaces/SpaceCreateMenu.tsx b/src/components/views/spaces/SpaceCreateMenu.tsx
index 5f16684fb8..a5d864b140 100644
--- a/src/components/views/spaces/SpaceCreateMenu.tsx
+++ b/src/components/views/spaces/SpaceCreateMenu.tsx
@@ -26,16 +26,14 @@ import createRoom from "../../../createRoom";
import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { SpaceAvatar } from "./SpaceBasicSettings";
import AccessibleButton from "../elements/AccessibleButton";
-import { BetaPill } from "../beta/BetaCard";
-import defaultDispatcher from "../../../dispatcher/dispatcher";
-import { Action } from "../../../dispatcher/actions";
-import { UserTab } from "../dialogs/UserSettingsDialog";
import Field from "../elements/Field";
import withValidation from "../elements/Validation";
-import { SpaceFeedbackPrompt } from "../../structures/SpaceRoomView";
import { Preset } from "matrix-js-sdk/src/@types/partials";
import { ICreateRoomStateEvent } from "matrix-js-sdk/src/@types/requests";
import RoomAliasField from "../elements/RoomAliasField";
+import SdkConfig from "../../../SdkConfig";
+import Modal from "../../../Modal";
+import BetaFeedbackDialog from "../dialogs/BetaFeedbackDialog";
const SpaceCreateMenuType = ({ title, description, className, onClick }) => {
return (
@@ -66,6 +64,26 @@ const nameToAlias = (name: string, domain: string): string => {
return `#${localpart}:${domain}`;
};
+// XXX: Temporary for the Spaces release only
+const SpaceFeedbackPrompt = ({ onClick }: { onClick?: () => void }) => {
+ if (!SdkConfig.get().bug_report_endpoint_url) return null;
+
+ return
+
+
+
{ _t("Spaces are a new feature.") }
+
{
+ if (onClick) onClick();
+ Modal.createTrackedDialog("Beta Feedback", "feature_spaces", BetaFeedbackDialog, {
+ featureId: "feature_spaces",
+ });
+ }}>
+ { _t("Give feedback.") }
+
+
+
;
+};
+
const SpaceCreateMenu = ({ onFinished }) => {
const cli = useContext(MatrixClientContext);
const [visibility, setVisibility] = useState(null);
@@ -252,13 +270,6 @@ const SpaceCreateMenu = ({ onFinished }) => {
managed={false}
>
- {
- onFinished();
- defaultDispatcher.dispatch({
- action: Action.ViewUserSettings,
- initialTabId: UserTab.Labs,
- });
- }} />
{ body }
;
diff --git a/src/components/views/spaces/SpaceSettingsGeneralTab.tsx b/src/components/views/spaces/SpaceSettingsGeneralTab.tsx
index a43b180752..8ee848a28c 100644
--- a/src/components/views/spaces/SpaceSettingsGeneralTab.tsx
+++ b/src/components/views/spaces/SpaceSettingsGeneralTab.tsx
@@ -21,7 +21,6 @@ import { EventType } from "matrix-js-sdk/src/@types/event";
import { _t } from "../../../languageHandler";
import AccessibleButton from "../elements/AccessibleButton";
-import { SpaceFeedbackPrompt } from "../../structures/SpaceRoomView";
import SpaceBasicSettings from "./SpaceBasicSettings";
import { avatarUrlForRoom } from "../../../Avatar";
import { IDialogProps } from "../dialogs/IDialogProps";
@@ -96,8 +95,6 @@ const SpaceSettingsGeneralTab = ({ matrixClient: cli, space, onFinished }: IProp
{ error && { error }
}
-
-
create a new room.": "If you can't find the room you're looking for, ask for an invite or create a new room.",
"Create room": "Create room",
- "Spaces are a beta feature.": "Spaces are a beta feature.",
"Public space": "Public space",
"Private space": "Private space",
" invites you": " invites you",
From 7ccc429beaa1c49d4d94b7f1f68c8b115fd5a53f Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 23 Jul 2021 15:47:11 +0100
Subject: [PATCH 02/11] Change spaces beta feedback to not be so beta-centric
---
res/css/_components.scss | 2 +-
...css => _GenericFeatureFeedbackDialog.scss} | 4 +-
src/components/views/beta/BetaCard.tsx | 2 +
.../views/dialogs/BetaFeedbackDialog.tsx | 98 +++++------------
.../dialogs/GenericFeatureFeedbackDialog.tsx | 101 ++++++++++++++++++
.../views/spaces/SpaceCreateMenu.tsx | 14 ++-
src/i18n/strings/en_EN.json | 17 +--
src/settings/Settings.tsx | 1 +
8 files changed, 151 insertions(+), 88 deletions(-)
rename res/css/views/dialogs/{_BetaFeedbackDialog.scss => _GenericFeatureFeedbackDialog.scss} (90%)
create mode 100644 src/components/views/dialogs/GenericFeatureFeedbackDialog.tsx
diff --git a/res/css/_components.scss b/res/css/_components.scss
index f9e3ab1160..95040ce855 100644
--- a/res/css/_components.scss
+++ b/res/css/_components.scss
@@ -67,7 +67,6 @@
@import "./views/dialogs/_AddExistingToSpaceDialog.scss";
@import "./views/dialogs/_AddressPickerDialog.scss";
@import "./views/dialogs/_Analytics.scss";
-@import "./views/dialogs/_BetaFeedbackDialog.scss";
@import "./views/dialogs/_BugReportDialog.scss";
@import "./views/dialogs/_ChangelogDialog.scss";
@import "./views/dialogs/_ChatCreateOrReuseChatDialog.scss";
@@ -81,6 +80,7 @@
@import "./views/dialogs/_EditCommunityPrototypeDialog.scss";
@import "./views/dialogs/_FeedbackDialog.scss";
@import "./views/dialogs/_ForwardDialog.scss";
+@import "./views/dialogs/_GenericFeatureFeedbackDialog.scss";
@import "./views/dialogs/_GroupAddressPicker.scss";
@import "./views/dialogs/_HostSignupDialog.scss";
@import "./views/dialogs/_IncomingSasDialog.scss";
diff --git a/res/css/views/dialogs/_BetaFeedbackDialog.scss b/res/css/views/dialogs/_GenericFeatureFeedbackDialog.scss
similarity index 90%
rename from res/css/views/dialogs/_BetaFeedbackDialog.scss
rename to res/css/views/dialogs/_GenericFeatureFeedbackDialog.scss
index 9f5f6b512e..f83eed9c53 100644
--- a/res/css/views/dialogs/_BetaFeedbackDialog.scss
+++ b/res/css/views/dialogs/_GenericFeatureFeedbackDialog.scss
@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-.mx_BetaFeedbackDialog {
- .mx_BetaFeedbackDialog_subheading {
+.mx_GenericFeatureFeedbackDialog {
+ .mx_GenericFeatureFeedbackDialog_subheading {
color: $primary-fg-color;
font-size: $font-14px;
line-height: $font-20px;
diff --git a/src/components/views/beta/BetaCard.tsx b/src/components/views/beta/BetaCard.tsx
index ec662d831b..c2ba869ab4 100644
--- a/src/components/views/beta/BetaCard.tsx
+++ b/src/components/views/beta/BetaCard.tsx
@@ -27,6 +27,8 @@ import BetaFeedbackDialog from "../dialogs/BetaFeedbackDialog";
import SdkConfig from "../../../SdkConfig";
import SettingsFlag from "../elements/SettingsFlag";
+// XXX: Keep this around for re-use in future Betas
+
interface IProps {
title?: string;
featureId: string;
diff --git a/src/components/views/dialogs/BetaFeedbackDialog.tsx b/src/components/views/dialogs/BetaFeedbackDialog.tsx
index 917004dbc7..788832119f 100644
--- a/src/components/views/dialogs/BetaFeedbackDialog.tsx
+++ b/src/components/views/dialogs/BetaFeedbackDialog.tsx
@@ -14,22 +14,18 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-import React, { useState } from "react";
+import React from "react";
-import QuestionDialog from './QuestionDialog';
import { _t } from '../../../languageHandler';
-import Field from "../elements/Field";
-import SdkConfig from "../../../SdkConfig";
import { IDialogProps } from "./IDialogProps";
import SettingsStore from "../../../settings/SettingsStore";
-import { submitFeedback } from "../../../rageshake/submit-rageshake";
-import StyledCheckbox from "../elements/StyledCheckbox";
-import Modal from "../../../Modal";
-import InfoDialog from "./InfoDialog";
import AccessibleButton from "../elements/AccessibleButton";
import defaultDispatcher from "../../../dispatcher/dispatcher";
import { Action } from "../../../dispatcher/actions";
import { UserTab } from "./UserSettingsDialog";
+import GenericFeatureFeedbackDialog from "./FeedbackDialog";
+
+// XXX: Keep this around for re-use in future Betas
interface IProps extends IDialogProps {
featureId: string;
@@ -38,74 +34,28 @@ interface IProps extends IDialogProps {
const BetaFeedbackDialog: React.FC = ({ featureId, onFinished }) => {
const info = SettingsStore.getBetaInfo(featureId);
- const [comment, setComment] = useState("");
- const [canContact, setCanContact] = useState(false);
+ const extraData = SettingsStore.getBetaInfo(featureId)?.extraSettings.reduce((o, k) => {
+ o[k] = SettingsStore.getValue(k);
+ return o;
+ }, {});
- const sendFeedback = async (ok: boolean) => {
- if (!ok) return onFinished(false);
-
- const extraData = SettingsStore.getBetaInfo(featureId)?.extraSettings.reduce((o, k) => {
- o[k] = SettingsStore.getValue(k);
- return o;
- }, {});
-
- submitFeedback(SdkConfig.get().bug_report_endpoint_url, info.feedbackLabel, comment, canContact, extraData);
- onFinished(true);
-
- Modal.createTrackedDialog("Beta Dialog Sent", featureId, InfoDialog, {
- title: _t("Beta feedback"),
- description: _t("Thank you for your feedback, we really appreciate it."),
- button: _t("Done"),
- hasCloseButton: false,
- fixedWidth: false,
- });
- };
-
- return (
-
- { _t(info.feedbackSubheading) }
-
- { _t("Your platform and username will be noted to help us use your feedback as much as we can.") }
-
-
{
- onFinished(false);
- defaultDispatcher.dispatch({
- action: Action.ViewUserSettings,
- initialTabId: UserTab.Labs,
- });
- }}>
- { _t("To leave the beta, visit your settings.") }
-
-
-
-
) }
-
Date: Fri, 23 Jul 2021 15:56:00 +0100
Subject: [PATCH 04/11] remove unused import and revert removing some needed
css
---
res/css/structures/_SpaceRoomView.scss | 57 -------------------
res/css/views/spaces/_SpaceCreateMenu.scss | 63 +++++++++++++++++++++
src/components/structures/SpaceRoomView.tsx | 1 -
3 files changed, 63 insertions(+), 58 deletions(-)
diff --git a/res/css/structures/_SpaceRoomView.scss b/res/css/structures/_SpaceRoomView.scss
index ca97262742..d4b164a03e 100644
--- a/res/css/structures/_SpaceRoomView.scss
+++ b/res/css/structures/_SpaceRoomView.scss
@@ -503,60 +503,3 @@ $SpaceRoomViewInnerWidth: 428px;
}
}
}
-
-.mx_SpaceFeedbackPrompt {
- margin-top: 18px;
- margin-bottom: 12px;
-
- > div {
- display: flex;
- flex-direction: row;
- font-size: $font-15px;
- line-height: $font-24px;
-
- > span {
- color: $secondary-fg-color;
- position: relative;
- padding-left: 32px;
- font-size: inherit;
- line-height: inherit;
- margin-right: auto;
-
- &::before {
- content: '';
- position: absolute;
- left: 0;
- top: 2px;
- height: 20px;
- width: 20px;
- background-color: $secondary-fg-color;
- mask-repeat: no-repeat;
- mask-size: contain;
- mask-image: url('$(res)/img/element-icons/room/room-summary.svg');
- mask-position: center;
- }
- }
-
- .mx_AccessibleButton_kind_link {
- color: $accent-color;
- position: relative;
- padding: 0 0 0 24px;
- margin-left: 8px;
- font-size: inherit;
- line-height: inherit;
-
- &::before {
- content: '';
- position: absolute;
- left: 0;
- height: 16px;
- width: 16px;
- background-color: $accent-color;
- mask-repeat: no-repeat;
- mask-size: contain;
- mask-image: url('$(res)/img/element-icons/chat-bubbles.svg');
- mask-position: center;
- }
- }
- }
-}
diff --git a/res/css/views/spaces/_SpaceCreateMenu.scss b/res/css/views/spaces/_SpaceCreateMenu.scss
index 88b9d8f693..7ed71e454c 100644
--- a/res/css/views/spaces/_SpaceCreateMenu.scss
+++ b/res/css/views/spaces/_SpaceCreateMenu.scss
@@ -99,3 +99,66 @@ $spacePanelWidth: 71px;
}
}
}
+
+.mx_SpaceFeedbackPrompt {
+ margin-top: 18px;
+ margin-bottom: 12px;
+
+ > hr {
+ border: none;
+ border-top: 1px solid $input-border-color;
+ margin-bottom: 12px;
+ }
+
+ > div {
+ display: flex;
+ flex-direction: row;
+ font-size: $font-15px;
+ line-height: $font-24px;
+
+ > span {
+ color: $secondary-fg-color;
+ position: relative;
+ padding-left: 32px;
+ font-size: inherit;
+ line-height: inherit;
+ margin-right: auto;
+
+ &::before {
+ content: '';
+ position: absolute;
+ left: 0;
+ top: 2px;
+ height: 20px;
+ width: 20px;
+ background-color: $secondary-fg-color;
+ mask-repeat: no-repeat;
+ mask-size: contain;
+ mask-image: url('$(res)/img/element-icons/room/room-summary.svg');
+ mask-position: center;
+ }
+ }
+
+ .mx_AccessibleButton_kind_link {
+ color: $accent-color;
+ position: relative;
+ padding: 0 0 0 24px;
+ margin-left: 8px;
+ font-size: inherit;
+ line-height: inherit;
+
+ &::before {
+ content: '';
+ position: absolute;
+ left: 0;
+ height: 16px;
+ width: 16px;
+ background-color: $accent-color;
+ mask-repeat: no-repeat;
+ mask-size: contain;
+ mask-image: url('$(res)/img/element-icons/chat-bubbles.svg');
+ mask-position: center;
+ }
+ }
+ }
+}
diff --git a/src/components/structures/SpaceRoomView.tsx b/src/components/structures/SpaceRoomView.tsx
index 1187a16d17..4e278b49e0 100644
--- a/src/components/structures/SpaceRoomView.tsx
+++ b/src/components/structures/SpaceRoomView.tsx
@@ -64,7 +64,6 @@ import { BetaPill } from "../views/beta/BetaCard";
import { UserTab } from "../views/dialogs/UserSettingsDialog";
import Modal from "../../Modal";
import BetaFeedbackDialog from "../views/dialogs/BetaFeedbackDialog";
-import SdkConfig from "../../SdkConfig";
import { EffectiveMembership, getEffectiveMembership } from "../../utils/membership";
interface IProps {
From 05a9023bac835b8ca114a78c1eeef0739cc55057 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 23 Jul 2021 18:31:31 +0100
Subject: [PATCH 05/11] delint and tidy code
---
.../views/dialogs/BetaFeedbackDialog.tsx | 9 ++----
.../views/spaces/SpaceCreateMenu.tsx | 30 +++++++++++--------
2 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/src/components/views/dialogs/BetaFeedbackDialog.tsx b/src/components/views/dialogs/BetaFeedbackDialog.tsx
index 788832119f..98b228082a 100644
--- a/src/components/views/dialogs/BetaFeedbackDialog.tsx
+++ b/src/components/views/dialogs/BetaFeedbackDialog.tsx
@@ -34,17 +34,14 @@ interface IProps extends IDialogProps {
const BetaFeedbackDialog: React.FC = ({ featureId, onFinished }) => {
const info = SettingsStore.getBetaInfo(featureId);
- const extraData = SettingsStore.getBetaInfo(featureId)?.extraSettings.reduce((o, k) => {
- o[k] = SettingsStore.getValue(k);
- return o;
- }, {});
-
return {
+ return SettingsStore.getValue(k);
+ }))}
>
{
onFinished(false);
diff --git a/src/components/views/spaces/SpaceCreateMenu.tsx b/src/components/views/spaces/SpaceCreateMenu.tsx
index 279ae1165b..ee01984db0 100644
--- a/src/components/views/spaces/SpaceCreateMenu.tsx
+++ b/src/components/views/spaces/SpaceCreateMenu.tsx
@@ -73,19 +73,23 @@ const SpaceFeedbackPrompt = ({ onClick }: { onClick?: () => void }) => {
{ _t("Spaces are a new feature.") }
-
{
- if (onClick) onClick();
- Modal.createTrackedDialog("Spaces Feedback", "", GenericFeatureFeedbackDialog, {
- title: _t("Spaces feedback"),
- subheading: _t("Thank you for trying Spaces. Your feedback will help inform the next versions."),
- rageshakeLabel: "spaces-feedback",
- rageshakeData: {
- "feature_spaces.all_rooms": SettingsStore.getValue("feature_spaces.all_rooms"),
- "feature_spaces.space_member_dms": SettingsStore.getValue("feature_spaces.space_member_dms"),
- "feature_spaces.space_dm_badges": SettingsStore.getValue("feature_spaces.space_dm_badges"),
- },
- });
- }}>
+ {
+ if (onClick) onClick();
+ Modal.createTrackedDialog("Spaces Feedback", "", GenericFeatureFeedbackDialog, {
+ title: _t("Spaces feedback"),
+ subheading: _t("Thank you for trying Spaces. " +
+ "Your feedback will help inform the next versions."),
+ rageshakeLabel: "spaces-feedback",
+ rageshakeData: Object.fromEntries([
+ "feature_spaces.all_rooms",
+ "feature_spaces.space_member_dms",
+ "feature_spaces.space_dm_badges",
+ ].map(k => [k, SettingsStore.getValue(k)])),
+ });
+ }}
+ >
{ _t("Give feedback.") }
From c8d92943501373c520460e688ba25cc8016dcdfa Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 23 Jul 2021 18:40:22 +0100
Subject: [PATCH 06/11] Discard unused utility now that we use
Object.fromEntries
---
src/utils/objects.ts | 18 ------------------
test/utils/arrays-test.ts | 3 +--
test/utils/objects-test.ts | 18 ------------------
3 files changed, 1 insertion(+), 38 deletions(-)
diff --git a/src/utils/objects.ts b/src/utils/objects.ts
index c2ee6ce100..e3b7b6cf59 100644
--- a/src/utils/objects.ts
+++ b/src/utils/objects.ts
@@ -141,21 +141,3 @@ export function objectKeyChanges(a: O, b: O): (keyof O)[] {
export function objectClone(obj: O): O {
return JSON.parse(JSON.stringify(obj));
}
-
-/**
- * Converts a series of entries to an object.
- * @param entries The entries to convert.
- * @returns The converted object.
- */
-// NOTE: Deprecated once we have Object.fromEntries() support.
-// @ts-ignore - return type is complaining about non-string keys, but we know better
-export function objectFromEntries(entries: Iterable<[K, V]>): {[k: K]: V} {
- const obj: {
- // @ts-ignore - same as return type
- [k: K]: V;} = {};
- for (const e of entries) {
- // @ts-ignore - same as return type
- obj[e[0]] = e[1];
- }
- return obj;
-}
diff --git a/test/utils/arrays-test.ts b/test/utils/arrays-test.ts
index cf9a5f0089..277260bf29 100644
--- a/test/utils/arrays-test.ts
+++ b/test/utils/arrays-test.ts
@@ -29,7 +29,6 @@ import {
ArrayUtil,
GroupedArray,
} from "../../src/utils/arrays";
-import { objectFromEntries } from "../../src/utils/objects";
function expectSample(i: number, input: number[], expected: number[], smooth = false) {
console.log(`Resample case index: ${i}`); // for debugging test failures
@@ -336,7 +335,7 @@ describe('arrays', () => {
expect(result).toBeDefined();
expect(result.value).toBeDefined();
- const asObject = objectFromEntries(result.value.entries());
+ const asObject = Object.fromEntries(result.value.entries());
expect(asObject).toMatchObject(output);
});
});
diff --git a/test/utils/objects-test.ts b/test/utils/objects-test.ts
index 154fa3604f..b360fbd1d1 100644
--- a/test/utils/objects-test.ts
+++ b/test/utils/objects-test.ts
@@ -18,7 +18,6 @@ import {
objectClone,
objectDiff,
objectExcluding,
- objectFromEntries,
objectHasDiff,
objectKeyChanges,
objectShallowClone,
@@ -242,21 +241,4 @@ describe('objects', () => {
expect(result.test.third).not.toBe(a.test.third);
});
});
-
- describe('objectFromEntries', () => {
- it('should create an object from an array of entries', () => {
- const output = { a: 1, b: 2, c: 3 };
- const result = objectFromEntries(Object.entries(output));
- expect(result).toBeDefined();
- expect(result).toMatchObject(output);
- });
-
- it('should maintain pointers in values', () => {
- const output = { a: {}, b: 2, c: 3 };
- const result = objectFromEntries(Object.entries(output));
- expect(result).toBeDefined();
- expect(result).toMatchObject(output);
- expect(result['a']).toBe(output.a);
- });
- });
});
From 70d8378a66a5842bdf88506e379434d02ca1dabc Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 23 Jul 2021 18:50:25 +0100
Subject: [PATCH 07/11] delint
---
src/components/structures/SpaceRoomView.tsx | 13 ++++++++-----
.../views/dialogs/BetaFeedbackDialog.tsx | 17 ++++++++++-------
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/components/structures/SpaceRoomView.tsx b/src/components/structures/SpaceRoomView.tsx
index 4e278b49e0..7a1d501767 100644
--- a/src/components/structures/SpaceRoomView.tsx
+++ b/src/components/structures/SpaceRoomView.tsx
@@ -395,11 +395,14 @@ const SpaceLanding = ({ space }) => {
return
{ _t("Spaces are a new feature.") }
-
{
- Modal.createTrackedDialog("Beta Feedback", "feature_spaces", BetaFeedbackDialog, {
- featureId: "feature_spaces",
- });
- }}>
+ {
+ Modal.createTrackedDialog("Beta Feedback", "feature_spaces", BetaFeedbackDialog, {
+ featureId: "feature_spaces",
+ });
+ }}
+ >
{ _t("Give feedback.") }
diff --git a/src/components/views/dialogs/BetaFeedbackDialog.tsx b/src/components/views/dialogs/BetaFeedbackDialog.tsx
index 98b228082a..d4fa618464 100644
--- a/src/components/views/dialogs/BetaFeedbackDialog.tsx
+++ b/src/components/views/dialogs/BetaFeedbackDialog.tsx
@@ -43,13 +43,16 @@ const BetaFeedbackDialog: React.FC
= ({ featureId, onFinished }) => {
return SettingsStore.getValue(k);
}))}
>
- {
- onFinished(false);
- defaultDispatcher.dispatch({
- action: Action.ViewUserSettings,
- initialTabId: UserTab.Labs,
- });
- }}>
+ {
+ onFinished(false);
+ defaultDispatcher.dispatch({
+ action: Action.ViewUserSettings,
+ initialTabId: UserTab.Labs,
+ });
+ }}
+ >
{ _t("To leave the beta, visit your settings.") }
;
From 64e3c72f657cba0e380c8b84585fcce03f81abf0 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 23 Jul 2021 18:51:27 +0100
Subject: [PATCH 08/11] Fix bad import due to naming clash
---
src/components/views/dialogs/BetaFeedbackDialog.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/views/dialogs/BetaFeedbackDialog.tsx b/src/components/views/dialogs/BetaFeedbackDialog.tsx
index d4fa618464..c5fba52b51 100644
--- a/src/components/views/dialogs/BetaFeedbackDialog.tsx
+++ b/src/components/views/dialogs/BetaFeedbackDialog.tsx
@@ -23,7 +23,7 @@ import AccessibleButton from "../elements/AccessibleButton";
import defaultDispatcher from "../../../dispatcher/dispatcher";
import { Action } from "../../../dispatcher/actions";
import { UserTab } from "./UserSettingsDialog";
-import GenericFeatureFeedbackDialog from "./FeedbackDialog";
+import GenericFeatureFeedbackDialog from "./GenericFeatureFeedbackDialog";
// XXX: Keep this around for re-use in future Betas
From a5606c72de1383069c8846218fd61b5e6164f453 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Wed, 28 Jul 2021 17:56:57 +0100
Subject: [PATCH 09/11] Update feedback prompt to match designs
---
res/css/structures/_SpaceRoomView.scss | 12 +---
res/css/views/spaces/_SpaceCreateMenu.scss | 70 +++++--------------
src/components/structures/SpaceRoomView.tsx | 17 +----
.../views/spaces/SpaceCreateMenu.tsx | 45 ++++++------
4 files changed, 42 insertions(+), 102 deletions(-)
diff --git a/res/css/structures/_SpaceRoomView.scss b/res/css/structures/_SpaceRoomView.scss
index f8c0a5c262..58a4b426c2 100644
--- a/res/css/structures/_SpaceRoomView.scss
+++ b/res/css/structures/_SpaceRoomView.scss
@@ -340,18 +340,12 @@ $SpaceRoomViewInnerWidth: 428px;
flex: 0;
}
- .mx_SpaceFeedbackPrompt_topRight {
+ .mx_SpaceFeedbackPrompt {
padding: 7px; // 8px - 1px border
border: 1px solid $menu-border-color;
border-radius: 8px;
- color: $secondary-fg-color;
- font-size: $font-15px;
- line-height: $font-24px;
- float: right;
-
- & + .mx_BaseAvatar {
- clear: both;
- }
+ width: max-content;
+ margin: 0 0 -40px auto; // collapse its own height to not push other components down
}
.mx_SpaceRoomDirectory_list {
diff --git a/res/css/views/spaces/_SpaceCreateMenu.scss b/res/css/views/spaces/_SpaceCreateMenu.scss
index 7ed71e454c..e44e16916f 100644
--- a/res/css/views/spaces/_SpaceCreateMenu.scss
+++ b/res/css/views/spaces/_SpaceCreateMenu.scss
@@ -104,61 +104,23 @@ $spacePanelWidth: 71px;
margin-top: 18px;
margin-bottom: 12px;
- > hr {
- border: none;
- border-top: 1px solid $input-border-color;
- margin-bottom: 12px;
+ font-size: $font-15px;
+ line-height: $font-24px;
+
+ > span {
+ color: $secondary-fg-color;
+ position: relative;
+ font-size: inherit;
+ line-height: inherit;
+ margin-right: auto;
}
- > div {
- display: flex;
- flex-direction: row;
- font-size: $font-15px;
- line-height: $font-24px;
-
- > span {
- color: $secondary-fg-color;
- position: relative;
- padding-left: 32px;
- font-size: inherit;
- line-height: inherit;
- margin-right: auto;
-
- &::before {
- content: '';
- position: absolute;
- left: 0;
- top: 2px;
- height: 20px;
- width: 20px;
- background-color: $secondary-fg-color;
- mask-repeat: no-repeat;
- mask-size: contain;
- mask-image: url('$(res)/img/element-icons/room/room-summary.svg');
- mask-position: center;
- }
- }
-
- .mx_AccessibleButton_kind_link {
- color: $accent-color;
- position: relative;
- padding: 0 0 0 24px;
- margin-left: 8px;
- font-size: inherit;
- line-height: inherit;
-
- &::before {
- content: '';
- position: absolute;
- left: 0;
- height: 16px;
- width: 16px;
- background-color: $accent-color;
- mask-repeat: no-repeat;
- mask-size: contain;
- mask-image: url('$(res)/img/element-icons/chat-bubbles.svg');
- mask-position: center;
- }
- }
+ .mx_AccessibleButton_kind_link {
+ color: $accent-color;
+ position: relative;
+ padding: 0;
+ margin-left: 8px;
+ font-size: inherit;
+ line-height: inherit;
}
}
diff --git a/src/components/structures/SpaceRoomView.tsx b/src/components/structures/SpaceRoomView.tsx
index 7a1d501767..b47eb12c74 100644
--- a/src/components/structures/SpaceRoomView.tsx
+++ b/src/components/structures/SpaceRoomView.tsx
@@ -62,9 +62,8 @@ import IconizedContextMenu, {
import AccessibleTooltipButton from "../views/elements/AccessibleTooltipButton";
import { BetaPill } from "../views/beta/BetaCard";
import { UserTab } from "../views/dialogs/UserSettingsDialog";
-import Modal from "../../Modal";
-import BetaFeedbackDialog from "../views/dialogs/BetaFeedbackDialog";
import { EffectiveMembership, getEffectiveMembership } from "../../utils/membership";
+import { SpaceFeedbackPrompt } from "../views/spaces/SpaceCreateMenu";
interface IProps {
space: Room;
@@ -393,19 +392,7 @@ const SpaceLanding = ({ space }) => {
};
return
-
- { _t("Spaces are a new feature.") }
-
{
- Modal.createTrackedDialog("Beta Feedback", "feature_spaces", BetaFeedbackDialog, {
- featureId: "feature_spaces",
- });
- }}
- >
- { _t("Give feedback.") }
-
-
+
diff --git a/src/components/views/spaces/SpaceCreateMenu.tsx b/src/components/views/spaces/SpaceCreateMenu.tsx
index ee01984db0..86999547b7 100644
--- a/src/components/views/spaces/SpaceCreateMenu.tsx
+++ b/src/components/views/spaces/SpaceCreateMenu.tsx
@@ -66,33 +66,30 @@ const nameToAlias = (name: string, domain: string): string => {
};
// XXX: Temporary for the Spaces release only
-const SpaceFeedbackPrompt = ({ onClick }: { onClick?: () => void }) => {
+export const SpaceFeedbackPrompt = ({ onClick }: { onClick?: () => void }) => {
if (!SdkConfig.get().bug_report_endpoint_url) return null;
return
-
-
-
{ _t("Spaces are a new feature.") }
-
{
- if (onClick) onClick();
- Modal.createTrackedDialog("Spaces Feedback", "", GenericFeatureFeedbackDialog, {
- title: _t("Spaces feedback"),
- subheading: _t("Thank you for trying Spaces. " +
- "Your feedback will help inform the next versions."),
- rageshakeLabel: "spaces-feedback",
- rageshakeData: Object.fromEntries([
- "feature_spaces.all_rooms",
- "feature_spaces.space_member_dms",
- "feature_spaces.space_dm_badges",
- ].map(k => [k, SettingsStore.getValue(k)])),
- });
- }}
- >
- { _t("Give feedback.") }
-
-
+
{ _t("Spaces are a new feature.") }
+
{
+ if (onClick) onClick();
+ Modal.createTrackedDialog("Spaces Feedback", "", GenericFeatureFeedbackDialog, {
+ title: _t("Spaces feedback"),
+ subheading: _t("Thank you for trying Spaces. " +
+ "Your feedback will help inform the next versions."),
+ rageshakeLabel: "spaces-feedback",
+ rageshakeData: Object.fromEntries([
+ "feature_spaces.all_rooms",
+ "feature_spaces.space_member_dms",
+ "feature_spaces.space_dm_badges",
+ ].map(k => [k, SettingsStore.getValue(k)])),
+ });
+ }}
+ >
+ { _t("Give feedback.") }
+
;
};
From f69b4549dde14ef93488202baca45f9bef26ab45 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Thu, 29 Jul 2021 15:13:02 +0100
Subject: [PATCH 10/11] Re-add top border stroke in space create menu
---
res/css/views/spaces/_SpaceCreateMenu.scss | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/res/css/views/spaces/_SpaceCreateMenu.scss b/res/css/views/spaces/_SpaceCreateMenu.scss
index e44e16916f..097b2b648e 100644
--- a/res/css/views/spaces/_SpaceCreateMenu.scss
+++ b/res/css/views/spaces/_SpaceCreateMenu.scss
@@ -43,6 +43,12 @@ $spacePanelWidth: 71px;
color: $secondary-fg-color;
margin: 0;
}
+
+ .mx_SpaceFeedbackPrompt {
+ border-top: 1px solid $input-border-color;
+ padding-top: 12px;
+ margin-top: 16px;
+ }
}
// XXX remove this when spaces leaves Beta
@@ -101,9 +107,6 @@ $spacePanelWidth: 71px;
}
.mx_SpaceFeedbackPrompt {
- margin-top: 18px;
- margin-bottom: 12px;
-
font-size: $font-15px;
line-height: $font-24px;
From af851f7f449f9596a8a93df3e7ee0a4f8627b4c7 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Thu, 29 Jul 2021 15:24:42 +0100
Subject: [PATCH 11/11] fix merge conflict resolution issue
---
src/components/views/dialogs/AddExistingSubspaceDialog.tsx | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/components/views/dialogs/AddExistingSubspaceDialog.tsx b/src/components/views/dialogs/AddExistingSubspaceDialog.tsx
index a6dbf9dd42..7fef2c2d9d 100644
--- a/src/components/views/dialogs/AddExistingSubspaceDialog.tsx
+++ b/src/components/views/dialogs/AddExistingSubspaceDialog.tsx
@@ -21,7 +21,6 @@ import { _t } from '../../../languageHandler';
import BaseDialog from "./BaseDialog";
import AccessibleButton from "../elements/AccessibleButton";
import MatrixClientContext from "../../../contexts/MatrixClientContext";
-import { SpaceFeedbackPrompt } from "../../structures/SpaceRoomView";
import { AddExistingToSpace, defaultSpacesRenderer, SubspaceSelector } from "./AddExistingToSpaceDialog";
interface IProps {
@@ -61,8 +60,6 @@ const AddExistingSubspaceDialog: React.FC = ({ space, onCreateSubspaceCl
spacesRenderer={defaultSpacesRenderer}
/>
-
- onFinished(false)} />
;
};