From 498c3e2c271524f7bac08df9d6cc4d72174a4521 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Wed, 20 Sep 2023 19:13:54 -0700 Subject: [PATCH] Tune the treeview UI a bit more (#1494) --- src/view/com/post-thread/PostThread.tsx | 26 ++----- src/view/com/post-thread/PostThreadItem.tsx | 80 ++++++++++++--------- src/view/com/util/PostMeta.tsx | 24 ++++--- 3 files changed, 69 insertions(+), 61 deletions(-) diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx index 373b4499..3c5d3a88 100644 --- a/src/view/com/post-thread/PostThread.tsx +++ b/src/view/com/post-thread/PostThread.tsx @@ -103,12 +103,6 @@ export const PostThread = observer(function PostThread({ return [] }, [view.isLoadingFromCache, view.thread, maxVisible]) const highlightedPostIndex = posts.findIndex(post => post._isHighlightedPost) - const showBottomBorder = - !treeView || - // in the treeview, only show the bottom border - // if there are replies under the highlighted posts - posts.findLast(v => v instanceof PostThreadItemModel) !== - posts[highlightedPostIndex] useSetTitle( view.thread?.postRecord && `${sanitizeDisplayName( @@ -194,10 +188,7 @@ export const PostThread = observer(function PostThread({ ) } else if (item === REPLY_PROMPT) { return ( - + {isDesktopWeb && } ) @@ -242,14 +233,11 @@ export const PostThread = observer(function PostThread({ // -prf return ( ) } else if (item === CHILD_SPINNER) { @@ -273,7 +261,7 @@ export const PostThread = observer(function PostThread({ } return <> }, - [onRefresh, onPressReply, pal, posts, isTablet, treeView, showBottomBorder], + [onRefresh, onPressReply, pal, posts, isTablet, treeView], ) // loading diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index 1089bfab..fc068469 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -166,7 +166,7 @@ export const PostThreadItem = observer(function PostThreadItem({ return ( <> {item.rootUri !== item.uri && ( - + - - - - {item._showChildReplyLine && ( - + - )} - + + {item._showChildReplyLine && ( + + )} + + )} {Array.from(Array(item._depth - 1)).map((_, n: number) => ( ))} @@ -626,12 +640,12 @@ function ExpandedPostDetails({ const styles = StyleSheet.create({ outer: { borderTopWidth: 1, - paddingLeft: 10, + paddingLeft: 8, }, outerHighlighted: { paddingTop: 16, - paddingLeft: 10, - paddingRight: 10, + paddingLeft: 8, + paddingRight: 8, }, noTopBorder: { borderTopWidth: 0, diff --git a/src/view/com/util/PostMeta.tsx b/src/view/com/util/PostMeta.tsx index 21cbbc54..b5c47dea 100644 --- a/src/view/com/util/PostMeta.tsx +++ b/src/view/com/util/PostMeta.tsx @@ -1,9 +1,10 @@ import React from 'react' -import {StyleSheet, View} from 'react-native' +import {StyleProp, StyleSheet, TextStyle, View, ViewStyle} from 'react-native' import {Text} from './text/Text' import {DesktopWebTextLink} from './Link' import {niceDate} from 'lib/strings/time' import {usePalette} from 'lib/hooks/usePalette' +import {TypographyVariant} from 'lib/ThemeContext' import {UserAvatar} from './UserAvatar' import {observer} from 'mobx-react-lite' import {sanitizeDisplayName} from 'lib/strings/display-names' @@ -19,10 +20,14 @@ interface PostMetaOpts { handle: string displayName?: string | undefined } - showAvatar?: boolean authorHasWarning: boolean postHref: string timestamp: string + showAvatar?: boolean + avatarSize?: number + displayNameType?: TypographyVariant + displayNameStyle?: StyleProp + style?: StyleProp } export const PostMeta = observer(function PostMetaImpl(opts: PostMetaOpts) { @@ -31,20 +36,20 @@ export const PostMeta = observer(function PostMetaImpl(opts: PostMetaOpts) { const handle = opts.author.handle return ( - - {opts.showAvatar && typeof opts.author.avatar !== 'undefined' && ( + + {opts.showAvatar && ( )}