about summary refs log tree commit diff
path: root/src/view/screens/ProfileFeed.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-12-05 20:25:32 -0600
committerGitHub <noreply@github.com>2023-12-05 18:25:32 -0800
commite6bda92b206de0d839c4e134d25fc7f56ae9c767 (patch)
treed52a979583406c6b373aec28fed31333c99ec787 /src/view/screens/ProfileFeed.tsx
parent7f3324d4a4499ed644074b0cb68d68b2dac8ab86 (diff)
downloadvoidsky-e6bda92b206de0d839c4e134d25fc7f56ae9c767.tar.zst
Surface raw server error if exists (#2096)
* Surface raw server error if exists

* Update copy

* Update translation files

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/screens/ProfileFeed.tsx')
-rw-r--r--src/view/screens/ProfileFeed.tsx21
1 files changed, 14 insertions, 7 deletions
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>
   )