about summary refs log tree commit diff
path: root/src/view/com/modals/InviteCodes.tsx
diff options
context:
space:
mode:
authorPatroll <6214736+P4tr0ll@users.noreply.github.com>2023-10-04 19:31:43 +0200
committerGitHub <noreply@github.com>2023-10-04 10:31:43 -0700
commit9278822088d212c9bee6a40a6a8b773bc482242d (patch)
tree72751140ef2bda744a89fb457fa9398b72cae9ab /src/view/com/modals/InviteCodes.tsx
parent2ba0c6a711a5e33f5dd0cdde23123cb336c8f991 (diff)
downloadvoidsky-9278822088d212c9bee6a40a6a8b773bc482242d.tar.zst
Fix invite codes flash on desktop, use loading placeholder (#1591)
* Fix invite codes flashing untrue value before loaded

* Add loading placeholder for right nav invites
Diffstat (limited to 'src/view/com/modals/InviteCodes.tsx')
-rw-r--r--src/view/com/modals/InviteCodes.tsx27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/view/com/modals/InviteCodes.tsx b/src/view/com/modals/InviteCodes.tsx
index 09cfd4de7..0cb0c56aa 100644
--- a/src/view/com/modals/InviteCodes.tsx
+++ b/src/view/com/modals/InviteCodes.tsx
@@ -26,6 +26,33 @@ export function Component({}: {}) {
     store.shell.closeModal()
   }, [store])
 
+  if (store.me.invites === null) {
+    return (
+      <View style={[styles.container, pal.view]} testID="inviteCodesModal">
+        <Text type="title-xl" style={[styles.title, pal.text]}>
+          Error
+        </Text>
+        <Text type="lg" style={[styles.description, pal.text]}>
+          An error occurred while loading invite codes.
+        </Text>
+        <View style={styles.flex1} />
+        <View
+          style={[
+            styles.btnContainer,
+            isTabletOrDesktop && styles.btnContainerDesktop,
+          ]}>
+          <Button
+            type="primary"
+            label="Done"
+            style={styles.btn}
+            labelStyle={styles.btnLabel}
+            onPress={onClose}
+          />
+        </View>
+      </View>
+    )
+  }
+
   if (store.me.invites.length === 0) {
     return (
       <View style={[styles.container, pal.view]} testID="inviteCodesModal">