Skip to content

Commit

Permalink
Merge pull request #466 from audioverse-org/av-70
Browse files Browse the repository at this point in the history
add trending music section
  • Loading branch information
jlaverde77 authored Sep 13, 2023
2 parents b8bb15c + 83b3135 commit 693d6d9
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 8 deletions.
18 changes: 18 additions & 0 deletions public/compiled-lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,18 @@
"value": "Previous topics"
}
],
"discover__trendingMusicNext": [
{
"type": 0,
"value": "Next trending scripture songs"
}
],
"discover__trendingMusicPrevious": [
{
"type": 0,
"value": "Previous trending scripture songs"
}
],
"discover__trendingTeachingsNext": [
{
"type": 0,
Expand Down Expand Up @@ -1491,6 +1503,12 @@
"value": "Topics"
}
],
"discover_trendingMusicHeading": [
{
"type": 0,
"value": "Trending Scripture Songs"
}
],
"discover_trendingTeachingsHeading": [
{
"type": 0,
Expand Down
9 changes: 9 additions & 0 deletions public/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,12 @@
"discover__topicsPrevious": {
"string": "Previous topics"
},
"discover__trendingMusicNext": {
"string": "Next trending scripture songs"
},
"discover__trendingMusicPrevious": {
"string": "Previous trending scripture songs"
},
"discover__trendingTeachingsNext": {
"string": "Next trending teachings"
},
Expand All @@ -705,6 +711,9 @@
"discover_topicsHeading": {
"string": "Topics"
},
"discover_trendingMusicHeading": {
"string": "Trending Scripture Songs"
},
"discover_trendingTeachingsHeading": {
"string": "Trending Teachings"
},
Expand Down
22 changes: 22 additions & 0 deletions src/components/organisms/cardSlider/section/trendingMusic.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
query getSectionTrendingMusic(
$language: Language!
$first: Int! = 3
$after: String = null
) {
trendingMusic: popularRecordings(
language: $language
contentType: MUSIC_TRACK
first: $first
after: $after
) {
nodes {
recording {
...cardRecording
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
38 changes: 38 additions & 0 deletions src/components/organisms/cardSlider/section/trendingMusic.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react';
import { useIntl } from 'react-intl';

import { CardRecordingFragment } from '~src/components/molecules/card/__generated__/recording';
import CardRecording from '~src/components/molecules/card/recording';
import root from '~src/lib/routes';
import useLanguageRoute from '~src/lib/useLanguageRoute';

import Section from '.';
import { useInfiniteGetSectionTrendingMusicQuery } from './__generated__/trendingMusic';

export default function TrendingMusic(): JSX.Element {
const route = useLanguageRoute();
const intl = useIntl();

return (
<Section
infiniteQuery={useInfiniteGetSectionTrendingMusicQuery}
heading={intl.formatMessage({
id: 'discover_trendingMusicHeading',
defaultMessage: 'Trending Scripture Songs',
})}
previous={intl.formatMessage({
id: 'discover__trendingMusicPrevious',
defaultMessage: 'Previous trending scripture songs',
})}
next={intl.formatMessage({
id: 'discover__trendingMusicNext',
defaultMessage: 'Next trending scripture songs',
})}
seeAllUrl={root.lang(route).songs.albums.get()}
selectNodes={(p) => p?.trendingMusic.nodes?.map((n) => n.recording)}
Card={(p: { node: CardRecordingFragment }) => (
<CardRecording recording={p.node} />
)}
/>
);
}
17 changes: 9 additions & 8 deletions src/containers/discover/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';

import TrendingTeachings from '~src/components/organisms/cardSlider/section/trendingTeachings';

import BlogPosts from '../../components/organisms/cardSlider/section/blogPosts';
import Conferences from '../../components/organisms/cardSlider/section/conferences';
import FeaturedTeachings from '../../components/organisms/cardSlider/section/featuredTeachings';
import RecentTeachings from '../../components/organisms/cardSlider/section/recentTeachings';
import StorySeasons from '../../components/organisms/cardSlider/section/storySeasons';
import Topics from '../../components/organisms/cardSlider/section/topics';
import BlogPosts from '~components/organisms/cardSlider/section/blogPosts';
import Conferences from '~components/organisms/cardSlider/section/conferences';
import FeaturedTeachings from '~components/organisms/cardSlider/section/featuredTeachings';
import RecentTeachings from '~components/organisms/cardSlider/section/recentTeachings';
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';

export default function Discover(): JSX.Element {
return (
Expand All @@ -19,6 +19,7 @@ export default function Discover(): JSX.Element {
<BlogPosts />
<StorySeasons />
<Conferences />
<TrendingMusic />
</div>
);
}
1 change: 1 addition & 0 deletions src/pages/[language]/discover/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export async function getStaticProps({
getSectionConferences: { language },
getSectionBlogPosts: { language },
getSectionTopics: { language },
getSectionTrendingMusic: { language },
});

return {
Expand Down

1 comment on commit 693d6d9

@vercel
Copy link

@vercel vercel bot commented on 693d6d9 Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.