From 27e555ef72d3b4cf68b61bd86aca60df055c140d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9D=E3=83=BC=E3=83=AB=20=E3=82=A6=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=83=96?= Date: Mon, 1 Oct 2018 15:47:10 -0500 Subject: [PATCH] Redirects work now --- app/client.js | 7 +-- app/components/link-grid.js | 4 +- app/data/redirects.json | 12 ++--- app/modules/redirect-404.js | 49 +++++++++++++++++++ app/modules/redirectOr404.js | 15 ------ app/sass/pages/_tour.scss | 1 - app/views/404.js | 41 +++++++++------- app/views/api.js | 94 +++++++++++++++++++++++++++--------- app/views/home.js | 14 +++++- app/views/redirect.js | 24 ++++----- 10 files changed, 180 insertions(+), 81 deletions(-) create mode 100644 app/modules/redirect-404.js delete mode 100644 app/modules/redirectOr404.js diff --git a/app/client.js b/app/client.js index 1bd34f5..511f399 100755 --- a/app/client.js +++ b/app/client.js @@ -8,12 +8,13 @@ import async from "choo-async"; import asyncHtml from "choo-async/html"; import choo from "choo"; import devtools from "choo-devtools"; +import { require as local } from "app-root-path"; import ssr from "choo-ssr"; // V A R I A B L E S -import head from "./components/head"; -import wrapper from "./components/wrapper"; +const head = local("app/components/head"); +const wrapper = local("app/components/wrapper"); @@ -57,7 +58,7 @@ module.exports = exports = main; // H E L P E R -function shell (head, body) { +function shell(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 diff --git a/app/components/link-grid.js b/app/components/link-grid.js index ffa4399..e21a861 100644 --- a/app/components/link-grid.js +++ b/app/components/link-grid.js @@ -11,7 +11,9 @@ import html from "choo/html"; // E X P O R T export default (links) => { - const renderedLinks = links.map((link) => returnLinkTemplate(link.title, link.description, link.destination, link.label)); + const renderedLinks = links.map((link) => + returnLinkTemplate(link.title, link.description, link.destination, link.label)); + return html`