diff options
Diffstat (limited to 'src/view/com/post-thread')
-rw-r--r-- | src/view/com/post-thread/PostThread.tsx | 7 | ||||
-rw-r--r-- | src/view/com/post-thread/PostThreadItem.tsx | 19 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx index 9622ceb49..3623abde4 100644 --- a/src/view/com/post-thread/PostThread.tsx +++ b/src/view/com/post-thread/PostThread.tsx @@ -30,7 +30,8 @@ export const PostThread = observer(function PostThread({ newView.setup().catch(err => console.error('Failed to fetch thread', err)) }, [uri, view?.params.uri, store]) - // not yet setup + // loading + // = if ( !view || (view.isLoading && !view.isRefreshing) || @@ -44,6 +45,7 @@ export const PostThread = observer(function PostThread({ } // error + // = if (view.hasError) { return ( <View> @@ -52,7 +54,8 @@ export const PostThread = observer(function PostThread({ ) } - // rendering + // loaded + // = const posts = Array.from(flattenThread(view.thread)) const renderItem = ({item}: {item: PostThreadViewPostModel}) => ( <PostThreadItem item={item} onNavigateContent={onNavigateContent} /> diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index 5e01ac0a6..8628f67c1 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -27,6 +27,7 @@ export const PostThreadItem = observer(function PostThreadItem({ }) { const record = item.record as unknown as bsky.Post.Record const hasEngagement = item.likeCount || item.repostCount + const onPressOuter = () => { const urip = new AdxUri(item.uri) onNavigateContent('PostThread', { @@ -34,24 +35,34 @@ export const PostThreadItem = observer(function PostThreadItem({ recordKey: urip.recordKey, }) } + const onPressAuthor = () => { + onNavigateContent('Profile', { + name: item.author.name, + }) + } + return ( <TouchableOpacity style={styles.outer} onPress={onPressOuter}> <View style={styles.layout}> {iter(Math.abs(item._depth), (i: number) => ( <View key={i} style={styles.replyBar} /> ))} - <View style={styles.layoutAvi}> + <TouchableOpacity style={styles.layoutAvi} onPress={onPressAuthor}> <Image style={styles.avi} source={AVIS[item.author.name] || AVIS['alice.com']} /> - </View> + </TouchableOpacity> <View style={styles.layoutContent}> <View style={styles.meta}> - <Text style={[styles.metaItem, s.f15, s.bold]}> + <Text + style={[styles.metaItem, s.f15, s.bold]} + onPress={onPressAuthor}> {item.author.displayName} </Text> - <Text style={[styles.metaItem, s.f14, s.gray]}> + <Text + style={[styles.metaItem, s.f14, s.gray]} + onPress={onPressAuthor}> @{item.author.name} </Text> <Text style={[styles.metaItem, s.f14, s.gray]}> |