-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #466 from audioverse-org/av-70
add trending music section
- Loading branch information
Showing
6 changed files
with
97 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/components/organisms/cardSlider/section/trendingMusic.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
38
src/components/organisms/cardSlider/section/trendingMusic.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} /> | ||
)} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
693d6d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
audioverse-next – ./
audioverse-next-git-master-audioverse.vercel.app
audioverse-next.vercel.app
beta.audioverse.org
www.audioverse.org
audioverse.org
audioverse-next-audioverse.vercel.app