Files
ThreadNet-Web/src/components/views/dialogs/BetaFeedbackDialog.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
2.0 KiB
TypeScript
Raw Normal View History

2021-05-11 15:58:19 +01:00
/*
2024-09-09 14:57:16 +01:00
Copyright 2024 New Vector Ltd.
2021-05-11 15:58:19 +01:00
Copyright 2021 The Matrix.org Foundation C.I.C.
2024-09-09 14:57:16 +01:00
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
Please see LICENSE files in the repository root for full details.
2021-05-11 15:58:19 +01:00
*/
import React from "react";
2021-05-11 15:58:19 +01:00
import { _t } from "../../../languageHandler";
import SettingsStore from "../../../settings/SettingsStore";
2021-05-11 17:30:33 +01:00
import AccessibleButton from "../elements/AccessibleButton";
import defaultDispatcher from "../../../dispatcher/dispatcher";
2021-06-29 13:11:58 +01:00
import { Action } from "../../../dispatcher/actions";
2022-03-24 16:42:53 -06:00
import { UserTab } from "./UserTab";
2021-07-23 18:51:27 +01:00
import GenericFeatureFeedbackDialog from "./GenericFeatureFeedbackDialog";
2024-12-23 20:25:15 +00:00
import { SettingKey } from "../../../settings/Settings.tsx";
// XXX: Keep this around for re-use in future Betas
2021-05-11 15:58:19 +01:00
interface IProps {
2024-12-23 20:25:15 +00:00
featureId: SettingKey;
onFinished(sendFeedback?: boolean): void;
2021-05-11 15:58:19 +01:00
}
2021-06-29 13:11:58 +01:00
const BetaFeedbackDialog: React.FC<IProps> = ({ featureId, onFinished }) => {
2021-05-11 15:58:19 +01:00
const info = SettingsStore.getBetaInfo(featureId);
if (!info) return null;
2021-05-11 15:58:19 +01:00
return (
<GenericFeatureFeedbackDialog
title={_t("labs|beta_feedback_title", { featureName: info.title })}
subheading={info.feedbackSubheading ? _t(info.feedbackSubheading) : undefined}
onFinished={onFinished}
rageshakeLabel={info.feedbackLabel}
2021-07-23 18:31:31 +01:00
rageshakeData={Object.fromEntries(
(SettingsStore.getBetaInfo(featureId)?.extraSettings || []).map((k) => {
2024-12-23 20:25:15 +00:00
return [k, SettingsStore.getValue(k)];
2021-07-23 18:31:31 +01:00
}),
)}
2021-07-23 18:50:25 +01:00
>
<AccessibleButton
kind="link_inline"
onClick={() => {
onFinished();
2021-07-23 18:50:25 +01:00
defaultDispatcher.dispatch({
action: Action.ViewUserSettings,
initialTabId: UserTab.Labs,
});
2022-12-12 12:24:14 +01:00
}}
>
{_t("labs|beta_feedback_leave_button")}
</AccessibleButton>
</GenericFeatureFeedbackDialog>
);
2021-05-11 15:58:19 +01:00
};
export default BetaFeedbackDialog;