From 51cb4a5cfd1be8d6ad6a172add96aec258f1bd46 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Mon, 17 Feb 2025 11:24:04 +0000 Subject: [PATCH] Remove unused checkbox setting. --- src/components/views/elements/Field.tsx | 5 +- .../views/elements/SettingsFlag.tsx | 78 ++++++++----------- 2 files changed, 32 insertions(+), 51 deletions(-) diff --git a/src/components/views/elements/Field.tsx b/src/components/views/elements/Field.tsx index 7d8a603562..9b41f7c1dd 100644 --- a/src/components/views/elements/Field.tsx +++ b/src/components/views/elements/Field.tsx @@ -60,8 +60,6 @@ interface IProps { // If specified, contents will appear as a tooltip on the element and // validation feedback tooltips will be suppressed. tooltipContent?: JSX.Element | string; - // If specified the tooltip will be shown regardless of feedback - forceTooltipVisible?: boolean; // If specified, the tooltip with be aligned accorindly with the field, defaults to Right. tooltipAlignment?: ComponentProps["placement"]; // If specified alongside tooltipContent, the class name to apply to the @@ -274,7 +272,6 @@ export default class Field extends React.PureComponent { validateOnChange, validateOnFocus, usePlaceholderAsHint, - forceTooltipVisible, tooltipAlignment, ...inputProps } = this.props; @@ -283,7 +280,7 @@ export default class Field extends React.PureComponent { const tooltipProps: Pick, "aria-live" | "aria-atomic"> = {}; let tooltipOpen = false; if (tooltipContent || this.state.feedback) { - tooltipOpen = (this.state.focused && forceTooltipVisible) || this.state.feedbackVisible; + tooltipOpen = this.state.feedbackVisible; if (!tooltipContent) { tooltipProps["aria-atomic"] = "true"; diff --git a/src/components/views/elements/SettingsFlag.tsx b/src/components/views/elements/SettingsFlag.tsx index d7fac91875..211f5ca785 100644 --- a/src/components/views/elements/SettingsFlag.tsx +++ b/src/components/views/elements/SettingsFlag.tsx @@ -13,7 +13,6 @@ import { secureRandomString } from "matrix-js-sdk/src/randomstring"; import SettingsStore from "../../../settings/SettingsStore"; import { _t } from "../../../languageHandler"; import ToggleSwitch from "./ToggleSwitch"; -import StyledCheckbox from "./StyledCheckbox"; import { type SettingLevel } from "../../../settings/SettingLevel"; import { type BooleanSettingKey, defaultWatchManager } from "../../../settings/Settings"; @@ -24,8 +23,6 @@ interface IProps { roomId?: string; // for per-room settings label?: string; isExplicit?: boolean; - // XXX: once design replaces all toggles make this the default - useCheckbox?: boolean; hideIfCannotSet?: boolean; onChange?(checked: boolean): void; } @@ -80,10 +77,6 @@ export default class SettingsFlag extends React.Component { this.props.onChange?.(checked); }; - private checkBoxOnChange = (e: React.ChangeEvent): void => { - this.onChange(e.target.checked); - }; - private save = async (val?: boolean): Promise => { await SettingsStore.setValue( this.props.name, @@ -101,45 +94,36 @@ export default class SettingsFlag extends React.Component { const label = this.props.label ?? SettingsStore.getDisplayName(this.props.name, this.props.level); const description = SettingsStore.getDescription(this.props.name); const shouldWarn = SettingsStore.shouldHaveWarning(this.props.name); - - if (this.props.useCheckbox) { - return ( - - {label} - - ); - } else { - return ( -
- - -
- ); - } + return ( +
+ + +
+ ); } }