diff --git a/src/components/views/elements/Field.tsx b/src/components/views/elements/Field.tsx index 6824eeeba6..5a9bc36f59 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 = forceTooltipVisible || this.state.feedbackVisible; + tooltipOpen = this.state.feedbackVisible; if (!tooltipContent) { tooltipProps["aria-atomic"] = "true"; tooltipProps["aria-live"] = this.state.valid ? "polite" : "assertive"; diff --git a/src/components/views/settings/SetIdServer.tsx b/src/components/views/settings/SetIdServer.tsx index c1ebd536ce..63a1045a12 100644 --- a/src/components/views/settings/SetIdServer.tsx +++ b/src/components/views/settings/SetIdServer.tsx @@ -9,6 +9,7 @@ Please see LICENSE files in the repository root for full details. import React, { type ReactNode } from "react"; import { logger } from "matrix-js-sdk/src/logger"; import { type IThreepid } from "matrix-js-sdk/src/matrix"; +import { EditInPlace, ErrorMessage, TooltipProvider } from "@vector-im/compound-web"; import { _t } from "../../../languageHandler"; import { MatrixClientPeg } from "../../../MatrixClientPeg"; @@ -22,7 +23,6 @@ import { timeout } from "../../../utils/promise"; import { type ActionPayload } from "../../../dispatcher/payloads"; import InlineSpinner from "../elements/InlineSpinner"; import AccessibleButton from "../elements/AccessibleButton"; -import Field from "../elements/Field"; import QuestionDialog from "../dialogs/QuestionDialog"; import SettingsFieldset from "./SettingsFieldset"; import { SettingsSubsectionText } from "./shared/SettingsSubsection"; @@ -120,25 +120,6 @@ export default class SetIdServer extends React.Component { this.setState({ idServer: u, error: undefined }); }; - private getTooltip = (): JSX.Element | undefined => { - if (this.state.checking) { - return ( -
- - {_t("identity_server|checking")} -
- ); - } else if (this.state.error) { - return {this.state.error}; - } else { - return undefined; - } - }; - - private idServerChangeEnabled = (): boolean => { - return !!this.state.idServer && !this.state.busy; - }; - private saveIdServer = (fullUrl: string): void => { // Account data change will update localstorage, client, etc through dispatcher MatrixClientPeg.safeGet().setAccountData("m.identity_server", { @@ -393,29 +374,27 @@ export default class SetIdServer extends React.Component { return ( -
- + this.setState((s) => ({ idServer: s.currentClientIdServer ?? "" }))} + onClearServerErrors={() => this.setState({ error: undefined })} + onSave={this.checkIdServer} + size={48} + saveButtonLabel={_t("action|change")} + savedLabel={this.state.error ? undefined : _t("identity_server|changed")} + savingLabel={_t("identity_server|checking")} placeholder={this.state.defaultIdServer} value={this.state.idServer} - onChange={this.onIdentityServerChanged} - tooltipContent={this.getTooltip()} - forceTooltipVisible={this.state.error ? true : undefined} - tooltipClassName="mx_SetIdServer_tooltip" disabled={this.state.busy} - forceValidity={this.state.error ? false : undefined} - /> - - {_t("action|change")} - + {this.state.error && {this.state.error}} + {discoSection} - +
); } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index b2903fce85..7982f85c39 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1244,6 +1244,7 @@ "change_prompt": "Disconnect from the identity server and connect to instead?", "change_server_prompt": "If you don't want to use to discover and be discoverable by existing contacts you know, enter another identity server below.", "checking": "Checking server", + "changed": "Your identity server has been changed", "description_connected": "You are currently using to discover and be discoverable by existing contacts you know. You can change your identity server below.", "description_disconnected": "You are not currently using an identity server. To discover and be discoverable by existing contacts you know, add one below.", "description_optional": "Using an identity server is optional. If you choose not to use an identity server, you won't be discoverable by other users and you won't be able to invite others by email or phone.",