Skip to content

Commit

Permalink
Merge pull request #491 from audioverse-org/AV-663-not-filtering-by-A…
Browse files Browse the repository at this point in the history
…udioBook-on-EGW-Browse-page

Av 663 not filtering by audio book on egw browse page
  • Loading branch information
jlaverde77 authored Oct 27, 2023
2 parents 1678179 + 86d0344 commit 8c55504
Show file tree
Hide file tree
Showing 13 changed files with 125 additions and 21 deletions.
24 changes: 18 additions & 6 deletions public/compiled-lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@
"cardSequence_egwAudiobookType": [
{
"type": 0,
"value": "ELLEN G. WHITE"
"value": "ELLEN WHITE"
}
],
"cardSequence_readByLabel": [
Expand Down Expand Up @@ -1374,7 +1374,7 @@
"discoverCollections_egwAudiobooksHeading": [
{
"type": 0,
"value": "Discover Ellen G. White"
"value": "Discover Ellen White"
}
],
"discoverCollections_storySeasonsHeading": [
Expand Down Expand Up @@ -1616,13 +1616,13 @@
"egwAudiobookList__heading": [
{
"type": 0,
"value": "Ellen G. White"
"value": "Ellen White"
}
],
"egwbooks__title": [
{
"type": 0,
"value": "Ellen G. White"
"value": "Ellen White"
}
],
"embed__partInfo": [
Expand Down Expand Up @@ -1884,7 +1884,7 @@
"header__navItemCollections-egwbooks": [
{
"type": 0,
"value": "Ellen G. White"
"value": "Ellen White"
}
],
"header__navItemCollections-presenters": [
Expand Down Expand Up @@ -3884,7 +3884,7 @@
"organismSection__egwAudiobooksHeading": [
{
"type": 0,
"value": "Ellen G. White"
"value": "Ellen White"
}
],
"organismSection__egwAudiobooksNext": [
Expand Down Expand Up @@ -4795,6 +4795,18 @@
"value": "See All Matching Conferences"
}
],
"search__egwbooksHeading": [
{
"type": 0,
"value": "Ellen White"
}
],
"search__egwbooksSeeAll": [
{
"type": 0,
"value": "See All Matching Ellen White Audiobooks"
}
],
"search__emptyStateMessage": [
{
"type": 0,
Expand Down
18 changes: 12 additions & 6 deletions public/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@
"string": "{count} chapters"
},
"cardSequence_egwAudiobookType": {
"string": "ELLEN G. WHITE"
"string": "ELLEN WHITE"
},
"cardSequence_readByLabel": {
"string": "Read By {name}"
Expand Down Expand Up @@ -646,7 +646,7 @@
"string": "Conferences"
},
"discoverCollections_egwAudiobooksHeading": {
"string": "Discover Ellen G. White"
"string": "Discover Ellen White"
},
"discoverCollections_storySeasonsHeading": {
"string": "Stories"
Expand Down Expand Up @@ -760,10 +760,10 @@
"string": "{minutes}m"
},
"egwAudiobookList__heading": {
"string": "Ellen G. White"
"string": "Ellen White"
},
"egwbooks__title": {
"string": "Ellen G. White"
"string": "Ellen White"
},
"embed__partInfo": {
"string": "Part {index} of {count}"
Expand Down Expand Up @@ -840,7 +840,7 @@
"string": "Conferences"
},
"header__navItemCollections-egwbooks": {
"string": "Ellen G. White"
"string": "Ellen White"
},
"header__navItemCollections-presenters": {
"string": "Presenters"
Expand Down Expand Up @@ -1837,7 +1837,7 @@
"string": "Previous Bible books"
},
"organismSection__egwAudiobooksHeading": {
"string": "Ellen G. White"
"string": "Ellen White"
},
"organismSection__egwAudiobooksNext": {
"string": "Next EGW audiobooks"
Expand Down Expand Up @@ -2292,6 +2292,12 @@
"search__conferencesSeeAll": {
"string": "See All Matching Conferences"
},
"search__egwbooksHeading": {
"string": "Ellen White"
},
"search__egwbooksSeeAll": {
"string": "See All Matching Ellen White Audiobooks"
},
"search__emptyStateMessage": {
"string": "Try searching for something else"
},
Expand Down
12 changes: 12 additions & 0 deletions src/components/atoms/scrollToTop.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// scrollToTop.tsx
import { useEffect } from 'react';

const ScrollToTop: React.FC = () => {
useEffect(() => {
window.scrollTo(0, 0);
}, []);

return null;
};

export default ScrollToTop;
2 changes: 1 addition & 1 deletion src/components/molecules/card/sequence.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function CardSequence({
label: egw
? intl.formatMessage({
id: 'cardSequence_egwAudiobookType',
defaultMessage: 'ELLEN G. WHITE',
defaultMessage: 'ELLEN WHITE',
})
: intl.formatMessage({
id: 'cardSequence_audiobookType',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const EgwAudiobooks: React.FC<EgwAudiobooksProps> = ({ heading }) => {
heading ||
intl.formatMessage({
id: 'organismSection__egwAudiobooksHeading',
defaultMessage: 'Ellen G. White',
defaultMessage: 'Ellen White',
})
}
previous={intl.formatMessage({
Expand Down
16 changes: 16 additions & 0 deletions src/components/organisms/searchResults.filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FormattedMessage } from 'react-intl';
import {
GetSearchAudiobooksDocument,
GetSearchConferencesDocument,
GetSearchEgwAudiobooksDocument,
GetSearchMusicTracksDocument,
GetSearchPersonsDocument,
GetSearchRecordingsDocument,
Expand Down Expand Up @@ -89,6 +90,21 @@ export const filters: Record<string, EntityFilter> = {
),
document: GetSearchAudiobooksDocument,
},
egwbooks: {
heading: (
<FormattedMessage
id="search__egwbooksHeading"
defaultMessage="Ellen White"
/>
),
seeAll: (
<FormattedMessage
id="search__egwbooksSeeAll"
defaultMessage="See All Matching Ellen White Audiobooks"
/>
),
document: GetSearchEgwAudiobooksDocument,
},
sponsors: {
heading: (
<FormattedMessage
Expand Down
48 changes: 47 additions & 1 deletion src/components/organisms/searchResults.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,53 @@ query getSearchAudiobooks(
$first: Int!
$after: String
) {
audiobooks(language: $language, search: $term, first: $first, after: $after) {
audiobooks(
language: $language
search: $term
first: $first
after: $after
excludePersons: [
{ personId: 128 }
{ personId: 381 }
{ personId: 445 }
{ personId: 506 }
{ personId: 1208 }
{ personId: 1884 }
]
) {
aggregate {
count
}
nodes {
...cardSequence
}
pageInfo {
hasNextPage
endCursor
}
}
}

query getSearchEgwAudiobooks(
$language: Language!
$term: String!
$first: Int!
$after: String
) {
audiobooks(
language: $language
search: $term
first: $first
after: $after
persons: [
{ personId: 128 }
{ personId: 381 }
{ personId: 445 }
{ personId: 506 }
{ personId: 1208 }
{ personId: 1884 }
]
) {
aggregate {
count
}
Expand Down
1 change: 1 addition & 0 deletions src/components/organisms/searchResults.useResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function useQueryResults(filter: EntityFilterId, term: string) {
teachings: useFilterQuery('teachings', vars, filter),
series: useFilterQuery('series', vars, filter),
books: useFilterQuery('books', vars, filter),
egwbooks: useFilterQuery('egwbooks', vars, filter),
sponsors: useFilterQuery('sponsors', vars, filter),
conferences: useFilterQuery('conferences', vars, filter),
music: useFilterQuery('music', vars, filter),
Expand Down
15 changes: 13 additions & 2 deletions src/components/templates/andNavigation.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import clsx from 'clsx';
import { useRouter } from 'next/router';
import Router, { useRouter } from 'next/router';
import React, { ReactNode, useEffect, useRef, useState } from 'react';

import LanguageAlternativesAlert from '~components/molecules/languageAlternativesAlert';
Expand Down Expand Up @@ -39,9 +39,20 @@ export default function AndNavigation({
useEffect(() => {
if (scrollRef.current) scrollRef.current.scrollTop = 0;
}, [term, entityType]);

useEffect(() => setEntityType(contextualFilterId), [contextualFilterId]);

useEffect(() => {
const fn = () => {
if (scrollRef.current) scrollRef.current.scrollTop = 0;
};

Router.events.on('routeChangeComplete', fn);

return () => {
Router.events.off('routeChangeComplete', fn);
};
}, []);

const hideMobileSearch =
contextualFilterId === 'all' &&
!['/[language]/discover', '/[language]'].includes(pathname);
Expand Down
2 changes: 1 addition & 1 deletion src/containers/audiobook/egwList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function EgwAudiobooksList({
heading={
<FormattedMessage
id="egwAudiobookList__heading"
defaultMessage="Ellen G. White"
defaultMessage="Ellen White"
/>
}
makeRoute={(l, i) => root.lang(l).egwbooks.page(i).get()}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/discover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function Discover(): JSX.Element {
heading={
<FormattedMessage
id="discoverCollections_egwAudiobooksHeading"
defaultMessage="Discover Ellen G. White"
defaultMessage="Discover Ellen White"
/>
}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/useNavigationItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export function useNavigationItems(): INavigationItem[] {
Icon: iconMap.fa_feather,
label: intl.formatMessage({
id: `header__navItemCollections-egwbooks`, //egw
defaultMessage: 'Ellen G. White',
defaultMessage: 'Ellen White',
}),
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[language]/egwbooks/page/[i].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function getStaticProps({
() => ({
title: intl.formatMessage({
id: 'egwbooks__title',
defaultMessage: 'Ellen G. White',
defaultMessage: 'Ellen White',
}),
})
);
Expand Down

1 comment on commit 8c55504

@vercel
Copy link

@vercel vercel bot commented on 8c55504 Oct 27, 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.