diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-11-15 18:17:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-15 18:17:03 -0800 |
commit | e749f2f3a52f5c1e137ce8262701b9c9df96324f (patch) | |
tree | 0ca385ae3306a0a2b1cc5ec1b0de953c183b07f6 /src/state/models/ui | |
parent | 03b20c70e48f07d6011f632a2aeac954b9de2d96 (diff) | |
download | voidsky-e749f2f3a52f5c1e137ce8262701b9c9df96324f.tar.zst |
Factor lightbox out into hook/context (#1919)
Diffstat (limited to 'src/state/models/ui')
-rw-r--r-- | src/state/models/ui/shell.ts | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/src/state/models/ui/shell.ts b/src/state/models/ui/shell.ts index 223c20625..1631b8f9c 100644 --- a/src/state/models/ui/shell.ts +++ b/src/state/models/ui/shell.ts @@ -1,4 +1,3 @@ -import {AppBskyActorDefs} from '@atproto/api' import {RootStoreModel} from '../root-store' import {makeAutoObservable} from 'mobx' import { @@ -13,34 +12,7 @@ export function isColorMode(v: unknown): v is ColorMode { return v === 'system' || v === 'light' || v === 'dark' } -interface LightboxModel {} - -export class ProfileImageLightbox implements LightboxModel { - name = 'profile-image' - constructor(public profile: AppBskyActorDefs.ProfileViewDetailed) { - makeAutoObservable(this) - } -} - -interface ImagesLightboxItem { - uri: string - alt?: string -} - -export class ImagesLightbox implements LightboxModel { - name = 'images' - constructor(public images: ImagesLightboxItem[], public index: number) { - makeAutoObservable(this) - } - setIndex(index: number) { - this.index = index - } -} - export class ShellUiModel { - isLightboxActive = false - activeLightbox: ProfileImageLightbox | ImagesLightbox | null = null - constructor(public rootStore: RootStoreModel) { makeAutoObservable(this, { rootStore: false, @@ -54,32 +26,13 @@ export class ShellUiModel { * (used by the android hardware back btn) */ closeAnyActiveElement(): boolean { - if (this.isLightboxActive) { - this.closeLightbox() - return true - } return false } /** * used to clear out any modals, eg for a navigation */ - closeAllActiveElements() { - if (this.isLightboxActive) { - this.closeLightbox() - } - } - - openLightbox(lightbox: ProfileImageLightbox | ImagesLightbox) { - this.rootStore.emitNavigation() - this.isLightboxActive = true - this.activeLightbox = lightbox - } - - closeLightbox() { - this.isLightboxActive = false - this.activeLightbox = null - } + closeAllActiveElements() {} setupLoginModals() { this.rootStore.onSessionReady(() => { |