const html = require('choo/html'); const assets = require('../../../common/assets'); const { checkSize } = require('../../utils'); const title = require('../../templates/title'); const setPasswordSection = require('../../templates/setPasswordSection'); const uploadBox = require('../../templates/uploadedFileList'); const expireInfo = require('../../templates/expireInfo'); module.exports = function(state, emit) { // the page flickers if both the server and browser set 'effect--fadeIn' const fade = state.layout ? '' : 'effect--fadeIn'; const files = state.files ? state.files : []; const optionClass = state.uploading ? 'uploadOptions--faded' : ''; const btnUploading = state.uploading ? 'btn--stripes' : ''; const faded = files.length > 0 ? 'uploadArea--faded' : ''; const selectFileClass = files.length > 0 ? 'btn--hidden' : ''; const sendFileClass = files.length > 0 ? '' : 'btn--hidden'; let btnText = ''; if (state.encrypting) { btnText = state.translate('encryptingFile'); } else if (state.uploading) { btnText = `sending... ${Math.floor(state.transfer.progressRatio * 100)}%`; } else { //default pre-upload text btnText = state.translate('uploadSuccessConfirmHeader'); } return html`