Apply the auto-fixable lint rules and the formatter, and drop the Vite build artifacts.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { Box, IconButton, Text, Tooltip, TooltipProvider, Scroll, color } from 'folds';
|
||||
import { Icon, Icons } from '../../components/icons';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { Icon, Icons } from '../../components/icons';
|
||||
import { useCall } from './useCall';
|
||||
import { ScreenShareItem, ScreenShareEntry } from './CallOverlay';
|
||||
import { useRoomCallMembers } from './useRoomCallMembers';
|
||||
@@ -69,7 +69,7 @@ export function DockedCallContent() {
|
||||
const { navigateRoom } = useRoomNavigate();
|
||||
const [, setIsDocked] = useSetting(settingsAtom, 'isCallPanelDocked');
|
||||
const setPendingDrag = useSetAtom(pendingUndockDragAtom);
|
||||
|
||||
|
||||
const unread = useRoomUnread(activeCall?.roomId ?? '', roomToUnreadAtom);
|
||||
const { callMembers } = useRoomCallMembers(activeCall?.roomId ?? '');
|
||||
const myUserId = mx.getUserId() ?? '';
|
||||
@@ -95,7 +95,8 @@ export function DockedCallContent() {
|
||||
remoteScreenTracks.forEach((trackInfo) => {
|
||||
const livekitId = trackInfo.participantId;
|
||||
const underscoreIndex = livekitId.lastIndexOf('_');
|
||||
const possibleDeviceId = underscoreIndex > 0 ? livekitId.substring(0, underscoreIndex) : livekitId;
|
||||
const possibleDeviceId =
|
||||
underscoreIndex > 0 ? livekitId.substring(0, underscoreIndex) : livekitId;
|
||||
const matchingMember = callMembers.find((m) => m.deviceId === possibleDeviceId);
|
||||
const matrixUserId = matchingMember?.userId ?? livekitId;
|
||||
|
||||
@@ -111,7 +112,14 @@ export function DockedCallContent() {
|
||||
});
|
||||
|
||||
return shares;
|
||||
}, [activeCall?.isScreenSharing, activeCall?.localScreenStream, activeCall?.remoteScreenTracks, activeCall?.roomId, callMembers, myUserId]);
|
||||
}, [
|
||||
activeCall?.isScreenSharing,
|
||||
activeCall?.localScreenStream,
|
||||
activeCall?.remoteScreenTracks,
|
||||
activeCall?.roomId,
|
||||
callMembers,
|
||||
myUserId,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!activeCall || activeCall.state !== CallState.Connected) {
|
||||
@@ -137,10 +145,10 @@ export function DockedCallContent() {
|
||||
const isParticipantSpeaking = (userId: string): boolean => {
|
||||
if (!activeCall) return false;
|
||||
if (activeCall.activeSpeakers.has(userId)) return true;
|
||||
|
||||
|
||||
const member = callMembers.find((m) => m.userId === userId);
|
||||
if (!member) return false;
|
||||
|
||||
|
||||
return Array.from(activeCall.activeSpeakers).some((speakerId) => {
|
||||
const underscoreIndex = speakerId.lastIndexOf('_');
|
||||
const deviceId = underscoreIndex > 0 ? speakerId.substring(0, underscoreIndex) : speakerId;
|
||||
@@ -154,10 +162,10 @@ export function DockedCallContent() {
|
||||
const isParticipantMuted = (userId: string): boolean => {
|
||||
if (!activeCall) return false;
|
||||
if (userId === myUserId) return activeCall.isMuted;
|
||||
|
||||
|
||||
const member = callMembers.find((m) => m.userId === userId);
|
||||
if (!member) return false;
|
||||
|
||||
|
||||
return Array.from(activeCall.mutedParticipants).some((mutedId) => {
|
||||
const underscoreIndex = mutedId.lastIndexOf('_');
|
||||
const deviceId = underscoreIndex > 0 ? mutedId.substring(0, underscoreIndex) : mutedId;
|
||||
@@ -194,7 +202,7 @@ export function DockedCallContent() {
|
||||
const handleHeaderMouseDown = async (e: React.MouseEvent) => {
|
||||
// Don't start drag if clicking a button
|
||||
if ((e.target as HTMLElement).closest('button')) return;
|
||||
|
||||
|
||||
// Exit browser fullscreen if active before undocking
|
||||
if (document.fullscreenElement) {
|
||||
try {
|
||||
@@ -203,11 +211,11 @@ export function DockedCallContent() {
|
||||
// Fullscreen exit may fail
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get the header element to calculate offset
|
||||
const header = e.currentTarget as HTMLElement;
|
||||
const rect = header.getBoundingClientRect();
|
||||
|
||||
|
||||
// Store the drag start position with mouse offset from panel edges
|
||||
setPendingDrag({
|
||||
startX: e.clientX,
|
||||
@@ -216,7 +224,7 @@ export function DockedCallContent() {
|
||||
offsetY: e.clientY - rect.top,
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
|
||||
|
||||
// Undock immediately - the floating overlay will pick up the drag
|
||||
setIsDocked(false);
|
||||
};
|
||||
@@ -235,30 +243,31 @@ export function DockedCallContent() {
|
||||
<div className={css.DockedCallPanelContent}>
|
||||
{/* Header - drag to undock */}
|
||||
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
|
||||
<div
|
||||
<div
|
||||
className={css.CallOverlayHeader}
|
||||
onMouseDown={handleHeaderMouseDown}
|
||||
style={{ cursor: 'grab' }}
|
||||
>
|
||||
<Box alignItems="Center" gap="200" style={{ minWidth: 0, flex: 1 }}>
|
||||
<Icon
|
||||
size="200"
|
||||
src={isVideoCall ? Icons.VideoCamera : Icons.Phone}
|
||||
/>
|
||||
<Icon size="200" src={isVideoCall ? Icons.VideoCamera : Icons.Phone} />
|
||||
<Text size="T300" truncate>
|
||||
{isConnecting ? 'Connecting...' : room?.name ?? 'Unknown Room'}
|
||||
{isConnecting ? 'Connecting...' : (room?.name ?? 'Unknown Room')}
|
||||
{selectedRoomId === activeCall.roomId && (
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
offset={4}
|
||||
tooltip={<Tooltip><Text>Current Room</Text></Tooltip>}
|
||||
tooltip={
|
||||
<Tooltip>
|
||||
<Text>Current Room</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<Icon
|
||||
<Icon
|
||||
ref={triggerRef}
|
||||
size="100"
|
||||
src={Icons.Check}
|
||||
style={{ marginLeft: '4px', opacity: 0.7, verticalAlign: 'middle' }}
|
||||
size="100"
|
||||
src={Icons.Check}
|
||||
style={{ marginLeft: '4px', opacity: 0.7, verticalAlign: 'middle' }}
|
||||
/>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
@@ -276,13 +285,17 @@ export function DockedCallContent() {
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
offset={4}
|
||||
tooltip={<Tooltip><Text>Go to Room</Text></Tooltip>}
|
||||
tooltip={
|
||||
<Tooltip>
|
||||
<Text>Go to Room</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<IconButton
|
||||
ref={triggerRef}
|
||||
onClick={() => navigateRoom(activeCall.roomId)}
|
||||
variant="Secondary"
|
||||
<IconButton
|
||||
ref={triggerRef}
|
||||
onClick={() => navigateRoom(activeCall.roomId)}
|
||||
variant="Secondary"
|
||||
size="300"
|
||||
>
|
||||
<Icon size="100" src={Icons.Link} />
|
||||
@@ -316,18 +329,19 @@ export function DockedCallContent() {
|
||||
{allParticipants.map((participantId) => {
|
||||
const avatarMxc = getMemberAvatarMxc(room, participantId);
|
||||
const avatarUrl = avatarMxc
|
||||
? mxcUrlToHttp(mx, avatarMxc, useAuthentication, 32, 32, 'crop') ?? undefined
|
||||
? (mxcUrlToHttp(mx, avatarMxc, useAuthentication, 32, 32, 'crop') ?? undefined)
|
||||
: undefined;
|
||||
const displayName = getMemberDisplayName(room, participantId)
|
||||
?? getMxIdLocalPart(participantId)
|
||||
?? participantId;
|
||||
const displayName =
|
||||
getMemberDisplayName(room, participantId) ??
|
||||
getMxIdLocalPart(participantId) ??
|
||||
participantId;
|
||||
const isMe = participantId === myUserId;
|
||||
const isMuted = isParticipantMuted(participantId);
|
||||
const isSpeaking = isParticipantSpeaking(participantId);
|
||||
|
||||
|
||||
return (
|
||||
<div key={participantId} className={css.ParticipantItem}>
|
||||
<div
|
||||
<div
|
||||
className={`${css.ParticipantAvatarWrapper} ${isSpeaking ? css.ParticipantSpeaking : ''}`}
|
||||
>
|
||||
<UserAvatar
|
||||
@@ -349,11 +363,7 @@ export function DockedCallContent() {
|
||||
</Text>
|
||||
</Box>
|
||||
{isMuted && (
|
||||
<Icon
|
||||
size="100"
|
||||
src={Icons.MicMute}
|
||||
className={css.ParticipantMutedIcon}
|
||||
/>
|
||||
<Icon size="100" src={Icons.MicMute} className={css.ParticipantMutedIcon} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
@@ -378,7 +388,11 @@ export function DockedCallContent() {
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
offset={4}
|
||||
tooltip={<Tooltip><Text>{activeCall.isMuted ? 'Unmute' : 'Mute'}</Text></Tooltip>}
|
||||
tooltip={
|
||||
<Tooltip>
|
||||
<Text>{activeCall.isMuted ? 'Unmute' : 'Mute'}</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<IconButton
|
||||
@@ -394,7 +408,11 @@ export function DockedCallContent() {
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
offset={4}
|
||||
tooltip={<Tooltip><Text>{activeCall.isDeafened ? 'Undeafen' : 'Deafen'}</Text></Tooltip>}
|
||||
tooltip={
|
||||
<Tooltip>
|
||||
<Text>{activeCall.isDeafened ? 'Undeafen' : 'Deafen'}</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<IconButton
|
||||
@@ -410,7 +428,11 @@ export function DockedCallContent() {
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
offset={4}
|
||||
tooltip={<Tooltip><Text>{activeCall.isScreenSharing ? 'Stop Screen Share' : 'Share Screen'}</Text></Tooltip>}
|
||||
tooltip={
|
||||
<Tooltip>
|
||||
<Text>{activeCall.isScreenSharing ? 'Stop Screen Share' : 'Share Screen'}</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<IconButton
|
||||
@@ -438,14 +460,14 @@ export function DockedCallContent() {
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
offset={4}
|
||||
tooltip={<Tooltip><Text>End Call</Text></Tooltip>}
|
||||
tooltip={
|
||||
<Tooltip>
|
||||
<Text>End Call</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<IconButton
|
||||
ref={triggerRef}
|
||||
onClick={handleEndCall}
|
||||
variant="Critical"
|
||||
>
|
||||
<IconButton ref={triggerRef} onClick={handleEndCall} variant="Critical">
|
||||
<Icon size="300" src={Icons.Phone} />
|
||||
</IconButton>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user