From 36ef9ec341cb352b1e0a04ed45c954324c21690c Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Mon, 9 Nov 2020 14:21:45 +0000
Subject: [PATCH 1/2] Update styling of the Analytics toast to try and decrease
number of users blindly pressing No
---
res/css/_components.scss | 1 +
src/components/structures/ToastContainer.tsx | 4 ++--
src/i18n/strings/en_EN.json | 3 +--
src/stores/ToastStore.ts | 1 +
src/toasts/AnalyticsToast.tsx | 3 ++-
5 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/res/css/_components.scss b/res/css/_components.scss
index 37d0e0d286..ae4b4b23fe 100644
--- a/res/css/_components.scss
+++ b/res/css/_components.scss
@@ -225,6 +225,7 @@
@import "./views/settings/tabs/user/_SecurityUserSettingsTab.scss";
@import "./views/settings/tabs/user/_VoiceUserSettingsTab.scss";
@import "./views/terms/_InlineTermsAgreement.scss";
+@import "./views/toasts/_AnalyticsToast.scss";
@import "./views/toasts/_NonUrgentEchoFailureToast.scss";
@import "./views/verification/_VerificationShowSas.scss";
@import "./views/voip/_CallContainer.scss";
diff --git a/src/components/structures/ToastContainer.tsx b/src/components/structures/ToastContainer.tsx
index 84473031fa..513cca82c3 100644
--- a/src/components/structures/ToastContainer.tsx
+++ b/src/components/structures/ToastContainer.tsx
@@ -55,11 +55,11 @@ export default class ToastContainer extends React.Component<{}, IState> {
let toast;
if (totalCount !== 0) {
const topToast = this.state.toasts[0];
- const {title, icon, key, component, props} = topToast;
+ const {title, icon, key, component, className, props} = topToast;
const toastClasses = classNames("mx_Toast_toast", {
"mx_Toast_hasIcon": icon,
[`mx_Toast_icon_${icon}`]: icon,
- });
+ }, className);
let countIndicator;
if (isStacked || this.state.countSeen > 0) {
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index a56e22e5fc..bf07193acf 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -397,7 +397,7 @@
"Unknown App": "Unknown App",
"Help us improve %(brand)s": "Help us improve %(brand)s",
"Send anonymous usage data which helps us improve %(brand)s. This will use a cookie.": "Send anonymous usage data which helps us improve %(brand)s. This will use a cookie.",
- "I want to help": "I want to help",
+ "Yes": "Yes",
"No": "No",
"Review where you’re logged in": "Review where you’re logged in",
"Verify all your sessions to ensure your account & messages are safe": "Verify all your sessions to ensure your account & messages are safe",
@@ -1355,7 +1355,6 @@
"Verify by emoji": "Verify by emoji",
"Almost there! Is your other session showing the same shield?": "Almost there! Is your other session showing the same shield?",
"Almost there! Is %(displayName)s showing the same shield?": "Almost there! Is %(displayName)s showing the same shield?",
- "Yes": "Yes",
"Verify all users in a room to ensure it's secure.": "Verify all users in a room to ensure it's secure.",
"In encrypted rooms, verify all users to ensure it’s secure.": "In encrypted rooms, verify all users to ensure it’s secure.",
"You've successfully verified your device!": "You've successfully verified your device!",
diff --git a/src/stores/ToastStore.ts b/src/stores/ToastStore.ts
index 038aebc7c9..850c3cb026 100644
--- a/src/stores/ToastStore.ts
+++ b/src/stores/ToastStore.ts
@@ -25,6 +25,7 @@ export interface IToast {
title: string;
icon?: string;
component: C;
+ className?: string;
props?: Omit, "toastKey">; // toastKey is injected by ToastContainer
}
diff --git a/src/toasts/AnalyticsToast.tsx b/src/toasts/AnalyticsToast.tsx
index e0eda5fa48..5a7737b1a6 100644
--- a/src/toasts/AnalyticsToast.tsx
+++ b/src/toasts/AnalyticsToast.tsx
@@ -64,12 +64,13 @@ export const showToast = (policyUrl?: string) => {
) : sub,
},
),
- acceptLabel: _t("I want to help"),
+ acceptLabel: _t("Yes"),
onAccept,
rejectLabel: _t("No"),
onReject,
},
component: GenericToast,
+ className: "mx_AnalyticsToast",
priority: 10,
});
};
From 5dd0766d35ff658dac984479bdbe93f12acb1d6c Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Mon, 9 Nov 2020 14:36:12 +0000
Subject: [PATCH 2/2] Add missing scss file
---
res/css/views/toasts/_AnalyticsToast.scss | 27 +++++++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100644 res/css/views/toasts/_AnalyticsToast.scss
diff --git a/res/css/views/toasts/_AnalyticsToast.scss b/res/css/views/toasts/_AnalyticsToast.scss
new file mode 100644
index 0000000000..fdbe7f1c76
--- /dev/null
+++ b/res/css/views/toasts/_AnalyticsToast.scss
@@ -0,0 +1,27 @@
+/*
+Copyright 2020 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.
+*/
+
+.mx_AnalyticsToast {
+ .mx_AccessibleButton_kind_danger {
+ background: none;
+ color: $accent-color;
+ }
+
+ .mx_AccessibleButton_kind_primary {
+ background: $accent-color;
+ color: #ffffff;
+ }
+}