From e2a6f08822e97d47539a6dd280dc4cc636df6884 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Mon, 27 Jun 2022 11:49:56 -0400 Subject: [PATCH] Fix Page component compatibility issues --- src/components/Page.tsx | 23 ++++++++++++++++++----- src/routes/search.tsx | 6 +++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/components/Page.tsx b/src/components/Page.tsx index 399c1a55c..be1253740 100644 --- a/src/components/Page.tsx +++ b/src/components/Page.tsx @@ -3,8 +3,11 @@ import React, { FunctionComponent, HTMLAttributes, useEffect, useRef } from 'rea import viewManager from './viewManager/viewManager'; type PageProps = { + id: string, // id is required for libraryMenu title?: string, - isBackButtonEnabled?: boolean + isBackButtonEnabled?: boolean, + isNowPlayingBarEnabled?: boolean, + isThemeMediaSupported?: boolean }; /** @@ -13,9 +16,12 @@ type PageProps = { */ const Page: FunctionComponent> = ({ children, + id, className = '', title, - isBackButtonEnabled = true + isBackButtonEnabled = true, + isNowPlayingBarEnabled = true, + isThemeMediaSupported = false }) => { const element = useRef(null); @@ -29,20 +35,27 @@ const Page: FunctionComponent> = ({ bubbles: true, cancelable: false, detail: { - isRestored: false + isRestored: false, + options: { + enableMediaControl: isNowPlayingBarEnabled, + supportsThemeMedia: isThemeMediaSupported + } } }; - // pagebeforeshow - hides tabs on tabless pages in libraryMenu + // viewbeforeshow - switches between the admin dashboard and standard themes + element.current?.dispatchEvent(new CustomEvent('viewbeforeshow', event)); + // pagebeforeshow - hides tabs on tables pages in libraryMenu element.current?.dispatchEvent(new CustomEvent('pagebeforeshow', event)); // viewshow - updates state of appRouter element.current?.dispatchEvent(new CustomEvent('viewshow', event)); // pageshow - updates header/navigation in libraryMenu element.current?.dispatchEvent(new CustomEvent('pageshow', event)); - }, [ element ]); + }, [ element, isNowPlayingBarEnabled, isThemeMediaSupported ]); return (
{ const [ searchParams ] = useSearchParams(); return ( - + {!query &&