mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix Page component compatibility issues
This commit is contained in:
parent
5b5784a448
commit
e2a6f08822
2 changed files with 23 additions and 6 deletions
|
@ -3,8 +3,11 @@ import React, { FunctionComponent, HTMLAttributes, useEffect, useRef } from 'rea
|
||||||
import viewManager from './viewManager/viewManager';
|
import viewManager from './viewManager/viewManager';
|
||||||
|
|
||||||
type PageProps = {
|
type PageProps = {
|
||||||
|
id: string, // id is required for libraryMenu
|
||||||
title?: string,
|
title?: string,
|
||||||
isBackButtonEnabled?: boolean
|
isBackButtonEnabled?: boolean,
|
||||||
|
isNowPlayingBarEnabled?: boolean,
|
||||||
|
isThemeMediaSupported?: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,9 +16,12 @@ type PageProps = {
|
||||||
*/
|
*/
|
||||||
const Page: FunctionComponent<PageProps & HTMLAttributes<HTMLDivElement>> = ({
|
const Page: FunctionComponent<PageProps & HTMLAttributes<HTMLDivElement>> = ({
|
||||||
children,
|
children,
|
||||||
|
id,
|
||||||
className = '',
|
className = '',
|
||||||
title,
|
title,
|
||||||
isBackButtonEnabled = true
|
isBackButtonEnabled = true,
|
||||||
|
isNowPlayingBarEnabled = true,
|
||||||
|
isThemeMediaSupported = false
|
||||||
}) => {
|
}) => {
|
||||||
const element = useRef<HTMLDivElement>(null);
|
const element = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
@ -29,20 +35,27 @@ const Page: FunctionComponent<PageProps & HTMLAttributes<HTMLDivElement>> = ({
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: false,
|
cancelable: false,
|
||||||
detail: {
|
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));
|
element.current?.dispatchEvent(new CustomEvent('pagebeforeshow', event));
|
||||||
// viewshow - updates state of appRouter
|
// viewshow - updates state of appRouter
|
||||||
element.current?.dispatchEvent(new CustomEvent('viewshow', event));
|
element.current?.dispatchEvent(new CustomEvent('viewshow', event));
|
||||||
// pageshow - updates header/navigation in libraryMenu
|
// pageshow - updates header/navigation in libraryMenu
|
||||||
element.current?.dispatchEvent(new CustomEvent('pageshow', event));
|
element.current?.dispatchEvent(new CustomEvent('pageshow', event));
|
||||||
}, [ element ]);
|
}, [ element, isNowPlayingBarEnabled, isThemeMediaSupported ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={element}
|
ref={element}
|
||||||
|
id={id}
|
||||||
data-role='page'
|
data-role='page'
|
||||||
className={`page ${className}`}
|
className={`page ${className}`}
|
||||||
data-title={title}
|
data-title={title}
|
||||||
|
|
|
@ -13,7 +13,11 @@ const SearchPage: FunctionComponent = () => {
|
||||||
const [ searchParams ] = useSearchParams();
|
const [ searchParams ] = useSearchParams();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page title={globalize.translate('Search')} className='mainAnimatedPage libraryPage allLibraryPage noSecondaryNavPage'>
|
<Page
|
||||||
|
id='searchPage'
|
||||||
|
title={globalize.translate('Search')}
|
||||||
|
className='mainAnimatedPage libraryPage allLibraryPage noSecondaryNavPage'
|
||||||
|
>
|
||||||
<SearchFields onSearch={setQuery} />
|
<SearchFields onSearch={setQuery} />
|
||||||
{!query &&
|
{!query &&
|
||||||
<SearchSuggestions
|
<SearchSuggestions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue