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

2520: Show number search results #2976

Merged
merged 19 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ Depending on whether you want to develop for Android, iOS or both the following

- Install Java JDK, SDK and Runtime (v8 or v11).
- Install the Android SDK by using
the [Android Support plugin](https://plugins.jetbrains.com/plugin/1792-android-support) in IntelliJ.
- Install the latest stable SDK Platform and Android SDK Tools in the SDK Manager (Settings > Appearance & Behaviour >
System Settings > Android SDK).
the [Android plugin](https://plugins.jetbrains.com/plugin/22989-android) in IntelliJ.
- Install the latest stable SDK Platform and Android SDK Tools in the SDK Manager (Settings > Languages & Frameworks > Android SDK Updater).
- Install and accept the SDK license in the SDK Manager.
- [optional] If you want to develop using an emulator, also install the Android Emulator in the Android SDK settings.

Expand Down
7 changes: 7 additions & 0 deletions native/src/components/CitySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ const SearchBar = styled.View`
padding: 0 10%;
`

const SearchCounter = styled.Text`
margin: 15px 0 10px 0;
simomps marked this conversation as resolved.
Show resolved Hide resolved
color: ${props => props.theme.colors.textSecondaryColor};
font-weight: 500;
`

type CitySelectorProps = {
cities: Array<CityModel>
navigateToDashboard: (city: CityModel) => void
Expand Down Expand Up @@ -70,6 +76,7 @@ const CitySelector = ({ cities, navigateToDashboard }: CitySelectorProps): React
<CityGroup>{t('nearbyCities')}</CityGroup>
<NearbyCities cities={cities} navigateToDashboard={navigateToDashboard} filterText={filterText} />
</CityGroupContainer>
<SearchCounter>{t('search:searchResultsCount', { count: resultCities.length })}</SearchCounter>
{resultCities.length === 0 ? <NothingFound paddingTop /> : cityEntries}
</View>
</View>
Expand Down
26 changes: 17 additions & 9 deletions native/src/routes/SearchModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ const Wrapper = styled.View`
background-color: ${props => props.theme.colors.backgroundColor};
`

const SearchCounter = styled.Text`
margin: 10px 20px;
color: ${props => props.theme.colors.textSecondaryColor};
`

export type SearchModalProps = {
allPossibleResults: Array<SearchResult>
languageCode: string
Expand Down Expand Up @@ -76,15 +81,18 @@ const SearchModal = ({
<SearchHeader query={query} closeSearchBar={onClose} onSearchChanged={setQuery} />
<KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : undefined} style={{ flex: 1 }}>
{query.length > 0 && (
<List
items={searchResults}
renderItem={renderItem}
accessibilityLabel={t('searchResultsCount', { count: searchResults.length })}
style={{ flex: 1 }}
noItemsMessage={
<FeedbackContainer routeType={SEARCH_ROUTE} language={languageCode} cityCode={cityCode} query={query} />
}
/>
<>
<SearchCounter>{t('searchResultsCount', { count: searchResults.length })}</SearchCounter>
<List
items={searchResults}
renderItem={renderItem}
accessibilityLabel={t('searchResultsCount', { count: searchResults.length })}
style={{ flex: 1 }}
noItemsMessage={
<FeedbackContainer routeType={SEARCH_ROUTE} language={languageCode} cityCode={cityCode} query={query} />
}
/>
</>
)}
</KeyboardAvoidingView>
</Wrapper>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
issue_key: 2520
show_in_stores: true
platforms:
- web
- android
- ios
en: Show number of search results
simomps marked this conversation as resolved.
Show resolved Hide resolved
de: Zeige die Anzahl von Suchergebnissen an
4 changes: 4 additions & 0 deletions web/src/components/CitySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const CityListParent = styled.div<{ $stickyTop: number }>`
background-color: ${props => props.theme.colors.backgroundColor};
border-bottom: 1px solid ${props => props.theme.colors.themeColor};
`
const SearchCounter = styled.p`
color: ${props => props.theme.colors.textSecondaryColor};
`

type CitySelectorProps = {
cities: Array<CityModel>
Expand Down Expand Up @@ -58,6 +61,7 @@ const CitySelector = ({ cities, language }: CitySelectorProps): ReactElement =>
placeholderText={t('searchCity')}
spaceSearch={false}
onStickyTopChanged={setStickyTop}>
<SearchCounter>{t('search:searchResultsCount', { count: resultCities.length })}</SearchCounter>
{resultCities.length === 0 ? <Failure errorMessage='search:nothingFound' /> : groups}
</ScrollingSearchBox>
</Container>
Expand Down
6 changes: 6 additions & 0 deletions web/src/routes/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ const List = styled.ul`
}
`

const SearchCounter = styled.p`
padding: 0 5px;
color: ${props => props.theme.colors.textSecondaryColor};
`

const SearchPage = ({ city, cityCode, languageCode, pathname }: CityRouteProps): ReactElement | null => {
const query = new URLSearchParams(useLocation().search).get('query') ?? ''
const [filterText, setFilterText] = useState<string>(query)
Expand Down Expand Up @@ -102,6 +107,7 @@ const SearchPage = ({ city, cityCode, languageCode, pathname }: CityRouteProps):
{query.length > 0 && (
<>
<List>
<SearchCounter>{t('searchResultsCount', { count: results.length })}</SearchCounter>
{results.map(({ title, content, path, thumbnail }) => (
<SearchListItem
title={title}
Expand Down
Loading