2017-08-24 23:54:02 +02:00
|
|
|
const html = require('choo/html');
|
|
|
|
const progress = require('./progress');
|
|
|
|
const { bytes } = require('../utils');
|
|
|
|
|
2018-01-24 19:23:13 +01:00
|
|
|
module.exports = function(state, emit) {
|
2017-08-24 23:54:02 +02:00
|
|
|
const transfer = state.transfer;
|
|
|
|
const div = html`
|
2017-11-08 00:54:42 +01:00
|
|
|
<div id="page-one">
|
2018-01-16 22:52:09 +01:00
|
|
|
<div id="download">
|
|
|
|
<div id="download-progress" class="fadeIn">
|
|
|
|
<div id="dl-title" class="title">${state.translate(
|
|
|
|
'downloadingPageProgress',
|
|
|
|
{
|
|
|
|
filename: state.fileInfo.name,
|
|
|
|
size: bytes(state.fileInfo.size)
|
|
|
|
}
|
|
|
|
)}</div>
|
|
|
|
<div class="description">${state.translate(
|
|
|
|
'downloadingPageMessage'
|
|
|
|
)}</div>
|
|
|
|
${progress(transfer.progressRatio)}
|
|
|
|
<div class="upload">
|
|
|
|
<div class="progress-text">${state.translate(
|
|
|
|
transfer.msg,
|
|
|
|
transfer.sizes
|
|
|
|
)}</div>
|
2018-01-24 19:23:13 +01:00
|
|
|
<button
|
|
|
|
id="cancel-upload"
|
|
|
|
title="${state.translate('deletePopupCancel')}"
|
|
|
|
onclick=${cancel}>${state.translate('deletePopupCancel')}</button>
|
2018-01-16 22:52:09 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2017-11-08 00:54:42 +01:00
|
|
|
</div>
|
2017-08-24 23:54:02 +02:00
|
|
|
</div>
|
|
|
|
`;
|
|
|
|
|
2018-01-24 19:23:13 +01:00
|
|
|
function cancel() {
|
|
|
|
const btn = document.getElementById('cancel-upload');
|
|
|
|
btn.remove();
|
|
|
|
emit('cancel');
|
|
|
|
}
|
2017-08-24 23:54:02 +02:00
|
|
|
return div;
|
|
|
|
};
|