Add an about page view that laods from backend

This commit is contained in:
Robbie Antenesse 2019-10-28 00:02:45 -06:00
parent f76c715aba
commit b5ef4a9bb5
1 changed files with 22 additions and 0 deletions

22
app/views/about.js Normal file
View File

@ -0,0 +1,22 @@
import html from 'choo/html';
export 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('render'));
}
return [
content,
community,
];
}