From 7396ce76e559bb4c3849d163847de708f31a7a92 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 11 May 2021 17:30:33 +0100 Subject: [PATCH] Tweak the feedbacks a tad --- res/css/_components.scss | 1 + res/css/structures/_SpaceRoomView.scss | 13 +++++- .../views/dialogs/_BetaFeedbackDialog.scss | 30 ++++++++++++ .../views/dialogs/BetaFeedbackDialog.tsx | 46 +++++++++++++++++-- src/i18n/strings/en_EN.json | 10 ++-- src/rageshake/submit-rageshake.ts | 4 +- 6 files changed, 93 insertions(+), 11 deletions(-) create mode 100644 res/css/views/dialogs/_BetaFeedbackDialog.scss diff --git a/res/css/_components.scss b/res/css/_components.scss index e6c55c0250..d8e5247f9d 100644 --- a/res/css/_components.scss +++ b/res/css/_components.scss @@ -63,6 +63,7 @@ @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"; diff --git a/res/css/structures/_SpaceRoomView.scss b/res/css/structures/_SpaceRoomView.scss index 3f8a2c5d58..503fe72414 100644 --- a/res/css/structures/_SpaceRoomView.scss +++ b/res/css/structures/_SpaceRoomView.scss @@ -339,6 +339,15 @@ $SpaceRoomViewInnerWidth: 428px; .mx_SearchBox { margin: 0 0 20px; } + + .mx_SpaceFeedbackPrompt { + margin-bottom: 16px; + + // hide the HR as we have our own + & + hr { + display: none; + } + } } .mx_SpaceRoomView_privateScope { @@ -495,7 +504,7 @@ $SpaceRoomViewInnerWidth: 428px; } .mx_AccessibleButton_kind_link { - color: $accent-color-alt; + color: $accent-color; position: relative; padding: 0 0 0 24px; margin-left: 8px; @@ -508,7 +517,7 @@ $SpaceRoomViewInnerWidth: 428px; left: 0; height: 16px; width: 16px; - background-color: $accent-color-alt; + background-color: $accent-color; mask-repeat: no-repeat; mask-size: contain; mask-image: url('$(res)/img/element-icons/chat-bubbles.svg'); diff --git a/res/css/views/dialogs/_BetaFeedbackDialog.scss b/res/css/views/dialogs/_BetaFeedbackDialog.scss new file mode 100644 index 0000000000..fe3df01986 --- /dev/null +++ b/res/css/views/dialogs/_BetaFeedbackDialog.scss @@ -0,0 +1,30 @@ +/* +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. +*/ + +.mx_BetaFeedbackDialog { + .mx_BetaFeedbackDialog_subheading { + color: $secondary-fg-color; + font-size: $font-14px; + line-height: $font-20px; + margin-bottom: 24px; + } + + .mx_AccessibleButton_kind_link { + padding: 0; + font-size: inherit; + line-height: inherit; + } +} diff --git a/src/components/views/dialogs/BetaFeedbackDialog.tsx b/src/components/views/dialogs/BetaFeedbackDialog.tsx index 702adc8fb1..119799c609 100644 --- a/src/components/views/dialogs/BetaFeedbackDialog.tsx +++ b/src/components/views/dialogs/BetaFeedbackDialog.tsx @@ -23,6 +23,13 @@ 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 {USER_LABS_TAB} from "./UserSettingsDialog"; interface IProps extends IDialogProps { featureId: string; @@ -32,25 +39,47 @@ const BetaFeedbackDialog: React.FC = ({featureId, onFinished}) => { const info = SettingsStore.getBetaInfo(featureId); const [comment, setComment] = useState(""); + const [canContact, setCanContact] = useState(false); const sendFeedback = async (ok: boolean) => { if (!ok) return onFinished(false); - submitFeedback(SdkConfig.get().bug_report_endpoint_url, info.feedbackLabel, comment); + submitFeedback(SdkConfig.get().bug_report_endpoint_url, info.feedbackLabel, comment, canContact); 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(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: USER_LABS_TAB, + }); + }}> + { _t("To leave the beta, visit your settings.") } + +
= ({featureId, onFinished}) => { setComment(ev.target.value); }} /> + + setCanContact((e.target as HTMLInputElement).checked)} + > + { _t("You may contact me if you have any follow up questions") } + } button={_t("Send feedback")} buttonDisabled={!comment} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 96cc245c7a..b5d402132e 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2065,8 +2065,11 @@ "Invite anyway": "Invite anyway", "Close dialog": "Close dialog", "Beta feedback": "Beta feedback", - "Add comment": "Add comment", - "Comment": "Comment", + "Thank you for your feedback, we really appreciate it.": "Thank you for your feedback, we really appreciate it.", + "Your platform and username will be noted to help us use your feedback as much as we can.": "Your platform and username will be noted to help us use your feedback as much as we can.", + "To leave the beta, visit your settings.": "To leave the beta, visit your settings.", + "Feedback": "Feedback", + "You may contact me if you have any follow up questions": "You may contact me if you have any follow up questions", "Send feedback": "Send feedback", "Please tell us what went wrong or, better, create a GitHub issue that describes the problem.": "Please tell us what went wrong or, better, create a GitHub issue that describes the problem.", "Preparing to send logs": "Preparing to send logs", @@ -2194,9 +2197,10 @@ "Rate %(brand)s": "Rate %(brand)s", "Tell us below how you feel about %(brand)s so far.": "Tell us below how you feel about %(brand)s so far.", "Please go into as much detail as you like, so we can track down the problem.": "Please go into as much detail as you like, so we can track down the problem.", + "Add comment": "Add comment", + "Comment": "Comment", "There are two ways you can provide feedback and help us improve %(brand)s.": "There are two ways you can provide feedback and help us improve %(brand)s.", "PRO TIP: If you start a bug, please submit debug logs to help us track down the problem.": "PRO TIP: If you start a bug, please submit debug logs to help us track down the problem.", - "Feedback": "Feedback", "Report a bug": "Report a bug", "Please view existing bugs on Github first. No match? Start a new one.": "Please view existing bugs on Github first. No match? Start a new one.", "Confirm abort of host creation": "Confirm abort of host creation", diff --git a/src/rageshake/submit-rageshake.ts b/src/rageshake/submit-rageshake.ts index 9c4fe1f95b..f46dd88fba 100644 --- a/src/rageshake/submit-rageshake.ts +++ b/src/rageshake/submit-rageshake.ts @@ -269,7 +269,7 @@ function uint8ToString(buf: Buffer) { return out; } -export async function submitFeedback(endpoint: string, label: string, comment: string) { +export async function submitFeedback(endpoint: string, label: string, comment: string, canContact = false) { let version = "UNKNOWN"; try { version = await PlatformPeg.get().getAppVersion(); @@ -278,10 +278,12 @@ export async function submitFeedback(endpoint: string, label: string, comment: s const body = new FormData(); body.append("label", label); body.append("text", comment); + body.append("can_contact", canContact ? "yes" : "no"); body.append("app", "element-web"); body.append("version", version); body.append("platform", PlatformPeg.get().getHumanReadableName()); + body.append("user_id", MatrixClientPeg.get()?.getUserId()); await _submitReport(SdkConfig.get().bug_report_endpoint_url, body, () => {}); }