about summary refs log tree commit diff
path: root/src/state
diff options
context:
space:
mode:
Diffstat (limited to 'src/state')
-rw-r--r--src/state/lightbox.tsx25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/state/lightbox.tsx b/src/state/lightbox.tsx
index e3bddaee0..a97164327 100644
--- a/src/state/lightbox.tsx
+++ b/src/state/lightbox.tsx
@@ -1,29 +1,26 @@
 import React from 'react'
 import {AppBskyActorDefs} from '@atproto/api'
-import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
 
-interface Lightbox {
-  name: string
-}
+import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
 
-export class ProfileImageLightbox implements Lightbox {
-  name = 'profile-image'
-  constructor(public profile: AppBskyActorDefs.ProfileViewDetailed) {}
+type ProfileImageLightbox = {
+  type: 'profile-image'
+  profile: AppBskyActorDefs.ProfileViewDetailed
 }
 
-interface ImagesLightboxItem {
+type ImagesLightboxItem = {
   uri: string
   alt?: string
 }
 
-export class ImagesLightbox implements Lightbox {
-  name = 'images'
-  constructor(public images: ImagesLightboxItem[], public index: number) {}
-  setIndex(index: number) {
-    this.index = index
-  }
+type ImagesLightbox = {
+  type: 'images'
+  images: ImagesLightboxItem[]
+  index: number
 }
 
+type Lightbox = ProfileImageLightbox | ImagesLightbox
+
 const LightboxContext = React.createContext<{
   activeLightbox: Lightbox | null
 }>({