/* Copyright 2024 New Vector Ltd. SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE in the repository root for full details. */ import { type ChangeEvent, type FC } from "react"; import { useTranslation } from "react-i18next"; import { Text } from "@vector-im/compound-web"; import { FieldRow, InputField } from "../input/Input"; import { showHandRaisedTimer as showHandRaisedTimerSetting, showReactions as showReactionsSetting, playReactionsSound as playReactionsSoundSetting, developerMode as developerModeSetting, useSetting, } from "./settings"; export const PreferencesSettingsTab: FC = () => { const { t } = useTranslation(); const [showHandRaisedTimer, setShowHandRaisedTimer] = useSetting( showHandRaisedTimerSetting, ); const [showReactions, setShowReactions] = useSetting(showReactionsSetting); const [playReactionsSound, setPlayReactionSound] = useSetting( playReactionsSoundSetting, ); const onChangeSetting = ( e: ChangeEvent, fn: (value: boolean) => void, ): void => { fn(e.target.checked); }; const [developerMode, setDeveloperMode] = useSetting(developerModeSetting); return (
{t("settings.preferences_tab.introduction")} onChangeSetting(e, setShowHandRaisedTimer)} /> onChangeSetting(e, setShowReactions)} /> onChangeSetting(e, setPlayReactionSound)} /> ): void => setDeveloperMode(event.target.checked) } />
); };