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

1233: Implement lists as actual list #2521

Merged
merged 38 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
93ee4e7
1233: Implement lists as actual list
lunars97 Oct 12, 2023
7013b5f
Merge branch 'main' into 1233-implement-lists-as-actual-lists
lunars97 Oct 12, 2023
313a458
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Oct 15, 2023
ae5b866
Merge branch 'main' into 1233-implement-lists-as-actual-lists
lunars97 Oct 15, 2023
e5c0a92
1233: ts error
lunars97 Oct 15, 2023
e137dee
Merge branch '1233-implement-lists-as-actual-lists' of github.com:dig…
lunars97 Oct 15, 2023
86ac141
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Oct 23, 2023
6a5297f
Merge branch 'main' into 1233-implement-lists-as-actual-lists
lunars97 Oct 23, 2023
5d4a98f
1233: linting error is resolved
lunars97 Oct 23, 2023
ec05c37
Merge branch '1233-implement-lists-as-actual-lists' of github.com:dig…
lunars97 Oct 23, 2023
d0cf257
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Oct 30, 2023
25a7757
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Oct 30, 2023
d935507
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Oct 31, 2023
7e45d3d
1233: additional changes to accessibility
lunars97 Nov 2, 2023
5ffe465
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Nov 6, 2023
f5d2d5d
1233: improved accessibility on native and web
lunars97 Nov 6, 2023
974f403
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Nov 9, 2023
5b50ae7
Merge branch 'main' into 1233-implement-lists-as-actual-lists
lunars97 Nov 9, 2023
50a092e
Merge branch 'main' into 1233-implement-lists-as-actual-lists
lunars97 Nov 9, 2023
5651011
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Nov 9, 2023
03e4817
Merge branch '1233-implement-lists-as-actual-lists' of github.com:dig…
lunars97 Nov 9, 2023
45e82cb
Merge branch 'main' into 1233-implement-lists-as-actual-lists
lunars97 Nov 20, 2023
9ac544a
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Nov 20, 2023
773d118
1233: Removed some unnessary props and renamed the file
lunars97 Nov 20, 2023
1ea3fcb
Merge branch '1233-implement-lists-as-actual-lists' of github.com:dig…
lunars97 Nov 20, 2023
637f376
Merge branch 'main' into 1233-implement-lists-as-actual-lists
lunars97 Nov 24, 2023
f063368
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Nov 24, 2023
25da5fe
Merge branch '1233-implement-lists-as-actual-lists' of github.com:dig…
lunars97 Nov 24, 2023
e992d40
1233: implemented suggestion related to prop
lunars97 Nov 24, 2023
79dfbe9
Merge branch 'main' into 1233-implement-lists-as-actual-lists
lunars97 Dec 4, 2023
b2a2494
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Dec 4, 2023
c27de1e
Merge branch 'main' into 1233-implement-lists-as-actual-lists
lunars97 Dec 4, 2023
d7fbee8
Merge branch 'main' into 1233-implement-lists-as-actual-lists
lunars97 Dec 4, 2023
23ab06b
1233: added pluralization and implemented suggestions
lunars97 Dec 4, 2023
5a60629
Merge branch '1233-implement-lists-as-actual-lists' of github.com:dig…
lunars97 Dec 4, 2023
bcee709
1233: added translation and implemented suggestions
lunars97 Dec 5, 2023
b27482c
Merge branch 'main' of github.com:digitalfabrik/integreat-app into 12…
lunars97 Dec 5, 2023
fbd31a3
Merge branch 'main' into 1233-implement-lists-as-actual-lists
lunars97 Dec 6, 2023
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
26 changes: 17 additions & 9 deletions native/src/components/Categories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import TileModel from '../models/TileModel'
import testID from '../testing/testID'
import { LanguageResourceCacheStateType, PageResourceCacheStateType } from '../utils/DataContainer'
import CategoryListItem from './CategoryListItem'
import List from './List'
import OrganizationContentInfo from './OrganizationContentInfo'
import Page from './Page'
import Tiles from './Tiles'
Expand Down Expand Up @@ -80,16 +81,23 @@ const Categories = ({
language={language}
path={category.path}
AfterContent={category.organization && <OrganizationContentInfo organization={category.organization} />}
Footer={children.map(it => (
<CategoryListItem
key={it.path}
category={it}
subCategories={categories.getChildren(it)}
resourceCache={resourceCache}
language={language}
onItemPress={navigateToCategory}
Footer={
<List
items={children}
renderItem={({ item: it }) => (
<CategoryListItem
key={it.path}
category={it}
subCategories={categories.getChildren(it)}
resourceCache={resourceCache}
language={language}
onItemPress={navigateToCategory}
/>
)}
// Fixes VirtualizedLists nesting error
scrollEnabled={false}
/>
))}
}
/>
)
}
Expand Down
23 changes: 14 additions & 9 deletions native/src/components/CategoryListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { contentDirection, isContentDirectionReversalRequired } from '../constan
import dimensions from '../constants/dimensions'
import { LanguageResourceCacheStateType } from '../utils/DataContainer'
import { getCachedThumbnail } from './Categories'
import List from './List'
import SimpleImage from './SimpleImage'
import SubCategoryListItem from './SubCategoryListItem'
import Pressable from './base/Pressable'
Expand Down Expand Up @@ -82,15 +83,19 @@ const CategoryListItem = ({
</CategoryEntryContainer>
</DirectionContainer>
</FlexStyledLink>
{subCategories.map(subCategory => (
<SubCategoryListItem
key={subCategory.path}
subCategory={subCategory}
resourceCache={resourceCache[subCategory.path] ?? {}}
onItemPress={onItemPress}
language={language}
/>
))}
<List
steffenkleinle marked this conversation as resolved.
Show resolved Hide resolved
items={subCategories}
renderItem={({ item: subCategory }) => (
<SubCategoryListItem
key={subCategory.path}
subCategory={subCategory}
resourceCache={resourceCache[subCategory.path] ?? {}}
onItemPress={onItemPress}
language={language}
/>
)}
scrollEnabled={false}
/>
</>
)

Expand Down
3 changes: 3 additions & 0 deletions native/src/components/LayoutedScrollView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ const LayoutedScrollView = (props: LayoutedScrollViewProps): ReactElement => {
<Layout>
<ScrollView
keyboardShouldPersistTaps='always'
// Fixes VirtualizedLists nesting error
// See https://github.com/facebook/react-native/issues/31697#issuecomment-1742437232
nestedScrollEnabled
steffenkleinle marked this conversation as resolved.
Show resolved Hide resolved
refreshControl={refreshControl}
contentContainerStyle={{
flexGrow: 1,
Expand Down
9 changes: 8 additions & 1 deletion native/src/components/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ const NoItemsMessage = styled.Text`

type ListProps<T> = {
items: Array<T>
noItemsMessage: ReactElement | string
noItemsMessage?: ReactElement | string
ztefanie marked this conversation as resolved.
Show resolved Hide resolved
renderItem: (props: { item: T; index: number }) => ReactElement
Header?: ReactElement
Footer?: ReactElement
scrollEnabled?: boolean
accessibilityLabel?: string
refresh?: () => void
onEndReached?: () => void
}
Expand All @@ -26,7 +28,9 @@ const List = <T,>({
Header,
Footer,
refresh,
accessibilityLabel,
onEndReached,
scrollEnabled,
}: ListProps<T>): ReactElement => (
<FlatList
data={items}
Expand All @@ -46,6 +50,9 @@ const List = <T,>({
paddingHorizontal: 10,
}}
onEndReachedThreshold={1}
scrollEnabled={scrollEnabled}
accessibilityRole='list'
accessibilityLabel={accessibilityLabel}
/>
)

Expand Down
4 changes: 3 additions & 1 deletion native/src/components/SearchListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { memo, ReactElement } from 'react'
import { useTranslation } from 'react-i18next'
import Highlighter from 'react-native-highlight-words'
import styled, { useTheme } from 'styled-components/native'

Expand Down Expand Up @@ -58,6 +59,7 @@ const SearchListItem = ({
onItemPress,
query,
}: SearchListItemProps): ReactElement => {
const { t } = useTranslation('search')
const theme = useTheme()
const { title, thumbnail } = category
const excerpt = getExcerpt(contentWithoutHtml, { query, maxChars: SEARCH_PREVIEW_MAX_CHARS })
Expand Down Expand Up @@ -86,7 +88,7 @@ const SearchListItem = ({
/>
)
return (
<FlexStyledLink onPress={() => onItemPress(category)}>
<FlexStyledLink onPress={() => onItemPress(category)} accessibilityHint={t('itemHint')}>
<DirectionContainer language={language}>
<SearchEntryContainer>
<TitleDirectionContainer language={language}>
Expand Down
7 changes: 6 additions & 1 deletion native/src/components/base/TextButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ type TextButtonProps = {
}

const TextButton = ({ text, onPress, disabled = false, type = 'primary', style }: TextButtonProps): ReactElement => (
<StyledPressable onPress={onPress} primary={type === 'primary'} disabled={disabled} style={style}>
<StyledPressable
onPress={onPress}
primary={type === 'primary'}
disabled={disabled}
style={style}
accessibilityRole='button'>
<StyledText>{text}</StyledText>
</StyledPressable>
)
Expand Down
1 change: 1 addition & 0 deletions native/src/routes/SearchModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ const SearchModal = ({
<List
items={searchResults}
renderItem={renderItem}
accessibilityLabel={t('searchResultsCount', { count: searchResults.length })}
noItemsMessage={
<>
<NothingFound />
Expand Down
14 changes: 14 additions & 0 deletions translations/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -8412,6 +8412,13 @@
"de": {
"nothingFound": "Es wurden leider keine passenden Ergebnisse gefunden.",
"searchPlaceholder": "Suche",
"itemHint": "Suchergebnis öffnen",
"searchResultsCount_zero": "0 Suchergebnisse",
"searchResultsCount_one": "1 Suchergebnis",
"searchResultsCount_two": "2 Suchergebnisse",
"searchResultsCount_few": "{{count}} Suchergebnisse",
"searchResultsCount_many": "{{count}} Suchergebnisse",
"searchResultsCount_other": "{{count}} Suchergebnisse",
"pageTitle": "Suche",
"delete": "Eingabe löschen"
},
Expand Down Expand Up @@ -8454,6 +8461,13 @@
"en": {
"nothingFound": "Sorry, we could not find any matching results.",
"searchPlaceholder": "Search",
"itemHint": "View search result",
"searchResultsCount_zero": "0 search results",
"searchResultsCount_one": "1 search result",
"searchResultsCount_two": "2 search results",
"searchResultsCount_few": "{{count}} search results",
"searchResultsCount_many": "{{count}} search results",
"searchResultsCount_other": "{{count}} search results",
"pageTitle": "Search",
"delete": "Delete input"
},
Expand Down