mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
removed PhotoSwipeStore
This commit is contained in:
parent
224c27b6f4
commit
82308d2a91
15 changed files with 90 additions and 84 deletions
|
@ -1,13 +1,11 @@
|
|||
import { makeAutoObservable } from 'mobx';
|
||||
import { FlowStore } from '~/store/flow/FlowStore';
|
||||
import { ModalStore } from '~/store/modal/ModalStore';
|
||||
import { PhotoSwipeStore } from '~/store/photoSwipe/PhotoSwipeStore';
|
||||
import { LabStore } from '~/store/lab/LabStore';
|
||||
|
||||
export class Store {
|
||||
flow = new FlowStore();
|
||||
modal = new ModalStore();
|
||||
photoSwipe = new PhotoSwipeStore();
|
||||
lab = new LabStore();
|
||||
|
||||
constructor() {
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
import { makeAutoObservable } from 'mobx';
|
||||
import { Dialog } from '~/constants/modal';
|
||||
import { DialogContentProps } from '~/hooks/modal/useModal';
|
||||
|
||||
export class ModalStore {
|
||||
current: Dialog | null = null;
|
||||
props: object | undefined;
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
setCurrent = (current: Dialog | null) => (this.current = current);
|
||||
setCurrent = <T extends Dialog>(current: T, props: DialogContentProps[T]) => {
|
||||
this.props = props;
|
||||
this.current = current ?? {};
|
||||
};
|
||||
|
||||
hide = () => (this.current = null);
|
||||
hide = () => {
|
||||
this.current = null;
|
||||
this.props = {};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
import { makeAutoObservable } from 'mobx';
|
||||
import { IFile } from '~/redux/types';
|
||||
|
||||
export class PhotoSwipeStore {
|
||||
images: IFile[] = [];
|
||||
index: number = 0;
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
setData = (images: IFile[], index: number) => {
|
||||
this.images = images;
|
||||
this.index = index;
|
||||
};
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
import { useStore } from '~/utils/context/StoreContextProvider';
|
||||
|
||||
export const usePhotoSwipeStore = () => useStore().photoSwipe;
|
Loading…
Add table
Add a link
Reference in a new issue