From 12ca24ad6ae4c3df63b7c8c07aac5f0006b09fe6 Mon Sep 17 00:00:00 2001 From: inmake Date: Tue, 8 Aug 2023 19:42:14 +0500 Subject: [PATCH] upd --- src/StreamPage.tsx | 284 +++++------------- src/assets/react.svg | 1 - src/components/icons/ChevronDownIcon.tsx | 28 ++ src/components/icons/ChevronLeftIcon.tsx | 7 +- src/components/icons/ChevronRightIcon.tsx | 7 +- src/components/icons/LoaderIcon.tsx | 4 +- src/components/icons/PersonsIcon.tsx | 33 ++ src/components/modals/QRCodeModal.tsx | 12 +- src/components/modals/ShareModal.tsx | 8 +- .../modals/UsersManagementModal.tsx | 96 ++++++ 10 files changed, 263 insertions(+), 217 deletions(-) delete mode 100644 src/assets/react.svg create mode 100644 src/components/icons/ChevronDownIcon.tsx create mode 100644 src/components/icons/PersonsIcon.tsx create mode 100644 src/components/modals/UsersManagementModal.tsx diff --git a/src/StreamPage.tsx b/src/StreamPage.tsx index 575399f..3013ee5 100644 --- a/src/StreamPage.tsx +++ b/src/StreamPage.tsx @@ -1,3 +1,4 @@ +/* eslint-disable no-irregular-whitespace */ /* eslint-disable react-hooks/exhaustive-deps */ /* eslint-disable @typescript-eslint/no-explicit-any */ @@ -9,7 +10,7 @@ import { io } from "socket.io-client"; import userAgentParser from "ua-parser-js"; import { Player } from "./components/Player"; import { Trans } from "react-i18next"; -import { useScreen } from "usehooks-ts"; +// import { useScreen } from "usehooks-ts"; import ShareIcon from "./components/icons/ShareIcon"; import ModalContainer from "./components/ModalContainer"; import useModalStore from "./stores/useModalStore"; @@ -20,14 +21,9 @@ import "react-toastify/dist/ReactToastify.css"; import FullscreenIcon from "./components/icons/FullscreenIcon"; import WindowedModeIcon from "./components/icons/WindowedModeIcon"; import QRIcon from "./components/icons/QRIcon"; -import AdminUserIcon from "./components/icons/AdminUserIcon"; -import UserIcon from "./components/icons/UserIcon"; -import MobilePhoneIcon from "./components/icons/MobilePhoneIcon"; -import DesktopIcon from "./components/icons/DesktopIcon"; -import HandOffIcon from "./components/icons/HandOffIcon"; -import HandOnIcon from "./components/icons/HandOnIcon"; -import ExitIcon from "./components/icons/ExitIcon"; import QRCodeModal from "./components/modals/QRCodeModal"; +import PersonsIcon from "./components/icons/PersonsIcon"; +import UsersManagementModal from "./components/modals/UsersManagementModal"; function StreamPage() { const params = useParams(); @@ -38,18 +34,18 @@ function StreamPage() { const [socket, setSocket] = useState(null); const [users, setUsers] = useState([]); const [me, setMe] = useState({}); - const [isOpenSidebar, setIsOpenSidebar] = useState(false); - const screen = useScreen(); + + // const screen = useScreen(); const [modal, setModal] = useModalStore((state) => [ state.modal, state.setModal, ]); - useEffect(() => { - if (screen?.orientation.type.includes("portrait")) { - // alert("portrait"); - } - }, [screen]); + // useEffect(() => { + // if (screen?.orientation.type.includes("portrait")) { + // alert("portrait"); + // } + // }, [screen]); function toastWarn(text: string) { toast.warn(text, { @@ -116,6 +112,8 @@ function StreamPage() { socket.on("join", (_socketId, room) => { setUsers(room.users); // console.log("join: ", _socketId, room.users); + + toastInfo("Присоеденился новый участник"); }); socket.on("update", (_socketId, room) => { @@ -147,192 +145,7 @@ function StreamPage() { }, [me]); return ( - -
-
-
- {!handleFullScreen.active ? ( - - ) : ( - - )} - - - - -
- -
- -
- {users.map((user: any) => ( -
-
- {user.admin ? : } - - {me && me.id === user.id && ( -

Вы

- )} -
- -
-

- {user.admin ? "Администратор" : "Пользователь"} -

-

({user.city})

-
- - {new userAgentParser(user.ua).getDevice().type === "mobile" ? ( - - ) : ( - - )} - - {!user.admin && ( - <> - {user.allowControl ? ( - - ) : ( - - )} - - )} - - {me && me.admin && !user.admin && ( - - )} -
- ))} -
-
- -
- {!isOpenSidebar ? ( - - ) : ( - - )} -
-
- + {!isStreamEnded ? ( isStreamLoaded ? ( <>{streamUrl && } @@ -369,6 +182,75 @@ function StreamPage() { )} +
+
+ {new userAgentParser().getDevice().model !== "iPhone" && ( + <> + {!handleFullScreen.active ? ( + + ) : ( + + )} + + )} + + + + + + +
+
+