From be36a4310084f4b170ba9eb1b12d1fd190eb6332 Mon Sep 17 00:00:00 2001 From: SomeRandomCpu Date: Sun, 1 Feb 2026 22:01:43 +0000 Subject: [PATCH] update to show settings button and hide pstream logo when desktop app user agent is detected --- src/components/layout/Navigation.tsx | 34 +++++++++++++++++++++------- src/hooks/useIsDesktopApp.ts | 3 +++ src/pages/layouts/HomeLayout.tsx | 1 + src/pages/parts/home/HeroPart.tsx | 4 +++- 4 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 src/hooks/useIsDesktopApp.ts diff --git a/src/components/layout/Navigation.tsx b/src/components/layout/Navigation.tsx index f2303e8f..d1152de6 100644 --- a/src/components/layout/Navigation.tsx +++ b/src/components/layout/Navigation.tsx @@ -9,6 +9,7 @@ import { LinksDropdown } from "@/components/LinksDropdown"; import { useNotifications } from "@/components/overlays/notificationsModal"; import { Lightbar } from "@/components/utils/Lightbar"; import { useAuth } from "@/hooks/auth/useAuth"; +import { useIsDesktopApp } from "@/hooks/useIsDesktopApp"; import { BlurEllipsis } from "@/pages/layouts/SubPageLayout"; import { conf } from "@/setup/config"; import { useBannerSize } from "@/stores/banner"; @@ -21,6 +22,7 @@ export interface NavigationProps { noLightbar?: boolean; doBackground?: boolean; clearBackground?: boolean; + hideBrandPill?: boolean; } export function Navigation(props: NavigationProps) { @@ -29,6 +31,11 @@ export function Navigation(props: NavigationProps) { const { loggedIn } = useAuth(); const [scrollPosition, setScrollPosition] = useState(0); const { openNotifications, getUnreadCount } = useNotifications(); + const isDesktopApp = useIsDesktopApp(); + + const handleDesktopSettings = () => { + window.dispatchEvent(new CustomEvent("pstream-desktop-settings")); + }; useEffect(() => { const handleScroll = () => { @@ -136,13 +143,15 @@ export function Navigation(props: NavigationProps) {
- window.scrollTo(0, 0)} - > - - + {!(props.hideBrandPill && isDesktopApp) && ( + window.scrollTo(0, 0)} + > + + + )}
-
+
+ {isDesktopApp && ( + + )} {loggedIn ? : } diff --git a/src/hooks/useIsDesktopApp.ts b/src/hooks/useIsDesktopApp.ts new file mode 100644 index 00000000..e801fca7 --- /dev/null +++ b/src/hooks/useIsDesktopApp.ts @@ -0,0 +1,3 @@ +export function useIsDesktopApp(): boolean { + return navigator.userAgent.includes("P-Stream/"); +} diff --git a/src/pages/layouts/HomeLayout.tsx b/src/pages/layouts/HomeLayout.tsx index c73cd845..c99a0f4d 100644 --- a/src/pages/layouts/HomeLayout.tsx +++ b/src/pages/layouts/HomeLayout.tsx @@ -30,6 +30,7 @@ export function HomeLayout(props: { bg={enableFeatured ? true : props.showBg} clearBackground={clearBackground} noLightbar={enableFeatured} + hideBrandPill /> {props.children} diff --git a/src/pages/parts/home/HeroPart.tsx b/src/pages/parts/home/HeroPart.tsx index f2acd709..c7907765 100644 --- a/src/pages/parts/home/HeroPart.tsx +++ b/src/pages/parts/home/HeroPart.tsx @@ -6,6 +6,7 @@ import { SearchBarInput } from "@/components/form/SearchBar"; import { ThinContainer } from "@/components/layout/ThinContainer"; import { useSlashFocus } from "@/components/player/hooks/useSlashFocus"; import { HeroTitle } from "@/components/text/HeroTitle"; +import { useIsDesktopApp } from "@/hooks/useIsDesktopApp"; import { useIsIOS, useIsMobile, useIsPWA } from "@/hooks/useIsMobile"; import { useIsTV } from "@/hooks/useIsTv"; import { useRandomTranslation } from "@/hooks/useRandomTranslation"; @@ -46,6 +47,7 @@ export function HeroPart({ const bannerSize = useBannerSize(); const { isMobile } = useIsMobile(); const { isTV } = useIsTV(); + const isDesktopApp = useIsDesktopApp(); const stickStateChanged = useCallback( (isFixed: boolean) => { @@ -81,7 +83,7 @@ export function HeroPart({ showTitle ? "mt-44" : "mt-4", )} > - {showTitle && (!isTV || search.length === 0) ? ( + {showTitle && (!isTV || search.length === 0) && !isDesktopApp ? (
{title}