import {getRoot, types} from "mobx-state-tree";

/**
 * @typedef {Object} RenameDialogStore
 * @property {string} id
 * @property {string} type
 * @property {string} path
 * @property {number[]} torrentIds
 * @property {function} close
 */
const RenameDialogStore = types.model('RenameDialogStore', {
  id: types.identifier,
  type: types.literal('rename'),
  path: types.string,
  torrentIds: types.array(types.number)
}).views((self) => {
  return {
    close() {
      /**@type RootStore*/const rootStore = getRoot(self);
      rootStore.destroyDialog(self.id);
    }
  };
});

export default RenameDialogStore;
import {getRoot, types} from "mobx-state-tree";

/**
 * @typedef {Object} CopyMagnetUrlDialogStore
 * @property {string} id
 * @property {string} type
 * @property {string} magnetLink
 * @property {number[]} torrentIds
 * @property {function} close
 */
const CopyMagnetUrlDialogStore = types.model('CopyMagnetUrlDialogStore', {
  id: types.identifier,
  type: types.literal('copyMagnetUrl'),
  magnetLink: types.string,
  torrentIds: types.array(types.number)
}).views((self) => {
  return {
    close() {
      /**@type RootStore*/const rootStore = getRoot(self);
      rootStore.destroyDialog(self.id);
    }
  };
});

export default CopyMagnetUrlDialogStore;
import {getRoot, types} from "mobx-state-tree";

/**
 * @typedef {Object} RemoveConfirmDialogStore
 * @property {string} id
 * @property {string} type
 * @property {number[]} torrentIds
 * @property {function} close
 */
const RemoveConfirmDialogStore = types.model('RemoveConfirmDialogStore', {
  id: types.identifier,
  type: types.literal('removeConfirm'),
  torrentIds: types.array(types.number)
}).views((self) => {
  return {
    close() {
      /**@type RootStore*/const rootStore = getRoot(self);
      rootStore.destroyDialog(self.id);
    }
  };
});

export default RemoveConfirmDialogStore;
Example #4
0
import {getRoot, types} from "mobx-state-tree";

/**
 * @typedef {Object} MoveDialogStore
 * @property {string} id
 * @property {string} type
 * @property {string} directory
 * @property {number[]} torrentIds
 * @property {function} close
 */
const MoveDialogStore = types.model('MoveDialogStore', {
  id: types.identifier,
  type: types.literal('move'),
  directory: types.string,
  torrentIds: types.array(types.number)
}).views((self) => {
  return {
    close() {
      /**@type RootStore*/const rootStore = getRoot(self);
      rootStore.destroyDialog(self.id);
    }
  };
});

export default MoveDialogStore;
import {getRoot, types} from "mobx-state-tree";

/**
 * @typedef {Object} CreateLabelDialogStore
 * @property {string} id
 * @property {string} type
 * @property {string[]} torrentIds
 * @property {function} close
 */
const CreateLabelDialogStore = types.model('CreateLabelDialogStore', {
  id: types.identifier,
  type: types.literal('createLabel'),
  torrentIds: types.array(types.string)
}).views((self) => {
  return {
    close() {
      /**@type RootStore*/const rootStore = getRoot(self);
      rootStore.destroyDialog(self.id);
    }
  };
});

export default CreateLabelDialogStore;