From ffef1dd4bbaff72d77b5a3c7a40de17f1e58977b Mon Sep 17 00:00:00 2001 From: adueck Date: Fri, 2 Dec 2022 09:36:08 +0500 Subject: [PATCH] clearer message about approximate search mode --- website/src/App.tsx | 24 ++++++++++++++++-------- website/src/components/SearchBar.tsx | 4 +++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/website/src/App.tsx b/website/src/App.tsx index efdce6a..5ac4ff4 100644 --- a/website/src/App.tsx +++ b/website/src/App.tsx @@ -395,12 +395,16 @@ class App extends Component { } private handleSearchValueChange(searchValue: string) { - if (searchValue === " ") return; + if (searchValue === " ") { + return; + } const lastChar = searchValue[searchValue.length-1]; if (lastChar >= '0' && lastChar <= '9') { return; } - if (this.state.dictionaryStatus !== "ready") return; + if (this.state.dictionaryStatus !== "ready") { + return; + } if (searchValue === "") { this.setState({ searchValue: "", @@ -510,12 +514,16 @@ class App extends Component { : <> - +

LingDocs Pashto Dictionary

- {this.state.options.searchType === "alphabetical" &&
-
Alphabetical browsing mode
-
} +
+
+ {this.state.options.searchType === "alphabetical" + ? <> Alphabetical browsing mode + : <> Approximate search mode} +
+
{this.state.user?.level === "editor" &&
Editor privileges active
@@ -529,7 +537,7 @@ class App extends Component { Phrase Builder - {` • `} + Grammar @@ -616,7 +624,7 @@ class App extends Component { { "footer-thick": this.state.options.searchBarPosition === "bottom" && !["/search", "/word"].includes(this.props.location.pathname) }, { "wee-less-footer": this.state.options.searchBarPosition === "bottom" && ["/search", "/word"].includes(this.props.location.pathname) }, )}> - +
diff --git a/website/src/components/SearchBar.tsx b/website/src/components/SearchBar.tsx index 5f702b2..566f858 100644 --- a/website/src/components/SearchBar.tsx +++ b/website/src/components/SearchBar.tsx @@ -26,7 +26,9 @@ const SearchBar = ({ state, optionsDispatch, handleSearchValueChange, onBottom } window.addEventListener("focus", onFocus); Mousetrap.bind(["shift+space"], (e) => { e.preventDefault(); - if (e.repeat) return; + if (e.repeat) { + return; + } inputRef.current?.focus(); }); return () => {