From ba837ad9afd3f4faa5a47b7ea620cd633e99d9cf Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Wed, 23 Nov 2022 10:39:28 -0600 Subject: Add threading to post feeds --- src/view/com/posts/FeedItem.tsx | 78 +++++++++++++++++++++++++++++++++-------- 1 file changed, 64 insertions(+), 14 deletions(-) (limited to 'src/view/com/posts/FeedItem.tsx') diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx index 6deb04209..4d7b307b1 100644 --- a/src/view/com/posts/FeedItem.tsx +++ b/src/view/com/posts/FeedItem.tsx @@ -15,6 +15,8 @@ import {UserAvatar} from '../util/UserAvatar' import {s, colors} from '../../lib/styles' import {useStores} from '../../../state' +const TOP_REPLY_LINE_LENGTH = 12 + export const FeedItem = observer(function FeedItem({ item, }: { @@ -74,8 +76,22 @@ export const FeedItem = observer(function FeedItem({ return } + const outerStyles = [ + styles.outer, + item._isThreadChild ? styles.outerNoTop : undefined, + item._isThreadParent ? styles.outerNoBottom : undefined, + ] return ( - + + {item._isThreadChild && } + {item._isThreadParent && ( + + )} {item.repostedBy && ( - + - - {replyHref !== '' && ( + {!item._isThreadChild ? ( + + ) : undefined} + {!item._isThreadChild && replyHref !== '' && ( Replying to @@ -165,6 +186,35 @@ const styles = StyleSheet.create({ backgroundColor: colors.white, padding: 10, }, + outerNoTop: { + marginTop: 1, + borderTopLeftRadius: 0, + borderTopRightRadius: 0, + }, + outerNoBottom: { + marginBottom: 0, + borderBottomLeftRadius: 0, + borderBottomRightRadius: 0, + }, + topReplyLine: { + position: 'absolute', + left: 34, + top: -1 * TOP_REPLY_LINE_LENGTH + 10, + height: TOP_REPLY_LINE_LENGTH, + borderLeftWidth: 2, + borderLeftColor: colors.gray2, + }, + bottomReplyLine: { + position: 'absolute', + left: 34, + top: 70, + bottom: 0, + borderLeftWidth: 2, + borderLeftColor: colors.gray2, + }, + bottomReplyLineSmallAvi: { + top: 50, + }, includeReason: { flexDirection: 'row', paddingLeft: 60, -- cgit 1.4.1