about summary refs log tree commit diff
path: root/src/view/com/lightbox/Lightbox.web.tsx
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-11-04 21:31:21 +0000
committerGitHub <noreply@github.com>2024-11-04 21:31:21 +0000
commit26c48373e29643ca7a3248315506131d53d05b8b (patch)
tree7931136c51cf779cad1a94cce28af78cc7cb0c6e /src/view/com/lightbox/Lightbox.web.tsx
parent174988bc5ab00774d200a882312985f55d903d81 (diff)
downloadvoidsky-26c48373e29643ca7a3248315506131d53d05b8b.tar.zst
Refactor lightbox prop drilling (#6073)
* Refactor lightbox footer to render prop

* Unify lightbox types

* Unindent

* Refactor LightboxFooter props

* Move LightboxFooter into the implementation file
Diffstat (limited to 'src/view/com/lightbox/Lightbox.web.tsx')
-rw-r--r--src/view/com/lightbox/Lightbox.web.tsx20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/view/com/lightbox/Lightbox.web.tsx b/src/view/com/lightbox/Lightbox.web.tsx
index 9a0fa5d33..2ba7d06cc 100644
--- a/src/view/com/lightbox/Lightbox.web.tsx
+++ b/src/view/com/lightbox/Lightbox.web.tsx
@@ -38,24 +38,8 @@ export function Lightbox() {
     return null
   }
 
-  const initialIndex =
-    activeLightbox.type === 'images' ? activeLightbox.index : 0
-
-  let imgs: Img[] | undefined
-  if (activeLightbox.type === 'profile-image') {
-    const opts = activeLightbox
-    if (opts.profile.avatar) {
-      imgs = [{uri: opts.profile.avatar}]
-    }
-  } else if (activeLightbox.type === 'images') {
-    const opts = activeLightbox
-    imgs = opts.images
-  }
-
-  if (!imgs) {
-    return null
-  }
-
+  const initialIndex = activeLightbox.index
+  const imgs = activeLightbox.images
   return (
     <LightboxInner
       imgs={imgs}