filled in size placeholder and other malarkey

This commit is contained in:
Danny Coates 2019-02-22 10:37:52 -08:00
parent 7449d1c351
commit c8e6e761d0
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
4 changed files with 25 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* global Android */ /* global Android LIMITS */
const html = require('choo/html'); const html = require('choo/html');
const raw = require('choo/html/raw'); const raw = require('choo/html/raw');
@ -265,12 +265,9 @@ module.exports.wip = function(state, emit) {
onblur="${blur}" onblur="${blur}"
onchange="${add}" onchange="${add}"
/> />
<label <div
for="file-upload" for="file-upload"
class="flex flex-row items-center justify-between w-full p-2 cursor-pointer" class="flex flex-row items-center justify-between w-full p-2"
title="${state.translate('addFilesButtonWithSize', {
size: bytes(1000000)
})}"
> >
<label <label
for="file-upload" for="file-upload"
@ -278,12 +275,10 @@ module.exports.wip = function(state, emit) {
title="${state.translate('addFilesButton')}" title="${state.translate('addFilesButton')}"
> >
<img src="${assets.get('addfiles.svg')}" class="w-6 h-6 mr-2" /> <img src="${assets.get('addfiles.svg')}" class="w-6 h-6 mr-2" />
${state.translate('addFilesButtonWithSize', { ${state.translate('addFilesButton')}
size: bytes(1000000) </label>
})}
</div>
<div class="font-normal text-sm text-grey-darker"> <div class="font-normal text-sm text-grey-darker">
${state.translate('totalSizeUpdate', { ${state.translate('totalSize', {
size: bytes(state.archive.size) size: bytes(state.archive.size)
})} })}
</div> </div>
@ -390,6 +385,15 @@ module.exports.uploading = function(state, emit) {
}; };
module.exports.empty = function(state, emit) { module.exports.empty = function(state, emit) {
const upsell = state.user.loggedIn
? ''
: html`
<p class="center font-medium text-xs text-grey-dark mt-4 mb-2">
${state.translate('signInSizeBump', {
size: bytes(LIMITS.MAX_FILE_SIZE, 0)
})}
</p>
`;
return html` return html`
<send-upload-area <send-upload-area
class="flex flex-col items-center justify-center border-2 border-dashed border-grey rounded px-6 py-16 h-full w-full" class="flex flex-col items-center justify-center border-2 border-dashed border-grey rounded px-6 py-16 h-full w-full"
@ -423,16 +427,14 @@ module.exports.empty = function(state, emit) {
role="button" role="button"
class="btn rounded-lg flex items-center mt-4" class="btn rounded-lg flex items-center mt-4"
title="${state.translate('addFilesButtonWithSize', { title="${state.translate('addFilesButtonWithSize', {
size: bytes(1000000) size: bytes(state.user.maxSize, 0)
})}" })}"
> >
${state.translate('addFilesButtonWithSize', { ${state.translate('addFilesButtonWithSize', {
size: bytes(1000000) size: bytes(state.user.maxSize, 0)
})} })}
</label> </label>
<a class="center font-medium text-xs text-grey-dark mt-4 mb-2"> ${upsell}
${state.translate('signInSizeBump', { size: bytes(1000000) })}
</a>
</send-upload-area> </send-upload-area>
`; `;

View File

@ -7,7 +7,9 @@ module.exports = function(name, url) {
<send-copy-dialog <send-copy-dialog
class="flex flex-col items-center text-center p-4 max-w-sm" class="flex flex-col items-center text-center p-4 max-w-sm"
> >
<h1 class="font-bold my-4">${state.translate('notifyUploadDone')}</h1> <h1 class="font-bold my-4">
${state.translate('notifyUploadEncryptDone')}
</h1>
<p class="font-normal leading-normal text-grey-darker word-break-all"> <p class="font-normal leading-normal text-grey-darker word-break-all">
${state.translate('copyUrlFormLabel')} <br /> ${state.translate('copyUrlFormLabel')} <br />
${name} ${name}

View File

@ -57,7 +57,7 @@ const LOCALIZE_NUMBERS = !!(
); );
const UNITS = ['B', 'kB', 'MB', 'GB']; const UNITS = ['B', 'kB', 'MB', 'GB'];
function bytes(num) { function bytes(num, decimalDigits = 1) {
if (num < 1) { if (num < 1) {
return '0B'; return '0B';
} }
@ -68,8 +68,8 @@ function bytes(num) {
try { try {
const locale = document.querySelector('html').lang; const locale = document.querySelector('html').lang;
nStr = n.toLocaleString(locale, { nStr = n.toLocaleString(locale, {
minimumFractionDigits: 1, minimumFractionDigits: decimalDigits,
maximumFractionDigits: 1 maximumFractionDigits: decimalDigits
}); });
} catch (e) { } catch (e) {
// fall through // fall through

View File

@ -147,6 +147,7 @@ maxPasswordLength = Maximum password length: { $length }
# A short status message shown when there was an error setting the password # A short status message shown when there was an error setting the password
passwordSetError = This password could not be set passwordSetError = This password could not be set
pageHeaderCredits = from the makers of Firefox pageHeaderCredits = from the makers of Firefox
addFilesButton = Add file(s)
addFilesButtonWithSize = Add file(s) up to { $size } addFilesButtonWithSize = Add file(s) up to { $size }
uploadFilesButton = Upload uploadFilesButton = Upload
uploadDropDragMessage = Drop files here uploadDropDragMessage = Drop files here