diff options
Diffstat (limited to 'src/view/screens')
-rw-r--r-- | src/view/screens/Log.tsx | 24 | ||||
-rw-r--r-- | src/view/screens/Search/Explore.tsx | 31 |
2 files changed, 32 insertions, 23 deletions
diff --git a/src/view/screens/Log.tsx b/src/view/screens/Log.tsx index e727a1fb8..e10aa83ab 100644 --- a/src/view/screens/Log.tsx +++ b/src/view/screens/Log.tsx @@ -1,18 +1,19 @@ import React from 'react' import {StyleSheet, TouchableOpacity, View} from 'react-native' -import {useFocusEffect} from '@react-navigation/native' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {NativeStackScreenProps, CommonNavigatorParams} from 'lib/routes/types' -import {ScrollView} from '../com/util/Views' -import {s} from 'lib/styles' -import {ViewHeader} from '../com/util/ViewHeader' -import {Text} from '../com/util/text/Text' -import {usePalette} from 'lib/hooks/usePalette' -import {getEntries} from '#/logger/logDump' -import {ago} from 'lib/strings/time' -import {useLingui} from '@lingui/react' import {msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' +import {useFocusEffect} from '@react-navigation/native' + +import {useGetTimeAgo} from '#/lib/hooks/useTimeAgo' +import {getEntries} from '#/logger/logDump' import {useSetMinimalShellMode} from '#/state/shell' +import {usePalette} from 'lib/hooks/usePalette' +import {CommonNavigatorParams, NativeStackScreenProps} from 'lib/routes/types' +import {s} from 'lib/styles' +import {Text} from '../com/util/text/Text' +import {ViewHeader} from '../com/util/ViewHeader' +import {ScrollView} from '../com/util/Views' export function LogScreen({}: NativeStackScreenProps< CommonNavigatorParams, @@ -22,6 +23,7 @@ export function LogScreen({}: NativeStackScreenProps< const {_} = useLingui() const setMinimalShellMode = useSetMinimalShellMode() const [expanded, setExpanded] = React.useState<string[]>([]) + const timeAgo = useGetTimeAgo() useFocusEffect( React.useCallback(() => { @@ -70,7 +72,7 @@ export function LogScreen({}: NativeStackScreenProps< /> ) : undefined} <Text type="sm" style={[styles.ts, pal.textLight]}> - {ago(entry.timestamp)} + {timeAgo(entry.timestamp)} </Text> </TouchableOpacity> {expanded.includes(entry.id) ? ( diff --git a/src/view/screens/Search/Explore.tsx b/src/view/screens/Search/Explore.tsx index c7f5f939f..dd93bf813 100644 --- a/src/view/screens/Search/Explore.tsx +++ b/src/view/screens/Search/Explore.tsx @@ -64,7 +64,7 @@ function SuggestedItemsHeader({ fill={t.palette.primary_500} style={{marginLeft: -2}} /> - <Text style={[a.text_2xl, a.font_bold, t.atoms.text]}>{title}</Text> + <Text style={[a.text_2xl, a.font_heavy, t.atoms.text]}>{title}</Text> </View> <Text style={[t.atoms.text_contrast_high, a.leading_snug]}> {description} @@ -119,6 +119,9 @@ function LoadMore({ }) .filter(Boolean) as LoadMoreItems[] }, [item.items, moderationOpts]) + + if (items.length === 0) return null + const type = items[0].type return ( @@ -142,20 +145,20 @@ function LoadMore({ a.relative, { height: 32, - width: 32 + 15 * 3, + width: 32 + 15 * items.length, }, ]}> <View style={[ a.align_center, a.justify_center, - a.border, t.atoms.bg_contrast_25, a.absolute, { width: 30, height: 30, left: 0, + borderWidth: 1, backgroundColor: t.palette.primary_500, borderColor: t.atoms.bg.backgroundColor, borderRadius: type === 'profile' ? 999 : 4, @@ -169,13 +172,13 @@ function LoadMore({ <View key={_item.key} style={[ - a.border, t.atoms.bg_contrast_25, a.absolute, { width: 30, height: 30, left: (i + 1) * 15, + borderWidth: 1, borderColor: t.atoms.bg.backgroundColor, borderRadius: _item.type === 'profile' ? 999 : 4, zIndex: 3 - i, @@ -350,13 +353,15 @@ export function Explore() { } } - i.push({ - type: 'loadMore', - key: 'loadMoreProfiles', - isLoadingMore: isLoadingMoreProfiles, - onLoadMore: onLoadMoreProfiles, - items: i.filter(item => item.type === 'profile').slice(-3), - }) + if (hasNextProfilesPage) { + i.push({ + type: 'loadMore', + key: 'loadMoreProfiles', + isLoadingMore: isLoadingMoreProfiles, + onLoadMore: onLoadMoreProfiles, + items: i.filter(item => item.type === 'profile').slice(-3), + }) + } } else { if (profilesError) { i.push({ @@ -412,7 +417,7 @@ export function Explore() { message: _(msg`Failed to load feeds preferences`), error: cleanError(preferencesError), }) - } else { + } else if (hasNextFeedsPage) { i.push({ type: 'loadMore', key: 'loadMoreFeeds', @@ -454,6 +459,8 @@ export function Explore() { profilesError, feedsError, preferencesError, + hasNextProfilesPage, + hasNextFeedsPage, ]) const renderItem = React.useCallback( |