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

View File

@ -7,7 +7,9 @@ module.exports = function(name, url) {
<send-copy-dialog
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">
${state.translate('copyUrlFormLabel')} <br />
${name}

View File

@ -57,7 +57,7 @@ const LOCALIZE_NUMBERS = !!(
);
const UNITS = ['B', 'kB', 'MB', 'GB'];
function bytes(num) {
function bytes(num, decimalDigits = 1) {
if (num < 1) {
return '0B';
}
@ -68,8 +68,8 @@ function bytes(num) {
try {
const locale = document.querySelector('html').lang;
nStr = n.toLocaleString(locale, {
minimumFractionDigits: 1,
maximumFractionDigits: 1
minimumFractionDigits: decimalDigits,
maximumFractionDigits: decimalDigits
});
} catch (e) {
// 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
passwordSetError = This password could not be set
pageHeaderCredits = from the makers of Firefox
addFilesButton = Add file(s)
addFilesButtonWithSize = Add file(s) up to { $size }
uploadFilesButton = Upload
uploadDropDragMessage = Drop files here