mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-06 15:30:27 +03:00
add mute video and hangup buttons and implemented their functionality
This commit is contained in:
parent
f76641b538
commit
fd1ccc7281
1 changed files with 39 additions and 40 deletions
|
|
@ -82,7 +82,7 @@ import { useCallState } from '../CallProvider';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes the raw hierarchy from useSpaceJoinedHierarchy into a flat list
|
* Processes the raw hierarchy from useSpaceJoinedHierarchy into a flat list
|
||||||
* suitable for the virtualizer, including collapsible headers for text/voice channels.
|
* suitable for the virtualizer, including collapsible headers for text/voice rooms.
|
||||||
* Removes the top-level "Rooms" category header.
|
* Removes the top-level "Rooms" category header.
|
||||||
*
|
*
|
||||||
* @param hierarchy - The raw hierarchy data (array of { roomId: string }).
|
* @param hierarchy - The raw hierarchy data (array of { roomId: string }).
|
||||||
|
|
@ -109,7 +109,7 @@ const processHierarchyForVirtualizer = (
|
||||||
|
|
||||||
if (currentCategoryRooms.text.length > 0) {
|
if (currentCategoryRooms.text.length > 0) {
|
||||||
processed.push({
|
processed.push({
|
||||||
type: 'channel_header',
|
type: 'room_header',
|
||||||
title: 'Text Rooms',
|
title: 'Text Rooms',
|
||||||
categoryId: textCategoryId,
|
categoryId: textCategoryId,
|
||||||
key: `${parentId}-text-header`,
|
key: `${parentId}-text-header`,
|
||||||
|
|
@ -123,7 +123,7 @@ const processHierarchyForVirtualizer = (
|
||||||
|
|
||||||
if (currentCategoryRooms.voice.length > 0) {
|
if (currentCategoryRooms.voice.length > 0) {
|
||||||
processed.push({
|
processed.push({
|
||||||
type: 'channel_header',
|
type: 'room_header',
|
||||||
title: 'Call Rooms',
|
title: 'Call Rooms',
|
||||||
categoryId: voiceCategoryId,
|
categoryId: voiceCategoryId,
|
||||||
key: `${parentId}-voice-header`,
|
key: `${parentId}-voice-header`,
|
||||||
|
|
@ -358,7 +358,15 @@ function SpaceHeader() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function FixedBottomNavArea() {
|
function FixedBottomNavArea() {
|
||||||
const { sendWidgetAction, activeCallRoomId } = useCallState();
|
const {
|
||||||
|
sendWidgetAction,
|
||||||
|
activeCallRoomId,
|
||||||
|
isAudioEnabled,
|
||||||
|
isVideoEnabled,
|
||||||
|
toggleAudio,
|
||||||
|
toggleVideo,
|
||||||
|
hangUp,
|
||||||
|
} = useCallState();
|
||||||
const mx = useMatrixClient();
|
const mx = useMatrixClient();
|
||||||
const userName = mx.getUser(mx.getUserId() ?? '')?.displayName ?? mx.getUserId() ?? 'User';
|
const userName = mx.getUser(mx.getUserId() ?? '')?.displayName ?? mx.getUserId() ?? 'User';
|
||||||
|
|
||||||
|
|
@ -371,22 +379,15 @@ function FixedBottomNavArea() {
|
||||||
.catch((err) => logger.error(`FixedBottomNavArea: Failed action '${action}':`, err));
|
.catch((err) => logger.error(`FixedBottomNavArea: Failed action '${action}':`, err));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleToggleMuteClick = () => {
|
|
||||||
const action = WidgetApiToWidgetAction.SetAudioInputMuted;
|
|
||||||
const data = {};
|
|
||||||
logger.debug(`FixedBottomNavArea: Sending action '${action}'`);
|
|
||||||
sendWidgetAction(action, data)
|
|
||||||
.then(() => logger.info(`FixedBottomNavArea: Action '${action}' sent.`))
|
|
||||||
.catch((err) => logger.error(`FixedBottomNavArea: Failed action '${action}':`, err));
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!activeCallRoomId) {
|
if (!activeCallRoomId) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
direction="Column"
|
direction="Column"
|
||||||
gap="200"
|
gap="500"
|
||||||
padding="300"
|
style={{
|
||||||
style={{ flexShrink: 0, borderTop: `1px solid` }}
|
flexShrink: 0,
|
||||||
|
borderTop: `1px solid #e0e0e0`,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Text size="T200" color="Muted" align="Center">
|
<Text size="T200" color="Muted" align="Center">
|
||||||
No active call
|
No active call
|
||||||
|
|
@ -396,27 +397,26 @@ function FixedBottomNavArea() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Text size="T200" color="Muted" align="Center">
|
<Box direction="Column">
|
||||||
{mx.getRoom(activeCallRoomId)?.normalizedName}
|
<Box
|
||||||
</Text>
|
direction="Row"
|
||||||
);
|
gap="500"
|
||||||
} /*
|
style={{
|
||||||
<Box
|
flexShrink: 0,
|
||||||
direction="Column"
|
borderTop: `1px solid #e0e0e0`,
|
||||||
gap="200"
|
}}
|
||||||
padding="300"
|
>
|
||||||
style={{ flexShrink: 0, borderTop: `1px solid ${config?.color?.LineStrong ?? '#ccc'}` }}
|
{/* Going to need better icons for this */}
|
||||||
>
|
<button onClick={toggleAudio}> Muted:{(!isAudioEnabled).toString()} </button>
|
||||||
<Box direction="Row" gap="200" justifyContent="Center">
|
<button onClick={toggleVideo}> Videosn't:{(!isVideoEnabled).toString()} </button>
|
||||||
<Button onClick={handleSendMessageClick} size="200" variant="Primary" fill="Outline">
|
|
||||||
<Icon src={Icons.Alphabet} size="100" />
|
|
||||||
</Button>
|
|
||||||
<Button onClick={handleToggleMuteClick} size="200" variant="Surface">
|
|
||||||
<Icon src={Icons.VolumeMute} size="100" />
|
|
||||||
</Button>
|
|
||||||
</Box>
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<button onClick={hangUp}> Hangup </button>
|
||||||
|
</Box>
|
||||||
|
<Box>{mx.getRoom(activeCallRoomId)?.normalizedName}</Box>
|
||||||
</Box>
|
</Box>
|
||||||
*/
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function Space() {
|
export function Space() {
|
||||||
const mx = useMatrixClient();
|
const mx = useMatrixClient();
|
||||||
|
|
@ -493,7 +493,7 @@ export function Space() {
|
||||||
scrollRef={scrollRef}
|
scrollRef={scrollRef}
|
||||||
style={{ flexGrow: 1, overflowY: 'auto', overflowX: 'hidden' }}
|
style={{ flexGrow: 1, overflowY: 'auto', overflowX: 'hidden' }}
|
||||||
>
|
>
|
||||||
<Box direction="Column" gap="300" paddingBottom="400">
|
<Box direction="Column" gap="300">
|
||||||
<NavCategory>
|
<NavCategory>
|
||||||
<NavItem variant="Background" radii="400" aria-selected={lobbySelected}>
|
<NavItem variant="Background" radii="400" aria-selected={lobbySelected}>
|
||||||
<NavLink to={getSpaceLobbyPath(getCanonicalAliasOrRoomId(mx, space.roomId))}>
|
<NavLink to={getSpaceLobbyPath(getCanonicalAliasOrRoomId(mx, space.roomId))}>
|
||||||
|
|
@ -559,16 +559,15 @@ export function Space() {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 'channel_header': {
|
case 'room_header': {
|
||||||
const { title, categoryId } = item;
|
const { title, categoryId } = item;
|
||||||
return (
|
return (
|
||||||
<Box paddingLeft="400" paddingTop="200" paddingBottom="100">
|
<Box>
|
||||||
<NavCategoryHeader variant="Subtle">
|
<NavCategoryHeader variant="Subtle">
|
||||||
<RoomNavCategoryButton
|
<RoomNavCategoryButton
|
||||||
data-category-id={categoryId}
|
data-category-id={categoryId}
|
||||||
onClick={handleCategoryClick}
|
onClick={handleCategoryClick}
|
||||||
closed={closedCategories.has(categoryId)}
|
closed={closedCategories.has(categoryId)}
|
||||||
isSubCategory
|
|
||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
</RoomNavCategoryButton>
|
</RoomNavCategoryButton>
|
||||||
|
|
@ -579,7 +578,7 @@ export function Space() {
|
||||||
case 'room': {
|
case 'room': {
|
||||||
const { room } = item;
|
const { room } = item;
|
||||||
return (
|
return (
|
||||||
<Box paddingLeft="500">
|
<Box>
|
||||||
<RoomNavItem
|
<RoomNavItem
|
||||||
room={room}
|
room={room}
|
||||||
selected={selectedRoomId === room.roomId}
|
selected={selectedRoomId === room.roomId}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue