signup dialog changes
- send empty or invalid emails to the standard fxa signup page - show the signup dialog when file too big and not logged in
This commit is contained in:
parent
c585c34c01
commit
a79400f99f
@ -6,6 +6,7 @@ import * as metrics from './metrics';
|
|||||||
import { bytes } from './utils';
|
import { bytes } from './utils';
|
||||||
import okDialog from './ui/okDialog';
|
import okDialog from './ui/okDialog';
|
||||||
import copyDialog from './ui/copyDialog';
|
import copyDialog from './ui/copyDialog';
|
||||||
|
import signupDialog from './ui/signupDialog';
|
||||||
|
|
||||||
export default function(state, emitter) {
|
export default function(state, emitter) {
|
||||||
let lastRender = 0;
|
let lastRender = 0;
|
||||||
@ -98,12 +99,16 @@ export default function(state, emitter) {
|
|||||||
try {
|
try {
|
||||||
state.archive.addFiles(files, maxSize);
|
state.archive.addFiles(files, maxSize);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
state.modal = okDialog(
|
if (e.message === 'fileTooBig' && maxSize < LIMITS.MAX_FILE_SIZE) {
|
||||||
state.translate(e.message, {
|
state.modal = signupDialog();
|
||||||
size: bytes(maxSize),
|
} else {
|
||||||
count: LIMITS.MAX_FILES_PER_ARCHIVE
|
state.modal = okDialog(
|
||||||
})
|
state.translate(e.message, {
|
||||||
);
|
size: bytes(maxSize),
|
||||||
|
count: LIMITS.MAX_FILES_PER_ARCHIVE
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
render();
|
render();
|
||||||
});
|
});
|
||||||
|
@ -4,6 +4,9 @@ const { bytes } = require('../utils');
|
|||||||
|
|
||||||
module.exports = function() {
|
module.exports = function() {
|
||||||
return function(state, emit, close) {
|
return function(state, emit, close) {
|
||||||
|
setTimeout(function() {
|
||||||
|
document.getElementById('email-input').focus();
|
||||||
|
});
|
||||||
return html`
|
return html`
|
||||||
<div class="flex flex-col p-4">
|
<div class="flex flex-col p-4">
|
||||||
<p class="p-8">
|
<p class="p-8">
|
||||||
@ -39,18 +42,20 @@ module.exports = function() {
|
|||||||
</button>
|
</button>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
|
function emailish(str) {
|
||||||
|
if (!str) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// just check if it's the right shape
|
||||||
|
const a = str.split('@');
|
||||||
|
return a.length === 2 && a.every(s => s.length > 0);
|
||||||
|
}
|
||||||
|
|
||||||
function submitEmail(event) {
|
function submitEmail(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const el = document.getElementById('email-input');
|
const el = document.getElementById('email-input');
|
||||||
const email = el.value;
|
const email = el.value;
|
||||||
if (email) {
|
emit('login', emailish(email) ? email : null);
|
||||||
// just check if it's the right shape
|
|
||||||
const a = email.split('@');
|
|
||||||
if (a.length === 2 && a.every(s => s.length > 0)) {
|
|
||||||
return emit('login', email);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
el.value = '';
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user