Add profile view
This commit is contained in:
@@ -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} />
|
||||
|
||||
@@ -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]}>
|
||||
|
||||
Reference in New Issue
Block a user