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
14 changes: 7 additions & 7 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 @@ -1467,6 +1467,12 @@
"value": "Previous trending teachings"
}
],
"discover_bibleBooksHeading": [
{
"type": 0,
"value": "Discover Bible Books"
}
],
"discover_conferencesHeading": [
{
"type": 0,
Expand All @@ -1479,6 +1485,12 @@
"value": "Featured Teachings"
}
],
"discover_presentersHeading": [
{
"type": 0,
"value": "Discover Presenters"
}
],
"discover_recentBlogHeading": [
{
"type": 0,
Expand Down Expand Up @@ -3803,6 +3815,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 @@ -693,12 +693,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 @@ -1797,6 +1803,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,4 +1,5 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';

import BlogPosts from '~components/organisms/cardSlider/section/blogPosts';
import Conferences from '~components/organisms/cardSlider/section/conferences';
Expand All @@ -8,15 +9,33 @@ import StorySeasons from '~components/organisms/cardSlider/section/storySeasons'
import Topics from '~components/organisms/cardSlider/section/topics';
import TrendingMusic from '~components/organisms/cardSlider/section/trendingMusic';
import TrendingTeachings from '~components/organisms/cardSlider/section/trendingTeachings';
import BibleBooks from '~src/components/organisms/cardSlider/section/bibleBooks';
import Presenters from '~src/components/organisms/cardSlider/section/presenters';

export default function Discover(): JSX.Element {
return (
<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 />
<TrendingMusic />
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 },
getSectionTrendingMusic: { language },
});

Expand Down
Loading