From 8e0c5d73d26f46a284b12333a18f4c2218145739 Mon Sep 17 00:00:00 2001 From: Ivan Evans <74743263+Pasithea0@users.noreply.github.com> Date: Wed, 25 Sep 2024 21:11:21 -0600 Subject: [PATCH] PWA merged @SEP25 --- index.html | 2 +- src/assets/css/index.css | 4 ++ src/components/Icon.tsx | 4 ++ src/components/buttons/IosPwaLimitations.tsx | 23 ++++++++ src/components/layout/Navigation.tsx | 6 +-- src/components/player/atoms/Widescreen.tsx | 23 ++++++++ src/components/player/base/TopControls.tsx | 2 +- .../player/internals/VideoContainer.tsx | 1 + src/pages/parts/home/HeroPart.tsx | 20 +++++-- src/pages/parts/player/PlayerPart.tsx | 53 +++++++++++++++++-- 10 files changed, 124 insertions(+), 14 deletions(-) create mode 100644 src/components/buttons/IosPwaLimitations.tsx create mode 100644 src/components/player/atoms/Widescreen.tsx diff --git a/index.html b/index.html index 3748634b..f0a020bd 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@ - + diff --git a/src/assets/css/index.css b/src/assets/css/index.css index 557656b4..803ac3a7 100644 --- a/src/assets/css/index.css +++ b/src/assets/css/index.css @@ -37,6 +37,10 @@ html[data-no-scroll], html[data-no-scroll] body { overflow: hidden; } +.top-content { + padding-top: calc(env(safe-area-inset-top) - 20px); +} + .roll { animation: roll 1s; } diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx index dda27f5f..4bd627a6 100644 --- a/src/components/Icon.tsx +++ b/src/components/Icon.tsx @@ -68,6 +68,8 @@ export enum Icons { BRUSH = "brush", UPLOAD = "upload", WEB = "web", + SHRINK = "shrink", + STRETCH = "stretch", } export interface IconProps { @@ -153,6 +155,8 @@ const iconList: Record = { `, + shrink: ``, + stretch: ``, }; function ChromeCastButton() { diff --git a/src/components/buttons/IosPwaLimitations.tsx b/src/components/buttons/IosPwaLimitations.tsx new file mode 100644 index 00000000..dc0ee9e7 --- /dev/null +++ b/src/components/buttons/IosPwaLimitations.tsx @@ -0,0 +1,23 @@ +/* eslint-disable no-alert */ +import { Icon, Icons } from "../Icon"; + +function IosPwaLimitations() { + const showAlert = () => { + alert( + "Due to Apple’s limitations, Picture-in-Picture (PiP) and Fullscreen are disabled on iOS PWAs. Use the browser vertion to re-enable these features.\n" + + "Tip: To hide the iOS home indicator, use guided access within the PWA!", + ); + }; + + return ( + + ); +} + +export default IosPwaLimitations; diff --git a/src/components/layout/Navigation.tsx b/src/components/layout/Navigation.tsx index 987a8e6e..92ebefa4 100644 --- a/src/components/layout/Navigation.tsx +++ b/src/components/layout/Navigation.tsx @@ -47,14 +47,14 @@ export function Navigation(props: NavigationProps) { {/* backgrounds - these are seperate because of z-index issues */}
{ + const videoElement = document.getElementById("video-element"); + if (videoElement) { + videoElement.classList.toggle("object-cover"); + setIsWideScreen(!isWideScreen); + } + }} + /> + ); +} diff --git a/src/components/player/base/TopControls.tsx b/src/components/player/base/TopControls.tsx index a092d431..8aa96002 100644 --- a/src/components/player/base/TopControls.tsx +++ b/src/components/player/base/TopControls.tsx @@ -44,7 +44,7 @@ export function TopControls(props: { {props.children} diff --git a/src/components/player/internals/VideoContainer.tsx b/src/components/player/internals/VideoContainer.tsx index ee31d6d9..1147e2a2 100644 --- a/src/components/player/internals/VideoContainer.tsx +++ b/src/components/player/internals/VideoContainer.tsx @@ -101,6 +101,7 @@ function VideoElement() { return (
- {status === playerStatus.PLAYING ? : null} + {/* Disable PiP for iOS PWA */} + {!isIOSPWA && + (status === playerStatus.PLAYING ? : null)} {status === playerStatus.PLAYING ? : null} + {/* Expand button for iOS PWA only */} + {isIOSPWA && status === playerStatus.PLAYING && }
- + {/* Disable for iOS PWA */} + {!isIOSPWA && ( +
+ +
+ )} + {/* Add info for iOS PWA */} + {isIOSPWA && ( +
+ +
+ )}