diff options
Diffstat (limited to 'src/state/models')
-rw-r--r-- | src/state/models/shell-ui.ts | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/src/state/models/shell-ui.ts b/src/state/models/shell-ui.ts index 1af74f56a..7628e068f 100644 --- a/src/state/models/shell-ui.ts +++ b/src/state/models/shell-ui.ts @@ -52,55 +52,22 @@ export class ReportAccountModal { } } -interface LightboxModel { - canSwipeLeft: boolean - canSwipeRight: boolean - onSwipeLeft: () => void - onSwipeRight: () => void -} +interface LightboxModel {} export class ProfileImageLightbox implements LightboxModel { name = 'profile-image' - canSwipeLeft = false - canSwipeRight = false constructor(public profileView: ProfileViewModel) { makeAutoObservable(this) } - onSwipeLeft() {} - onSwipeRight() {} -} - -export class ImageLightbox implements LightboxModel { - name = 'image' - canSwipeLeft = true - canSwipeRight = true - constructor(public uri: string) { - makeAutoObservable(this) - } - onSwipeLeft() {} - onSwipeRight() {} } export class ImagesLightbox implements LightboxModel { name = 'images' - get canSwipeLeft() { - return this.index > 0 - } - get canSwipeRight() { - return this.index < this.uris.length - 1 - } constructor(public uris: string[], public index: number) { makeAutoObservable(this) } - onSwipeLeft() { - if (this.canSwipeLeft) { - this.index = this.index - 1 - } - } - onSwipeRight() { - if (this.canSwipeRight) { - this.index = this.index + 1 - } + setIndex(index: number) { + this.index = index } } @@ -187,9 +154,7 @@ export class ShellUiModel { this.activeModal = undefined } - openLightbox( - lightbox: ProfileImageLightbox | ImageLightbox | ImagesLightbox, - ) { + openLightbox(lightbox: ProfileImageLightbox | ImagesLightbox) { this.isLightboxActive = true this.activeLightbox = lightbox } |