render header and footer only once. fixes #788
This commit is contained in:
parent
94714ecb62
commit
3e6a88d31d
|
@ -110,21 +110,21 @@ export default function(state, emitter) {
|
||||||
}
|
}
|
||||||
await delay(1000);
|
await delay(1000);
|
||||||
await fadeOut('.page');
|
await fadeOut('.page');
|
||||||
openLinksInNewTab(links, false);
|
|
||||||
emitter.emit('pushState', `/share/${ownedFile.id}`);
|
emitter.emit('pushState', `/share/${ownedFile.id}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.error(err);
|
|
||||||
|
|
||||||
if (err.message === '0') {
|
if (err.message === '0') {
|
||||||
//cancelled. do nothing
|
//cancelled. do nothing
|
||||||
metrics.cancelledUpload({ size, type });
|
metrics.cancelledUpload({ size, type });
|
||||||
return render();
|
render();
|
||||||
}
|
} else {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(err);
|
||||||
state.raven.captureException(err);
|
state.raven.captureException(err);
|
||||||
metrics.stoppedUpload({ size, type, err });
|
metrics.stoppedUpload({ size, type, err });
|
||||||
emitter.emit('pushState', '/error');
|
emitter.emit('pushState', '/error');
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
openLinksInNewTab(links, false);
|
||||||
state.uploading = false;
|
state.uploading = false;
|
||||||
state.transfer = null;
|
state.transfer = null;
|
||||||
}
|
}
|
||||||
|
@ -188,8 +188,8 @@ export default function(state, emitter) {
|
||||||
if (err.message === '0') {
|
if (err.message === '0') {
|
||||||
// download cancelled
|
// download cancelled
|
||||||
state.transfer.reset();
|
state.transfer.reset();
|
||||||
return render();
|
render();
|
||||||
}
|
} else {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error(err);
|
console.error(err);
|
||||||
state.transfer = null;
|
state.transfer = null;
|
||||||
|
@ -199,6 +199,7 @@ export default function(state, emitter) {
|
||||||
metrics.stoppedDownload({ size, err });
|
metrics.stoppedDownload({ size, err });
|
||||||
}
|
}
|
||||||
emitter.emit('pushState', location);
|
emitter.emit('pushState', location);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
openLinksInNewTab(links, false);
|
openLinksInNewTab(links, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ const html = require('choo/html');
|
||||||
const assets = require('../../../common/assets');
|
const assets = require('../../../common/assets');
|
||||||
|
|
||||||
module.exports = function(state) {
|
module.exports = function(state) {
|
||||||
return html`<footer class="footer">
|
const footer = html`<footer class="footer">
|
||||||
<div class="legalSection">
|
<div class="legalSection">
|
||||||
<a
|
<a
|
||||||
href="https://www.mozilla.org"
|
href="https://www.mozilla.org"
|
||||||
|
@ -61,4 +61,11 @@ module.exports = function(state) {
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>`;
|
</footer>`;
|
||||||
|
// HACK
|
||||||
|
// We only want to render this once because we
|
||||||
|
// toggle the targets of the links with utils/openLinksInNewTab
|
||||||
|
footer.isSameNode = function(target) {
|
||||||
|
return target && target.nodeName && target.nodeName === 'FOOTER';
|
||||||
|
};
|
||||||
|
return footer;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,8 @@ const browser = browserName();
|
||||||
|
|
||||||
module.exports = function(state) {
|
module.exports = function(state) {
|
||||||
const feedbackUrl = `https://qsurvey.mozilla.com/s3/txp-firefox-send?ver=${version}&browser=${browser}`;
|
const feedbackUrl = `https://qsurvey.mozilla.com/s3/txp-firefox-send?ver=${version}&browser=${browser}`;
|
||||||
return html`<header class="header">
|
const header = html`
|
||||||
|
<header class="header">
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<a class="logo__link" href="/">
|
<a class="logo__link" href="/">
|
||||||
<img
|
<img
|
||||||
|
@ -32,7 +33,14 @@ module.exports = function(state) {
|
||||||
rel="noreferrer noopener"
|
rel="noreferrer noopener"
|
||||||
class="feedback"
|
class="feedback"
|
||||||
target="_blank">${state.translate('siteFeedback')}</a>
|
target="_blank">${state.translate('siteFeedback')}</a>
|
||||||
</header>`;
|
</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;
|
||||||
};
|
};
|
||||||
|
|
||||||
function browserName() {
|
function browserName() {
|
||||||
|
|
Loading…
Reference in New Issue