Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Improve the styling of search initialization errors.
Browse files Browse the repository at this point in the history
Signed-off-by: Kalle Struik <kalle@kallestruik.nl>
  • Loading branch information
KalleStruik committed Oct 5, 2021
1 parent 9f26c1c commit bdd490b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion res/css/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
@import "./views/elements/_AccessibleButton.scss";
@import "./views/elements/_AddressSelector.scss";
@import "./views/elements/_AddressTile.scss";
@import "./views/elements/_DesktopBuildsNotice.scss";
@import "./views/elements/_SearchWarning.scss";
@import "./views/elements/_DesktopCapturerSourcePicker.scss";
@import "./views/elements/_DialPadBackspaceButton.scss";
@import "./views/elements/_DirectorySearchBox.scss";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_DesktopBuildsNotice {
.mx_SearchWarning {
text-align: center;
padding: 0 16px;

Expand Down
4 changes: 2 additions & 2 deletions src/components/structures/FilePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import EventIndexPeg from "../../indexing/EventIndexPeg";
import { _t } from '../../languageHandler';
import BaseCard from "../views/right_panel/BaseCard";
import { RightPanelPhases } from "../../stores/RightPanelStorePhases";
import DesktopBuildsNotice, { WarningKind } from "../views/elements/DesktopBuildsNotice";
import SearchWarning, { WarningKind } from "../views/elements/SearchWarning";
import { replaceableComponent } from "../../utils/replaceableComponent";

import ResizeNotifier from '../../utils/ResizeNotifier';
Expand Down Expand Up @@ -258,7 +258,7 @@ class FilePanel extends React.Component<IProps, IState> {
previousPhase={RightPanelPhases.RoomSummary}
withoutScrollContainer
>
<DesktopBuildsNotice isRoomEncrypted={isRoomEncrypted} kind={WarningKind.Files} />
<SearchWarning isRoomEncrypted={isRoomEncrypted} kind={WarningKind.Files} />
<TimelinePanel
manageReadReceipts={false}
manageReadMarkers={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,27 @@ interface IProps {
kind: WarningKind;
}

export default function DesktopBuildsNotice({ isRoomEncrypted, kind }: IProps) {
export default function SearchWarning({ isRoomEncrypted, kind }: IProps) {
if (!isRoomEncrypted) return null;
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 (
<div className="mx_SearchWarning">
{ _t("Message search initialisation failed, check <a>your settings</a> for more information", {}, {
a: sub => (<a className="mx_linkButton"
onClick={(evt) => {
evt.preventDefault();
dis.dispatch({
action: Action.ViewUserSettings,
initialTabId: UserTab.Security,
});
}}>
{ sub }
</a>),
}) }
</div>
);
}

const { desktopBuilds, brand } = SdkConfig.get();
Expand Down Expand Up @@ -88,7 +91,7 @@ export default function DesktopBuildsNotice({ isRoomEncrypted, kind }: IProps) {
}

return (
<div className="mx_DesktopBuildsNotice">
<div className="mx_SearchWarning">
{ logo }
<span>{ text }</span>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/rooms/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import AccessibleButton from "../elements/AccessibleButton";
import classNames from "classnames";
import { _t } from '../../../languageHandler';
import { Key } from "../../../Keyboard";
import DesktopBuildsNotice, { WarningKind } from "../elements/DesktopBuildsNotice";
import SearchWarning, { WarningKind } from "../elements/SearchWarning";
import { replaceableComponent } from "../../../utils/replaceableComponent";

interface IProps {
Expand Down Expand Up @@ -123,7 +123,7 @@ export default class SearchBar extends React.Component<IProps, IState> {
</div>
<AccessibleButton className="mx_SearchBar_cancel" onClick={this.props.onCancelClick} />
</div>
<DesktopBuildsNotice isRoomEncrypted={this.props.isRoomEncrypted} kind={WarningKind.Search} />
<SearchWarning isRoomEncrypted={this.props.isRoomEncrypted} kind={WarningKind.Search} />
</>
);
}
Expand Down

0 comments on commit bdd490b

Please sign in to comment.