drop.chapril.org-firefoxsend/app/pages/unsupported/index.js

76 lines
2.2 KiB
JavaScript
Raw Normal View History

const html = require('choo/html');
const assets = require('../../../common/assets');
2018-07-31 20:09:18 +02:00
const title = require('../../templates/title');
module.exports = function(state) {
let strings = {};
let why = '';
let url = '';
let buttonAction = '';
2018-07-31 20:09:18 +02:00
if (state.params.reason !== 'outdated') {
strings = unsupportedStrings(state);
why = html`
<div class="description">
<a href="https://github.com/mozilla/send/blob/master/docs/faq.md#why-is-my-browser-not-supported">
${state.translate('notSupportedLink')}
</a>
</div>`;
url =
'https://www.mozilla.org/firefox/new/?utm_campaign=send-acquisition&utm_medium=referral&utm_source=send.firefox.com';
buttonAction = html`
<div class="firefoxDownload__action">
Firefox<br><span class="firefoxDownload__text">${strings.button}</span>
</div>`;
} else {
strings = outdatedStrings(state);
url = 'https://support.mozilla.org/kb/update-firefox-latest-version';
buttonAction = html`
<div class="firefoxDownload__action">
${strings.button}
</div>`;
}
2018-07-31 20:09:18 +02:00
2018-02-16 21:56:53 +01:00
return html`
2018-07-31 20:09:18 +02:00
<div class="page unsupportedPage">
${title(state)}
<div class="error unsupportedPage__error">${strings.header}</div>
<div class="description flexible">
${strings.description}
2018-07-31 20:09:18 +02:00
${why}
</div>
2018-07-31 20:09:18 +02:00
<div class="flexible firefoxDownload">
<a href="${url}" class="firefoxDownload__button">
<img
src="${assets.get('firefox_logo-only.svg')}"
class="firefoxDownload__logo"
alt="Firefox"/>
${buttonAction}
</a>
</div>
<div class="unsupportedPage__info">
${strings.explainer}
</div>
</div>`;
};
2018-02-16 21:56:53 +01:00
function outdatedStrings(state) {
return {
2018-07-31 20:09:18 +02:00
header: state.translate('notSupportedHeader'),
2018-02-16 21:56:53 +01:00
description: state.translate('notSupportedOutdatedDetail'),
button: state.translate('updateFirefox'),
explainer: state.translate('uploadPageExplainer')
};
}
function unsupportedStrings(state) {
return {
2018-07-31 20:09:18 +02:00
header: state.translate('notSupportedHeader'),
2018-02-16 21:56:53 +01:00
description: state.translate('notSupportedDetail'),
button: state.translate('downloadFirefoxButtonSub'),
explainer: state.translate('uploadPageExplainer')
};
}