From a9eab1fabbff063844ab169c38c6176b70f02af2 Mon Sep 17 00:00:00 2001 From: Ivan Evans <74743263+Pasithea0@users.noreply.github.com> Date: Sun, 29 Dec 2024 00:07:30 -0700 Subject: [PATCH] add notice --- src/pages/HomePage.tsx | 54 ++++++++++++++++++++++ src/pages/parts/home/PopupModal.tsx | 72 +++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 src/pages/parts/home/PopupModal.tsx diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index d8a5b10c..6aa74d0b 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -15,6 +15,8 @@ import { SearchListPart } from "@/pages/parts/search/SearchListPart"; import { SearchLoadingPart } from "@/pages/parts/search/SearchLoadingPart"; import DiscoverContent from "@/utils/discoverContent"; +import { PopupModal } from "./parts/home/PopupModal"; + function useSearch(search: string) { const [searching, setSearching] = useState(false); const [loading, setLoading] = useState(false); @@ -63,6 +65,22 @@ export function HomePage() { simulateLoading(); }, []); + const [showModal, setShowModal] = useState(() => { + const isSafari = + typeof navigator !== "undefined" && + /Safari/.test(navigator.userAgent) && + !/Chrome/.test(navigator.userAgent); + + const isMac = + typeof navigator !== "undefined" && /Mac/.test(navigator.platform); + + const isIOS = + typeof navigator !== "undefined" && + /iPhone|iPad|iPod/.test(navigator.userAgent); + + return isSafari && (isMac || isIOS); + }); + return (
@@ -74,6 +92,42 @@ export function HomePage() { `} {t("global.name")} + + {/* Popup Modal */} + {showModal && ( + + Due to a recent update, many P-Stream sources are broken on iOS + and macOS. +
+ The only available source on Safari right now is SoaperTV. +
+
+ Workaround: + Please switch to Chrome on desktop where all sources are still + working. (And where the extension is available!) +
+
+ I'm working on a fix. For updates on this issue please join + the{" "} + + P-Stream Discord + + . Sorry for the inconvenience. +

+ } + onClose={() => setShowModal(false)} + /> + )} + {/* END */} +
diff --git a/src/pages/parts/home/PopupModal.tsx b/src/pages/parts/home/PopupModal.tsx new file mode 100644 index 00000000..0b269f77 --- /dev/null +++ b/src/pages/parts/home/PopupModal.tsx @@ -0,0 +1,72 @@ +import classNames from "classnames"; +import { ReactNode, useEffect } from "react"; + +import { IconPatch } from "@/components/buttons/IconPatch"; +import { Icons } from "@/components/Icon"; +import { Flare } from "@/components/utils/Flare"; +import { Heading2 } from "@/components/utils/Text"; + +export interface PopupModalProps { + title: string; + message: ReactNode; + closable?: boolean; + onClose?: () => void; +} + +export function PopupModal({ + title, + message, + closable = true, + onClose, +}: PopupModalProps) { + useEffect(() => { + document.body.style.overflow = "hidden"; + + return () => { + document.body.style.overflow = ""; + }; + }, []); + + return ( +
+ +
+ + +
+ {title} + {closable && ( + + )} +
+

{message}

+
+
+
+
+ ); +}