about summary refs log tree commit diff
path: root/src/view/com/post-thread/PostThreadLoadMore.tsx
blob: 27e2ea724d2f30037f958620a8a87e13fc5dd069 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import * as React from 'react'
import {View} from 'react-native'
import {AppBskyFeedDefs, AtUri} from '@atproto/api'
import {Trans} from '@lingui/macro'

import {makeProfileLink} from '#/lib/routes/links'
import {atoms as a, useTheme} from '#/alf'
import {Text} from '#/components/Typography'
import {Link} from '../util/Link'
import {UserAvatar} from '../util/UserAvatar'

export function PostThreadLoadMore({post}: {post: AppBskyFeedDefs.PostView}) {
  const t = useTheme()

  const postHref = React.useMemo(() => {
    const urip = new AtUri(post.uri)
    return makeProfileLink(post.author, 'post', urip.rkey)
  }, [post.uri, post.author])

  return (
    <Link
      href={postHref}
      style={[a.flex_row, a.align_center, a.py_md, {paddingHorizontal: 14}]}
      hoverStyle={[t.atoms.bg_contrast_25]}>
      <View style={[a.flex_row]}>
        <View
          style={{
            alignItems: 'center',
            justifyContent: 'center',
            width: 34,
            height: 34,
            borderRadius: 18,
            backgroundColor: t.atoms.bg.backgroundColor,
            marginRight: -20,
          }}>
          <UserAvatar
            avatar={post.author.avatar}
            size={30}
            type={post.author.associated?.labeler ? 'labeler' : 'user'}
          />
        </View>
        <View
          style={{
            alignItems: 'center',
            justifyContent: 'center',
            width: 34,
            height: 34,
            borderRadius: 18,
            backgroundColor: t.atoms.bg.backgroundColor,
          }}>
          <UserAvatar
            avatar={post.author.avatar}
            size={30}
            type={post.author.associated?.labeler ? 'labeler' : 'user'}
          />
        </View>
      </View>
      <View style={[a.px_sm]}>
        <Text style={[{color: t.palette.primary_500}, a.text_md]}>
          <Trans>Continue thread...</Trans>
        </Text>
      </View>
    </Link>
  )
}