1
1
import React from 'react'
2
2
import { Pressable , View } from 'react-native'
3
3
import { MeasuredDimensions , runOnJS , runOnUI } from 'react-native-reanimated'
4
+ import { AppBskyGraphDefs } from '@atproto/api'
4
5
import { msg , Trans } from '@lingui/macro'
5
6
import { useLingui } from '@lingui/react'
6
7
import { useNavigation } from '@react-navigation/native'
@@ -26,6 +27,7 @@ export function ProfileSubpageHeader({
26
27
title,
27
28
avatar,
28
29
isOwner,
30
+ purpose,
29
31
creator,
30
32
avatarType,
31
33
children,
@@ -35,6 +37,7 @@ export function ProfileSubpageHeader({
35
37
title : string | undefined
36
38
avatar : string | undefined
37
39
isOwner : boolean | undefined
40
+ purpose : AppBskyGraphDefs . ListPurpose | undefined
38
41
creator :
39
42
| {
40
43
did : string
@@ -105,7 +108,7 @@ export function ProfileSubpageHeader({
105
108
alignItems : 'flex-start' ,
106
109
gap : 10 ,
107
110
paddingTop : 14 ,
108
- paddingBottom : 6 ,
111
+ paddingBottom : 14 ,
109
112
paddingHorizontal : isMobile ? 12 : 14 ,
110
113
} } >
111
114
< View ref = { aviRef } collapsable = { false } >
@@ -123,7 +126,7 @@ export function ProfileSubpageHeader({
123
126
) }
124
127
</ Pressable >
125
128
</ View >
126
- < View style = { { flex : 1 } } >
129
+ < View style = { { flex : 1 , gap : 4 } } >
127
130
{ isLoading ? (
128
131
< LoadingPlaceholder
129
132
width = { 200 }
@@ -142,24 +145,50 @@ export function ProfileSubpageHeader({
142
145
/>
143
146
) }
144
147
145
- { isLoading ? (
148
+ { isLoading || ! creator ? (
146
149
< LoadingPlaceholder width = { 50 } height = { 8 } />
147
150
) : (
148
- < Text type = "xl" style = { [ pal . textLight ] } numberOfLines = { 1 } >
149
- { ! creator ? (
150
- < Trans > by —</ Trans >
151
- ) : isOwner ? (
152
- < Trans > by you</ Trans >
153
- ) : (
154
- < Trans >
155
- by{ ' ' }
156
- < TextLink
157
- text = { sanitizeHandle ( creator . handle , '@' ) }
158
- href = { makeProfileLink ( creator ) }
159
- style = { pal . textLight }
160
- />
161
- </ Trans >
162
- ) }
151
+ < Text type = "lg" style = { [ pal . textLight ] } numberOfLines = { 1 } >
152
+ { purpose === 'app.bsky.graph.defs#curatelist' ? (
153
+ isOwner ? (
154
+ < Trans > List by you</ Trans >
155
+ ) : (
156
+ < Trans >
157
+ List by{ ' ' }
158
+ < TextLink
159
+ text = { sanitizeHandle ( creator . handle || '' , '@' ) }
160
+ href = { makeProfileLink ( creator ) }
161
+ style = { pal . textLight }
162
+ />
163
+ </ Trans >
164
+ )
165
+ ) : purpose === 'app.bsky.graph.defs#modlist' ? (
166
+ isOwner ? (
167
+ < Trans > Moderation list by you</ Trans >
168
+ ) : (
169
+ < Trans >
170
+ Moderation list by{ ' ' }
171
+ < TextLink
172
+ text = { sanitizeHandle ( creator . handle || '' , '@' ) }
173
+ href = { makeProfileLink ( creator ) }
174
+ style = { pal . textLight }
175
+ />
176
+ </ Trans >
177
+ )
178
+ ) : purpose === 'app.bsky.graph.defs#referencelist' ? (
179
+ isOwner ? (
180
+ < Trans > Starter pack by you</ Trans >
181
+ ) : (
182
+ < Trans >
183
+ Starter pack by{ ' ' }
184
+ < TextLink
185
+ text = { sanitizeHandle ( creator . handle || '' , '@' ) }
186
+ href = { makeProfileLink ( creator ) }
187
+ style = { pal . textLight }
188
+ />
189
+ </ Trans >
190
+ )
191
+ ) : null }
163
192
</ Text >
164
193
) }
165
194
</ View >
0 commit comments