about summary refs log tree commit diff
path: root/src/state/models/ui/shell.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-05-04 00:54:35 -0500
committerGitHub <noreply@github.com>2023-05-04 00:54:35 -0500
commitd97e75c62f39b874af97b40ebc7211841d9ce1b7 (patch)
tree6cbe62dfe8baa44c73d8e480f27af4041e2875ae /src/state/models/ui/shell.ts
parent4ef853ef6cd649af12f0810b8c38911cd639e033 (diff)
downloadvoidsky-d97e75c62f39b874af97b40ebc7211841d9ce1b7.tar.zst
[APP-539] Rework lightbox and alt-image behaviors (#573)
* Replace the long press on the lightbox with footer controls

* Remove long-press from images in the feed

* Tune the lightbox footer control ui

* Replace the AltImageRead modal with the ability to view all alt text in the lightbox footer

* Tune lightbox footer for iOS

* Add alt text to the web lightbox

* Fix lint

* a11y slight changes

---------

Co-authored-by: renahlee <renahlee@outlook.com>
Diffstat (limited to 'src/state/models/ui/shell.ts')
-rw-r--r--src/state/models/ui/shell.ts17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/state/models/ui/shell.ts b/src/state/models/ui/shell.ts
index dea220c55..4a55c23ad 100644
--- a/src/state/models/ui/shell.ts
+++ b/src/state/models/ui/shell.ts
@@ -48,11 +48,6 @@ export interface AltTextImageModal {
   image: ImageModel
 }
 
-export interface AltTextImageReadModal {
-  name: 'alt-text-image-read'
-  altText: string
-}
-
 export interface DeleteAccountModal {
   name: 'delete-account'
 }
@@ -106,7 +101,6 @@ export type Modal =
 
   // Posts
   | AltTextImageModal
-  | AltTextImageReadModal
   | CropImageModal
   | ServerInputModal
   | RepostModal
@@ -127,9 +121,14 @@ export class ProfileImageLightbox implements LightboxModel {
   }
 }
 
+interface ImagesLightboxItem {
+  uri: string
+  alt?: string
+}
+
 export class ImagesLightbox implements LightboxModel {
   name = 'images'
-  constructor(public uris: string[], public index: number) {
+  constructor(public images: ImagesLightboxItem[], public index: number) {
     makeAutoObservable(this)
   }
   setIndex(index: number) {
@@ -173,7 +172,7 @@ export class ShellUiModel {
   isModalActive = false
   activeModals: Modal[] = []
   isLightboxActive = false
-  activeLightbox: ProfileImageLightbox | ImagesLightbox | undefined
+  activeLightbox: ProfileImageLightbox | ImagesLightbox | null = null
   isComposerActive = false
   composerOpts: ComposerOpts | undefined
 
@@ -262,7 +261,7 @@ export class ShellUiModel {
 
   closeLightbox() {
     this.isLightboxActive = false
-    this.activeLightbox = undefined
+    this.activeLightbox = null
   }
 
   openComposer(opts: ComposerOpts) {