Change empty states if not own profile (#9518)
* change empty states if not own profile * Update ProfileFeedgens.tsx * capitalise starter packs
This commit is contained in:
@@ -23,6 +23,7 @@ import {logger} from '#/logger'
|
|||||||
import {isIOS, isNative, isWeb} from '#/platform/detection'
|
import {isIOS, isNative, isWeb} from '#/platform/detection'
|
||||||
import {usePreferencesQuery} from '#/state/queries/preferences'
|
import {usePreferencesQuery} from '#/state/queries/preferences'
|
||||||
import {RQKEY, useProfileFeedgensQuery} from '#/state/queries/profile-feedgens'
|
import {RQKEY, useProfileFeedgensQuery} from '#/state/queries/profile-feedgens'
|
||||||
|
import {useSession} from '#/state/session'
|
||||||
import {EmptyState} from '#/view/com/util/EmptyState'
|
import {EmptyState} from '#/view/com/util/EmptyState'
|
||||||
import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
|
import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
|
||||||
import {List, type ListRef} from '#/view/com/util/List'
|
import {List, type ListRef} from '#/view/com/util/List'
|
||||||
@@ -81,6 +82,8 @@ export function ProfileFeedgens({
|
|||||||
const isEmpty = !isPending && !data?.pages[0]?.feeds.length
|
const isEmpty = !isPending && !data?.pages[0]?.feeds.length
|
||||||
const {data: preferences} = usePreferencesQuery()
|
const {data: preferences} = usePreferencesQuery()
|
||||||
const navigation = useNavigation()
|
const navigation = useNavigation()
|
||||||
|
const {currentAccount} = useSession()
|
||||||
|
const isSelf = currentAccount?.did === did
|
||||||
|
|
||||||
const items = useMemo(() => {
|
const items = useMemo(() => {
|
||||||
let items: any[] = []
|
let items: any[] = []
|
||||||
@@ -152,15 +155,23 @@ export function ProfileFeedgens({
|
|||||||
<EmptyState
|
<EmptyState
|
||||||
style={{width: '100%'}}
|
style={{width: '100%'}}
|
||||||
icon={HashtagWideIcon}
|
icon={HashtagWideIcon}
|
||||||
message={_(msg`You haven't made any custom feeds yet.`)}
|
message={
|
||||||
|
isSelf
|
||||||
|
? _(msg`You haven't made any custom feeds yet.`)
|
||||||
|
: _(msg`No custom feeds yet`)
|
||||||
|
}
|
||||||
textStyle={[t.atoms.text_contrast_medium, a.font_medium]}
|
textStyle={[t.atoms.text_contrast_medium, a.font_medium]}
|
||||||
button={{
|
button={
|
||||||
label: _(msg`Browse custom feeds`),
|
isSelf
|
||||||
text: _(msg`Browse custom feeds`),
|
? {
|
||||||
onPress: () => navigation.navigate('Feeds' as never),
|
label: _(msg`Browse custom feeds`),
|
||||||
size: 'small',
|
text: _(msg`Browse custom feeds`),
|
||||||
color: 'secondary',
|
onPress: () => navigation.navigate('Feeds' as never),
|
||||||
}}
|
size: 'small',
|
||||||
|
color: 'secondary',
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
} else if (item === ERROR_ITEM) {
|
} else if (item === ERROR_ITEM) {
|
||||||
@@ -194,7 +205,16 @@ export function ProfileFeedgens({
|
|||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
},
|
},
|
||||||
[_, t, error, refetch, onPressRetryLoadMore, preferences, navigation],
|
[
|
||||||
|
_,
|
||||||
|
t,
|
||||||
|
error,
|
||||||
|
refetch,
|
||||||
|
onPressRetryLoadMore,
|
||||||
|
preferences,
|
||||||
|
navigation,
|
||||||
|
isSelf,
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {logger} from '#/logger'
|
|||||||
import {isIOS, isNative, isWeb} from '#/platform/detection'
|
import {isIOS, isNative, isWeb} from '#/platform/detection'
|
||||||
import {usePreferencesQuery} from '#/state/queries/preferences'
|
import {usePreferencesQuery} from '#/state/queries/preferences'
|
||||||
import {RQKEY, useProfileListsQuery} from '#/state/queries/profile-lists'
|
import {RQKEY, useProfileListsQuery} from '#/state/queries/profile-lists'
|
||||||
|
import {useSession} from '#/state/session'
|
||||||
import {EmptyState} from '#/view/com/util/EmptyState'
|
import {EmptyState} from '#/view/com/util/EmptyState'
|
||||||
import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
|
import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
|
||||||
import {List, type ListRef} from '#/view/com/util/List'
|
import {List, type ListRef} from '#/view/com/util/List'
|
||||||
@@ -81,6 +82,8 @@ export function ProfileLists({
|
|||||||
const isEmpty = !isPending && !data?.pages[0]?.lists.length
|
const isEmpty = !isPending && !data?.pages[0]?.lists.length
|
||||||
const {data: preferences} = usePreferencesQuery()
|
const {data: preferences} = usePreferencesQuery()
|
||||||
const navigation = useNavigation()
|
const navigation = useNavigation()
|
||||||
|
const {currentAccount} = useSession()
|
||||||
|
const isSelf = currentAccount?.did === did
|
||||||
|
|
||||||
const items = useMemo(() => {
|
const items = useMemo(() => {
|
||||||
let items: any[] = []
|
let items: any[] = []
|
||||||
@@ -151,17 +154,23 @@ export function ProfileLists({
|
|||||||
return (
|
return (
|
||||||
<EmptyState
|
<EmptyState
|
||||||
icon={ListIcon}
|
icon={ListIcon}
|
||||||
message={_(
|
message={
|
||||||
msg`Lists allow you to see content from your favorite people.`,
|
isSelf
|
||||||
)}
|
? _(msg`You haven't created any lists yet.`)
|
||||||
|
: _(msg`No lists`)
|
||||||
|
}
|
||||||
textStyle={[t.atoms.text_contrast_medium, a.font_medium]}
|
textStyle={[t.atoms.text_contrast_medium, a.font_medium]}
|
||||||
button={{
|
button={
|
||||||
label: _(msg`Create a list`),
|
isSelf
|
||||||
text: _(msg`Create a list`),
|
? {
|
||||||
onPress: () => navigation.navigate('Lists' as never),
|
label: _(msg`Create a list`),
|
||||||
size: 'small',
|
text: _(msg`Create a list`),
|
||||||
color: 'primary',
|
onPress: () => navigation.navigate('Lists' as never),
|
||||||
}}
|
size: 'small',
|
||||||
|
color: 'primary',
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
} else if (item === ERROR_ITEM) {
|
} else if (item === ERROR_ITEM) {
|
||||||
@@ -195,7 +204,16 @@ export function ProfileLists({
|
|||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
},
|
},
|
||||||
[_, t, error, refetch, onPressRetryLoadMore, preferences, navigation],
|
[
|
||||||
|
_,
|
||||||
|
t,
|
||||||
|
error,
|
||||||
|
refetch,
|
||||||
|
onPressRetryLoadMore,
|
||||||
|
preferences,
|
||||||
|
navigation,
|
||||||
|
isSelf,
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -429,13 +429,17 @@ function ProfileScreenLoaded({
|
|||||||
ignoreFilterFor={profile.did}
|
ignoreFilterFor={profile.did}
|
||||||
setScrollViewTag={setScrollViewTag}
|
setScrollViewTag={setScrollViewTag}
|
||||||
emptyStateMessage={_(msg`No posts yet`)}
|
emptyStateMessage={_(msg`No posts yet`)}
|
||||||
emptyStateButton={{
|
emptyStateButton={
|
||||||
label: _(msg`Write a post`),
|
isMe
|
||||||
text: _(msg`Write a post`),
|
? {
|
||||||
onPress: () => openComposer({}),
|
label: _(msg`Write a post`),
|
||||||
size: 'small',
|
text: _(msg`Write a post`),
|
||||||
color: 'primary',
|
onPress: () => openComposer({}),
|
||||||
}}
|
size: 'small',
|
||||||
|
color: 'primary',
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
: null}
|
: null}
|
||||||
@@ -465,13 +469,17 @@ function ProfileScreenLoaded({
|
|||||||
ignoreFilterFor={profile.did}
|
ignoreFilterFor={profile.did}
|
||||||
setScrollViewTag={setScrollViewTag}
|
setScrollViewTag={setScrollViewTag}
|
||||||
emptyStateMessage={_(msg`No media yet`)}
|
emptyStateMessage={_(msg`No media yet`)}
|
||||||
emptyStateButton={{
|
emptyStateButton={
|
||||||
label: _(msg`Post a photo`),
|
isMe
|
||||||
text: _(msg`Post a photo`),
|
? {
|
||||||
onPress: () => openComposer({}),
|
label: _(msg`Post a photo`),
|
||||||
size: 'small',
|
text: _(msg`Post a photo`),
|
||||||
color: 'primary',
|
onPress: () => openComposer({}),
|
||||||
}}
|
size: 'small',
|
||||||
|
color: 'primary',
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
emptyStateIcon={ImageIcon}
|
emptyStateIcon={ImageIcon}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -487,13 +495,17 @@ function ProfileScreenLoaded({
|
|||||||
ignoreFilterFor={profile.did}
|
ignoreFilterFor={profile.did}
|
||||||
setScrollViewTag={setScrollViewTag}
|
setScrollViewTag={setScrollViewTag}
|
||||||
emptyStateMessage={_(msg`No video posts yet`)}
|
emptyStateMessage={_(msg`No video posts yet`)}
|
||||||
emptyStateButton={{
|
emptyStateButton={
|
||||||
label: _(msg`Post a video`),
|
isMe
|
||||||
text: _(msg`Post a video`),
|
? {
|
||||||
onPress: () => openComposer({}),
|
label: _(msg`Post a video`),
|
||||||
size: 'small',
|
text: _(msg`Post a video`),
|
||||||
color: 'primary',
|
onPress: () => openComposer({}),
|
||||||
}}
|
size: 'small',
|
||||||
|
color: 'primary',
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
emptyStateIcon={VideoIcon}
|
emptyStateIcon={VideoIcon}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -535,16 +547,24 @@ function ProfileScreenLoaded({
|
|||||||
headerOffset={headerHeight}
|
headerOffset={headerHeight}
|
||||||
enabled={isFocused}
|
enabled={isFocused}
|
||||||
setScrollViewTag={setScrollViewTag}
|
setScrollViewTag={setScrollViewTag}
|
||||||
emptyStateMessage={_(
|
emptyStateMessage={
|
||||||
msg`Starter packs let you share your favorite feeds and people with your friends.`,
|
isMe
|
||||||
)}
|
? _(
|
||||||
emptyStateButton={{
|
msg`Starter Packs let you share your favorite feeds and people with your friends.`,
|
||||||
label: _(msg`Create a Starter Pack`),
|
)
|
||||||
text: _(msg`Create a Starter Pack`),
|
: _(msg`No Starter Packs yet`)
|
||||||
onPress: wrappedNavToWizard,
|
}
|
||||||
color: 'primary',
|
emptyStateButton={
|
||||||
size: 'small',
|
isMe
|
||||||
}}
|
? {
|
||||||
|
label: _(msg`Create a Starter Pack`),
|
||||||
|
text: _(msg`Create a Starter Pack`),
|
||||||
|
onPress: wrappedNavToWizard,
|
||||||
|
color: 'primary',
|
||||||
|
size: 'small',
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
emptyStateIcon={CircleAndSquareIcon}
|
emptyStateIcon={CircleAndSquareIcon}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user