fox-send/app/templates/header/index.js

29 lines
937 B
JavaScript
Raw Normal View History

const html = require('choo/html');
2018-10-01 21:20:26 +00:00
const userAccount = require('../../templates/userAccount');
2018-09-28 14:54:23 +00:00
const version = require('../../../package.json').version;
const { browserName } = require('../../utils');
2018-10-01 21:20:26 +00:00
module.exports = function(state, emit) {
2018-09-28 14:54:23 +00:00
const browser = browserName();
const feedbackUrl = `https://qsurvey.mozilla.com/s3/txp-firefox-send?ver=${version}&browser=${browser}`;
2018-02-16 20:56:53 +00:00
const header = html`
<header class="header">
2018-09-28 14:54:23 +00:00
<h1>Firefox Send</h1>
2018-10-01 21:20:26 +00:00
${userAccount(state, emit)}
2018-09-28 14:54:23 +00:00
<a href="${feedbackUrl}"
rel="noreferrer noopener"
class="feedback"
alt="Feedback"
target="_blank">${state.translate('siteFeedback')}
</a>
</header>`;
// HACK
// We only want to render this once because we
// toggle the targets of the links with utils/openLinksInNewTab
header.isSameNode = function(target) {
return target && target.nodeName && target.nodeName === 'HEADER';
};
return header;
2018-02-16 20:56:53 +00:00
};