mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-10-31 08:15:07 +00:00
feat(settings): re-enable slim Help & About tab
This commit is contained in:
@@ -20,6 +20,7 @@ import SidebarIcon from "@vector-im/compound-design-tokens/assets/web/icons/side
|
||||
import MicOnIcon from "@vector-im/compound-design-tokens/assets/web/icons/mic-on";
|
||||
import LockIcon from "@vector-im/compound-design-tokens/assets/web/icons/lock";
|
||||
import BlockIcon from "@vector-im/compound-design-tokens/assets/web/icons/block";
|
||||
import HelpIcon from "@vector-im/compound-design-tokens/assets/web/icons/help";
|
||||
|
||||
import TabbedView, { Tab, useActiveTabWithDefault } from "../../structures/TabbedView";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
@@ -31,6 +32,7 @@ import NotificationUserSettingsTab from "../settings/tabs/user/NotificationUserS
|
||||
import PreferencesUserSettingsTab from "../settings/tabs/user/PreferencesUserSettingsTab";
|
||||
import VoiceUserSettingsTab from "../settings/tabs/user/VoiceUserSettingsTab";
|
||||
import MjolnirUserSettingsTab from "../settings/tabs/user/MjolnirUserSettingsTab";
|
||||
import HelpUserSettingsTab from "../settings/tabs/user/HelpUserSettingsTab";
|
||||
import { UIFeature } from "../../../settings/UIFeature";
|
||||
import BaseDialog from "./BaseDialog";
|
||||
import SidebarUserSettingsTab from "../settings/tabs/user/SidebarUserSettingsTab";
|
||||
@@ -253,8 +255,7 @@ export default function UserSettingsDialog(props: IProps): JSX.Element {
|
||||
),
|
||||
);
|
||||
}
|
||||
// JP: Disable help tab for now
|
||||
/* tabs.push(
|
||||
tabs.push(
|
||||
new Tab(
|
||||
UserTab.Help,
|
||||
_td("setting|help_about|title"),
|
||||
@@ -262,7 +263,7 @@ export default function UserSettingsDialog(props: IProps): JSX.Element {
|
||||
<HelpUserSettingsTab />,
|
||||
"UserSettingsHelpAbout",
|
||||
),
|
||||
);*/
|
||||
);
|
||||
|
||||
return tabs as NonEmptyArray<Tab<UserTab>>;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import React, { type JSX, type ReactNode } from "react";
|
||||
import React, { type JSX } from "react";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { type EmptyObject } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
@@ -21,7 +21,6 @@ import { SettingsSection } from "../../shared/SettingsSection";
|
||||
import { SettingsSubsection, SettingsSubsectionText } from "../../shared/SettingsSubsection";
|
||||
import ExternalLink from "../../../elements/ExternalLink";
|
||||
import MatrixClientContext from "../../../../../contexts/MatrixClientContext";
|
||||
import { BugReportDialogButton } from "../../../elements/BugReportDialogButton";
|
||||
|
||||
interface IState {
|
||||
appVersion: string | null;
|
||||
@@ -79,118 +78,6 @@ export default class HelpUserSettingsTab extends React.Component<EmptyObject, IS
|
||||
});
|
||||
};
|
||||
|
||||
private renderLegal(): ReactNode {
|
||||
const tocLinks = SdkConfig.get().terms_and_conditions_links;
|
||||
if (!tocLinks) return null;
|
||||
|
||||
const legalLinks: JSX.Element[] = [];
|
||||
for (const tocEntry of tocLinks) {
|
||||
legalLinks.push(
|
||||
<div key={tocEntry.url}>
|
||||
<ExternalLink href={tocEntry.url}>{tocEntry.text}</ExternalLink>
|
||||
</div>,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<SettingsSubsection heading={_t("common|legal")}>
|
||||
<SettingsSubsectionText>{legalLinks}</SettingsSubsectionText>
|
||||
</SettingsSubsection>
|
||||
);
|
||||
}
|
||||
|
||||
private renderCredits(): JSX.Element {
|
||||
// Note: This is not translated because it is legal text.
|
||||
// Also, is ugly but necessary.
|
||||
return (
|
||||
<SettingsSubsection heading={_t("common|credits")}>
|
||||
<SettingsSubsectionText>
|
||||
<ul>
|
||||
<li>
|
||||
{_t(
|
||||
"credits|default_cover_photo",
|
||||
{},
|
||||
{
|
||||
photo: (sub) => (
|
||||
<ExternalLink
|
||||
href="themes/element/img/backgrounds/lake.jpg"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{sub}
|
||||
</ExternalLink>
|
||||
),
|
||||
author: (sub) => (
|
||||
<ExternalLink href="https://www.flickr.com/golan">{sub}</ExternalLink>
|
||||
),
|
||||
terms: (sub) => (
|
||||
<ExternalLink
|
||||
href="https://creativecommons.org/licenses/by-sa/4.0/"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{sub}
|
||||
</ExternalLink>
|
||||
),
|
||||
},
|
||||
)}
|
||||
</li>
|
||||
<li>
|
||||
{_t(
|
||||
"credits|twemoji_colr",
|
||||
{},
|
||||
{
|
||||
colr: (sub) => (
|
||||
<ExternalLink
|
||||
href="https://github.com/matrix-org/twemoji-colr"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{sub}
|
||||
</ExternalLink>
|
||||
),
|
||||
author: (sub) => <ExternalLink href="https://mozilla.org">{sub}</ExternalLink>,
|
||||
terms: (sub) => (
|
||||
<ExternalLink
|
||||
href="https://www.apache.org/licenses/LICENSE-2.0"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{sub}
|
||||
</ExternalLink>
|
||||
),
|
||||
},
|
||||
)}
|
||||
</li>
|
||||
<li>
|
||||
{_t(
|
||||
"credits|twemoji",
|
||||
{},
|
||||
{
|
||||
twemoji: (sub) => (
|
||||
<ExternalLink href="https://twemoji.twitter.com/">{sub}</ExternalLink>
|
||||
),
|
||||
author: (sub) => (
|
||||
<ExternalLink href="https://twemoji.twitter.com/">{sub}</ExternalLink>
|
||||
),
|
||||
terms: (sub) => (
|
||||
<ExternalLink
|
||||
href="https://creativecommons.org/licenses/by/4.0/"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{sub}
|
||||
</ExternalLink>
|
||||
),
|
||||
},
|
||||
)}
|
||||
</li>
|
||||
</ul>
|
||||
</SettingsSubsectionText>
|
||||
</SettingsSubsection>
|
||||
);
|
||||
}
|
||||
|
||||
private getVersionTextToCopy = (): string => {
|
||||
const { appVersion, cryptoVersion } = this.getVersionInfo();
|
||||
return `${appVersion}\n${cryptoVersion}`;
|
||||
@@ -214,42 +101,11 @@ export default class HelpUserSettingsTab extends React.Component<EmptyObject, IS
|
||||
updateButton = <UpdateCheckButton />;
|
||||
}
|
||||
|
||||
let bugReportingSection;
|
||||
if (SdkConfig.get().bug_report_endpoint_url) {
|
||||
bugReportingSection = (
|
||||
<SettingsSubsection
|
||||
heading={_t("bug_reporting|title")}
|
||||
description={
|
||||
<>
|
||||
<SettingsSubsectionText>{_t("bug_reporting|introduction")}</SettingsSubsectionText>
|
||||
{_t("bug_reporting|description")}
|
||||
</>
|
||||
}
|
||||
>
|
||||
<BugReportDialogButton />
|
||||
<SettingsSubsectionText>
|
||||
{_t(
|
||||
"bug_reporting|matrix_security_issue",
|
||||
{},
|
||||
{
|
||||
a: (sub) => (
|
||||
<ExternalLink href="https://matrix.org/security-disclosure-policy/">
|
||||
{sub}
|
||||
</ExternalLink>
|
||||
),
|
||||
},
|
||||
)}
|
||||
</SettingsSubsectionText>
|
||||
</SettingsSubsection>
|
||||
);
|
||||
}
|
||||
|
||||
const { appVersion, cryptoVersion } = this.getVersionInfo();
|
||||
|
||||
return (
|
||||
<SettingsTab>
|
||||
<SettingsSection>
|
||||
{bugReportingSection}
|
||||
<SettingsSubsection heading={_t("common|faq")} description={faqText} />
|
||||
<SettingsSubsection heading={_t("setting|help_about|versions")}>
|
||||
<SettingsSubsectionText>
|
||||
@@ -262,8 +118,6 @@ export default class HelpUserSettingsTab extends React.Component<EmptyObject, IS
|
||||
{updateButton}
|
||||
</SettingsSubsectionText>
|
||||
</SettingsSubsection>
|
||||
{this.renderLegal()}
|
||||
{this.renderCredits()}
|
||||
<SettingsSubsection heading={_t("common|advanced")}>
|
||||
<SettingsSubsectionText>
|
||||
{_t(
|
||||
|
||||
@@ -200,8 +200,7 @@ describe("<UserSettingsDialog />", () => {
|
||||
expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent("Ignored Users");
|
||||
});
|
||||
|
||||
// HealthChat disables the Help tab "for now" (UserSettingsDialog.tsx). Restore when re-enabled.
|
||||
it.skip("renders with help tab selected", () => {
|
||||
it("renders with help tab selected", () => {
|
||||
const { container } = render(getComponent({ initialTabId: UserTab.Help }));
|
||||
|
||||
expect(getActiveTabLabel(container)).toEqual("Help & About");
|
||||
|
||||
+29
@@ -219,5 +219,34 @@ NodeList [
|
||||
Encryption
|
||||
</span>
|
||||
</li>,
|
||||
<li
|
||||
aria-controls="mx_tabpanel_USER_HELP_TAB"
|
||||
aria-selected="false"
|
||||
class="mx_AccessibleButton mx_TabbedView_tabLabel"
|
||||
data-testid="settings-tab-USER_HELP_TAB"
|
||||
role="tab"
|
||||
tabindex="-1"
|
||||
>
|
||||
<svg
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
width="1em"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M12 8a1.5 1.5 0 0 0-1.5 1.5 1 1 0 1 1-2 0 3.5 3.5 0 1 1 6.01 2.439q-.183.188-.352.355c-.287.288-.54.54-.76.824-.293.375-.398.651-.398.882a1 1 0 1 1-2 0c0-.874.407-1.58.819-2.11.305-.392.688-.775 1-1.085l.257-.26A1.5 1.5 0 0 0 12 8m1 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0"
|
||||
/>
|
||||
<path
|
||||
d="M8.1 21.213A9.7 9.7 0 0 0 12 22a9.7 9.7 0 0 0 3.9-.788 10.1 10.1 0 0 0 3.175-2.137q1.35-1.35 2.137-3.175A9.7 9.7 0 0 0 22 12a9.7 9.7 0 0 0-.788-3.9 10.1 10.1 0 0 0-2.137-3.175q-1.35-1.35-3.175-2.137A9.7 9.7 0 0 0 12 2a9.7 9.7 0 0 0-3.9.788 10.1 10.1 0 0 0-3.175 2.137Q3.575 6.275 2.788 8.1A9.7 9.7 0 0 0 2 12q0 2.075.788 3.9a10.1 10.1 0 0 0 2.137 3.175q1.35 1.35 3.175 2.137m9.575-3.538Q15.35 20 12 20t-5.675-2.325T4 12t2.325-5.675T12 4t5.675 2.325T20 12t-2.325 5.675"
|
||||
/>
|
||||
</svg>
|
||||
<span
|
||||
class="mx_TabbedView_tabLabel_text"
|
||||
id="mx_tabpanel_USER_HELP_TAB_label"
|
||||
>
|
||||
Help & About
|
||||
</span>
|
||||
</li>,
|
||||
]
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user