From 42f1c5d45d1bb4673c984334ba01c8e8e6e02f57 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Wed, 31 Aug 2022 21:02:12 -0500 Subject: [PATCH] Update post thread aesthetics --- src/view/com/feed/FeedItem.tsx | 2 - src/view/com/post-thread/PostThread.tsx | 2 +- src/view/com/post-thread/PostThreadItem.tsx | 215 +++++++++++--------- 3 files changed, 118 insertions(+), 101 deletions(-) diff --git a/src/view/com/feed/FeedItem.tsx b/src/view/com/feed/FeedItem.tsx index c8acf18997..8c1e8dd211 100644 --- a/src/view/com/feed/FeedItem.tsx +++ b/src/view/com/feed/FeedItem.tsx @@ -133,8 +133,6 @@ export const FeedItem = observer(function FeedItem({ const styles = StyleSheet.create({ outer: { - // borderWidth: 1, - // borderColor: '#e8e8e8', borderRadius: 10, margin: 2, marginBottom: 0, diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx index f7044b741b..c12d99edbc 100644 --- a/src/view/com/post-thread/PostThread.tsx +++ b/src/view/com/post-thread/PostThread.tsx @@ -75,7 +75,7 @@ export const PostThread = observer(function PostThread({uri}: {uri: string}) { ) return ( - + item._reactKey} diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index ed411131f6..376ec6805d 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -9,14 +9,6 @@ import {ago, pluralize} from '../../lib/strings' import {AVIS} from '../../lib/assets' import {useStores} from '../../../state' -function iter(n: number, fn: (_i: number) => T): Array { - const arr: T[] = [] - for (let i = 0; i < n; i++) { - arr.push(fn(i)) - } - return arr -} - export const PostThreadItem = observer(function PostThreadItem({ item, onPressShare, @@ -61,41 +53,83 @@ export const PostThreadItem = observer(function PostThreadItem({ .catch(e => console.error('Failed to toggle like', record, e)) } - return ( - - - {iter(Math.abs(item._depth), (i: number) => ( - - ))} - - - - - - - {item.author.displayName} - - - @{item.author.name} - - - · {ago(item.indexedAt)} - + const Ctrls = () => ( + + + + {item.replyCount} + + + + + {item.repostCount} + + + + + + {item.likeCount} + + + onPressShare(item.uri)}> + + + + ) + + if (item._isHighlightedPost) { + return ( + + + + + + + + + {item.author.displayName} + + + · {ago(item.indexedAt)} + + + + + @{item.author.name} + + - + + + {record.text} {item._isHighlightedPost && hasEngagement ? ( @@ -124,74 +158,59 @@ export const PostThreadItem = observer(function PostThreadItem({ ) : ( <> )} - - - - {item.replyCount} - - - - - {item.repostCount} - - - - - - {item.likeCount} - - - onPressShare(item.uri)}> - - + + - - ) + ) + } else { + return ( + + + + + + + + + {item.author.displayName} + + + @{item.author.name} + + + · {ago(item.indexedAt)} + + + + {record.text} + + + + + + ) + } }) const styles = StyleSheet.create({ outer: { - marginTop: 1, backgroundColor: colors.white, + borderRadius: 10, + margin: 2, + marginBottom: 0, }, layout: { flexDirection: 'row', }, - replyBar: { - width: 5, - backgroundColor: colors.gray2, - marginRight: 2, - }, layoutAvi: { width: 70, paddingLeft: 10,