drop.chapril.org-firefoxsend/app/pages/upload.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

const html = require('choo/html');
2018-01-30 21:15:09 +01:00
const progress = require('../templates/progress');
const { bytes } = require('../utils');
module.exports = function(state, emit) {
const transfer = state.transfer;
const div = html`
2018-01-16 22:52:09 +01:00
<div id="download">
<div id="upload-progress" class="fadeIn">
2018-01-24 19:23:13 +01:00
<div class="title" id="upload-filename">
${state.translate('uploadingPageProgress', {
2018-01-16 22:52:09 +01:00
filename: transfer.file.name,
size: bytes(transfer.file.size)
2018-01-24 19:23:13 +01:00
})}
</div>
2018-01-16 22:52:09 +01:00
<div class="description"></div>
${progress(transfer.progressRatio)}
<div class="upload">
2018-01-24 19:23:13 +01:00
<div class="progress-text">
${state.translate(transfer.msg, transfer.sizes)}
</div>
<button
id="cancel-upload"
title="${state.translate('uploadingPageCancel')}"
onclick=${cancel}>
${state.translate('uploadingPageCancel')}
</button>
2018-01-16 22:52:09 +01:00
</div>
</div>
</div>
`;
function cancel() {
const btn = document.getElementById('cancel-upload');
btn.disabled = true;
btn.textContent = state.translate('uploadCancelNotification');
emit('cancel');
}
return div;
};