diff --git a/apps/web/src/components/structures/HomePage.tsx b/apps/web/src/components/structures/HomePage.tsx index 866d44d3514..91ef49efd0d 100644 --- a/apps/web/src/components/structures/HomePage.tsx +++ b/apps/web/src/components/structures/HomePage.tsx @@ -10,6 +10,7 @@ import React, { type JSX } from "react"; import { useContext, useState } from "react"; import { ChatSolidIcon, ExploreIcon, GroupIcon } from "@vector-im/compound-design-tokens/assets/web/icons"; import { AutoHideScrollbar } from "@element-hq/web-shared-components"; +import classNames from "classnames"; import { getHomePageUrl } from "../../utils/pages"; import { _t, _tDom } from "../../languageHandler"; @@ -26,7 +27,6 @@ import MiniAvatarUploader, { AVATAR_SIZE } from "../views/elements/MiniAvatarUpl import PosthogTrackers from "../../PosthogTrackers"; import EmbeddedPage from "./EmbeddedPage"; import { useIsAdmin } from "../../hooks/useIsAdmin"; -import classNames from "classnames"; const onClickSendDm = (ev: ButtonEvent): void => { PosthogTrackers.trackInteraction("WebHomeCreateChatButton", ev); diff --git a/apps/web/src/components/views/rooms/LiveStreamWidget.tsx b/apps/web/src/components/views/rooms/LiveStreamWidget.tsx index 9fc8cbabdc3..8f9929a3b8d 100644 --- a/apps/web/src/components/views/rooms/LiveStreamWidget.tsx +++ b/apps/web/src/components/views/rooms/LiveStreamWidget.tsx @@ -8,6 +8,7 @@ import QuestionDialog from "../dialogs/QuestionDialog"; import ErrorDialog from "../dialogs/ErrorDialog"; import { getLiveWidget, stopLive } from "../../../utils/live/liveWidget"; import { useMatrixClientContext } from "../../../contexts/MatrixClientContext"; +import UIStore from "../../../stores/UIStore"; interface IProps { room: Room; @@ -69,8 +70,8 @@ const LiveStreamWidget: React.FC = ({ room, canManage }) => { const dx = e.clientX - dragState.current.startX; const dy = e.clientY - dragState.current.startY; - const maxX = window.innerWidth - width - MARGIN; - const maxY = window.innerHeight - height - MARGIN; + const maxX = UIStore.instance.windowWidth - width - MARGIN; + const maxY = UIStore.instance.windowHeight - height - MARGIN; setPosition({ x: Math.min(Math.max(dragState.current.origX + dx, MARGIN), Math.max(maxX, MARGIN)), @@ -94,7 +95,7 @@ const LiveStreamWidget: React.FC = ({ room, canManage }) => { const onResizeMove = (e: React.PointerEvent): void => { if (!resizeState.current) return; const dx = e.clientX - resizeState.current.startX; - const maxWidth = window.innerWidth * MAX_WIDTH_RATIO; + const maxWidth = UIStore.instance.windowWidth * MAX_WIDTH_RATIO; setWidth(Math.min(Math.max(resizeState.current.origWidth + dx, MIN_WIDTH), maxWidth)); }; @@ -103,24 +104,25 @@ const LiveStreamWidget: React.FC = ({ room, canManage }) => { }; // --------- player HLS --------- + const liveUrl = live?.url; useEffect(() => { - if (!live || !videoRef.current) return; + if (!liveUrl || !videoRef.current) return; const video = videoRef.current; if (Hls.isSupported()) { const hls = new Hls(); - hls.loadSource(live.url); + hls.loadSource(liveUrl); hls.attachMedia(video); hlsRef.current = hls; } else if (video.canPlayType("application/vnd.apple.mpegurl")) { - video.src = live.url; + video.src = liveUrl; } return () => { hlsRef.current?.destroy(); hlsRef.current = null; }; - }, [live?.url]); + }, [liveUrl]); const onStop = useCallback((): void => { Modal.createDialog(QuestionDialog, { diff --git a/apps/web/src/components/views/rooms/RoomTile.tsx b/apps/web/src/components/views/rooms/RoomTile.tsx index fd7c83896ee..58bb6430369 100644 --- a/apps/web/src/components/views/rooms/RoomTile.tsx +++ b/apps/web/src/components/views/rooms/RoomTile.tsx @@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details. */ import React, { createRef } from "react"; -import { type Room, RoomEvent } from "matrix-js-sdk/src/matrix"; +import { type Room, RoomEvent, RoomStateEvent, type MatrixEvent } from "matrix-js-sdk/src/matrix"; import { KnownMembership } from "matrix-js-sdk/src/types"; import classNames from "classnames"; import { OverflowHorizontalIcon } from "@vector-im/compound-design-tokens/assets/web/icons"; @@ -47,7 +47,6 @@ import { isKnockDenied } from "../../../utils/membership"; import SettingsStore from "../../../settings/SettingsStore"; import { getNotificationIcon } from "../dialogs/spotlight/RoomResultContextMenus.tsx"; import { getLiveWidget } from "../../../utils/live/liveWidget"; -import { RoomStateEvent, type MatrixEvent } from "matrix-js-sdk/src/matrix"; interface Props { room: Room; diff --git a/apps/web/src/components/views/settings/tabs/room/BusinessVisibilitySection.tsx b/apps/web/src/components/views/settings/tabs/room/BusinessVisibilitySection.tsx index b39ddc503ec..6f87a31faa5 100644 --- a/apps/web/src/components/views/settings/tabs/room/BusinessVisibilitySection.tsx +++ b/apps/web/src/components/views/settings/tabs/room/BusinessVisibilitySection.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useEffect, useState } from "react"; -import { EventType, JoinRule, MatrixEvent, RoomStateEvent, type Room } from "matrix-js-sdk/src/matrix"; +import { EventType, JoinRule, type MatrixEvent, RoomStateEvent, type Room } from "matrix-js-sdk/src/matrix"; import { SettingsToggleInput } from "@vector-im/compound-web"; import Modal from "../../../../../Modal"; diff --git a/apps/web/src/components/views/settings/tabs/room/DeleteRoomSection.tsx b/apps/web/src/components/views/settings/tabs/room/DeleteRoomSection.tsx index 7aca215581f..4d57193a2a1 100644 --- a/apps/web/src/components/views/settings/tabs/room/DeleteRoomSection.tsx +++ b/apps/web/src/components/views/settings/tabs/room/DeleteRoomSection.tsx @@ -1,6 +1,5 @@ import React, { useState } from "react"; -import { _t } from "../../../../../languageHandler"; import AccessibleButton from "../../../elements/AccessibleButton"; import { SettingsSubsection } from "../../shared/SettingsSubsection"; import { useIsAdmin } from "../../../../../hooks/useIsAdmin"; diff --git a/apps/web/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx b/apps/web/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx index 696f6462c19..1ea1a507fc2 100644 --- a/apps/web/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx +++ b/apps/web/src/components/views/settings/tabs/room/SecurityRoomSettingsTab.tsx @@ -194,10 +194,10 @@ export default class SecurityRoomSettingsTab extends React.Component => { try { - const { playback_url } = await getStream(this.props.room.roomId); + const { playback_url: playbackUrl } = await getStream(this.props.room.roomId); this.setState({ - streamPlaybackUrl: playback_url ?? "", - streamInput: playback_url ?? "", + streamPlaybackUrl: playbackUrl ?? "", + streamInput: playbackUrl ?? "", }); } catch (e) { logger.error("Falha ao carregar canal de transmissão:", e); @@ -685,8 +685,8 @@ export default class SecurityRoomSettingsTab extends React.Component - {"Salvar"} + Salvar ); const streamSection = this.state.roomFeatures["live"] && ( - {"Salvar"} + Salvar {/* controle de iniciar/encerrar — só faz sentido se já tem URL salva */} @@ -747,8 +747,8 @@ export default class SecurityRoomSettingsTab extends React.Component {ROOM_FEATURES.map(({ key, label }) => (
{ /> {feedback && ( -
diff --git a/apps/web/src/components/views/spaces/SpaceCreateMenu.tsx b/apps/web/src/components/views/spaces/SpaceCreateMenu.tsx index 83518b859c8..04abc5e8c14 100644 --- a/apps/web/src/components/views/spaces/SpaceCreateMenu.tsx +++ b/apps/web/src/components/views/spaces/SpaceCreateMenu.tsx @@ -212,7 +212,7 @@ export const SpaceCreateForm: React.FC = ({ (null); const [containerSize, setContainerSize] = useState({ - width: window.innerWidth, - height: window.innerHeight, + width: UIStore.instance.windowWidth, + height: UIStore.instance.windowHeight, }); const [selectedTab, setSelectedTab] = useState<"rolou" | "eventos">("rolou"); const [watchingVod, setWatchingVod] = useState(null); @@ -266,7 +267,7 @@ export function VodsDrawer({ roomId, showVods, showEvents, open, onOpenChange }: /> )} - {showEvents && effectiveTab === "eventos" && } + {showEvents && effectiveTab === "eventos" && }
); diff --git a/apps/web/src/hooks/useIsAdmin.ts b/apps/web/src/hooks/useIsAdmin.ts index 86dd23bf705..3266bdf5334 100644 --- a/apps/web/src/hooks/useIsAdmin.ts +++ b/apps/web/src/hooks/useIsAdmin.ts @@ -1,9 +1,10 @@ // hooks/useIsGlobalAdmin.ts import { useEffect, useState } from "react"; + import { isGlobalAdmin } from "../utils/admin/isGlobalAdmin"; -export function useIsAdmin() { +export function useIsAdmin(): boolean { const [isAdmin, setIsAdmin] = useState(false); useEffect(() => { diff --git a/apps/web/src/utils/admin/roomBusiness.ts b/apps/web/src/utils/admin/roomBusiness.ts index 44d97c55645..55ca65cb852 100644 --- a/apps/web/src/utils/admin/roomBusiness.ts +++ b/apps/web/src/utils/admin/roomBusiness.ts @@ -1,6 +1,7 @@ -import { MatrixClientPeg } from "../../MatrixClientPeg"; import { type MatrixClient } from "matrix-js-sdk/src/matrix"; +import { MatrixClientPeg } from "../../MatrixClientPeg"; + export interface SpaceChildRoom { roomId: string; name?: string; diff --git a/apps/web/src/utils/live/liveWidget.ts b/apps/web/src/utils/live/liveWidget.ts index 6a46cf67196..83d652cc614 100644 --- a/apps/web/src/utils/live/liveWidget.ts +++ b/apps/web/src/utils/live/liveWidget.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import { type Room, type MatrixClient, RoomStateEvent, MatrixEvent } from "matrix-js-sdk/src/matrix"; +import { type Room, type MatrixClient, RoomStateEvent, type MatrixEvent } from "matrix-js-sdk/src/matrix"; const LIVE_WIDGET_TYPE = "im.vector.modular.widgets"; const LIVE_WIDGET_STATE_KEY = "live_widget";