refactor: repo (#1070)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { FileItem } from '@standardnotes/snjs'
|
||||
import { action, makeObservable, observable } from 'mobx'
|
||||
|
||||
export class FilePreviewModalController {
|
||||
isOpen = false
|
||||
currentFile: FileItem | undefined = undefined
|
||||
otherFiles: FileItem[] = []
|
||||
|
||||
constructor() {
|
||||
makeObservable(this, {
|
||||
isOpen: observable,
|
||||
currentFile: observable,
|
||||
otherFiles: observable,
|
||||
|
||||
activate: action,
|
||||
dismiss: action,
|
||||
setCurrentFile: action,
|
||||
})
|
||||
}
|
||||
|
||||
setCurrentFile = (currentFile: FileItem) => {
|
||||
this.currentFile = currentFile
|
||||
}
|
||||
|
||||
activate = (currentFile: FileItem, otherFiles: FileItem[]) => {
|
||||
this.currentFile = currentFile
|
||||
this.otherFiles = otherFiles
|
||||
this.isOpen = true
|
||||
}
|
||||
|
||||
dismiss = () => {
|
||||
this.isOpen = false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user