Skip to content

Commit

Permalink
Autoplay the chapter and close the hat on navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
jakecoble committed Dec 19, 2024
1 parent e04ae5c commit adff4a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/molecules/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -79,6 +80,10 @@ const Player = ({
}
}, []);

useEffect(() => {
if (!isServerSide()) session.play();
}, [session]);

const iconColor = isBackgroundColorDark(backgroundColor)
? BaseColors.WHITE
: BaseColors.DARK;
Expand Down
4 changes: 4 additions & 0 deletions src/components/organisms/passageNavigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ export default function PassageNavigation({
}
}, [selectedChapterId, chapterId, setSelectedChapterId, versions]);

useEffect(() => {
setOpen(false);
}, [selectedChapterId]);

const [selectedView, setSelectedView] = useLocalStorage<'grid' | 'list'>(
'passageNavLayout',
'grid',
Expand Down

0 comments on commit adff4a9

Please sign in to comment.