diff --git a/client.js b/client.js
index e2c9d14..e351bf1 100755
--- a/client.js
+++ b/client.js
@@ -16,13 +16,12 @@ const ssr = require("choo-ssr");
const head = require("./views/partials/head");
const html = require("./views/components/html");
const layout = require("./views/components/layout");
-const noscript = require("./views/partials/noscript");
// P R O G R A M
-function main () {
+function main() {
const app = async(choo());
app.use(ssr());
@@ -39,21 +38,16 @@ function main () {
ssr.body(
async.catch(
layout(content),
- require("./views/pages/_error")(app)
+ require("./views/pages/error")(app)
),
- noscript(),
- ssr.state(),
+ ssr.state()
)
));
app.route("/", page(require("./views/pages/home")(app)));
- // app.route("/github-feed", page(require("./views/pages/github-feed")(app)));
app.route("/resources", page(require("./views/pages/resources")(app)));
app.route("/*", page(require("./views/pages/page")(app)));
- // app.route("/:page", page(require("./views/show")(app)));
- // app.route("*", page(require("./views/pages/_404")(app)));
-
return app;
}
diff --git a/views/components/html.js b/views/components/html.js
index 88eefe7..c54c31d 100755
--- a/views/components/html.js
+++ b/views/components/html.js
@@ -4,18 +4,18 @@
// P A C K A G E
-const h = require("choo-async/html");
+const html = require("choo-async/html");
-// P R O G R A M
+// E X P O R T
-function html(head, body) {
+module.exports = exports = (head, body) => {
return (state, emit) => {
const bodyPromise = Promise.resolve(body(state, emit));
const headPromise = bodyPromise.then(() => head(state, emit)); // resolve `head` once `body` is resolved
- return h`
+ return html`
${headPromise}
@@ -23,10 +23,4 @@ function html(head, body) {
`;
};
-}
-
-
-
-// E X P O R T
-
-module.exports = exports = html;
+};
diff --git a/views/components/layout.js b/views/components/layout.js
index 6194969..a01beba 100755
--- a/views/components/layout.js
+++ b/views/components/layout.js
@@ -13,18 +13,17 @@ const navigation = require("../partials/navigation");
-// P R O G R A M
+// E X P O R T
-const layout = children => (state, emit) => html`
+module.exports = exports = children => (state, emit) => html`
+
+
${navigation(state, emit)}
${children(state, emit)}
${footer(state, emit)}
`;
-
-
-
-// E X P O R T
-
-module.exports = exports = layout;
diff --git a/views/pages/_404.js b/views/pages/_404.js
deleted file mode 100755
index 002f7dc..0000000
--- a/views/pages/_404.js
+++ /dev/null
@@ -1,25 +0,0 @@
-"use strict";
-
-
-
-// P A C K A G E
-
-const html = require("choo-async/html");
-
-
-
-// P R O G R A M
-
-// eslint-disable-next-line
-const missing = () => async (state, emit) => html`
-
-
404
-
This page does not exist
-
-`;
-
-
-
-// E X P O R T
-
-module.exports = exports = missing;
diff --git a/views/pages/_error.js b/views/pages/_error.js
deleted file mode 100755
index 99fb36d..0000000
--- a/views/pages/_error.js
+++ /dev/null
@@ -1,26 +0,0 @@
-"use strict";
-
-
-
-// P A C K A G E
-
-const html = require("choo-async/html");
-
-
-
-// P R O G R A M
-
-function error () {
- return err => () => html`
-
-
An error has occured
-
${err.stack}
-
- `;
-}
-
-
-
-// E X P O R T
-
-module.exports = exports = error;
diff --git a/views/pages/error.js b/views/pages/error.js
new file mode 100755
index 0000000..fa33898
--- /dev/null
+++ b/views/pages/error.js
@@ -0,0 +1,29 @@
+"use strict";
+
+
+
+// P A C K A G E
+
+const html = require("choo-async/html");
+
+
+
+// E X P O R T
+
+module.exports = exports = err => html`
+
+
+
+
+
Error
+
+
+
+
+
+
+
${err.stack}
+
+
+
+`;
diff --git a/views/pages/home.js b/views/pages/home.js
index ec849a7..141ea94 100755
--- a/views/pages/home.js
+++ b/views/pages/home.js
@@ -8,10 +8,9 @@ const html = require("choo-async/html");
-// P R O G R A M
+// E X P O R T
-// eslint-disable-next-line
-const home = () => async (state, emit) => html`
+module.exports = exports = () => async () => html`
@@ -121,9 +120,3 @@ const home = () => async (state, emit) => html`
document.getElementsByTagName("body")[0].classList.add("home"); // TODO: make this happen in components/layout
`;
-
-
-
-// E X P O R T
-
-module.exports = exports = home;
diff --git a/views/pages/page.js b/views/pages/page.js
index caad85c..b12f964 100644
--- a/views/pages/page.js
+++ b/views/pages/page.js
@@ -30,9 +30,9 @@ const raw = require("nanohtml/raw");
-// P R O G R A M
+// E X P O R T
-const page = () => async (state, emit) => { // eslint-disable-line
+module.exports = exports = () => async state => {
const path = state.params.wildcard;
if (!fs.existsSync(`./documents/${path}.md`)) {
@@ -110,9 +110,3 @@ function partialFinder(markdownBody) {
return dedent(markdownBody); // partials get rendered as code snippets w/o `dedent`
}
-
-
-
-// E X P O R T
-
-module.exports = exports = page;
diff --git a/views/pages/resources.js b/views/pages/resources.js
index 49b0ec6..ee39404 100644
--- a/views/pages/resources.js
+++ b/views/pages/resources.js
@@ -8,10 +8,9 @@ const html = require("choo-async/html");
-// P R O G R A M
+// E X P O R T
-// eslint-disable-next-line
-const resources = () => async (state, emit) => html`
+module.exports = exports = () => async () => html`
@@ -109,9 +108,3 @@ const resources = () => async (state, emit) => html`
`;
// TODO: Make blog post section dynamic. It should be grabbing the latest posts automatically
-
-
-
-// E X P O R T
-
-module.exports = exports = resources;
diff --git a/views/partials/ecosystem-scripts.js b/views/partials/ecosystem-scripts.js
index f1fc2cd..664a3aa 100644
--- a/views/partials/ecosystem-scripts.js
+++ b/views/partials/ecosystem-scripts.js
@@ -6,16 +6,21 @@ $("[data-action]").on("click", event => {
event.preventDefault();
const data = event.currentTarget.dataset;
- if (data.action === "open") {
- open(data.target);
- }
+ switch(data.action) {
+ case "open":
+ open(data.target);
+ break;
- if (data.action === "openSubmodule") {
- openSubmodule(data.target);
- }
+ case "openSubmodule":
+ openSubmodule(data.target);
+ break;
- if (data.action === "close") {
- close();
+ case "close":
+ close();
+ break;
+
+ default:
+ break;
}
});
diff --git a/views/partials/ecosystem.js b/views/partials/ecosystem.js
index 1efa040..b6e90d2 100644
--- a/views/partials/ecosystem.js
+++ b/views/partials/ecosystem.js
@@ -10,7 +10,7 @@ const html = require("choo-async/html");
-// P R O G R A M
+// E X P O R T
module.exports = exports = class Ecosystem extends Component {
constructor() {
diff --git a/views/partials/edit-link.js b/views/partials/edit-link.js
index daf58e5..76d4ed8 100644
--- a/views/partials/edit-link.js
+++ b/views/partials/edit-link.js
@@ -2,7 +2,7 @@
-// P A C K A G E
+// P A C K A G E S
const html = require("choo-async/html");
const local = require("app-root-path").require;
@@ -13,9 +13,9 @@ const config = local("/config");
-// P R O G R A M
+// E X P O R T
-const editLink = pagePath => {
+module.exports = exports = pagePath => {
let githubUrl = `https://github.com/${config.github.repo}/edit/${config.github.branch}`;
switch(pagePath) {
@@ -36,9 +36,3 @@ const editLink = pagePath => {
${config.github.linkText}
`;
};
-
-
-
-// E X P O R T
-
-module.exports = exports = editLink;
diff --git a/views/partials/email-subscribe.js b/views/partials/email-subscribe.js
index 7a1b1f6..9a5b85e 100644
--- a/views/partials/email-subscribe.js
+++ b/views/partials/email-subscribe.js
@@ -8,25 +8,17 @@ const html = require("choo-async/html");
-// P R O G R A M
-
-const emailSubscribe = () => {
- return html`
-
-
Don't miss a bit - Subscribe for LBRY technical updates
+`;
diff --git a/views/partials/footer.js b/views/partials/footer.js
index 41cb96e..5d9ea0b 100755
--- a/views/partials/footer.js
+++ b/views/partials/footer.js
@@ -14,10 +14,9 @@ const emailSubscribe = local("/views/partials/email-subscribe");
-// P R O G R A M
+// E X P O R T
-// eslint-disable-next-line
-const footer = (state, emit) => html`
+module.exports = exports = state => html`
${emailSubscribe()}
@@ -58,9 +57,3 @@ const footer = (state, emit) => html`
`;
-
-
-
-// E X P O R T
-
-module.exports = exports = footer;
diff --git a/views/partials/head.js b/views/partials/head.js
index 1b054f6..7581de8 100755
--- a/views/partials/head.js
+++ b/views/partials/head.js
@@ -2,54 +2,48 @@
-// P A C K A G E S
+// P A C K A G E
const html = require("choo-async/html");
-// P R O G R A M
-
-function head () {
- return () => html`${[
- html``,
- html`LBRY · tagline`,
-
- html``,
- html``,
- html``,
- html``,
- html``,
-
- // Open Graph
- html``,
- html``,
- html``,
- html``,
- html``,
- html``,
-
- // Social/App Stuff
- html``,
- html``,
- html``,
- html``,
- html``,
- html``,
-
- html``,
- html``,
- html``,
- html``,
-
- html``,
- html``,
- html``
- ]}`;
-}
-
-
-
// E X P O R T
-module.exports = exports = head;
+module.exports = exports = () => async () => html`${[
+ html``,
+ html`LBRY · tagline`,
+
+ html``,
+ html``,
+ html``,
+ html``,
+ html``,
+
+ // Open Graph
+ html``,
+ html``,
+ html``,
+ html``,
+ html``,
+ html``,
+
+ // Social/App Stuff
+ html``,
+ html``,
+ html``,
+ html``,
+ html``,
+ html``,
+
+ html``,
+ html``,
+ html``,
+ html``,
+
+ html``,
+ html``,
+ html``
+]}`;
+
+// TODO: Update meta details
diff --git a/views/partials/mission-statement.js b/views/partials/mission-statement.js
index c88782d..e671d3e 100644
--- a/views/partials/mission-statement.js
+++ b/views/partials/mission-statement.js
@@ -8,18 +8,10 @@ const html = require("choo-async/html");
-// P R O G R A M
-
-const missionStatement = () => {
- return html`
-
- Mission Statement To create a market for accessing and publishing information1 that is global2, decentralized3, robust4, optimal5 and complete6.
-
- `;
-};
-
-
-
// E X P O R T
-module.exports = exports = missionStatement;
+module.exports = exports = () => html`
+
+ Mission Statement To create a market for accessing and publishing information1 that is global2, decentralized3, robust4, optimal5 and complete6.
+
+`;
diff --git a/views/partials/navigation.js b/views/partials/navigation.js
index 88d9a06..df1fa34 100755
--- a/views/partials/navigation.js
+++ b/views/partials/navigation.js
@@ -6,35 +6,7 @@
const html = require("choo-async/html");
-
-
-// P R O G R A M
-
-const navigation = (state, emit) => { // eslint-disable-line
- const renderedNavigationItems = navigationItems.map(navigationItem => {
- return `${navigationItem.name}`;
- });
-
- return html`
-
-
-
- `;
-};
+// V A R I A B L E
const navigationItems = [
{
@@ -68,4 +40,15 @@ const navigationItems = [
// E X P O R T
-module.exports = exports = navigation;
+module.exports = exports = state => {
+ const renderedNavigationItems = navigationItems.map(navigationItem => `${navigationItem.name}`);
+
+ return html`
+
+ `;
+};
diff --git a/views/partials/noscript.js b/views/partials/noscript.js
deleted file mode 100755
index 45a18aa..0000000
--- a/views/partials/noscript.js
+++ /dev/null
@@ -1,25 +0,0 @@
-"use strict";
-
-
-// P A C K A G E
-
-const html = require("choo-async/html");
-
-
-
-// P R O G R A M
-
-function noscript () {
- return () => html`
-
- `;
-}
-
-
-
-// E X P O R T
-
-module.exports = exports = noscript;
diff --git a/views/show.js b/views/show.js
deleted file mode 100755
index c8a83b7..0000000
--- a/views/show.js
+++ /dev/null
@@ -1,33 +0,0 @@
-"use strict";
-
-
-
-// P A C K A G E
-
-const html = require("choo-async/html");
-
-
-
-// P R O G R A M
-
-const show = app => async (state, emit) => {
- const page = require(`${__dirname}/pages/${state.params.page}.js`);
- if (page) return html`${page(state, emit)(app)}`;
-
- /*
- else {
- return html`
-
-
404
-
The page you are looking for does not exist.
-
- `;
- }
- */
-};
-
-
-
-// E X P O R T
-
-module.exports = exports = show;