fixes
This commit is contained in:
5 files changed
+7
-138
No files matched your search
@@ -1,128 +0,0 @@
|
||||
import {
|
||||
Box,
|
||||
Chip,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Line,
|
||||
Spinner,
|
||||
Text,
|
||||
Tooltip,
|
||||
TooltipProvider,
|
||||
color,
|
||||
} from 'folds';
|
||||
import { useCallState } from '$pages/client/call/CallProvider';
|
||||
import { useRoomNavigate } from '$hooks/useRoomNavigate';
|
||||
import * as css from './RoomCallNavStatus.css';
|
||||
|
||||
export function CallNavStatus() {
|
||||
const {
|
||||
activeCallRoomId,
|
||||
isActiveCallReady,
|
||||
isAudioEnabled,
|
||||
isVideoEnabled,
|
||||
toggleAudio,
|
||||
toggleVideo,
|
||||
hangUp,
|
||||
} = useCallState();
|
||||
const { navigateRoom } = useRoomNavigate();
|
||||
const hasActiveCall = Boolean(activeCallRoomId);
|
||||
const isConnected = hasActiveCall && isActiveCallReady;
|
||||
const handleGoToCallRoom = () => {
|
||||
if (activeCallRoomId) {
|
||||
navigateRoom(activeCallRoomId);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box direction="Column" shrink="No">
|
||||
<Line variant="Surface" size="300" />
|
||||
<Box className={css.Actions} direction="Row" alignItems="Center" gap="100">
|
||||
<Box className={css.RoomButtonWrap} grow="Yes">
|
||||
{hasActiveCall && (
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
offset={4}
|
||||
tooltip={
|
||||
<Tooltip>
|
||||
<Text>Go to Room</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<Chip
|
||||
size="500"
|
||||
fill="Soft"
|
||||
as="button"
|
||||
onClick={handleGoToCallRoom}
|
||||
ref={triggerRef}
|
||||
className={css.RoomButton}
|
||||
>
|
||||
{isConnected ? (
|
||||
<Icon size="300" src={Icons.VolumeHigh} style={{ color: color.Success.Main }} />
|
||||
) : (
|
||||
<Spinner size="300" variant="Secondary" />
|
||||
)}
|
||||
<Text
|
||||
as="span"
|
||||
size="L400"
|
||||
style={{ color: isConnected ? color.Success.Main : color.Warning.Main }}
|
||||
>
|
||||
{isConnected ? 'Connected' : 'Connecting'}
|
||||
</Text>
|
||||
</Chip>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
)}
|
||||
</Box>
|
||||
{hasActiveCall && (
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
offset={4}
|
||||
tooltip={
|
||||
<Tooltip>
|
||||
<Text>Hang Up</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<IconButton fill="None" size="300" ref={triggerRef} onClick={hangUp}>
|
||||
<Icon src={Icons.PhoneDown} />
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
)}
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
offset={4}
|
||||
tooltip={
|
||||
<Tooltip>
|
||||
<Text>{!isAudioEnabled ? 'Unmute' : 'Mute'}</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<IconButton fill="None" size="300" ref={triggerRef} onClick={toggleAudio}>
|
||||
<Icon src={!isAudioEnabled ? Icons.MicMute : Icons.Mic} />
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
<TooltipProvider
|
||||
position="Top"
|
||||
offset={4}
|
||||
tooltip={
|
||||
<Tooltip>
|
||||
<Text>{!isVideoEnabled ? 'Video On' : 'Video Off'}</Text>
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<IconButton fill="None" size="300" ref={triggerRef} onClick={toggleVideo}>
|
||||
<Icon src={!isVideoEnabled ? Icons.VideoCameraMute : Icons.VideoCamera} />
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -1,29 +1,32 @@
|
||||
import { Avatar, Box, Icon, Icons, Text } from 'folds';
|
||||
import { MouseEventHandler } from 'react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { Room, CallMembership } from '$types/matrix-sdk';
|
||||
import { NavButton, NavItem, NavItemContent } from '$components/nav';
|
||||
import { UserAvatar } from '$components/user-avatar';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { useCallState } from '$pages/client/call/CallProvider';
|
||||
import { getMxIdLocalPart } from '$utils/matrix';
|
||||
import { getMemberAvatarMxc, getMemberDisplayName } from '$utils/room';
|
||||
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
|
||||
import { useOpenUserRoomProfile } from '$state/hooks/userRoomProfile';
|
||||
import { useSpaceOptionally } from '$hooks/useSpace';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { nicknamesAtom } from '$state/nicknames';
|
||||
import { useCallEmbed } from '$hooks/useCallEmbed';
|
||||
|
||||
type RoomNavUserProps = {
|
||||
room: Room;
|
||||
callMembership: CallMembership;
|
||||
};
|
||||
|
||||
export function RoomNavUser({ room, callMembership }: RoomNavUserProps) {
|
||||
const mx = useMatrixClient();
|
||||
const useAuthentication = useMediaAuthentication();
|
||||
const openProfile = useOpenUserRoomProfile();
|
||||
const space = useSpaceOptionally();
|
||||
const { isActiveCallReady, activeCallRoomId } = useCallState();
|
||||
const isActiveCall = isActiveCallReady && activeCallRoomId === room.roomId;
|
||||
|
||||
const callEmbed = useCallEmbed();
|
||||
const isActiveCall = callEmbed?.roomId === room.roomId;
|
||||
|
||||
const userId = callMembership.sender ?? '';
|
||||
const avatarMxcUrl = getMemberAvatarMxc(room, userId);
|
||||
const avatarUrl = avatarMxcUrl
|
||||
|
||||
@@ -50,7 +50,6 @@ import {
|
||||
useRoomsNotificationPreferencesContext,
|
||||
} from '$hooks/useRoomsNotificationPreferences';
|
||||
import { useDirectCreateSelected } from '$hooks/router/useDirectSelected';
|
||||
import { CallNavStatus } from '$features/room-nav/RoomCallNavStatus';
|
||||
import { useDirectRooms } from './useDirectRooms';
|
||||
|
||||
type DirectMenuProps = {
|
||||
@@ -280,7 +279,6 @@ export function Direct() {
|
||||
</Box>
|
||||
</PageNavContent>
|
||||
)}
|
||||
<CallNavStatus />
|
||||
</PageNav>
|
||||
);
|
||||
}
|
||||
@@ -61,7 +61,6 @@ import {
|
||||
import { UseStateProvider } from '$components/UseStateProvider';
|
||||
import { JoinAddressPrompt } from '$components/join-address-prompt';
|
||||
import { RoomSearchParams } from '$pages/paths';
|
||||
import { CallNavStatus } from '$features/room-nav/RoomCallNavStatus';
|
||||
import { useHomeRooms } from './useHomeRooms';
|
||||
|
||||
type HomeMenuProps = {
|
||||
@@ -359,7 +358,6 @@ export function Home() {
|
||||
</Box>
|
||||
</PageNavContent>
|
||||
)}
|
||||
<CallNavStatus />
|
||||
</PageNav>
|
||||
);
|
||||
}
|
||||
@@ -68,7 +68,6 @@ import { ContainerColor } from '$styles/ContainerColor.css';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { BreakWord } from '$styles/Text.css';
|
||||
import { InviteUserPrompt } from '$components/invite-user-prompt';
|
||||
import { CallNavStatus } from '$features/room-nav/RoomCallNavStatus';
|
||||
import { mobileOrTablet } from '$utils/user-agent';
|
||||
import { lastVisitedRoomIdAtom } from '$state/room/lastRoom';
|
||||
import { SwipeableOverlayWrapper } from '$components/SwipeableOverlayWrapper';
|
||||
@@ -546,7 +545,6 @@ export function Space() {
|
||||
</NavCategory>
|
||||
</Box>
|
||||
</PageNavContent>
|
||||
<CallNavStatus />
|
||||
</SwipeableOverlayWrapper>
|
||||
</PageNav>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user