module.exports = UpdateAvailableModal var h = require('virtual-dom/h') var hyperx = require('hyperx') var hx = hyperx(h) var path = require('path') var {dispatch} = require('../lib/dispatcher') function UpdateAvailableModal (state) { // First, extract the base folder that the files are all in var files = state.modal.files var pathPrefix = files.map((x) => x.path).reduce(findCommonPrefix) if (files.length > 0 && !pathPrefix.endsWith('/') && !pathPrefix.endsWith('\\')) { pathPrefix = path.dirname(pathPrefix) } // Then, use the name of the base folder (or sole file, for a single file torrent) // as the default name. Show all files relative to the base folder. var defaultName = path.basename(pathPrefix) var basePath = path.dirname(pathPrefix) var fileElems = files.map(function (file) { var relativePath = files.length === 0 ? file.name : path.relative(pathPrefix, file.path) return hx`
Create New Torrent