From a427010629e6fa8b95113d97632abb7ba3035b3f Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 28 Sep 2023 11:03:52 +0100 Subject: [PATCH 1/2] Don't render a pressable if there's only one notification author --- src/view/com/notifications/FeedItem.tsx | 49 ++++++++++++++++++++----- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/src/view/com/notifications/FeedItem.tsx b/src/view/com/notifications/FeedItem.tsx index 00e56e1c..ff5ec9f5 100644 --- a/src/view/com/notifications/FeedItem.tsx +++ b/src/view/com/notifications/FeedItem.tsx @@ -22,7 +22,7 @@ import { import {NotificationsFeedItemModel} from 'state/models/feeds/notifications' import {PostThreadModel} from 'state/models/content/post-thread' import {s, colors} from 'lib/styles' -import {ago} from 'lib/strings/time' +import {niceDate} from 'lib/strings/time' import {sanitizeDisplayName} from 'lib/strings/display-names' import {sanitizeHandle} from 'lib/strings/handles' import {pluralize} from 'lib/strings/helpers' @@ -38,6 +38,7 @@ import {usePalette} from 'lib/hooks/usePalette' import {useAnimatedValue} from 'lib/hooks/useAnimatedValue' import {formatCount} from '../util/numeric/format' import {makeProfileLink} from 'lib/routes/links' +import {TimeElapsed} from '../util/TimeElapsed' const MAX_AUTHORS = 5 @@ -88,7 +89,7 @@ export const FeedItem = observer(function FeedItemImpl({ }, [item]) const onToggleAuthorsExpanded = () => { - setAuthorsExpanded(!isAuthorsExpanded) + setAuthorsExpanded(currentlyExpanded => !currentlyExpanded) } const authors: Author[] = useMemo(() => { @@ -179,7 +180,6 @@ export const FeedItem = observer(function FeedItemImpl({ } return ( - // eslint-disable-next-line react-native-a11y/no-nested-touchables - 1 ? onToggleAuthorsExpanded : undefined} - accessible={false}> + 1} + onToggleAuthorsExpanded={onToggleAuthorsExpanded}> ) : undefined} {action} - {ago(item.indexedAt)} + + {({timeElapsed}) => ( + + {' ' + timeElapsed} + + )} + - + {item.isLike || item.isRepost || item.isQuote ? ( ) : null} @@ -250,6 +256,29 @@ export const FeedItem = observer(function FeedItemImpl({ ) }) +function ExpandListPressable({ + hasMultipleAuthors, + children, + onToggleAuthorsExpanded, +}: { + hasMultipleAuthors: boolean + children: React.ReactNode + onToggleAuthorsExpanded: () => void +}) { + if (hasMultipleAuthors) { + return ( + + {children} + + ) + } else { + return <>{children} + } +} + function CondensedAuthorsList({ visible, authors, @@ -466,7 +495,9 @@ const styles = StyleSheet.create({ paddingTop: 4, paddingLeft: 36, }, - + expandedAuthorsTrigger: { + zIndex: 1, + }, expandedAuthorsCloseBtn: { flexDirection: 'row', alignItems: 'center', From d57c8f7bca2afdac526fdd4ada4a297908ed02e9 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 28 Sep 2023 10:32:34 -0700 Subject: [PATCH 2/2] Fix pointer --- src/view/com/notifications/FeedItem.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/view/com/notifications/FeedItem.tsx b/src/view/com/notifications/FeedItem.tsx index ff5ec9f5..c51335c7 100644 --- a/src/view/com/notifications/FeedItem.tsx +++ b/src/view/com/notifications/FeedItem.tsx @@ -241,7 +241,9 @@ export const FeedItem = observer(function FeedItemImpl({ {action} {({timeElapsed}) => ( - + {' ' + timeElapsed} )} @@ -448,6 +450,10 @@ const styles = StyleSheet.create({ overflowHidden: { overflow: 'hidden', }, + pointer: { + // @ts-ignore web only + cursor: 'pointer', + }, outer: { padding: 10,