Skip to content

Commit da6bcc5

Browse files
authored
Tweak ProfileList design (bluesky-social#7100)
* Remove "No description" * Move Lists about into header * Remove pager with one tab * Layout tweaks
1 parent adbc270 commit da6bcc5

File tree

4 files changed

+179
-208
lines changed

4 files changed

+179
-208
lines changed

src/screens/StarterPack/StarterPackScreen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ function Header({
407407
isOwner={isOwn}
408408
avatar={undefined}
409409
creator={creator}
410+
purpose="app.bsky.graph.defs#referencelist"
410411
avatarType="starter-pack">
411412
{hasSession ? (
412413
<View style={[a.flex_row, a.gap_sm, a.align_center]}>

src/view/com/pager/PagerWithHeader.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
2121
import {ScrollProvider} from '#/lib/ScrollContext'
2222
import {isIOS} from '#/platform/detection'
2323
import {Pager, PagerRef, RenderTabBarFnProps} from '#/view/com/pager/Pager'
24+
import {useTheme} from '#/alf'
2425
import {ListMethods} from '../util/List'
2526
import {PagerHeaderProvider} from './PagerHeaderContext'
2627
import {TabBar} from './TabBar'
@@ -256,6 +257,7 @@ let PagerTabBar = ({
256257
dragProgress: SharedValue<number>
257258
dragState: SharedValue<'idle' | 'dragging' | 'settling'>
258259
}): React.ReactNode => {
260+
const t = useTheme()
259261
const [minimumHeaderHeight, setMinimumHeaderHeight] = React.useState(0)
260262
const headerTransform = useAnimatedStyle(() => {
261263
const translateY =
@@ -277,7 +279,7 @@ let PagerTabBar = ({
277279
return (
278280
<Animated.View
279281
pointerEvents={isIOS ? 'auto' : 'box-none'}
280-
style={[styles.tabBarMobile, headerTransform]}>
282+
style={[styles.tabBarMobile, headerTransform, t.atoms.bg]}>
281283
<View
282284
ref={headerRef}
283285
pointerEvents={isIOS ? 'auto' : 'box-none'}

src/view/com/profile/ProfileSubpageHeader.tsx

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react'
22
import {Pressable, View} from 'react-native'
33
import {MeasuredDimensions, runOnJS, runOnUI} from 'react-native-reanimated'
4+
import {AppBskyGraphDefs} from '@atproto/api'
45
import {msg, Trans} from '@lingui/macro'
56
import {useLingui} from '@lingui/react'
67
import {useNavigation} from '@react-navigation/native'
@@ -26,6 +27,7 @@ export function ProfileSubpageHeader({
2627
title,
2728
avatar,
2829
isOwner,
30+
purpose,
2931
creator,
3032
avatarType,
3133
children,
@@ -35,6 +37,7 @@ export function ProfileSubpageHeader({
3537
title: string | undefined
3638
avatar: string | undefined
3739
isOwner: boolean | undefined
40+
purpose: AppBskyGraphDefs.ListPurpose | undefined
3841
creator:
3942
| {
4043
did: string
@@ -105,7 +108,7 @@ export function ProfileSubpageHeader({
105108
alignItems: 'flex-start',
106109
gap: 10,
107110
paddingTop: 14,
108-
paddingBottom: 6,
111+
paddingBottom: 14,
109112
paddingHorizontal: isMobile ? 12 : 14,
110113
}}>
111114
<View ref={aviRef} collapsable={false}>
@@ -123,7 +126,7 @@ export function ProfileSubpageHeader({
123126
)}
124127
</Pressable>
125128
</View>
126-
<View style={{flex: 1}}>
129+
<View style={{flex: 1, gap: 4}}>
127130
{isLoading ? (
128131
<LoadingPlaceholder
129132
width={200}
@@ -142,24 +145,50 @@ export function ProfileSubpageHeader({
142145
/>
143146
)}
144147

145-
{isLoading ? (
148+
{isLoading || !creator ? (
146149
<LoadingPlaceholder width={50} height={8} />
147150
) : (
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}
163192
</Text>
164193
)}
165194
</View>

0 commit comments

Comments
 (0)