mirror of
https://github.com/learnk8s/learnk8s.io.git
synced 2026-02-14 08:29:52 +00:00
remove 'getPages'
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer } from './layout.v3'
|
||||
import { State, Action, getConfig, getPages, getOpenGraph, Store } from './store'
|
||||
import { State, Action, getConfig, getOpenGraph, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { join } from 'path'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
@@ -38,7 +38,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === NotFound404.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === NotFound404.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === NotFound404.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Navbar, Html, OpenGraph, Head, Body, Footer, Consultation } from './layout.v3'
|
||||
import { State, Action, getConfig, getPages, getOpenGraph, Store } from './store'
|
||||
import { State, Action, getConfig, getOpenGraph, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { join } from 'path'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
@@ -184,7 +184,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === AboutUs.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === AboutUs.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === AboutUs.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { State, Action, getPages, getOpenGraph, getConfig, Store } from './store'
|
||||
import { State, Action, getOpenGraph, getConfig, Store, Selector } from './store'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer } from './layout.v3'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { join } from 'path'
|
||||
@@ -38,7 +38,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === Academy.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === Academy.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Academy.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import { Course } from 'schema-dts'
|
||||
import { JsonLd } from 'react-schemaorg'
|
||||
import { State, Action, getPages, getOpenGraph, getConfig, Store } from './store'
|
||||
import { State, Action, getOpenGraph, getConfig, Store, Selector } from './store'
|
||||
import { material } from './material'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer, mailto, MailTo, FAQs, FAQ } from './layout.v3'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
@@ -69,7 +69,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === Advanced.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === Advanced.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Advanced.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import { Course } from 'schema-dts'
|
||||
import { JsonLd } from 'react-schemaorg'
|
||||
import { State, Action, getPages, getOpenGraph, getConfig, Store } from './store'
|
||||
import { State, Action, getOpenGraph, getConfig, Store, Selector } from './store'
|
||||
import { material } from './material'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer, mailto, MailTo, FAQs, FAQ } from './layout.v3'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
@@ -69,7 +69,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === Architecting.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === Architecting.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Architecting.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Html, Head, OpenGraph, Body, Navbar, Footer, WhatIsLearnk8s } from '../layout.v3'
|
||||
import { State, Action, getPages, getOpenGraph, getConfig, Store } from '../store'
|
||||
import { State, Action, getOpenGraph, getConfig, Store, Selector } from '../store'
|
||||
import { join } from 'path'
|
||||
import { toMdast } from '../markdown'
|
||||
import { toVFile } from '../files'
|
||||
@@ -107,7 +107,7 @@ type Section = {
|
||||
}
|
||||
|
||||
function renderPage(state: State, sections: Section[]) {
|
||||
const page = getPages(state).find(it => it.id === BestPractices.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === BestPractices.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === BestPractices.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react'
|
||||
import { Navbar, Footer, Consultation, Html, Head, Body, OpenGraph } from './layout.v3'
|
||||
import { State, Action, getConfig, getPages, getOpenGraph, getBlogPosts, hasTag, Store } from './store'
|
||||
import { State, Action, getConfig, getOpenGraph, getBlogPosts, hasTag, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { join } from 'path'
|
||||
import { BlogPost } from './store/websiteReducer'
|
||||
@@ -41,7 +41,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const pages = getPages(state)
|
||||
const pages = Selector.pages.selectAll(state)
|
||||
const page = pages.find(it => it.id === BiteSized.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === BiteSized.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
|
||||
@@ -2,8 +2,6 @@ import * as React from 'react'
|
||||
import { Store } from 'redux'
|
||||
import {
|
||||
State,
|
||||
Actions,
|
||||
getPages,
|
||||
hasTag,
|
||||
getOpenGraph,
|
||||
getBlogPosts,
|
||||
@@ -11,6 +9,7 @@ import {
|
||||
getBlogPostMarkdownBlocks,
|
||||
getConfig,
|
||||
getPreviewPictures,
|
||||
Selector,
|
||||
} from './store'
|
||||
import { toVFile, read } from './files'
|
||||
import { join } from 'path'
|
||||
@@ -27,9 +26,9 @@ import { transform } from './markdown/utils'
|
||||
import { mdast2Jsx, mdast2JsxInline } from './markdown/jsx'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
|
||||
export async function Mount({ store }: { store: Store<State, Actions> }) {
|
||||
export async function Mount({ store }: { store: Store }) {
|
||||
const state = store.getState()
|
||||
const pages = getPages(state).filter(hasTag(state, 'bite-sized'))
|
||||
const pages = Selector.pages.selectAll(state).filter(hasTag(state, 'bite-sized'))
|
||||
await Promise.all(
|
||||
pages.map(async page => {
|
||||
defaultAssetsPipeline({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer, Consultation } from './layout.v3'
|
||||
import { join } from 'path'
|
||||
import { getOpenGraph, getPages, getConfig, State, Action, getBlogPosts, hasTag, Store } from './store'
|
||||
import { getOpenGraph, getConfig, State, Action, getBlogPosts, hasTag, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { BlogPost } from './store/websiteReducer'
|
||||
import { format } from 'date-fns'
|
||||
@@ -39,7 +39,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const pages = getPages(state)
|
||||
const pages = Selector.pages.selectAll(state)
|
||||
const page = pages.find(it => it.id === Blog.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Blog.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Navbar, Footer, Consultation, Html, Head, Body, OpenGraph } from './layout.v3'
|
||||
import { State, Action, getConfig, getPages, getOpenGraph, Store } from './store'
|
||||
import { State, Action, getConfig, getOpenGraph, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { join } from 'path'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
@@ -37,7 +37,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === Career.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === Career.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Career.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ok } from 'assert'
|
||||
import { store, getPages, getRedirects } from './store'
|
||||
import { store, getRedirects, Selector } from './store'
|
||||
import commander from 'commander'
|
||||
import { register } from './register'
|
||||
import * as Hast from 'hast'
|
||||
@@ -16,7 +16,8 @@ ok(commander.hostname, 'Please provide a hostname such as --hostname http://loca
|
||||
register(store)
|
||||
const state = store.getState()
|
||||
const redirectPageIds = getRedirects(state).map(it => it.fromPageId)
|
||||
const pages = getPages(state)
|
||||
const pages = Selector.pages
|
||||
.selectAll(state)
|
||||
.filter(it => !redirectPageIds.includes(it.id))
|
||||
.filter(it => it.url.split('.').pop() !== 'xml')
|
||||
.filter(it => it.id !== 'not-found-404')
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { Store } from 'redux'
|
||||
import { Actions, State, getPages, getRedirects, getOpenGraph, getBlogPosts, store } from './store'
|
||||
import { State, getRedirects, getOpenGraph, getBlogPosts, store, Selector, Store } from './store'
|
||||
import { ok } from 'assert'
|
||||
|
||||
function getCommonPages(state: State) {
|
||||
const redirectPageIds = getRedirects(state).map(it => it.fromPageId)
|
||||
return getPages(state)
|
||||
return Selector.pages
|
||||
.selectAll(state)
|
||||
.filter(it => !redirectPageIds.includes(it.id))
|
||||
.filter(it => it.url.split('.').pop() !== 'xml')
|
||||
}
|
||||
|
||||
function checkTitleDescription(store: Store<State, Actions>) {
|
||||
function checkTitleDescription(store: Store) {
|
||||
const state = store.getState()
|
||||
const pages = getCommonPages(state)
|
||||
pages.forEach(page => {
|
||||
@@ -28,7 +28,7 @@ function checkTitleDescription(store: Store<State, Actions>) {
|
||||
})
|
||||
}
|
||||
|
||||
function checkOpenGraph(store: Store<State, Actions>) {
|
||||
function checkOpenGraph(store: Store) {
|
||||
const state = store.getState()
|
||||
const commonPageIds = getCommonPages(state).map(it => it.id)
|
||||
const openGraphs = getOpenGraph(state).filter(it => commonPageIds.includes(it.pageId))
|
||||
@@ -38,7 +38,7 @@ function checkOpenGraph(store: Store<State, Actions>) {
|
||||
})
|
||||
}
|
||||
|
||||
function checkBlogPost(store: Store<State, Actions>) {
|
||||
function checkBlogPost(store: Store) {
|
||||
const state = store.getState()
|
||||
const blogPosts = getBlogPosts(state)
|
||||
blogPosts.forEach(bp => {
|
||||
@@ -48,7 +48,7 @@ function checkBlogPost(store: Store<State, Actions>) {
|
||||
})
|
||||
}
|
||||
|
||||
export function checkPageDetail(store: Store<State, Actions>) {
|
||||
export function checkPageDetail(store: Store) {
|
||||
checkTitleDescription(store)
|
||||
checkOpenGraph(store)
|
||||
checkBlogPost(store)
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
MailTo,
|
||||
} from './layout.v3'
|
||||
import { join } from 'path'
|
||||
import { getOpenGraph, getPages, getConfig, State, Action, Store } from './store'
|
||||
import { getOpenGraph, getConfig, State, Action, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
|
||||
@@ -69,7 +69,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === Consulting.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === Consulting.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Consulting.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer, Consultation } from './layout.v3'
|
||||
import { State, Action, getPages, getOpenGraph, getConfig, Store } from './store'
|
||||
import { State, Action, getOpenGraph, getConfig, Store, Selector } from './store'
|
||||
import { join } from 'path'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
@@ -37,7 +37,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === ContactUs.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === ContactUs.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === ContactUs.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { State, Action, store, Store } from './store'
|
||||
import { State, Action, store, Store, Selector } from './store'
|
||||
import { toVFile } from './files'
|
||||
import { join } from 'path'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import { Course } from 'schema-dts'
|
||||
import { JsonLd } from 'react-schemaorg'
|
||||
import { State, Action, getPages, getOpenGraph, getConfig, Store } from './store'
|
||||
import { State, Action, getOpenGraph, getConfig, Store, Selector } from './store'
|
||||
import { material } from './material'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer, mailto, MailTo, FAQs, FAQ } from './layout.v3'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
@@ -69,7 +69,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === Exploring.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === Exploring.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Exploring.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { State, Action, getPages, getConfig, getBlogPosts, getAuthors, getOpenGraph, Store } from './store'
|
||||
import { State, Action, getConfig, getBlogPosts, getAuthors, getOpenGraph, Store, Selector } from './store'
|
||||
import { join } from 'path'
|
||||
import { RSSPipeline } from './optimise'
|
||||
|
||||
@@ -26,7 +26,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const pages = getPages(state)
|
||||
const pages = Selector.pages.selectAll(state)
|
||||
const page = pages.find(it => it.id === RSS.id)
|
||||
if (!page) {
|
||||
throw new Error(`RSS page not registered`)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer } from './layout.v3'
|
||||
import { join } from 'path'
|
||||
import { getOpenGraph, getPages, getConfig, State, Action, Store } from './store'
|
||||
import { getOpenGraph, getConfig, State, Action, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
import { PrimaryButton } from './homepage'
|
||||
@@ -38,7 +38,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const pages = getPages(state)
|
||||
const pages = Selector.pages.selectAll(state)
|
||||
const page = pages.find(it => it.id === FreeTools.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === FreeTools.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import * as React from 'react'
|
||||
import {
|
||||
getConfig,
|
||||
Actions,
|
||||
State,
|
||||
getPages,
|
||||
getOpenGraph,
|
||||
getBlogPosts,
|
||||
getAuthors,
|
||||
getBlogPostMarkdownBlocks,
|
||||
hasTag,
|
||||
getPreviewPictures,
|
||||
Selector,
|
||||
Store,
|
||||
} from './store'
|
||||
import { Page } from './store/websiteReducer'
|
||||
import { Head, Html, Body, Navbar, OpenGraph, Footer, Author, Subscribe, WhatIsLearnk8s } from './layout.v3'
|
||||
@@ -24,12 +24,11 @@ import { selectAll } from 'unist-util-select'
|
||||
import * as Mdast from 'mdast'
|
||||
import { mdast2Jsx } from './markdown/jsx'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { Store } from 'redux'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
|
||||
export async function Mount({ store }: { store: Store<State, Actions> }) {
|
||||
export async function Mount({ store }: { store: Store }) {
|
||||
const state = store.getState()
|
||||
const pages = getPages(state).filter(hasTag(state, 'general-post'))
|
||||
const pages = Selector.pages.selectAll(state).filter(hasTag(state, 'general-post'))
|
||||
await Promise.all(
|
||||
pages.map(async page => {
|
||||
defaultAssetsPipeline({
|
||||
@@ -44,7 +43,7 @@ export async function Mount({ store }: { store: Store<State, Actions> }) {
|
||||
}
|
||||
|
||||
export async function renderPage(pageMeta: Page, state: State) {
|
||||
const page = getPages(state).find(it => it.id === pageMeta.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === pageMeta.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === pageMeta.id)
|
||||
if (!openGraph) {
|
||||
throw new Error('The page does not have an open graph.')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer, ListItem, Interlude, Consultation, Hero } from './layout.v3'
|
||||
import { State, Action, getConfig, getPages, getOpenGraph, Store } from './store'
|
||||
import { State, Action, getConfig, getOpenGraph, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { join } from 'path'
|
||||
import { Training } from './training.v2'
|
||||
@@ -42,7 +42,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === HomePage.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === HomePage.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === HomePage.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -28,7 +28,7 @@ import * as GenericBlogPost from './genericBlogPost'
|
||||
|
||||
import * as BiteSizedListing from './biteSized'
|
||||
import * as BiteSizedRenderer from './biteSized.v2'
|
||||
import { store, getConfig } from './store'
|
||||
import { store, getConfig, Selector } from './store'
|
||||
import * as Workshop from './training.v2'
|
||||
import * as TrainingLandingPage from './training-landing'
|
||||
import * as Training from './learn'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Training } from './training.v2'
|
||||
import { State, Action, Store } from './store'
|
||||
import { State, Action, Store, Selector } from './store'
|
||||
|
||||
export const Pages = {
|
||||
landingLondon: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Footer, Html, Head, OpenGraph, Body, Navbar } from './layout.v3'
|
||||
import { State, Action, getPages, getOpenGraph, getConfig, Store } from './store'
|
||||
import { State, Action, getOpenGraph, getConfig, Store, Selector } from './store'
|
||||
import { join } from 'path'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
@@ -44,7 +44,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === Learn.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === Learn.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Learn.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import { Course } from 'schema-dts'
|
||||
import { JsonLd } from 'react-schemaorg'
|
||||
import { State, Action, getPages, getOpenGraph, getConfig, Store } from './store'
|
||||
import { State, Action, getOpenGraph, getConfig, Store, Selector } from './store'
|
||||
import { material } from './material'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer, mailto, MailTo, FAQs, FAQ } from './layout.v3'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
@@ -69,7 +69,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === Architecting.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === Architecting.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Architecting.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer } from './layout.v3'
|
||||
import { Action, State, getConfig, getPages, getOpenGraph, Store } from './store'
|
||||
import { Action, State, getConfig, getOpenGraph, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { join } from 'path'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
@@ -37,7 +37,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === Newsletter.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === Newsletter.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Newsletter.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { State, Action, Store } from './store'
|
||||
import { State, Action, Store, Selector } from './store'
|
||||
import { Training } from './training.v2'
|
||||
|
||||
export const Page = {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import React from 'react'
|
||||
import { Store } from 'redux'
|
||||
import { State, getConfig, getRedirects, getPages } from './store'
|
||||
import { State, getConfig, getRedirects, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
|
||||
export function Mount({ store }: { store: Store }) {
|
||||
const state = store.getState()
|
||||
const redirects = getRedirects(state)
|
||||
const pages = getPages(state)
|
||||
const pages = Selector.pages.selectAll(state)
|
||||
redirects.map(redirect => {
|
||||
const from = pages.find(it => it.id === redirect.fromPageId)!
|
||||
const to = pages.find(it => it.id === redirect.redirectToPageId)!
|
||||
|
||||
@@ -41,7 +41,7 @@ import * as K8Bit from './k8bit/k8bit'
|
||||
|
||||
import * as BiteSizedListing from './biteSized'
|
||||
import * as BiteSizedArticles from './bite-sized-articles'
|
||||
import { Store } from './store'
|
||||
import { Store, Selector } from './store'
|
||||
import * as Courses from './courses'
|
||||
import * as Workshops from './training.v2'
|
||||
import * as Training from './learn'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { join } from 'path'
|
||||
import { State, Action, getConfig, getPages, getBlogPosts, getAuthors, getOpenGraph, Store } from './store'
|
||||
import { State, Action, getConfig, getBlogPosts, getAuthors, getOpenGraph, Store, Selector } from './store'
|
||||
import { RSSPipeline } from './optimise'
|
||||
|
||||
export const RSS = {
|
||||
@@ -41,7 +41,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const pages = getPages(state)
|
||||
const pages = Selector.pages.selectAll(state)
|
||||
const page = pages.find(it => it.id === RSS.id)
|
||||
if (!page) {
|
||||
throw new Error(`RSS page not registered`)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { State, Action, getConfig, getPages, getRedirects, hasTag, Store } from './store'
|
||||
import { State, Action, getConfig, getRedirects, hasTag, Store, Selector } from './store'
|
||||
import { RSSPipeline } from './optimise'
|
||||
import { join } from 'path'
|
||||
|
||||
@@ -26,7 +26,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
|
||||
function renderPage(state: State) {
|
||||
const redirects = getRedirects(state).map(it => it.fromPageId)
|
||||
const pages = getPages(state).filter(it => !redirects.includes(it.id))
|
||||
const pages = Selector.pages.selectAll(state).filter(it => !redirects.includes(it.id))
|
||||
const page = pages.find(it => it.id === SitemapXML.id)
|
||||
if (!page) {
|
||||
throw new Error(`Sitemap page not registered`)
|
||||
|
||||
@@ -60,9 +60,9 @@ export function getConfig(state: State): ConfigReducer.Config {
|
||||
return Selector.configs.selectAll(store.getState())[0]
|
||||
}
|
||||
|
||||
export function getPages(state: State): WebsiteReducer.Page[] {
|
||||
return Object.values(Selector.pages.selectAll(store.getState()))
|
||||
}
|
||||
// export function getPages(state: State): WebsiteReducer.Page[] {
|
||||
// return Object.values(Selector.pages.selectAll(store.getState()))
|
||||
// }
|
||||
|
||||
export function getOpenGraph(state: State): WebsiteReducer.OpenGraph[] {
|
||||
return Object.values(Selector.openGraphs.selectAll(store.getState()))
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react'
|
||||
import marked from 'marked'
|
||||
import { cat } from 'shelljs'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer, Consultation } from './layout.v3'
|
||||
import { State, Action, getConfig, getPages, getOpenGraph, Store } from './store'
|
||||
import { State, Action, getConfig, getOpenGraph, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { join } from 'path'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
@@ -45,7 +45,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === TermsAndConditions.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === TermsAndConditions.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === TermsAndConditions.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from 'schema-dts'
|
||||
import { JsonLd } from 'react-schemaorg'
|
||||
import { material } from './material'
|
||||
import { getPages, getOpenGraph, getConfig, getAuthors, Store, Action, Selector, State } from './store'
|
||||
import { getOpenGraph, getConfig, getAuthors, Store, Action, Selector, State } from './store'
|
||||
import { join } from 'path'
|
||||
import { format, subDays } from 'date-fns'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
@@ -134,7 +134,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderInPersonCoursePage(course: CourseInPerson, state: State) {
|
||||
const page = getPages(state).find(it => it.id === `page-${course.id}`)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === `page-${course.id}`)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === `page-${course.id}`)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
const instructors = getAuthors(state).filter(it =>
|
||||
@@ -317,7 +317,7 @@ function renderInPersonCoursePage(course: CourseInPerson, state: State) {
|
||||
}
|
||||
|
||||
function renderOnlineCoursePage(course: CourseOnline, state: State) {
|
||||
const page = getPages(state).find(it => it.id === `page-${course.id}`)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === `page-${course.id}`)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === `page-${course.id}`)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
const instructors = getAuthors(state).filter(it =>
|
||||
|
||||
@@ -10,17 +10,7 @@ import {
|
||||
} from 'schema-dts'
|
||||
import { JsonLd } from 'react-schemaorg'
|
||||
import { material } from './material'
|
||||
import {
|
||||
State,
|
||||
getPages,
|
||||
getOpenGraph,
|
||||
getWorkshops,
|
||||
getConfig,
|
||||
Store,
|
||||
Action,
|
||||
Selector,
|
||||
getAuthors,
|
||||
} from './store'
|
||||
import { State, getOpenGraph, getWorkshops, getConfig, Store, Action, Selector, getAuthors } from './store'
|
||||
import { join } from 'path'
|
||||
import { format, subDays } from 'date-fns'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
@@ -118,7 +108,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === Training.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === Training.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Training.id)
|
||||
const courses = getWorkshops(state)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import { Navbar, Html, Head, OpenGraph, Body, Footer, mailto, MailTo } from './layout.v3'
|
||||
import { join } from 'path'
|
||||
import { getOpenGraph, getPages, getConfig, State, Action, Store } from './store'
|
||||
import { getOpenGraph, getConfig, State, Action, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
|
||||
@@ -43,7 +43,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const pages = getPages(state)
|
||||
const pages = Selector.pages.selectAll(state)
|
||||
const page = pages.find(it => it.id === Wallpaper.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === Wallpaper.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
|
||||
@@ -8,7 +8,7 @@ import { toMdast } from './markdown'
|
||||
import { toVFile } from './files'
|
||||
import { mdast2JsxInline } from './markdown/jsx'
|
||||
import { Html, Head, Body, OpenGraph } from './layout.v3'
|
||||
import { State, Action, getConfig, getPages, getOpenGraph, Store } from './store'
|
||||
import { State, Action, getConfig, getOpenGraph, Store, Selector } from './store'
|
||||
import { defaultAssetsPipeline } from './optimise'
|
||||
import { join } from 'path'
|
||||
import { tachyons } from './tachyons/tachyons'
|
||||
@@ -64,7 +64,7 @@ export function Mount({ store }: { store: Store }) {
|
||||
}
|
||||
|
||||
function renderPage(state: State) {
|
||||
const page = getPages(state).find(it => it.id === ZeroToK8s.id)!
|
||||
const page = Selector.pages.selectAll(state).find(it => it.id === ZeroToK8s.id)!
|
||||
const openGraph = getOpenGraph(state).find(it => it.pageId === ZeroToK8s.id)
|
||||
const currentAbsoluteUrl = `${getConfig(state).protocol}://${join(getConfig(state).hostname, page.url)}`
|
||||
return (
|
||||
|
||||
4
test.ts
4
test.ts
@@ -1,6 +1,6 @@
|
||||
const backstop = require('backstopjs')
|
||||
import { ok } from 'assert'
|
||||
import { store, getPages } from './src/store'
|
||||
import { store, Selector } from './src/store'
|
||||
import commander from 'commander'
|
||||
import { register } from './src/register'
|
||||
|
||||
@@ -17,7 +17,7 @@ ok(commander.approve || commander.test, 'Please provide either --approve or --te
|
||||
function renderPage(siteUrl: string): string[] {
|
||||
register(store)
|
||||
const state = store.getState()
|
||||
const pages = getPages(state)
|
||||
const pages = Selector.pages.selectAll(state)
|
||||
return pages.map(it => `${siteUrl}${it.url}`)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user