Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

Sermons list #9

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d335700
Convert sermons list to table
narthur Aug 19, 2020
89dc68a
style sermons table; link titles
narthur Aug 19, 2020
2972893
Add deploy step to ci.yml
narthur Aug 20, 2020
0f5250b
attempt ci fix
narthur Aug 20, 2020
2e3ba71
only run ci on push
narthur Aug 20, 2020
cf784cf
increase deploy timeout; add incremental build caching
narthur Aug 20, 2020
993f4a1
remove ci timeout; clean up build logs
narthur Aug 20, 2020
7265e9c
replace timeout
narthur Aug 20, 2020
2c4ec94
Move most of sermon query into template; fix sermon detail image
narthur Aug 20, 2020
da3eef1
try to debug ci
narthur Aug 24, 2020
485e09b
try to debug ci
narthur Aug 24, 2020
4bd040b
log build stats
narthur Aug 24, 2020
76b6219
fix build stats
narthur Aug 24, 2020
822b5c5
Attempt deploying compressed build
narthur Aug 24, 2020
bb13f0a
Try to deploy zip using Neltify API
narthur Aug 24, 2020
fae39c0
try to fix caching; re-enable build step
narthur Aug 24, 2020
7ae3115
try to fix deploy step
narthur Aug 24, 2020
fe97c1e
Delete deploy CI job
narthur Aug 25, 2020
85ac4f3
Put querys back in node, extract path helper
narthur Aug 25, 2020
299f9f0
Implement Matthew's parallel strategy
narthur Aug 26, 2020
19f9039
trigger branch preview
narthur Aug 26, 2020
155da8f
Trigger build
mattleff Aug 26, 2020
39669d7
Test incremental build speed
mattleff Aug 26, 2020
161840d
Test incremental build speed
mattleff Aug 27, 2020
0a5165c
Test incremental deploy with Gatsby Cloud + Netlify
mattleff Aug 27, 2020
8e16680
Test Gatsby Cloud with S3
mattleff Aug 27, 2020
ecbbd68
Add gh-pages deploy
narthur Aug 27, 2020
2b15b3c
Merge branch 'sermons-list' of https://github.com/avorg/audioverse-ga…
narthur Aug 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: CI
on: [push, pull_request]
on: push
jobs:
audit:
runs-on: ubuntu-latest
Expand Down
6 changes: 2 additions & 4 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
* See: https://www.gatsbyjs.org/docs/node-apis/
*/

const sermonFactory = require('./src/templates/sermon.factory.js'),
sermonsFactory = require('./src/templates/sermons.factory.js')
const sermonFactory = require('./src/templates/sermons.factory.js')

exports.createPages = async ({graphql, actions}) => {
const {createPage} = actions

await sermonFactory.createPages(graphql, createPage)
await sermonsFactory.createPages(graphql, createPage)
}
}
9 changes: 3 additions & 6 deletions gatsby-node.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ describe("gatsby node", () => {
data: {
avorg: {
sermons: {
nodes: [],
pageInfo: {
hasNextPage: false
}
nodes: [{}]
}
}
}
Expand All @@ -25,6 +22,6 @@ describe("gatsby node", () => {

await createPages(args)

expect(path.resolve).toBeCalledWith(`./src/templates/sermons.js`)
expect(path.resolve).toBeCalledWith(`./src/templates/sermons.list.js`)
})
})
})
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"gatsby-source-graphql": "^2.6.1",
"gatsby-transformer-sharp": "^2.5.7",
"lodash": "^4.17.19",
"moment": "^2.27.0",
"node-sass": "^4.14.1",
"prop-types": "^15.7.2",
"react": "^16.12.0",
Expand All @@ -38,7 +39,7 @@
],
"license": "0BSD",
"scripts": {
"build": "GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages",
"build": "GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"start": "npm run develop",
Expand Down
13 changes: 7 additions & 6 deletions src/common.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
$gray-night: #1c1c1d;
$gray-dark: #242426;
$gray-mid: #262627;
$gray-light: #747474;
$gray-lighter: #dbdbdb;
$gray-lightest: #e5e5e5;
$gray-bleached: #eee;
$gray-darkest: #242426;
$gray-darker: #262627;
$gray-dark: #747474;
$gray-mid: #dbdbdb;
$gray-light: #e5e5e5;
$gray-lighter: #eee;
$gray-lightest: #f7f7f7;

$accent: #3DA88E;
3 changes: 1 addition & 2 deletions src/components/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}

.organism-header {
background-color: $gray-dark;
background-color: $gray-darkest;
}

// CSS Reset, Etc:
Expand Down Expand Up @@ -571,7 +571,6 @@ thead {
td,
th {
text-align: left;
border-bottom: 1px solid hsla(0, 0%, 0%, 0.12);
font-feature-settings: "tnum";
-moz-font-feature-settings: "tnum";
-ms-font-feature-settings: "tnum";
Expand Down
4 changes: 2 additions & 2 deletions src/components/molecules/pagination.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
margin-right: .2em;

a {
color: $gray-light;
color: $gray-dark;
text-decoration: none;
display: block;
border-radius: 3px;
padding: .2em .5em;
}

&:not(.active) a:hover {
background-color: $gray-bleached;
background-color: $gray-lighter;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/helpers/paths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getSermonPath = (node, languageCode) => `/${languageCode}/sermons/${node.id}`
38 changes: 18 additions & 20 deletions src/helpers/queries.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
const _ = require(`lodash`),
constants = require(`../constants`)

// Must include pageInfo.hasNextPage and pageInfo.endCursor in generated queries
exports.getPages = async (graphql, query, queryArgs, pageSelector, cursor = null, pages = []) => {
queryArgs.cursor = cursor
const NUM_PER_PAGE = 250;

const result = await graphql(query, queryArgs),
page = _.get(result, pageSelector)

pages.push(page)
exports.NUM_PER_PAGE = NUM_PER_PAGE;

const hasNextPage = _.get(page, 'pageInfo.hasNextPage') &&
pages.length < constants.query_page_limit
// Required in query:
// pageInfo.hasNextPage
// pageInfo.endCursor
// aggregate.count
exports.getPages = async (graphql, query, queryArgs, pageSelector) => {
const result = await graphql(query, queryArgs),
page = _.get(result, pageSelector),
pages = [page],
pageCount = Math.ceil(_.get(page, 'aggregate.count') / NUM_PER_PAGE),
maxPage = Math.min(pageCount, constants.query_page_limit)

if (hasNextPage) {
const nextCursor = _.get(page, 'pageInfo.endCursor')
if (!page) return [];
if (!maxPage || maxPage < 1) return pages;

return exports.getPages(
graphql,
query,
queryArgs,
pageSelector,
nextCursor,
pages
)
}
pages.push(...await Promise.all(_.range(1, maxPage).map(i => graphql(query, {
...queryArgs,
cursor: Buffer.from(i * NUM_PER_PAGE + 1 + '').toString('base64')
}).then(result => _.get(result, pageSelector)))));

return pages
}
69 changes: 0 additions & 69 deletions src/templates/sermon.factory.js

This file was deleted.

62 changes: 0 additions & 62 deletions src/templates/sermon.factory.spec.js

This file was deleted.

9 changes: 4 additions & 5 deletions src/templates/sermon.js → src/templates/sermons.detail.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from "react"
import Layout from "../components/layout"
import './sermon.scss'
import './sermons.detail.scss'

export default function Sermon({ pageContext }) {
export default function SermonsDetail({ pageContext }) {
const sermon = pageContext.node,
firstPresenter = sermon.persons[0],
imageSrc = firstPresenter && firstPresenter.imageWithFallback.url,
imageAlt = firstPresenter && firstPresenter.name;
imageSrc = sermon.imageWithFallback.url,
imageAlt = sermon.title;

return (
<Layout>
Expand Down
Loading