about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-10-03 20:23:07 -0500
committerGitHub <noreply@github.com>2024-10-03 20:23:07 -0500
commit3f66531e83d5bc1409a444c3cf479b0f53063dc4 (patch)
tree3b68e90dbd2076903bc9243c069829e9009a27a2 /src
parentce53b3a2648732ee67abd3cf4333f154031bd7e5 (diff)
downloadvoidsky-3f66531e83d5bc1409a444c3cf479b0f53063dc4.tar.zst
Add option to search in any language (#5598)
Diffstat (limited to 'src')
-rw-r--r--src/screens/Search/utils.ts1
-rw-r--r--src/view/screens/Search/Search.tsx28
2 files changed, 20 insertions, 9 deletions
diff --git a/src/screens/Search/utils.ts b/src/screens/Search/utils.ts
index dcf92c092..012ae4e9f 100644
--- a/src/screens/Search/utils.ts
+++ b/src/screens/Search/utils.ts
@@ -35,6 +35,7 @@ export function makeSearchQuery(query: string, params: Params) {
   return [
     query,
     Object.entries(params)
+      .filter(([_, value]) => value)
       .map(([name, value]) => `${name}:${value}`)
       .join(' '),
   ]
diff --git a/src/view/screens/Search/Search.tsx b/src/view/screens/Search/Search.tsx
index 4a6c87f10..6fce99814 100644
--- a/src/view/screens/Search/Search.tsx
+++ b/src/view/screens/Search/Search.tsx
@@ -338,18 +338,28 @@ function SearchLanguageDropdown({
   onChange(value: string): void
 }) {
   const t = useThemeNew()
+  const {_} = useLingui()
   const {contentLanguages} = useLanguagePrefs()
 
   const items = React.useMemo(() => {
-    return LANGUAGES.filter(l => Boolean(l.code2))
-      .map(l => ({
-        label: l.name,
-        inputLabel: l.name,
-        value: l.code2,
-        key: l.code2 + l.code3,
-      }))
-      .sort(a => (contentLanguages.includes(a.value) ? -1 : 1))
-  }, [contentLanguages])
+    return [
+      {
+        label: _(msg`Any language`),
+        inputLabel: _(msg`Any language`),
+        value: '',
+        key: '*',
+      },
+    ].concat(
+      LANGUAGES.filter(l => Boolean(l.code2))
+        .map(l => ({
+          label: l.name,
+          inputLabel: l.name,
+          value: l.code2,
+          key: l.code2 + l.code3,
+        }))
+        .sort(a => (contentLanguages.includes(a.value) ? -1 : 1)),
+    )
+  }, [_, contentLanguages])
 
   const style = {
     backgroundColor: t.atoms.bg_contrast_25.backgroundColor,