fox-send/app/pages/preview.js

45 lines
1.3 KiB
JavaScript
Raw Normal View History

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) {
const fileInfo = state.fileInfo;
const size = fileInfo.size
? state.translate('downloadFileSize', { size: bytes(fileInfo.size) })
: '';
2018-01-24 18:23:13 +00:00
2018-02-01 00:26:59 +00:00
const title = fileInfo.name
? state.translate('downloadFileName', { filename: fileInfo.name })
2018-02-01 00:26:59 +00:00
: state.translate('downloadFileTitle');
2018-02-01 00:26:59 +00:00
const info = html`
<div id="dl-file"
data-nonce="${fileInfo.nonce}"
data-requires-password="${fileInfo.requiresPassword}"></div>`;
if (!pageAction) {
2018-02-01 00:26:59 +00:00
return info;
}
const div = html`
<div id="page-one">
<div id="download">
<div id="download-page-one">
<div class="title">
2018-02-01 00:26:59 +00:00
<span>${title}</span>
<span id="dl-filesize">${' ' + size}</span>
</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"
title="${state.translate('downloadAltText')}"/>
2018-01-24 18:23:13 +00:00
${pageAction}
</div>
<a class="send-new" href="/">${state.translate('sendYourFilesLink')}</a>
</div>
2018-02-01 00:26:59 +00:00
${info}
</div>
`;
return div;
};