File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/components/ListenToPlayer Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import { useContext , useEffect , useState } from "react"
4
4
import { Howl } from "howler"
5
+ import { useLocale } from "next-intl"
5
6
import { Portal } from "@radix-ui/react-portal"
6
7
7
8
import PlayerWidget from "@/components/ListenToPlayer/PlayerWidget"
@@ -16,6 +17,7 @@ import { FeedbackWidgetContext } from "@/contexts/FeedbackWidgetContext"
16
17
import { useTranslation } from "@/hooks/useTranslation"
17
18
18
19
const ListenToPlayer = ( { slug } : { slug : string } ) => {
20
+ const locale = useLocale ( )
19
21
const { setShowFeedbackWidget } = useContext ( FeedbackWidgetContext )
20
22
const { playlist, index } = getPlaylistBySlug ( slug )
21
23
@@ -118,6 +120,9 @@ const ListenToPlayer = ({ slug }: { slug: string }) => {
118
120
}
119
121
} , [ playbackSpeed , sound ] )
120
122
123
+ // Only show the player if the locale is English and there is a playlist, renders null early
124
+ if ( ! playlist . length || index === - 1 || locale !== "en" ) return null
125
+
121
126
const handlePlayPause = ( ) => {
122
127
if ( ! sound ) return
123
128
@@ -207,8 +212,6 @@ const ListenToPlayer = ({ slug }: { slug: string }) => {
207
212
} )
208
213
}
209
214
210
- if ( ! playlist . length || index === - 1 ) return null
211
-
212
215
return (
213
216
< >
214
217
< TopOfPagePlayer
You can’t perform that action at this time.
0 commit comments