1
0
Fork 0
mirror of https://gitlab.com/Alamantus/Readlebee.git synced 2026-03-01 03:19:45 +01:00
Readlebee/app/views/about.js
Robbie Antenesse 3bfaf5f3df Convert import/export to require/module.exports;Window conditions
Add conditions for whether to use certain things if run from server
2020-09-20 17:19:22 -06:00

24 lines
757 B
JavaScript

const html = require('choo/html');
const aboutView = (state, emit, i18n) => {
const content = html`<section class="content"><i class="icon-loading animate-spin"></i></section>`;
const community = html`<section class="content"></section>`;
const promises = [];
if (typeof i18n.pages.about === 'undefined' || typeof i18n.pages.community === 'undefined') {
promises.push(i18n.fetchLocalePage('about'));
promises.push(i18n.fetchLocalePage('community'));
} else {
content.innerHTML = i18n.pages.about;
community.innerHTML = i18n.pages.community;
}
if (promises.length > 0) {
Promise.all(promises).then(fulfilled => emit(state.events.RENDER));
}
return [
content,
community,
];
}
module.exports = { aboutView };