11'use client' ;
22
3+ import Link from 'next/link' ;
4+ import { useVoiceAssistant } from '@livekit/components-react' ;
35import { AgentControlBar } from '@/components/livekit/agent-control-bar/agent-control-bar' ;
6+ import { AudioBarVisualizer } from '@/components/livekit/audio-visualizer/audio-bar-visualizer/audio-bar-visualizer' ;
47import { Button } from '@/components/livekit/button' ;
58import { ChatEntry } from '@/components/livekit/chat-entry' ;
9+ import { useMicrophone } from '../_components' ;
610
711export default function Page ( ) {
12+ const { state, audioTrack } = useVoiceAssistant ( ) ;
13+
14+ useMicrophone ( ) ;
15+
816 return (
917 < >
1018 < header className = "grid h-96 place-content-center space-y-6 text-center" >
11- < h1 className = "text-5xl" >
12- < span className = "font-bold tracking-tighter" > LiveKit</ span > { ' ' }
13- < span className = "font-light tracking-tighter" > UI</ span >
19+ < h1 className = "flex items-baseline justify-center gap-2 text-5xl" >
20+ < svg
21+ height = "48"
22+ viewBox = "0 0 123 28"
23+ fill = "none"
24+ xmlns = "http://www.w3.org/2000/svg"
25+ className = "text-foreground"
26+ >
27+ < path
28+ d = "M4.7 0H0v27.6h17v-4H4.7V0ZM24.8 12.5h-4.5v15h4.5v-15ZM38.2 27 32.4 8H28l6 19.6h8.6l6-19.6H44l-5.8 19ZM59.8 7.6c-5.9 0-9.6 4.2-9.6 10.2 0 6 3.6 10.2 9.6 10.2 4.6 0 8-2 9.2-6.2h-4.6c-.7 1.9-2 3-4.5 3-2.8 0-4.7-2-5-5.7h14.4l.1-1.4c0-6.1-3.8-10.1-9.6-10.1Zm-5 8.4c.5-3.6 2.4-5.2 5-5.2 2.9 0 4.7 2 5 5.2h-10ZM96 0h-5.9L78.7 12.6V0H74v27.6h4.7v-14l12.6 14h6L84.1 13 96.1 0ZM104 8h-4.6v15h4.5V8ZM20.3 8h-4.6v4.5h4.6V8ZM108.5 23h-4.6v4.6h4.6V23ZM122 23h-4.5v4.6h4.6V23ZM122 12.5V8h-4.5V0H113v8h-4.6v4.5h4.6V23h4.5V12.5h4.6Z"
29+ fill = "currentColor"
30+ />
31+ </ svg >
32+ < span className = "font-extralight tracking-tighter" > UI</ span >
1433 </ h1 >
1534 < p className = "text-lg text-pretty" >
1635 A set of Open Source UI components for
@@ -19,43 +38,62 @@ export default function Page() {
1938 </ p >
2039 < div className = "flex justify-center gap-4" >
2140 < Button variant = "primary" asChild >
22- < a href = "/ui/components" > View components</ a >
41+ < Link href = "/ui/components" > View components</ Link >
2342 </ Button >
2443 < Button variant = "ghost" asChild >
25- < a href = "https://docs.livekit.io/agents/start/frontend/" > Read our docs</ a >
44+ < Link href = "https://docs.livekit.io/agents/start/frontend/" > Read our docs</ Link >
2645 </ Button >
2746 </ div >
2847 </ header >
2948
30- < main className = "mx-auto max-w-3xl space-y-8" >
31- < div className = "border-border bg-background h-96 rounded-3xl border p-8" >
32- < div className = "flex h-full flex-col gap-4" >
33- < div className = "flex-1 grow" >
34- < ChatEntry
35- locale = "en-US"
36- name = "User"
37- message = "Hello, how are you?"
38- messageOrigin = "local"
39- timestamp = { 1761096559966 }
49+ < main className = "mx-auto max-w-5xl space-y-8" >
50+ < div className = "grid grid-cols-1 gap-4 md:grid-cols-2" >
51+ < div className = "border-border bg-background h-96 rounded-3xl border p-8" >
52+ < div className = "flex h-full flex-col gap-4" >
53+ < div className = "grid flex-1 grow place-content-center" >
54+ < AudioBarVisualizer state = { state } audioTrack = { audioTrack ! } />
55+ </ div >
56+ < AgentControlBar
57+ className = "w-full"
58+ controls = { {
59+ leave : true ,
60+ chat : true ,
61+ camera : true ,
62+ microphone : true ,
63+ screenShare : true ,
64+ } }
4065 />
41- < ChatEntry
42- locale = "en-US"
43- name = "Agent"
44- message = "I am good, how about you?"
45- messageOrigin = "remote"
46- timestamp = { 1761096569216 }
66+ </ div >
67+ </ div >
68+ < div className = "border-border bg-background h-96 rounded-3xl border p-8" >
69+ < div className = "flex h-full flex-col gap-4" >
70+ < div className = "flex-1 grow" >
71+ < ChatEntry
72+ locale = "en-US"
73+ name = "User"
74+ message = "Hello, how are you?"
75+ messageOrigin = "local"
76+ timestamp = { 1761096559966 }
77+ />
78+ < ChatEntry
79+ locale = "en-US"
80+ name = "Agent"
81+ message = "I am good, how about you?"
82+ messageOrigin = "remote"
83+ timestamp = { 1761096569216 }
84+ />
85+ </ div >
86+ < AgentControlBar
87+ className = "w-full"
88+ controls = { {
89+ leave : true ,
90+ chat : true ,
91+ camera : true ,
92+ microphone : true ,
93+ screenShare : true ,
94+ } }
4795 />
4896 </ div >
49- < AgentControlBar
50- className = "w-full"
51- controls = { {
52- leave : true ,
53- chat : true ,
54- camera : true ,
55- microphone : true ,
56- screenShare : true ,
57- } }
58- />
5997 </ div >
6098 </ div >
6199 </ main >
0 commit comments