const html = require('choo/html'); const progress = require('../../templates/progress'); const { bytes } = require('../../utils'); module.exports = function(state, emit) { const transfer = state.transfer; const cancelBtn = html` `; return html`
${state.translate('downloadingPageProgress', { filename: state.fileInfo.name, size: bytes(state.fileInfo.size) })}
${state.translate('downloadingPageMessage')}
${progress(transfer.progressRatio, transfer.progressIndefinite)}
${state.translate(transfer.msg, transfer.sizes)}
${transfer.state === 'downloading' ? cancelBtn : null}
`; function cancel() { const btn = document.getElementById('cancel'); btn.remove(); emit('cancel'); } };