From b5ef4a9bb5b3456605346c81f1e1d6baa97d396e Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Mon, 28 Oct 2019 00:02:45 -0600 Subject: [PATCH] Add an about page view that laods from backend --- app/views/about.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/views/about.js diff --git a/app/views/about.js b/app/views/about.js new file mode 100644 index 0000000..6e09cb4 --- /dev/null +++ b/app/views/about.js @@ -0,0 +1,22 @@ +import html from 'choo/html'; + +export const aboutView = (state, emit, i18n) => { + const content = html`
`; + const community = html`
`; + + 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, + ]; +} \ No newline at end of file