Skip to content

Commit 5b1afb7

Browse files
fix: change the chat input action icon
Co-authored-by: Yurii Kinakh <yuriikinakh5@gmail.com>
1 parent 3e1b605 commit 5b1afb7

File tree

2 files changed

+106
-20
lines changed

2 files changed

+106
-20
lines changed

src/App.css

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@
239239
.vp-chat-overlay {
240240
position: absolute !important;
241241
top: 64px !important;
242-
bottom: 56px !important;
242+
bottom: 80px !important;
243243
left: 0 !important;
244244
right: 48px !important;
245245
display: flex !important;
@@ -304,15 +304,15 @@
304304
bottom: 0 !important;
305305
left: 0 !important;
306306
right: 0 !important;
307-
height: 56px !important;
307+
height: 64px !important;
308308
display: flex !important;
309-
align-items: center !important;
310-
padding: 0 16px !important;
309+
flex-direction: column !important;
310+
justify-content: space-between !important;
311+
padding: 8px 16px !important;
311312
}
312313

313314
.vp-chat-input-container {
314315
height: 40px !important;
315-
flex: 1 !important;
316316
display: flex !important;
317317
flex-direction: row !important;
318318
align-items: center !important;
@@ -334,10 +334,17 @@
334334
}
335335

336336
.vp-chat-input::placeholder {
337-
color: rgba(255, 255, 255, 0.8) !important;
337+
color: rgba(255, 255, 255, 0.7) !important;
338338
}
339339

340-
.vp-chat-send-btn {
340+
.vp-chat-camera-off {
341+
text-align: center !important;
342+
color: rgba(255, 255, 255, 0.5) !important;
343+
font-size: 14px !important;
344+
line-height: 1 !important;
345+
}
346+
347+
.vp-chat-action-btn {
341348
width: 40px !important;
342349
height: 100% !important;
343350
display: flex !important;
@@ -349,6 +356,55 @@
349356
cursor: pointer !important;
350357
}
351358

359+
.vp-chat-input-listening {
360+
flex: 1 !important;
361+
color: rgba(255, 255, 255, 0.7) !important;
362+
font-style: italic !important;
363+
font-size: 14px !important;
364+
}
365+
366+
.vp-audio-bars {
367+
display: flex !important;
368+
flex-shrink: 0 !important;
369+
align-items: center !important;
370+
gap: 2px !important;
371+
height: 16px !important;
372+
margin-right: 4px !important;
373+
}
374+
375+
.vp-audio-bars span {
376+
width: 3px !important;
377+
border-radius: 2px !important;
378+
background: #ffffff !important;
379+
animation: vp-audio-bar 0.8s ease-in-out infinite !important;
380+
}
381+
382+
.vp-audio-bars span:nth-child(1) {
383+
animation-delay: 0s !important;
384+
}
385+
386+
.vp-audio-bars span:nth-child(2) {
387+
animation-delay: 0.15s !important;
388+
}
389+
390+
.vp-audio-bars span:nth-child(3) {
391+
animation-delay: 0.3s !important;
392+
}
393+
394+
.vp-audio-bars span:nth-child(4) {
395+
animation-delay: 0.45s !important;
396+
}
397+
398+
@keyframes vp-audio-bar {
399+
0%, 100% {
400+
height: 4px;
401+
}
402+
403+
50% {
404+
height: 16px;
405+
}
406+
}
407+
352408
@media (min-width: 768px) {
353409
.vp-room {
354410
bottom: 20px !important;

src/components/RoomScreen.js

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
useTracks,
1111
} from '@livekit/components-react';
1212
import { Track, AudioPresets, RoomEvent, VideoQuality } from 'livekit-client';
13-
import { X, SendHorizonal } from 'lucide-react';
13+
import { X, Mic, MicOff, SendHorizonal } from 'lucide-react';
1414
import { api } from '../utils/api';
1515
import { AVATAR_URL, LIVEKIT_URL, USERNAME } from '../utils/constants';
1616

@@ -136,7 +136,7 @@ function ParticipantTile({ participant }) {
136136
}
137137

138138
function RoomContainer({ roomName, onLeave }) {
139-
const { disableMic } = useMediaControls();
139+
const { isMuted, enableMic, disableMic } = useMediaControls();
140140
const { messages, message, setMessage, sendMessage } = useChat();
141141
const messagesEndRef = useRef(null);
142142

@@ -311,20 +311,50 @@ function RoomContainer({ roomName, onLeave }) {
311311
{remoteParticipants.length > 0 && (
312312
<div className="vp-chat-input-bar">
313313
<div className="vp-chat-input-container">
314-
<input
315-
className="vp-chat-input"
316-
type="text"
317-
placeholder="Type a message..."
318-
value={message}
319-
onChange={(e) => setMessage(e.target.value)}
320-
onKeyDown={(e) => {
321-
if (e.key === 'Enter') sendMessage();
314+
{!isMuted ? (
315+
<>
316+
<span className="vp-chat-input-listening">Listening...</span>
317+
<div className="vp-audio-bars">
318+
<span />
319+
<span />
320+
<span />
321+
<span />
322+
</div>
323+
</>
324+
) : (
325+
<input
326+
className="vp-chat-input"
327+
type="text"
328+
placeholder="Type a message..."
329+
value={message}
330+
onChange={(e) => setMessage(e.target.value)}
331+
onKeyDown={(e) => {
332+
if (e.key === 'Enter') sendMessage();
333+
}}
334+
/>
335+
)}
336+
<div
337+
className="vp-chat-action-btn"
338+
onClick={() => {
339+
if (message.trim()) {
340+
sendMessage();
341+
} else if (isMuted) {
342+
enableMic();
343+
} else {
344+
disableMic();
345+
}
322346
}}
323-
/>
324-
<div className="vp-chat-send-btn" onClick={sendMessage}>
325-
<SendHorizonal size={20} color="white" />
347+
>
348+
{message.trim() ? (
349+
<SendHorizonal size={20} color="white" />
350+
) : isMuted ? (
351+
<Mic size={20} color="white" />
352+
) : (
353+
<MicOff size={20} color="white" />
354+
)}
326355
</div>
327356
</div>
357+
<span className="vp-chat-camera-off">Your camera is off</span>
328358
</div>
329359
)}
330360
</div>

0 commit comments

Comments
 (0)