const html = require('choo/html');
const { bytes } = require('../utils');
const assets = require('../../common/assets');
module.exports = function(state, emit) {
const archive = state.fileInfo;
return html`
${state.translate(
'downloadTitle'
)}
⚠️ ${state.translate('noStreamsWarning')} ⚠️
`;
function optionChanged(event) {
event.stopPropagation();
const choice = event.target.value;
const button = event.currentTarget.nextElementSibling;
let title = button.title;
console.error(choice, title);
switch (choice) {
case 'copy':
title = state.translate('copyLinkButton');
break;
case 'firefox':
title = state.translate('downloadFirefox');
break;
case 'download':
title = state.translate('downloadButtonLabel');
break;
}
button.title = title;
button.value = title;
}
function submit(event) {
const action = document.querySelector('input[type="radio"]:checked').value;
switch (action) {
case 'copy':
emit('copy', { url: window.location.href });
document.querySelector('input[type="submit"]').value = state.translate(
'copiedUrl'
);
break;
case 'firefox':
window.open(
'https://www.mozilla.org/firefox/new/?utm_campaign=send-acquisition&utm_medium=referral&utm_source=send.firefox.com'
);
break;
case 'download':
emit('download', archive);
break;
}
return false;
}
};