Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/web/src/components/structures/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
Expand Down
16 changes: 9 additions & 7 deletions apps/web/src/components/views/rooms/LiveStreamWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -69,8 +70,8 @@ const LiveStreamWidget: React.FC<IProps> = ({ 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)),
Expand All @@ -94,7 +95,7 @@ const LiveStreamWidget: React.FC<IProps> = ({ 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));
};

Expand All @@ -103,24 +104,25 @@ const LiveStreamWidget: React.FC<IProps> = ({ 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, {
Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/components/views/rooms/RoomTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt

private loadStream = async (): Promise<void> => {
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);
Expand Down Expand Up @@ -685,8 +685,8 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
const canEnableEncryption = !isEncrypted && !isEncryptionForceDisabled && hasEncryptionPermission;
const calendarSection = this.state.roomFeatures["events"] && (
<SettingsFieldset
legend={"Calendário de eventos"}
description={"ID do Google Calendar que fornece os eventos desta sala."}
legend="Calendário de eventos"
description="ID do Google Calendar que fornece os eventos desta sala."
>
<input
className="mx_LiveStreamInput"
Expand All @@ -702,14 +702,14 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
onClick={this.onSaveCalendar}
disabled={this.state.calendarBusy || this.state.calendarInput.trim() === this.state.roomCalendarId}
>
{"Salvar"}
Salvar
</AccessibleButton>
</SettingsFieldset>
);
const streamSection = this.state.roomFeatures["live"] && (
<SettingsFieldset
legend={"Canal de transmissão (Live)"}
description={"URL de reprodução (HLS) do canal usado para transmitir ao vivo nesta sala."}
legend="Canal de transmissão (Live)"
description="URL de reprodução (HLS) do canal usado para transmitir ao vivo nesta sala."
>
<input
type="text"
Expand All @@ -724,7 +724,7 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
onClick={this.onSaveStream}
disabled={this.state.streamBusy || this.state.streamInput.trim() === this.state.streamPlaybackUrl}
>
{"Salvar"}
Salvar
</AccessibleButton>

{/* controle de iniciar/encerrar — só faz sentido se já tem URL salva */}
Expand All @@ -747,8 +747,8 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
);
const featuresSection = (
<SettingsFieldset
legend={"Funcionalidades da sala"}
description={"Ative ou desative abas opcionais para esta sala."}
legend="Funcionalidades da sala"
description="Ative ou desative abas opcionais para esta sala."
>
{ROOM_FEATURES.map(({ key, label }) => (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export const PromoteAdminSection: React.FC = () => {
/>

{feedback && (
<div role="alert" style={{ marginTop: "8px", fontSize: "14px",
<div role="alert"
style={{ marginTop: "8px", fontSize: "14px",
color: feedback.ok
? "var(--cpd-color-text-success-primary, #0a0)"
: "var(--cpd-color-text-critical-primary, #d00)" }}>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/views/spaces/SpaceCreateMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const SpaceCreateForm: React.FC<ISpaceCreateFormProps> = ({
<Field
name="spacePrice"
type="number"
label={"Preço (R$) — deixe 0 para grátis"}
label="Preço (R$) — deixe 0 para grátis"
value={priceReais ?? ""}
min={0}
step={0.01}
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/components/views/vods_drawer/VodsDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { VodsGrid } from "./VodsGrid";
import { EventsTable } from "./EventsTable";
import { VodWatchView } from "./VodWatchView";
import { type LiveShow } from "../../../vods/vodsData";
import UIStore from "../../../stores/UIStore";

/**
* Height of the closed drawer "peek" strip. Exported so RoomView can add a
Expand All @@ -29,8 +30,8 @@ interface VodsDrawerProps {
export function VodsDrawer({ roomId, showVods, showEvents, open, onOpenChange }: VodsDrawerProps): JSX.Element {
const rootRef = useRef<HTMLDivElement>(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<LiveShow | null>(null);
Expand Down Expand Up @@ -266,7 +267,7 @@ export function VodsDrawer({ roomId, showVods, showEvents, open, onOpenChange }:
/>
</>
)}
{showEvents && effectiveTab === "eventos" && <EventsTable roomId={roomId}/>}
{showEvents && effectiveTab === "eventos" && <EventsTable roomId={roomId} />}
</div>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/hooks/useIsAdmin.ts
Original file line number Diff line number Diff line change
@@ -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(() => {
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/utils/admin/roomBusiness.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/utils/live/liveWidget.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Loading