pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

detect tv and hide title?

+55 -1
+49
src/hooks/useIsTv.ts
··· 1 + import { useEffect, useState } from "react"; 2 + 3 + export function useIsTV() { 4 + const [isTV, setIsTV] = useState(false); 5 + 6 + useEffect(() => { 7 + function detectTV() { 8 + const userAgent = navigator.userAgent || ""; 9 + 10 + const tvKeywords = [ 11 + "Silk", 12 + "SmartTV", 13 + "Tizen", 14 + "Web0S", 15 + "SamsungBrowser", 16 + "HbbTV", 17 + "Viera", 18 + "NetCast", 19 + "AppleTV", 20 + "Android TV", 21 + "GoogleTV", 22 + "Roku", 23 + "PlayStation", 24 + "Xbox", 25 + "Opera TV", 26 + "AquosBrowser", 27 + "Hisense", 28 + "SonyBrowser", 29 + "SharpBrowser", 30 + "AFT", // Amazon Fire TV 31 + "Chromecast", 32 + ]; 33 + 34 + const isTVDetected = tvKeywords.some((keyword) => 35 + userAgent.toLowerCase().includes(keyword.toLowerCase()), 36 + ); 37 + 38 + if (isTVDetected) { 39 + setIsTV(true); 40 + } 41 + } 42 + 43 + detectTV(); 44 + }, []); 45 + 46 + return { 47 + isTV, 48 + }; 49 + }
+6 -1
src/pages/parts/home/HeroPart.tsx
··· 6 6 import { ThinContainer } from "@/components/layout/ThinContainer"; 7 7 import { useSlashFocus } from "@/components/player/hooks/useSlashFocus"; 8 8 import { HeroTitle } from "@/components/text/HeroTitle"; 9 + import { useIsTV } from "@/hooks/useIsTv"; 9 10 import { useRandomTranslation } from "@/hooks/useRandomTranslation"; 10 11 import { useSearchQuery } from "@/hooks/useSearchQuery"; 11 12 import { useBannerSize } from "@/stores/banner"; ··· 41 42 ); 42 43 const { width: windowWidth, height: windowHeight } = useWindowSize(); 43 44 45 + const { isTV } = useIsTV(); 46 + 44 47 // Detect if running as a PWA on iOS 45 48 const isIOSPWA = 46 49 /iPad|iPhone|iPod/i.test(navigator.userAgent) && ··· 74 77 <ThinContainer> 75 78 <div className="mt-44 space-y-16 text-center"> 76 79 <div className="relative z-10 mb-16"> 77 - <HeroTitle className="mx-auto max-w-md">{title}</HeroTitle> 80 + {isTV && search.length > 0 ? null : ( 81 + <HeroTitle className="mx-auto max-w-md">{title}</HeroTitle> 82 + )} 78 83 </div> 79 84 <div className="relative h-20 z-30"> 80 85 <Sticky