Bluesky app fork with some witchin' additions 💫

Change empty states if not own profile (#9518)

* change empty states if not own profile

* Update ProfileFeedgens.tsx

* capitalise starter packs

authored by samuel.fm and committed by GitHub f02b9c32 2200cc95

Changed files
+109 -51
src
view
+29 -9
src/view/com/feeds/ProfileFeedgens.tsx
··· 23 23 import {isIOS, isNative, isWeb} from '#/platform/detection' 24 24 import {usePreferencesQuery} from '#/state/queries/preferences' 25 25 import {RQKEY, useProfileFeedgensQuery} from '#/state/queries/profile-feedgens' 26 + import {useSession} from '#/state/session' 26 27 import {EmptyState} from '#/view/com/util/EmptyState' 27 28 import {ErrorMessage} from '#/view/com/util/error/ErrorMessage' 28 29 import {List, type ListRef} from '#/view/com/util/List' ··· 81 82 const isEmpty = !isPending && !data?.pages[0]?.feeds.length 82 83 const {data: preferences} = usePreferencesQuery() 83 84 const navigation = useNavigation() 85 + const {currentAccount} = useSession() 86 + const isSelf = currentAccount?.did === did 84 87 85 88 const items = useMemo(() => { 86 89 let items: any[] = [] ··· 152 155 <EmptyState 153 156 style={{width: '100%'}} 154 157 icon={HashtagWideIcon} 155 - message={_(msg`You haven't made any custom feeds yet.`)} 158 + message={ 159 + isSelf 160 + ? _(msg`You haven't made any custom feeds yet.`) 161 + : _(msg`No custom feeds yet`) 162 + } 156 163 textStyle={[t.atoms.text_contrast_medium, a.font_medium]} 157 - button={{ 158 - label: _(msg`Browse custom feeds`), 159 - text: _(msg`Browse custom feeds`), 160 - onPress: () => navigation.navigate('Feeds' as never), 161 - size: 'small', 162 - color: 'secondary', 163 - }} 164 + button={ 165 + isSelf 166 + ? { 167 + label: _(msg`Browse custom feeds`), 168 + text: _(msg`Browse custom feeds`), 169 + onPress: () => navigation.navigate('Feeds' as never), 170 + size: 'small', 171 + color: 'secondary', 172 + } 173 + : undefined 174 + } 164 175 /> 165 176 ) 166 177 } else if (item === ERROR_ITEM) { ··· 194 205 } 195 206 return null 196 207 }, 197 - [_, t, error, refetch, onPressRetryLoadMore, preferences, navigation], 208 + [ 209 + _, 210 + t, 211 + error, 212 + refetch, 213 + onPressRetryLoadMore, 214 + preferences, 215 + navigation, 216 + isSelf, 217 + ], 198 218 ) 199 219 200 220 useEffect(() => {
+29 -11
src/view/com/lists/ProfileLists.tsx
··· 23 23 import {isIOS, isNative, isWeb} from '#/platform/detection' 24 24 import {usePreferencesQuery} from '#/state/queries/preferences' 25 25 import {RQKEY, useProfileListsQuery} from '#/state/queries/profile-lists' 26 + import {useSession} from '#/state/session' 26 27 import {EmptyState} from '#/view/com/util/EmptyState' 27 28 import {ErrorMessage} from '#/view/com/util/error/ErrorMessage' 28 29 import {List, type ListRef} from '#/view/com/util/List' ··· 81 82 const isEmpty = !isPending && !data?.pages[0]?.lists.length 82 83 const {data: preferences} = usePreferencesQuery() 83 84 const navigation = useNavigation() 85 + const {currentAccount} = useSession() 86 + const isSelf = currentAccount?.did === did 84 87 85 88 const items = useMemo(() => { 86 89 let items: any[] = [] ··· 151 154 return ( 152 155 <EmptyState 153 156 icon={ListIcon} 154 - message={_( 155 - msg`Lists allow you to see content from your favorite people.`, 156 - )} 157 + message={ 158 + isSelf 159 + ? _(msg`You haven't created any lists yet.`) 160 + : _(msg`No lists`) 161 + } 157 162 textStyle={[t.atoms.text_contrast_medium, a.font_medium]} 158 - button={{ 159 - label: _(msg`Create a list`), 160 - text: _(msg`Create a list`), 161 - onPress: () => navigation.navigate('Lists' as never), 162 - size: 'small', 163 - color: 'primary', 164 - }} 163 + button={ 164 + isSelf 165 + ? { 166 + label: _(msg`Create a list`), 167 + text: _(msg`Create a list`), 168 + onPress: () => navigation.navigate('Lists' as never), 169 + size: 'small', 170 + color: 'primary', 171 + } 172 + : undefined 173 + } 165 174 /> 166 175 ) 167 176 } else if (item === ERROR_ITEM) { ··· 195 204 } 196 205 return null 197 206 }, 198 - [_, t, error, refetch, onPressRetryLoadMore, preferences, navigation], 207 + [ 208 + _, 209 + t, 210 + error, 211 + refetch, 212 + onPressRetryLoadMore, 213 + preferences, 214 + navigation, 215 + isSelf, 216 + ], 199 217 ) 200 218 201 219 useEffect(() => {
+51 -31
src/view/screens/Profile.tsx
··· 429 429 ignoreFilterFor={profile.did} 430 430 setScrollViewTag={setScrollViewTag} 431 431 emptyStateMessage={_(msg`No posts yet`)} 432 - emptyStateButton={{ 433 - label: _(msg`Write a post`), 434 - text: _(msg`Write a post`), 435 - onPress: () => openComposer({}), 436 - size: 'small', 437 - color: 'primary', 438 - }} 432 + emptyStateButton={ 433 + isMe 434 + ? { 435 + label: _(msg`Write a post`), 436 + text: _(msg`Write a post`), 437 + onPress: () => openComposer({}), 438 + size: 'small', 439 + color: 'primary', 440 + } 441 + : undefined 442 + } 439 443 /> 440 444 ) 441 445 : null} ··· 465 469 ignoreFilterFor={profile.did} 466 470 setScrollViewTag={setScrollViewTag} 467 471 emptyStateMessage={_(msg`No media yet`)} 468 - emptyStateButton={{ 469 - label: _(msg`Post a photo`), 470 - text: _(msg`Post a photo`), 471 - onPress: () => openComposer({}), 472 - size: 'small', 473 - color: 'primary', 474 - }} 472 + emptyStateButton={ 473 + isMe 474 + ? { 475 + label: _(msg`Post a photo`), 476 + text: _(msg`Post a photo`), 477 + onPress: () => openComposer({}), 478 + size: 'small', 479 + color: 'primary', 480 + } 481 + : undefined 482 + } 475 483 emptyStateIcon={ImageIcon} 476 484 /> 477 485 ) ··· 487 495 ignoreFilterFor={profile.did} 488 496 setScrollViewTag={setScrollViewTag} 489 497 emptyStateMessage={_(msg`No video posts yet`)} 490 - emptyStateButton={{ 491 - label: _(msg`Post a video`), 492 - text: _(msg`Post a video`), 493 - onPress: () => openComposer({}), 494 - size: 'small', 495 - color: 'primary', 496 - }} 498 + emptyStateButton={ 499 + isMe 500 + ? { 501 + label: _(msg`Post a video`), 502 + text: _(msg`Post a video`), 503 + onPress: () => openComposer({}), 504 + size: 'small', 505 + color: 'primary', 506 + } 507 + : undefined 508 + } 497 509 emptyStateIcon={VideoIcon} 498 510 /> 499 511 ) ··· 535 547 headerOffset={headerHeight} 536 548 enabled={isFocused} 537 549 setScrollViewTag={setScrollViewTag} 538 - emptyStateMessage={_( 539 - msg`Starter packs let you share your favorite feeds and people with your friends.`, 540 - )} 541 - emptyStateButton={{ 542 - label: _(msg`Create a Starter Pack`), 543 - text: _(msg`Create a Starter Pack`), 544 - onPress: wrappedNavToWizard, 545 - color: 'primary', 546 - size: 'small', 547 - }} 550 + emptyStateMessage={ 551 + isMe 552 + ? _( 553 + msg`Starter Packs let you share your favorite feeds and people with your friends.`, 554 + ) 555 + : _(msg`No Starter Packs yet`) 556 + } 557 + emptyStateButton={ 558 + isMe 559 + ? { 560 + label: _(msg`Create a Starter Pack`), 561 + text: _(msg`Create a Starter Pack`), 562 + onPress: wrappedNavToWizard, 563 + color: 'primary', 564 + size: 'small', 565 + } 566 + : undefined 567 + } 548 568 emptyStateIcon={CircleAndSquareIcon} 549 569 /> 550 570 )