Files
CT/src/ViewModel/storageViewModel.ts
T

30 lines
797 B
TypeScript
Raw Normal View History

2024-07-21 17:55:53 +02:00
import * as React from "bloatless-react";
2024-07-21 19:44:10 +02:00
import StorageModel, { PATH_COMPONENT_SEPARATOR } from "../Model/storageModel";
2024-07-21 17:55:53 +02:00
export default class StorageViewModel {
storageModel: StorageModel;
// state
isShowingStorageModal: React.State<boolean> = new React.State(false);
2024-07-21 19:44:10 +02:00
selectedPath: React.State<string> = new React.State(PATH_COMPONENT_SEPARATOR);
didMakeChanges: React.State<boolean> = new React.State(false);
2024-07-21 17:55:53 +02:00
// view methods
showStorageModal = (): void => {
this.isShowingStorageModal.value = true;
2024-07-21 19:44:10 +02:00
};
2024-07-21 17:55:53 +02:00
hideStorageModal = (): void => {
2024-07-21 19:44:10 +02:00
if (this.didMakeChanges.value == true) {
window.location.reload();
}
2024-07-21 17:55:53 +02:00
this.isShowingStorageModal.value = false;
2024-07-21 19:44:10 +02:00
};
2024-07-21 17:55:53 +02:00
// init
constructor(storageModel: StorageModel) {
this.storageModel = storageModel;
}
}