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) { var info = state.modal // First, extract the base folder that the files are all in var files = info.files var pathPrefix = info.folderPath if (!pathPrefix) { if (files.length > 0) { pathPrefix = files.map((x) => x.path).reduce(findCommonPrefix) if (!pathPrefix.endsWith('/') && !pathPrefix.endsWith('\\')) { pathPrefix = path.dirname(pathPrefix) } } else { pathPrefix = files[0] } } // 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