From 71594d069c5f5fa35eb60238409be20e51997c85 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Wed, 31 Aug 2022 21:02:12 -0500 Subject: Update post thread aesthetics --- src/view/com/post-thread/PostThreadItem.tsx | 209 +++++++++++++++------------- 1 file changed, 114 insertions(+), 95 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 ed411131f..376ec6805 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} - - - + + + + + + ) + } else { + return ( + + + + + + + - {item.repostCount} + style={[styles.metaItem, s.f15, s.bold]} + onPress={onPressAuthor}> + {item.author.displayName} - - - - {item.likeCount} + style={[styles.metaItem, s.f14, s.gray5]} + onPress={onPressAuthor}> + @{item.author.name} + + + · {ago(item.indexedAt)} - - onPressShare(item.uri)}> - - + + + {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, -- cgit 1.4.1