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 { replaceableComponent } from "../../utils/replaceableComponent";
import UIStore from "../../stores/UIStore";
import Search from '../views/emojipicker/Search';
const DEBUG = false;
let debuglog = function(msg: string) {};

View file

@ -18,7 +18,6 @@ import React from "react";
import EventIndexPeg from "../../../indexing/EventIndexPeg";
import { _t } from "../../../languageHandler";
import SdkConfig from "../../../SdkConfig";
import dis from "../../../dispatcher/dispatcher";
import { Action } from "../../../dispatcher/actions";
import { UserTab } from "../dialogs/UserSettingsDialog";
@ -39,15 +38,19 @@ export default function DesktopBuildsNotice({isRoomEncrypted, kind}: IProps) {
if (EventIndexPeg.get()) return null;
if (EventIndexPeg.error) {
return _t("Message search initialisation failed, check <a>your settings</a> for more information", {}, {
a: sub => (<a onClick={(evt) => {
evt.preventDefault();
dis.dispatch({
action: Action.ViewUserSettings,
initialTabId: UserTab.Security,
});
}}>{sub}</a>),
});
return <>
{_t("Message search initialisation failed, check <a>your settings</a> for more information", {}, {
a: sub => (<a onClick={(evt) => {
evt.preventDefault();
dis.dispatch({
action: Action.ViewUserSettings,
initialTabId: UserTab.Security,
});
}}>
{sub}
</a>),
})}
</>;
}
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.
*/
import React, {createRef, RefObject} from 'react';
import React, { createRef, RefObject } from 'react';
import AccessibleButton from "../elements/AccessibleButton";
import classNames from "classnames";
import { _t } from '../../../languageHandler';
import {Key} from "../../../Keyboard";
import DesktopBuildsNotice, {WarningKind} from "../elements/DesktopBuildsNotice";
import {replaceableComponent} from "../../../utils/replaceableComponent";
import { replaceableComponent } from "../../../utils/replaceableComponent";
interface IProps {
onCancelClick: () => void;
@ -50,15 +50,15 @@ export default class SearchBar extends React.Component<IProps, IState> {
};
}
public onThisRoomClick = () => {
this.setState({ scope: SearchScope.Room }, () => this._searchIfQuery());
private onThisRoomClick = () => {
this.setState({ scope: SearchScope.Room }, () => this.searchIfQuery());
};
public onAllRoomsClick = () => {
this.setState({ scope: SearchScope.All }, () => this._searchIfQuery());
private onAllRoomsClick = () => {
this.setState({ scope: SearchScope.All }, () => this.searchIfQuery());
};
public onSearchChange = (e: React.KeyboardEvent) => {
private onSearchChange = (e: React.KeyboardEvent) => {
switch (e.key) {
case Key.ENTER:
this.onSearch();
@ -69,17 +69,17 @@ export default class SearchBar extends React.Component<IProps, IState> {
}
};
_searchIfQuery() {
private searchIfQuery(): void {
if (this.searchTerm.current.value) {
this.onSearch();
}
}
onSearch = () => {
private onSearch = (): void => {
this.props.onSearch(this.searchTerm.current.value, this.state.scope);
};
render() {
public render() {
const searchButtonClasses = classNames("mx_SearchBar_searchButton", {
mx_SearchBar_searching: this.props.searchInProgress,
});