diff options
Diffstat (limited to 'src/view')
-rw-r--r-- | src/view/com/posts/Feed.tsx | 2 | ||||
-rw-r--r-- | src/view/com/posts/FeedErrorMessage.tsx | 29 | ||||
-rw-r--r-- | src/view/screens/ProfileFeed.tsx | 21 |
3 files changed, 37 insertions, 15 deletions
diff --git a/src/view/com/posts/Feed.tsx b/src/view/com/posts/Feed.tsx index 5da04e389..113436e73 100644 --- a/src/view/com/posts/Feed.tsx +++ b/src/view/com/posts/Feed.tsx @@ -210,7 +210,7 @@ let Feed = ({ return ( <FeedErrorMessage feedDesc={feed} - error={error} + error={error ?? undefined} onPressTryAgain={onPressTryAgain} /> ) diff --git a/src/view/com/posts/FeedErrorMessage.tsx b/src/view/com/posts/FeedErrorMessage.tsx index f63bc1a88..aeac45980 100644 --- a/src/view/com/posts/FeedErrorMessage.tsx +++ b/src/view/com/posts/FeedErrorMessage.tsx @@ -10,7 +10,7 @@ import {useNavigation} from '@react-navigation/native' import {NavigationProp} from 'lib/routes/types' import {logger} from '#/logger' import {useModalControls} from '#/state/modals' -import {msg as msgLingui} from '@lingui/macro' +import {msg as msgLingui, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {FeedDescriptor} from '#/state/queries/post-feed' import {EmptyState} from '../util/EmptyState' @@ -35,7 +35,7 @@ export function FeedErrorMessage({ onPressTryAgain, }: { feedDesc: FeedDescriptor - error: any + error?: Error onPressTryAgain: () => void }) { const knownError = React.useMemo( @@ -47,7 +47,13 @@ export function FeedErrorMessage({ knownError !== KnownError.Unknown && feedDesc.startsWith('feedgen') ) { - return <FeedgenErrorMessage feedDesc={feedDesc} knownError={knownError} /> + return ( + <FeedgenErrorMessage + feedDesc={feedDesc} + knownError={knownError} + rawError={error} + /> + ) } if (knownError === KnownError.Block) { @@ -71,9 +77,11 @@ export function FeedErrorMessage({ function FeedgenErrorMessage({ feedDesc, knownError, + rawError, }: { feedDesc: FeedDescriptor knownError: KnownError + rawError?: Error }) { const pal = usePalette('default') const {_: _l} = useLingui() @@ -84,7 +92,7 @@ function FeedgenErrorMessage({ [KnownError.Unknown]: '', [KnownError.Block]: '', [KnownError.FeedgenDoesNotExist]: _l( - msgLingui`Hmmm, we're having trouble finding this feed. It may have been deleted.`, + msgLingui`Hmm, we're having trouble finding this feed. It may have been deleted.`, ), [KnownError.FeedgenMisconfigured]: _l( msgLingui`Hmm, the feed server appears to be misconfigured. Please let the feed owner know about this issue.`, @@ -96,13 +104,13 @@ function FeedgenErrorMessage({ msgLingui`Hmm, the feed server appears to be offline. Please let the feed owner know about this issue.`, ), [KnownError.FeedNSFPublic]: _l( - msgLingui`We're sorry, but this content is not viewable without a Bluesky account.`, + msgLingui`This content is not viewable without a Bluesky account.`, ), [KnownError.FeedgenUnknown]: _l( - msgLingui`Hmm, some kind of issue occured when contacting the feed server. Please let the feed owner know about this issue.`, + msgLingui`Hmm, some kind of issue occurred when contacting the feed server. Please let the feed owner know about this issue.`, ), [KnownError.FeedTooManyRequests]: _l( - msgLingui`We're sorry, but this feed is currently receiving high traffic and is temporarily unavailable. Please try again later.`, + msgLingui`This feed is currently receiving high traffic and is temporarily unavailable. Please try again later.`, ), }[knownError]), [_l, knownError], @@ -180,6 +188,13 @@ function FeedgenErrorMessage({ }, ]}> <Text style={pal.text}>{msg}</Text> + + {rawError?.message && ( + <Text style={pal.textLight}> + <Trans>Message from server</Trans>: {rawError.message} + </Text> + )} + {cta} </View> ) diff --git a/src/view/screens/ProfileFeed.tsx b/src/view/screens/ProfileFeed.tsx index 3a0bdcc0f..155df6480 100644 --- a/src/view/screens/ProfileFeed.tsx +++ b/src/view/screens/ProfileFeed.tsx @@ -136,7 +136,7 @@ export function ProfileFeedScreen(props: Props) { function ProfileFeedScreenIntermediate({feedUri}: {feedUri: string}) { const {data: preferences} = usePreferencesQuery() const {data: info} = useFeedSourceInfoQuery({uri: feedUri}) - const {isLoading: isPublicStatusLoading, data: isPublic} = + const {isLoading: isPublicStatusLoading, data: isPublicResponse} = useIsFeedPublicQuery({uri: feedUri}) if (!preferences || !info || isPublicStatusLoading) { @@ -153,7 +153,7 @@ function ProfileFeedScreenIntermediate({feedUri}: {feedUri: string}) { <ProfileFeedScreenInner preferences={preferences} feedInfo={info as FeedSourceFeedInfo} - isPublic={Boolean(isPublic)} + isPublicResponse={isPublicResponse} /> ) } @@ -161,11 +161,11 @@ function ProfileFeedScreenIntermediate({feedUri}: {feedUri: string}) { export function ProfileFeedScreenInner({ preferences, feedInfo, - isPublic, + isPublicResponse, }: { preferences: UsePreferencesQueryResponse feedInfo: FeedSourceFeedInfo - isPublic: boolean + isPublicResponse: ReturnType<typeof useIsFeedPublicQuery>['data'] }) { const {_} = useLingui() const pal = usePalette('default') @@ -403,7 +403,7 @@ export function ProfileFeedScreenInner({ renderHeader={renderHeader} onCurrentPageSelected={onCurrentPageSelected}> {({onScroll, headerHeight, isScrolledDown, scrollElRef, isFocused}) => - isPublic ? ( + isPublicResponse?.isPublic ? ( <FeedSection ref={feedSectionRef} feed={`feedgen|${feedInfo.uri}`} @@ -417,7 +417,7 @@ export function ProfileFeedScreenInner({ /> ) : ( <CenteredView sideBorders style={[{paddingTop: headerHeight}]}> - <NonPublicFeedMessage /> + <NonPublicFeedMessage rawError={isPublicResponse?.error} /> </CenteredView> ) } @@ -455,7 +455,7 @@ export function ProfileFeedScreenInner({ ) } -function NonPublicFeedMessage() { +function NonPublicFeedMessage({rawError}: {rawError?: Error}) { const pal = usePalette('default') return ( @@ -474,6 +474,7 @@ function NonPublicFeedMessage() { { padding: 12, borderRadius: 8, + gap: 12, }, ]}> <Text style={[pal.text]}> @@ -482,6 +483,12 @@ function NonPublicFeedMessage() { account. Please sign up or sign in to view this feed! </Trans> </Text> + + {rawError?.message && ( + <Text style={pal.textLight}> + <Trans>Message from server</Trans>: {rawError.message} + </Text> + )} </View> </View> ) |