Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Discover Presenters and Bible Books sections #464

Merged
merged 13 commits into from
Sep 13, 2023
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"babel-jest": "^27.5.1",
"babel-loader": "^8.2.3",
"babel-plugin-react-intl": "^8.2.4",
"concurrently": "^8.2.0",
"concurrently": "^8.2.1",
"eslint": "^8.43.0",
"eslint-config-next": "^13.0.3",
"eslint-plugin-formatjs": "^3.0.0",
Expand Down
30 changes: 30 additions & 0 deletions public/compiled-lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,12 @@
"value": "Previous trending teachings"
}
],
"discover_bibleBooksHeading": [
{
"type": 0,
"value": "Discover Bible Books"
}
],
"discover_conferencesHeading": [
{
"type": 0,
Expand All @@ -1473,6 +1479,12 @@
"value": "Featured Teachings"
}
],
"discover_presentersHeading": [
{
"type": 0,
"value": "Discover Presenters"
}
],
"discover_recentBlogHeading": [
{
"type": 0,
Expand Down Expand Up @@ -3791,6 +3803,24 @@
"value": "Previous audiobooks"
}
],
"organismSection__bibleBooksHeading": [
{
"type": 0,
"value": "Bible Books"
}
],
"organismSection__bibleBooksNext": [
{
"type": 0,
"value": "Next Bible books"
}
],
"organismSection__bibleBooksPrevious": [
{
"type": 0,
"value": "Previous Bible books"
}
],
"organismSection_presentersHeading": [
{
"type": 0,
Expand Down
15 changes: 15 additions & 0 deletions public/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -690,12 +690,18 @@
"discover__trendingTeachingsPrevious": {
"string": "Previous trending teachings"
},
"discover_bibleBooksHeading": {
"string": "Discover Bible Books"
},
"discover_conferencesHeading": {
"string": "Recent Conferences"
},
"discover_featuredTeachingsHeading": {
"string": "Featured Teachings"
},
"discover_presentersHeading": {
"string": "Discover Presenters"
},
"discover_recentBlogHeading": {
"string": "Recent Blog Posts"
},
Expand Down Expand Up @@ -1791,6 +1797,15 @@
"organismSection__audiobooksPrevious": {
"string": "Previous audiobooks"
},
"organismSection__bibleBooksHeading": {
"string": "Bible Books"
},
"organismSection__bibleBooksNext": {
"string": "Next Bible books"
},
"organismSection__bibleBooksPrevious": {
"string": "Previous Bible books"
},
"organismSection_presentersHeading": {
"string": "Presenters"
},
Expand Down
20 changes: 20 additions & 0 deletions src/components/organisms/cardSlider/section/bibleBooks.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
query getSectionBibleBooks(
$language: Language!
$first: Int! = 3
$after: String = null
) {
bibleBooks: featuredSequences(
contentType: BIBLE_BOOK
language: $language
first: $first
after: $after
) {
nodes {
...cardSequence
}
pageInfo {
hasNextPage
endCursor
}
}
}
43 changes: 43 additions & 0 deletions src/components/organisms/cardSlider/section/bibleBooks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React from 'react';
import { useIntl } from 'react-intl';

import { CardSequenceFragment } from '~src/components/molecules/card/__generated__/sequence';
import CardSequence from '~src/components/molecules/card/sequence';
import root from '~src/lib/routes';
import { useLanguageId } from '~src/lib/useLanguageId';

import Section from '.';
import { useInfiniteGetSectionBibleBooksQuery } from './__generated__/bibleBooks';

export default function BibleBooks(props: {
heading?: string | JSX.Element;
}): JSX.Element {
const intl = useIntl();
const lang = useLanguageId();

const {
heading = intl.formatMessage({
id: 'organismSection__bibleBooksHeading',
defaultMessage: 'Bible Books',
}),
} = props;

return (
<Section
infiniteQuery={useInfiniteGetSectionBibleBooksQuery}
heading={heading}
previous={intl.formatMessage({
id: 'organismSection__bibleBooksPrevious',
defaultMessage: 'Previous Bible books',
})}
next={intl.formatMessage({
id: 'organismSection__bibleBooksNext',
defaultMessage: 'Next Bible books',
})}
seeAllUrl={root.lang(lang).books.get()}
Card={(p: { node: CardSequenceFragment }) => (
<CardSequence sequence={p.node} />
)}
/>
);
}
16 changes: 11 additions & 5 deletions src/components/organisms/cardSlider/section/presenters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ import { useLanguageId } from '~src/lib/useLanguageId';
import Section from '.';
import { useInfiniteGetSectionPresentersQuery } from './__generated__/presenters';

export default function Presenters(): JSX.Element {
export default function Presenters(props: {
heading?: string | JSX.Element;
}): JSX.Element {
const intl = useIntl();
const lang = useLanguageId();

const {
heading = intl.formatMessage({
id: 'organismSection_presentersHeading',
defaultMessage: 'Presenters',
}),
} = props;

return (
<Section
rows={2}
minCardWidth={170}
infiniteQuery={useInfiniteGetSectionPresentersQuery}
heading={intl.formatMessage({
id: 'organismSection_presentersHeading',
defaultMessage: 'Presenters',
})}
heading={heading}
previous={intl.formatMessage({
id: 'organismSection_presentersPrevious',
defaultMessage: 'Previous presenters',
Expand Down
2 changes: 1 addition & 1 deletion src/containers/discover/collections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FormattedMessage } from 'react-intl';

import LineHeading from '~components/atoms/lineHeading';
import CardFavoriteEntity from '~components/molecules/card/favoriteEntity';
import Audiobooks from '~src/components/organisms/cardSlider/section/Audiobooks';
import Audiobooks from '~src/components/organisms/cardSlider/section/audiobooks';
import Conferences from '~src/components/organisms/cardSlider/section/conferences';
import Presenters from '~src/components/organisms/cardSlider/section/presenters';
import ScriptureSongs from '~src/components/organisms/cardSlider/section/scriptureSongs';
Expand Down
19 changes: 19 additions & 0 deletions src/containers/discover/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';

import BibleBooks from '~src/components/organisms/cardSlider/section/bibleBooks';
import Presenters from '~src/components/organisms/cardSlider/section/presenters';
import TrendingTeachings from '~src/components/organisms/cardSlider/section/trendingTeachings';

import BlogPosts from '../../components/organisms/cardSlider/section/blogPosts';
Expand All @@ -14,9 +17,25 @@ export default function Discover(): JSX.Element {
<div>
<RecentTeachings />
<Topics />
<Presenters
heading={
<FormattedMessage
id="discover_presentersHeading"
defaultMessage="Discover Presenters"
/>
}
/>
<TrendingTeachings />
<FeaturedTeachings />
<BlogPosts />
<BibleBooks
heading={
<FormattedMessage
id="discover_bibleBooksHeading"
defaultMessage="Discover Bible Books"
/>
}
/>
<StorySeasons />
<Conferences />
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/pages/[language]/discover/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export async function getStaticProps({
getSectionConferences: { language },
getSectionBlogPosts: { language },
getSectionTopics: { language },
getSectionPresenters: { language },
getSectionBibleBooks: { language },
});

return {
Expand Down