diff --git a/src/components/molecules/player.tsx b/src/components/molecules/player.tsx index a4682d40e..5271df11e 100644 --- a/src/components/molecules/player.tsx +++ b/src/components/molecules/player.tsx @@ -23,6 +23,7 @@ import IconPlay from '~public/img/icons/icon-play-large.svg'; import useGlobalSpaceDown from '~src/lib/hooks/useGlobalSpaceDown'; import useIsAuthenticated from '~src/lib/hooks/useIsAuthenticated'; import usePlaybackSession from '~src/lib/hooks/usePlaybackSession'; +import isServerSide from '~src/lib/isServerSide'; import { PlaybackContext } from '../templates/andPlaybackContext'; import { PlayerFragment } from './__generated__/player'; @@ -79,6 +80,10 @@ const Player = ({ } }, []); + useEffect(() => { + if (!isServerSide()) session.play(); + }, []); // eslint-disable-line react-hooks/exhaustive-deps + const iconColor = isBackgroundColorDark(backgroundColor) ? BaseColors.WHITE : BaseColors.DARK; diff --git a/src/components/organisms/passageNavigation/bookGrid.tsx b/src/components/organisms/passageNavigation/bookGrid.tsx index 3eb2c100b..56b46d344 100644 --- a/src/components/organisms/passageNavigation/bookGrid.tsx +++ b/src/components/organisms/passageNavigation/bookGrid.tsx @@ -1,17 +1,24 @@ import clsx from 'clsx'; import React from 'react'; +import { Book } from '.'; import { PassageNavigationFragment } from './__generated__/index'; -import ChapterGrid from './chapterGrid'; +import ChapterGrid, { ChapterId } from './chapterGrid'; import styles from './index.module.scss'; type Props = { books: Array; - selectedBook: string | number | null; - selectBook: (id: string | number | null) => void; + selectedBook: Book; + selectBook: (book: Book) => void; + chapterId: ChapterId; }; -export default function BookGrid({ books, selectedBook, selectBook }: Props) { +export default function BookGrid({ + books, + selectedBook, + selectBook, + chapterId, +}: Props) { return (