fix double routing bug + positioning bottom for context menus mobile

This commit is contained in:
mrjvs 2023-10-20 16:31:35 +02:00
parent 75109ce45c
commit 5d6c672136
5 changed files with 19 additions and 7 deletions

View File

@ -64,7 +64,7 @@ export function Overlay(props: OverlayProps) {
{portalElement {portalElement
? createPortal( ? createPortal(
<Transition show={router.isOverlayActive()} animation="none"> <Transition show={router.isOverlayActive()} animation="none">
<div className="popout-wrapper pointer-events-auto fixed inset-0 z-[999] select-none"> <div className="popout-wrapper absolute overflow-hidden pointer-events-auto inset-0 z-[999] select-none">
<Transition animation="fade" isChild> <Transition animation="fade" isChild>
<div <div
onClick={click} onClick={click}
@ -74,7 +74,11 @@ export function Overlay(props: OverlayProps) {
})} })}
/> />
</Transition> </Transition>
<Transition animation="slide-up" className="h-0" isChild> <Transition
animation="slide-up"
className="absolute inset-0 pointer-events-none"
isChild
>
{props.children} {props.children}
</Transition> </Transition>
</div> </div>

View File

@ -10,7 +10,7 @@ export function OverlayMobilePosition(props: MobilePositionProps) {
return ( return (
<div <div
className={classNames([ className={classNames([
"pointer-events-auto z-10 block origin-top-left touch-none overflow-hidden", "pointer-events-auto z-10 bottom-0 block origin-top-left inset-x-0 absolute overflow-hidden",
props.className, props.className,
])} ])}
> >

View File

@ -194,7 +194,11 @@ interface EpisodesProps {
onChange?: (meta: PlayerMeta) => void; onChange?: (meta: PlayerMeta) => void;
} }
export function Episodes(props: EpisodesProps) { export function EpisodesRouter(props: EpisodesProps) {
return <EpisodesOverlay onChange={props.onChange} id="episodes" />;
}
export function Episodes() {
const { t } = useTranslation(); const { t } = useTranslation();
const router = useOverlayRouter("episodes"); const router = useOverlayRouter("episodes");
const setHasOpenOverlay = usePlayerStore((s) => s.setHasOpenOverlay); const setHasOpenOverlay = usePlayerStore((s) => s.setHasOpenOverlay);
@ -213,7 +217,6 @@ export function Episodes(props: EpisodesProps) {
> >
{t("videoPlayer.buttons.episodes")} {t("videoPlayer.buttons.episodes")}
</VideoPlayerButton> </VideoPlayerButton>
<EpisodesOverlay onChange={props.onChange} id={router.id} />
</OverlayAnchor> </OverlayAnchor>
); );
} }

View File

@ -75,6 +75,10 @@ function SettingsOverlay({ id }: { id: string }) {
); );
} }
export function SettingsRouter() {
return <SettingsOverlay id="settings" />;
}
export function Settings() { export function Settings() {
const router = useOverlayRouter("settings"); const router = useOverlayRouter("settings");
const setHasOpenOverlay = usePlayerStore((s) => s.setHasOpenOverlay); const setHasOpenOverlay = usePlayerStore((s) => s.setHasOpenOverlay);
@ -86,7 +90,6 @@ export function Settings() {
return ( return (
<OverlayAnchor id={router.id}> <OverlayAnchor id={router.id}>
<VideoPlayerButton onClick={() => router.open()} icon={Icons.GEAR} /> <VideoPlayerButton onClick={() => router.open()} icon={Icons.GEAR} />
<SettingsOverlay id={router.id} />
</OverlayAnchor> </OverlayAnchor>
); );
} }

View File

@ -23,6 +23,8 @@ export function PlayerPart(props: PlayerPartProps) {
<Player.Container onLoad={props.onLoad}> <Player.Container onLoad={props.onLoad}>
{props.children} {props.children}
<Player.BlackOverlay show={showTargets} /> <Player.BlackOverlay show={showTargets} />
<Player.EpisodesRouter onChange={props.onMetaChange} />
<Player.SettingsRouter />
<Player.SubtitleView controlsShown={showTargets} /> <Player.SubtitleView controlsShown={showTargets} />
{status === playerStatus.PLAYING ? ( {status === playerStatus.PLAYING ? (
@ -75,7 +77,7 @@ export function PlayerPart(props: PlayerPartProps) {
<Player.Time /> <Player.Time />
</Player.LeftSideControls> </Player.LeftSideControls>
<div className="flex items-center space-x-3"> <div className="flex items-center space-x-3">
<Player.Episodes onChange={props.onMetaChange} /> <Player.Episodes />
<Player.Airplay /> <Player.Airplay />
<Player.Settings /> <Player.Settings />
<Player.Fullscreen /> <Player.Fullscreen />