added account to capabilities
This commit is contained in:
parent
3a162d47c5
commit
942457b357
@ -64,6 +64,7 @@ export default async function capabilities() {
|
||||
const polyStreams = nativeStreams ? false : polyfillStreams();
|
||||
|
||||
return {
|
||||
account: typeof localStorage !== 'undefined',
|
||||
crypto,
|
||||
streamUpload: nativeStreams || polyStreams,
|
||||
streamDownload:
|
||||
|
@ -1,7 +1,7 @@
|
||||
const html = require('choo/html');
|
||||
|
||||
module.exports = function(state) {
|
||||
if (state.user.loggedIn) {
|
||||
if (state.user.loggedIn || !state.capabilities.account) {
|
||||
return null;
|
||||
}
|
||||
return html`
|
||||
|
@ -1,10 +1,16 @@
|
||||
const html = require('choo/html');
|
||||
|
||||
module.exports = function(state, emit) {
|
||||
if (!state.capabilities.account) {
|
||||
return null;
|
||||
}
|
||||
const user = state.user;
|
||||
const menu = user.loggedIn
|
||||
? html`
|
||||
<ul class="account_dropdown">
|
||||
<ul
|
||||
class="account_dropdown"
|
||||
onblur=${hideMenu}
|
||||
tabindex="-1">
|
||||
<li class="account_dropdown__text">
|
||||
${user.email}
|
||||
</li>
|
||||
@ -15,9 +21,10 @@ module.exports = function(state, emit) {
|
||||
</li>
|
||||
</ul>`
|
||||
: html`
|
||||
<ul class="account_dropdown"
|
||||
tabindex="-1"
|
||||
>
|
||||
<ul
|
||||
class="account_dropdown"
|
||||
onblur=${hideMenu}
|
||||
tabindex="-1">
|
||||
<li>
|
||||
<a class="account_dropdown__link" onclick=${login}>${state.translate(
|
||||
'signInMenuOption'
|
||||
@ -55,12 +62,9 @@ module.exports = function(state, emit) {
|
||||
emit('logout');
|
||||
}
|
||||
|
||||
//the onblur trick makes links unclickable wtf
|
||||
/*
|
||||
function hideMenu(event) {
|
||||
event.stopPropagation();
|
||||
const dropdown = document.querySelector('.account_dropdown');
|
||||
dropdown.classList.remove('visible');
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
@ -7,6 +7,7 @@ module.exports = function(req) {
|
||||
const locale = req.language || 'en-US';
|
||||
return {
|
||||
locale,
|
||||
capabilities: { account: true },
|
||||
translate: locales.getTranslator(locale),
|
||||
title: 'Firefox Send',
|
||||
description:
|
||||
|
@ -157,7 +157,6 @@ const web = {
|
||||
}
|
||||
},
|
||||
'extract-loader',
|
||||
'babel-loader',
|
||||
'./build/fluent_loader'
|
||||
]
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user