From 8cb076f5fd8d4435703ac1ac4705c275eb38c0e8 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 8 Aug 2023 11:29:38 -0500 Subject: [PATCH 1/2] fix thread spacing and reply lines --- src/state/models/content/post-thread-item.ts | 2 +- src/view/com/post-thread/PostThreadItem.tsx | 393 ++++++++++--------- 2 files changed, 218 insertions(+), 177 deletions(-) diff --git a/src/state/models/content/post-thread-item.ts b/src/state/models/content/post-thread-item.ts index 141b4f93..942f3acc 100644 --- a/src/state/models/content/post-thread-item.ts +++ b/src/state/models/content/post-thread-item.ts @@ -107,7 +107,7 @@ export class PostThreadItemModel { const itemModel = new PostThreadItemModel(this.rootStore, item) itemModel._depth = this._depth + 1 itemModel._showParentReplyLine = - itemModel.parentUri !== highlightedPostUri && replies.length === 0 + itemModel.parentUri !== highlightedPostUri if (item.replies?.length) { itemModel._showChildReplyLine = true itemModel.assignTreeModels(item, highlightedPostUri, false, true) diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index 41be392a..cbdd90b8 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -159,171 +159,189 @@ export const PostThreadItem = observer(function PostThreadItem({ if (item._isHighlightedPost) { return ( - - - - - + <> + {item.rootUri !== item.uri && ( + + + + - - - + )} + + + + + + + + + + + + + {sanitizeDisplayName( + item.post.author.displayName || + sanitizeHandle(item.post.author.handle), + )} + + + + ·  + + {({timeElapsed}) => <>{timeElapsed}} + + + + + + + - - {sanitizeDisplayName( - item.post.author.displayName || - sanitizeHandle(item.post.author.handle), - )} + + {sanitizeHandle(item.post.author.handle, '@')} - - ·  - - {({timeElapsed}) => <>{timeElapsed}} - - - - + + + + + {item.richText?.text ? ( + + + + ) : undefined} + {item.post.embed && ( + + + + )} + + + {hasEngagement ? ( + + {item.post.repostCount ? ( + + + + {formatCount(item.post.repostCount)} + {' '} + {pluralize(item.post.repostCount, 'repost')} + + + ) : ( + <> + )} + {item.post.likeCount ? ( + + + + {formatCount(item.post.likeCount)} + {' '} + {pluralize(item.post.likeCount, 'like')} + + + ) : ( + <> + )} + + ) : ( + <> + )} + + - - - - {sanitizeHandle(item.post.author.handle, '@')} - - - - - - - - {item.richText?.text ? ( - - - - ) : undefined} - {item.post.embed && ( - - - - )} - - - {hasEngagement ? ( - - {item.post.repostCount ? ( - - - - {formatCount(item.post.repostCount)} - {' '} - {pluralize(item.post.repostCount, 'repost')} - - - ) : ( - <> - )} - {item.post.likeCount ? ( - - - - {formatCount(item.post.likeCount)} - {' '} - {pluralize(item.post.likeCount, 'like')} - - - ) : ( - <> - )} - - ) : ( - <> - )} - - - - - + + ) } else { return ( @@ -336,26 +354,36 @@ export const PostThreadItem = observer(function PostThreadItem({ pal.border, pal.view, item._showParentReplyLine && styles.noTopBorder, + !item._showChildReplyLine && {borderBottomWidth: 1}, ]} moderation={item.moderation.content}> - {item._showParentReplyLine && ( - - )} - {item._showChildReplyLine && ( - - )} - + + + + {item._showParentReplyLine && ( + + )} + + + + + + {item._showChildReplyLine && ( + + )} + Date: Tue, 8 Aug 2023 11:36:48 -0500 Subject: [PATCH 2/2] remove unused styles --- src/view/com/post-thread/PostThreadItem.tsx | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index cbdd90b8..c7b5711c 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -34,8 +34,6 @@ import {formatCount} from '../util/numeric/format' import {TimeElapsed} from 'view/com/util/TimeElapsed' import {makeProfileLink} from 'lib/routes/links' -const PARENT_REPLY_LINE_LENGTH = 8 - export const PostThreadItem = observer(function PostThreadItem({ item, onPostReply, @@ -529,20 +527,6 @@ const styles = StyleSheet.create({ noTopBorder: { borderTopWidth: 0, }, - parentReplyLine: { - position: 'absolute', - left: 44, - top: -1 * PARENT_REPLY_LINE_LENGTH + 6, - height: PARENT_REPLY_LINE_LENGTH, - borderLeftWidth: 2, - }, - childReplyLine: { - position: 'absolute', - left: 44, - top: 65, - bottom: 0, - borderLeftWidth: 2, - }, layout: { flexDirection: 'row', gap: 10,