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

Commit f4f03b4

Browse files
committed
Improve the styling of search initialization errors.
Signed-off-by: Kalle Struik <[email protected]>
1 parent c86040b commit f4f03b4

File tree

5 files changed

+27
-25
lines changed

5 files changed

+27
-25
lines changed

res/css/_components.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
@import "./views/elements/_AddressSelector.scss";
144144
@import "./views/elements/_AddressTile.scss";
145145
@import "./views/elements/_CopyableText.scss";
146-
@import "./views/elements/_DesktopBuildsNotice.scss";
146+
@import "./views/elements/_SearchWarning.scss";
147147
@import "./views/elements/_DesktopCapturerSourcePicker.scss";
148148
@import "./views/elements/_DialPadBackspaceButton.scss";
149149
@import "./views/elements/_DirectorySearchBox.scss";

res/css/views/elements/_DesktopBuildsNotice.scss renamed to res/css/views/elements/_SearchWarning.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
.mx_DesktopBuildsNotice {
17+
.mx_SearchWarning {
1818
text-align: center;
1919
padding: 0 16px;
2020

src/components/structures/FilePanel.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { logger } from "matrix-js-sdk/src/logger";
2727
import { MatrixClientPeg } from '../../MatrixClientPeg';
2828
import EventIndexPeg from "../../indexing/EventIndexPeg";
2929
import { _t } from '../../languageHandler';
30-
import DesktopBuildsNotice, { WarningKind } from "../views/elements/DesktopBuildsNotice";
30+
import SearchWarning, { WarningKind } from "../views/elements/SearchWarning";
3131
import BaseCard from "../views/right_panel/BaseCard";
3232
import ResizeNotifier from '../../utils/ResizeNotifier';
3333
import TimelinePanel from "./TimelinePanel";
@@ -275,7 +275,7 @@ class FilePanel extends React.Component<IProps, IState> {
275275
sensor={this.card.current}
276276
onMeasurement={this.onMeasurement}
277277
/>
278-
<DesktopBuildsNotice isRoomEncrypted={isRoomEncrypted} kind={WarningKind.Files} />
278+
<SearchWarning isRoomEncrypted={isRoomEncrypted} kind={WarningKind.Files} />
279279
<TimelinePanel
280280
manageReadReceipts={false}
281281
manageReadMarkers={false}

src/components/views/elements/DesktopBuildsNotice.tsx renamed to src/components/views/elements/SearchWarning.tsx

+21-19
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,30 @@ interface IProps {
3535
kind: WarningKind;
3636
}
3737

38-
export default function DesktopBuildsNotice({ isRoomEncrypted, kind }: IProps) {
38+
export default function SearchWarning({ isRoomEncrypted, kind }: IProps) {
3939
if (!isRoomEncrypted) return null;
4040
if (EventIndexPeg.get()) return null;
4141

4242
if (EventIndexPeg.error) {
43-
return <>
44-
{ _t("Message search initialisation failed, check <a>your settings</a> for more information", {}, {
45-
a: sub => (
46-
<AccessibleButton
47-
kind="link_inline"
48-
onClick={(evt) => {
49-
evt.preventDefault();
50-
dis.dispatch({
51-
action: Action.ViewUserSettings,
52-
initialTabId: UserTab.Security,
53-
});
54-
}}
55-
>
56-
{ sub }
57-
</AccessibleButton>),
58-
}) }
59-
</>;
43+
return (
44+
<div className="mx_SearchWarning">
45+
{ _t("Message search initialisation failed, check <a>your settings</a> for more information", {}, {
46+
a: sub => (
47+
<AccessibleButton
48+
kind="link_inline"
49+
onClick={(evt) => {
50+
evt.preventDefault();
51+
dis.dispatch({
52+
action: Action.ViewUserSettings,
53+
initialTabId: UserTab.Security,
54+
});
55+
}}
56+
>
57+
{ sub }
58+
</AccessibleButton>),
59+
}) }
60+
</div>
61+
);
6062
}
6163

6264
const brand = SdkConfig.get("brand");
@@ -97,7 +99,7 @@ export default function DesktopBuildsNotice({ isRoomEncrypted, kind }: IProps) {
9799
}
98100

99101
return (
100-
<div className="mx_DesktopBuildsNotice">
102+
<div className="mx_SearchWarning">
101103
{ logo }
102104
<span>{ text }</span>
103105
</div>

src/components/views/rooms/SearchBar.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import classNames from "classnames";
2020

2121
import AccessibleButton from "../elements/AccessibleButton";
2222
import { _t } from '../../../languageHandler';
23-
import DesktopBuildsNotice, { WarningKind } from "../elements/DesktopBuildsNotice";
2423
import { PosthogScreenTracker } from '../../../PosthogTrackers';
2524
import { getKeyBindingsManager } from "../../../KeyBindingsManager";
2625
import { KeyBindingAction } from "../../../accessibility/KeyboardShortcuts";
26+
import SearchWarning, { WarningKind } from "../elements/SearchWarning";
2727

2828
interface IProps {
2929
onCancelClick: () => void;
@@ -127,7 +127,7 @@ export default class SearchBar extends React.Component<IProps, IState> {
127127
</div>
128128
<AccessibleButton className="mx_SearchBar_cancel" onClick={this.props.onCancelClick} />
129129
</div>
130-
<DesktopBuildsNotice isRoomEncrypted={this.props.isRoomEncrypted} kind={WarningKind.Search} />
130+
<SearchWarning isRoomEncrypted={this.props.isRoomEncrypted} kind={WarningKind.Search} />
131131
</>
132132
);
133133
}

0 commit comments

Comments
 (0)