1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-10 05:02:45 +01:00

added account to capabilities

This commit is contained in:
Danny Coates 2018-09-14 13:58:19 -07:00
parent 3a162d47c5
commit 942457b357
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
5 changed files with 14 additions and 9 deletions

View File

@ -64,6 +64,7 @@ export default async function capabilities() {
const polyStreams = nativeStreams ? false : polyfillStreams();
return {
account: typeof localStorage !== 'undefined',
crypto,
streamUpload: nativeStreams || polyStreams,
streamDownload:

View File

@ -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`

View File

@ -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');
}
*/
};

View File

@ -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:

View File

@ -157,7 +157,6 @@ const web = {
}
},
'extract-loader',
'babel-loader',
'./build/fluent_loader'
]
},