2017-08-24 21:54:02 +00:00
|
|
|
const html = require('choo/html');
|
|
|
|
const assets = require('../../common/assets');
|
|
|
|
const { bytes } = require('../utils');
|
|
|
|
|
2018-01-24 18:23:13 +00:00
|
|
|
module.exports = function(state, pageAction) {
|
2017-08-24 21:54:02 +00:00
|
|
|
const fileInfo = state.fileInfo;
|
2018-01-31 23:47:34 +00:00
|
|
|
|
2017-08-31 16:43:36 +00:00
|
|
|
const size = fileInfo.size
|
|
|
|
? state.translate('downloadFileSize', { size: bytes(fileInfo.size) })
|
|
|
|
: '';
|
2018-01-24 18:23:13 +00:00
|
|
|
|
2018-01-31 23:47:34 +00:00
|
|
|
const name = fileInfo.name
|
2017-08-31 16:43:36 +00:00
|
|
|
? state.translate('downloadFileName', { filename: fileInfo.name })
|
2018-01-31 23:47:34 +00:00
|
|
|
: '';
|
|
|
|
const title = html`
|
|
|
|
<span id="dl-file"
|
|
|
|
data-nonce="${fileInfo.nonce}"
|
|
|
|
data-requires-password="${fileInfo.requiresPassword}">${name}</span>`;
|
|
|
|
|
|
|
|
if (!pageAction) {
|
|
|
|
return title;
|
|
|
|
}
|
2017-08-24 21:54:02 +00:00
|
|
|
const div = html`
|
|
|
|
<div id="page-one">
|
|
|
|
<div id="download">
|
|
|
|
<div id="download-page-one">
|
|
|
|
<div class="title">
|
2018-01-31 23:47:34 +00:00
|
|
|
${title}
|
2017-08-31 16:43:36 +00:00
|
|
|
<span id="dl-filesize">${' ' + size}</span>
|
2017-08-24 21:54:02 +00:00
|
|
|
</div>
|
|
|
|
<div class="description">${state.translate('downloadMessage')}</div>
|
2018-01-24 18:23:13 +00:00
|
|
|
<img
|
|
|
|
src="${assets.get('illustration_download.svg')}"
|
|
|
|
id="download-img"
|
2018-01-31 23:47:34 +00:00
|
|
|
title="${state.translate('downloadAltText')}"/>
|
2018-01-24 18:23:13 +00:00
|
|
|
${pageAction}
|
2017-08-24 21:54:02 +00:00
|
|
|
</div>
|
|
|
|
<a class="send-new" href="/">${state.translate('sendYourFilesLink')}</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
`;
|
|
|
|
return div;
|
|
|
|
};
|