diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-07-21 13:07:24 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-07-21 13:07:24 -0500 |
commit | 28dbc5f5e614b3caf08d36a7edaaf19a0ee0f0bc (patch) | |
tree | 073a42ff18ee286ace5cf701f859d32842da684c /src/view/com/post-thread/PostThreadItem.tsx | |
parent | 139c9deb75d54d72cc819f5308001ec66d3962bc (diff) | |
download | voidsky-28dbc5f5e614b3caf08d36a7edaaf19a0ee0f0bc.tar.zst |
Add the ability to navigate to posts within a thread
Diffstat (limited to 'src/view/com/post-thread/PostThreadItem.tsx')
-rw-r--r-- | src/view/com/post-thread/PostThreadItem.tsx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index 985d11dfa..2b72b7e4b 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -8,7 +8,7 @@ import { TouchableOpacity, View, } from 'react-native' -import {bsky} from '@adxp/mock-api' +import {bsky, AdxUri} from '@adxp/mock-api' import moment from 'moment' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {OnNavigateContent} from '../../routes/types' @@ -31,7 +31,8 @@ function iter<T>(n: number, fn: (i: number) => T): Array<T> { } export const PostThreadItem = observer(function PostThreadItem({ - item, // onNavigateContent, + item, + onNavigateContent, }: { item: PostThreadViewPostModel onNavigateContent: OnNavigateContent @@ -39,12 +40,16 @@ export const PostThreadItem = observer(function PostThreadItem({ const record = item.record as unknown as bsky.Post.Record const hasEngagement = item.likeCount || item.repostCount const onPressOuter = () => { - // TODO onNavigateContent + const urip = new AdxUri(item.uri) + onNavigateContent('PostThread', { + name: item.author.name, + recordKey: urip.recordKey, + }) } return ( <TouchableOpacity style={styles.outer} onPress={onPressOuter}> <View style={styles.layout}> - {iter(item._depth, () => ( + {iter(Math.abs(item._depth), () => ( <View style={styles.replyBar} /> ))} <View style={styles.layoutAvi}> @@ -143,7 +148,7 @@ const styles = StyleSheet.create({ }, replyBar: { width: 5, - backgroundColor: '#d4f0ff', + backgroundColor: 'gray', marginRight: 2, }, layoutAvi: { |