From 1af8e83d536cf6a9db128409c8e00a0b44d9a985 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 19 Sep 2023 19:08:11 -0700 Subject: Tree view threads experiment (#1480) * Add tree-view experiment to threads * Fix typo * Remove extra minimalshellmode call * Fix to parent line rendering * Fix extra border * Some ui cleanup --- src/view/com/post-thread/PostThreadItem.tsx | 141 ++++++++++++++++++++-------- 1 file changed, 103 insertions(+), 38 deletions(-) (limited to 'src/view/com/post-thread/PostThreadItem.tsx') diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index 37c7ece47..1089bfabf 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -35,15 +35,18 @@ import {formatCount} from '../util/numeric/format' import {TimeElapsed} from 'view/com/util/TimeElapsed' import {makeProfileLink} from 'lib/routes/links' import {isDesktopWeb} from 'platform/detection' +import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' export const PostThreadItem = observer(function PostThreadItem({ item, onPostReply, hasPrecedingItem, + treeView, }: { item: PostThreadItemModel onPostReply: () => void hasPrecedingItem: boolean + treeView: boolean }) { const pal = usePalette('default') const store = useStores() @@ -389,25 +392,28 @@ export const PostThreadItem = observer(function PostThreadItem({ ) } else { + const isThreadedChild = treeView && item._depth > 0 return ( - <> + + style={{ + flexDirection: 'row', + gap: 10, + paddingLeft: 8, + height: isThreadedChild ? 8 : 16, + }}> - {item._showParentReplyLine && ( + {!isThreadedChild && item._showParentReplyLine && ( {item.richText?.text ? ( - + + {item._hasMore ? ( + + + More + + + + ) : undefined} - {item._hasMore ? ( - - Continue thread... - - - ) : undefined} - + ) } }) +function PostOuterWrapper({ + item, + hasPrecedingItem, + treeView, + children, +}: React.PropsWithChildren<{ + item: PostThreadItemModel + hasPrecedingItem: boolean + treeView: boolean +}>) { + const {isMobile} = useWebMediaQueries() + const pal = usePalette('default') + if (treeView && item._depth > 0) { + return ( + + {Array.from(Array(item._depth - 1)).map((_, n: number) => ( + + ))} + {children} + + ) + } + return ( + + {children} + + ) +} + function ExpandedPostDetails({ post, needsTranslation, @@ -600,7 +666,7 @@ const styles = StyleSheet.create({ flexDirection: 'row', alignItems: 'center', flexWrap: 'wrap', - paddingBottom: 8, + paddingBottom: 4, paddingRight: 10, }, postTextLargeContainer: { @@ -629,11 +695,10 @@ const styles = StyleSheet.create({ }, loadMore: { flexDirection: 'row', - justifyContent: 'space-between', - borderTopWidth: 1, - paddingLeft: 80, - paddingRight: 20, - paddingVertical: 12, + alignItems: 'center', + justifyContent: 'flex-start', + gap: 4, + paddingHorizontal: 20, }, replyLine: { width: 2, -- cgit 1.4.1