Fix DesktopBuildsNotice return type

This commit is contained in:
Germain Souquet 2021-06-22 10:26:49 +01:00
parent 7825c30bf7
commit 3d3c428455
3 changed files with 23 additions and 21 deletions

View file

@ -82,7 +82,6 @@ import SpaceRoomView from "./SpaceRoomView";
import { IOpts } from "../../createRoom"; import { IOpts } from "../../createRoom";
import { replaceableComponent } from "../../utils/replaceableComponent"; import { replaceableComponent } from "../../utils/replaceableComponent";
import UIStore from "../../stores/UIStore"; import UIStore from "../../stores/UIStore";
import Search from '../views/emojipicker/Search';
const DEBUG = false; const DEBUG = false;
let debuglog = function(msg: string) {}; let debuglog = function(msg: string) {};

View file

@ -18,7 +18,6 @@ import React from "react";
import EventIndexPeg from "../../../indexing/EventIndexPeg"; import EventIndexPeg from "../../../indexing/EventIndexPeg";
import { _t } from "../../../languageHandler"; import { _t } from "../../../languageHandler";
import SdkConfig from "../../../SdkConfig"; import SdkConfig from "../../../SdkConfig";
import dis from "../../../dispatcher/dispatcher"; import dis from "../../../dispatcher/dispatcher";
import { Action } from "../../../dispatcher/actions"; import { Action } from "../../../dispatcher/actions";
import { UserTab } from "../dialogs/UserSettingsDialog"; import { UserTab } from "../dialogs/UserSettingsDialog";
@ -39,15 +38,19 @@ export default function DesktopBuildsNotice({isRoomEncrypted, kind}: IProps) {
if (EventIndexPeg.get()) return null; if (EventIndexPeg.get()) return null;
if (EventIndexPeg.error) { if (EventIndexPeg.error) {
return _t("Message search initialisation failed, check <a>your settings</a> for more information", {}, { return <>
a: sub => (<a onClick={(evt) => { {_t("Message search initialisation failed, check <a>your settings</a> for more information", {}, {
evt.preventDefault(); a: sub => (<a onClick={(evt) => {
dis.dispatch({ evt.preventDefault();
action: Action.ViewUserSettings, dis.dispatch({
initialTabId: UserTab.Security, action: Action.ViewUserSettings,
}); initialTabId: UserTab.Security,
}}>{sub}</a>), });
}); }}>
{sub}
</a>),
})}
</>;
} }
const {desktopBuilds, brand} = SdkConfig.get(); const {desktopBuilds, brand} = SdkConfig.get();

View file

@ -15,13 +15,13 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import React, {createRef, RefObject} from 'react'; import React, { createRef, RefObject } from 'react';
import AccessibleButton from "../elements/AccessibleButton"; import AccessibleButton from "../elements/AccessibleButton";
import classNames from "classnames"; import classNames from "classnames";
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import {Key} from "../../../Keyboard"; import {Key} from "../../../Keyboard";
import DesktopBuildsNotice, {WarningKind} from "../elements/DesktopBuildsNotice"; import DesktopBuildsNotice, {WarningKind} from "../elements/DesktopBuildsNotice";
import {replaceableComponent} from "../../../utils/replaceableComponent"; import { replaceableComponent } from "../../../utils/replaceableComponent";
interface IProps { interface IProps {
onCancelClick: () => void; onCancelClick: () => void;
@ -50,15 +50,15 @@ export default class SearchBar extends React.Component<IProps, IState> {
}; };
} }
public onThisRoomClick = () => { private onThisRoomClick = () => {
this.setState({ scope: SearchScope.Room }, () => this._searchIfQuery()); this.setState({ scope: SearchScope.Room }, () => this.searchIfQuery());
}; };
public onAllRoomsClick = () => { private onAllRoomsClick = () => {
this.setState({ scope: SearchScope.All }, () => this._searchIfQuery()); this.setState({ scope: SearchScope.All }, () => this.searchIfQuery());
}; };
public onSearchChange = (e: React.KeyboardEvent) => { private onSearchChange = (e: React.KeyboardEvent) => {
switch (e.key) { switch (e.key) {
case Key.ENTER: case Key.ENTER:
this.onSearch(); this.onSearch();
@ -69,17 +69,17 @@ export default class SearchBar extends React.Component<IProps, IState> {
} }
}; };
_searchIfQuery() { private searchIfQuery(): void {
if (this.searchTerm.current.value) { if (this.searchTerm.current.value) {
this.onSearch(); this.onSearch();
} }
} }
onSearch = () => { private onSearch = (): void => {
this.props.onSearch(this.searchTerm.current.value, this.state.scope); this.props.onSearch(this.searchTerm.current.value, this.state.scope);
}; };
render() { public render() {
const searchButtonClasses = classNames("mx_SearchBar_searchButton", { const searchButtonClasses = classNames("mx_SearchBar_searchButton", {
mx_SearchBar_searching: this.props.searchInProgress, mx_SearchBar_searching: this.props.searchInProgress,
}); });