Add preferences tab for choosing to enable timer.

This commit is contained in:
Half-Shot 2024-10-29 13:13:01 +00:00
parent dbabf45ca7
commit e1a4310e29
3 changed files with 63 additions and 2 deletions

View File

@ -12,7 +12,7 @@ Please see LICENSE in the repository root for full details.
.dialog {
box-sizing: border-box;
inline-size: 520px;
inline-size: 580px;
max-inline-size: 90%;
max-block-size: 600px;
}

View File

@ -0,0 +1,53 @@
/*
Copyright 2022-2024 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only
Please see LICENSE in the repository root for full details.
*/
import { ChangeEvent, FC, useCallback } from "react";
import { useTranslation } from "react-i18next";
import { Text } from "@vector-im/compound-web";
import { FieldRow, InputField } from "../input/Input";
import {
showHandRaisedTimer as showHandRaisedTimerSetting,
useSetting,
} from "./settings";
interface Props {
roomId?: string;
}
export const PreferencesSettingsTab: FC<Props> = ({}) => {
const { t } = useTranslation();
const [showHandRaisedTimer, setShowHandRaisedTimer] = useSetting(
showHandRaisedTimerSetting,
);
const onChangeSetting = useCallback(
(e: ChangeEvent<HTMLInputElement>) => {
setShowHandRaisedTimer(e.target.checked);
},
[setShowHandRaisedTimer],
);
return (
<div>
<h4>{t("settings.preferences_tab_h4")}</h4>
<Text>{t("settings.preferences_tab_body")}</Text>
<FieldRow>
<InputField
id="showHandRaisedTimer"
label={t("settings.preferences_tab_show_hand_raised_timer_label")}
description={t(
"settings.preferences_tab_show_hand_raised_timer_description",
)}
type="checkbox"
checked={showHandRaisedTimer}
onChange={onChangeSetting}
/>
</FieldRow>
</div>
);
};

View File

@ -30,11 +30,13 @@ import {
useOptInAnalytics,
} from "./settings";
import { isFirefox } from "../Platform";
import { PreferencesSettingsTab } from "./PreferencesSettingsTab";
type SettingsTab =
| "audio"
| "video"
| "profile"
| "preferences"
| "feedback"
| "more"
| "developer";
@ -135,6 +137,12 @@ export const SettingsModal: FC<Props> = ({
content: generateDeviceSelection(devices.videoInput, t("common.camera")),
};
const preferencesTab: Tab<SettingsTab> = {
key: "preferences",
name: t("common.preferences"),
content: <PreferencesSettingsTab />,
};
const profileTab: Tab<SettingsTab> = {
key: "profile",
name: t("common.profile"),
@ -234,7 +242,7 @@ export const SettingsModal: FC<Props> = ({
const tabs = [audioTab, videoTab];
if (widget === null) tabs.push(profileTab);
tabs.push(feedbackTab, moreTab);
tabs.push(preferencesTab, feedbackTab, moreTab);
if (developerSettingsTab) tabs.push(developerTab);
return (