Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add language filtering UI to search #5459

Merged
merged 14 commits into from
Sep 25, 2024
Merged

Add language filtering UI to search #5459

merged 14 commits into from
Sep 25, 2024

Conversation

estrattonbailey
Copy link
Member

@estrattonbailey estrattonbailey commented Sep 23, 2024

Adds language filtering to the search interface. Works like this:

  • if lang:* param exists, it uses that, otherwise defaults to the user's first contentLanguages[] string
  • when searching, selecting a different language from the dropdown overrides whats typed in the search box (if anything)

Also replaces basically the whole header section on the search screen. Functionality remains the same, except that when pressing "Cancel" it clears the search query as well. This felt like a bug to me with the existing handling.

Had to touch TextField in order to adjust its sizing to match new button sizing and keep alignment looking good. You can see the alignment on the search screen on mobile, or just check out the storybook.

Web

CleanShot 2024-09-24 at 13 17 04@2x
CleanShot 2024-09-24 at 13 17 13@2x
CleanShot 2024-09-24 at 13 17 19@2x

iOS

IMG_3911
IMG_3912
IMG_3913

Android

Screenshot_20240924-131110
Screenshot_20240924-131125
Screenshot_20240924-131007

Copy link

github-actions bot commented Sep 23, 2024

Old size New size Diff
10.01 MB 10.01 MB 2.8 KB (0.03%)

@arcalinea arcalinea temporarily deployed to search-lang - social-app PR #5459 September 24, 2024 18:18 — with Render Destroyed
@surfdude29
Copy link
Contributor

surfdude29 commented Sep 24, 2024

I just tried it on the preview branch, very nice 👌

One minor point to mention (that is not in any way caused by this PR, of course): having languages in the dropdown does highlight that some are repeated, e.g. French and German, which seems to be the issue referred to in #4314

IMG_4178

@estrattonbailey
Copy link
Member Author

@surfdude29 yeah we have some work we need to do here sometime. It's complicated by the fact that users have these values stored. So if we remove any, we need to remap old values to new values, among other things. Need to give it some thought, but it's on my list. Thanks for the bump!

@arcalinea arcalinea temporarily deployed to search-lang - social-app PR #5459 September 25, 2024 16:09 — with Render Destroyed
@@ -349,7 +491,7 @@ let SearchScreenInner = ({query}: {query?: string}): React.ReactNode => {
title: _(msg`Top`),
component: (
<SearchScreenPostResults
query={query}
query={queryWithParams}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post queries can have params like lang, but profiles and feeds don't support these and will return nothing. So those are passed the raw query without params.

@@ -32,7 +32,7 @@ export function Forms() {
label="Text field"
/>

<View style={[a.flex_row, a.gap_sm]}>
<View style={[a.flex_row, a.align_start, a.gap_sm]}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prevents stretching, just for testing cross-platform

Copy link
Contributor

@haileyok haileyok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels really good, huge improvement.

Noted the hamburger question, worth considering I think going forward.

Comment on lines +989 to +1008
<TextField.Root>
<TextField.Icon icon={MagnifyingGlass} />
<TextField.Input
inputRef={textInput}
label={_(msg`Search`)}
value={searchText}
placeholder={_(msg`Search`)}
returnKeyType="search"
onChangeText={onChangeText}
onSubmitEditing={onSubmit}
onFocus={onFocus}
keyboardAppearance={t.scheme}
selectTextOnFocus={isNative}
autoFocus={false}
accessibilityRole="search"
autoCorrect={false}
autoComplete="off"
autoCapitalize="none"
/>
</TextField.Root>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very small question here that can be addressed separately, do we want to extract this out to our SearchBox (I think that's what it is called...) so we can use it in the right nav on web? Maybe with a configurable size since this might be too big for the sidebar. Just a thought.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that'd be cool. With the autocomplete and the operator hints we mentioned.

src/view/screens/Search/Search.tsx Outdated Show resolved Hide resolved
@arcalinea arcalinea temporarily deployed to search-lang - social-app PR #5459 September 25, 2024 20:46 — with Render Destroyed
@estrattonbailey estrattonbailey merged commit b1ca250 into main Sep 25, 2024
6 checks passed
estrattonbailey added a commit that referenced this pull request Sep 26, 2024
* origin/main:
  Adjust line height to not cut off emoji (#5496)
  Emoji in account list (#5497)
  Make the counter more rounded (#5083)
  add emoji prop to composer reply to text (#5495)
  Fix banner height in edit profile modal (#5494)
  Messages list - make avatars link to profile (#5484)
  Add back empty placeholder (#5489)
  Filter errors that get sent to Sentry (#5247)
  Add language filtering UI to search (#5459)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants