From 0736a9d0dce11e81d4eb1e7bdfae34d98e031732 Mon Sep 17 00:00:00 2001 From: inmake Date: Tue, 28 Oct 2025 17:44:11 +0500 Subject: [PATCH] Update environment configurations for client and server, refactor ControlsPopover to accept session prop, and adjust media handling in UserCamera. Disable buttons based on session state and improve participant popup functionality. --- client/.env | 8 ++++---- client/src/components/ui/ControlsPopover.tsx | 12 ++++++++++-- client/src/components/ui/UserCamera.tsx | 2 +- client/src/pages/HomePage.tsx | 9 +++------ client/src/pages/SessionPage.tsx | 6 ++++-- server/.env | 4 ++-- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/client/.env b/client/.env index 0f22f67..5e374be 100644 --- a/client/.env +++ b/client/.env @@ -1,4 +1,4 @@ -VITE_API_URL=http://localhost:3000 -VITE_WEBRTC_URL=http://localhost:3001 -# VITE_API_URL=https://stream.graff.estate/api -# VITE_WEBRTC_URL=https://stream.graff.estate \ No newline at end of file +# VITE_API_URL=http://localhost:3000 +# VITE_WEBRTC_URL=http://localhost:3001 +VITE_API_URL=https://stream.graff.estate/api +VITE_WEBRTC_URL=https://stream.graff.estate \ No newline at end of file diff --git a/client/src/components/ui/ControlsPopover.tsx b/client/src/components/ui/ControlsPopover.tsx index 194fefb..05b9ee8 100644 --- a/client/src/components/ui/ControlsPopover.tsx +++ b/client/src/components/ui/ControlsPopover.tsx @@ -15,8 +15,13 @@ import SharePopup from "../popups/SharePopup"; import SettingsModal from "../modals/SettingsModal"; import clsx from "clsx"; import { useClickAway } from "@uidotdev/usehooks"; +import type { Session } from "../../types/Session"; -function ControlsPopover() { +interface ControlsPopoverProps { + session?: Session; +} + +function ControlsPopover({ session }: ControlsPopoverProps) { const [isOpened, setIsOpened] = useState(false); const buttonRef = useRef(null); @@ -33,7 +38,9 @@ function ControlsPopover() { function handleClickOpenParticipantsPopup() { setIsOpened(false); - setPopup(); + if (session) { + setPopup(); + } } function handleClickOpenSharePopup() { @@ -77,6 +84,7 @@ function ControlsPopover() { variant="tertiary" className="w-full !justify-start" onClick={handleClickOpenParticipantsPopup} + disabled={!session} >
diff --git a/client/src/components/ui/UserCamera.tsx b/client/src/components/ui/UserCamera.tsx index f62344f..1672c1f 100644 --- a/client/src/components/ui/UserCamera.tsx +++ b/client/src/components/ui/UserCamera.tsx @@ -314,7 +314,7 @@ export default function UserCamera({ (!mediaStream || isVideoOff) && "hidden" )} autoPlay - muted={isLocal ? isMuted : isAudioMuted} + muted={isLocal ? true : isAudioMuted} playsInline onLoadedData={() => { if (!isLocal && ref.current) { diff --git a/client/src/pages/HomePage.tsx b/client/src/pages/HomePage.tsx index b4df4b6..03aed95 100644 --- a/client/src/pages/HomePage.tsx +++ b/client/src/pages/HomePage.tsx @@ -2,15 +2,12 @@ import Button from "../components/ui/Button"; import FloatingActionButton from "../components/ui/FloatingActionButton"; import { useMe, useLogout } from "../hooks/useAuth"; import { useNavigate } from "react-router"; -import ShareFilledIcon from "../components/icons/ShareFilledIcon"; import usePopupStore from "../store/popupStore"; import SettingsModal from "../components/modals/SettingsModal"; import useModalStore from "../store/modalStore"; import CogFilledIcon from "../components/icons/CogFilledIcon"; import ChatPopup from "../components/popups/ChatPopup"; import ChatFilledIcon from "../components/icons/ChatFilledIcon"; -import ParticipantsPopup from "../components/popups/ParticipantsPopup"; -import ControlsPopover from "../components/ui/ControlsPopover"; function HomePage() { const { data: user } = useMe(); @@ -33,14 +30,14 @@ function HomePage() { {/* Потестить модалки */} - setPopup()} >
-
+ */} setPopup()} @@ -58,7 +55,7 @@ function HomePage() {
- + {/* */}
diff --git a/client/src/pages/SessionPage.tsx b/client/src/pages/SessionPage.tsx index a535bb7..27e75e4 100644 --- a/client/src/pages/SessionPage.tsx +++ b/client/src/pages/SessionPage.tsx @@ -84,7 +84,9 @@ function SessionPage() { } function handleParticipantsOpen() { - setPopup(); + if (session) { + setPopup(); + } } function handleShareOpen() { @@ -250,7 +252,7 @@ function SessionPage() {
- + {/* WebRTC видеочат - работает всегда, пока пользователь на странице */} diff --git a/server/.env b/server/.env index e2aaa31..9f5c018 100644 --- a/server/.env +++ b/server/.env @@ -1,4 +1,4 @@ DATABASE_URL=postgres://postgres:v1sq3vD5faXL@194.26.138.94:5432/stream JWT_SECRET=b5cf2bd3894fb24191f13dc9dddaeecccc92d0ee298e7ee41c2d0aab51c28fa1 -PORT=3000 -SOCKET_PORT=3001 \ No newline at end of file +PORT=6000 +SOCKET_PORT=6001 \ No newline at end of file