77 useUserRef ,
88} from '@/lib/store' ;
99import styles from '@/styles/Chat.module.css' ;
10- import mediaStyle from '@/styles/Components .module.css' ;
10+ import mediaStyle from '@/styles/Livekit .module.css' ;
1111import { ChannelMediaIcon } from '../icons/ChannelMediaIcon' ;
1212import ChannelMessageIcon from '../icons/ChannelMessageIcon' ;
1313import { useUser } from '@supabase/auth-helpers-react' ;
@@ -27,7 +27,11 @@ import { useEffect, useRef, useState } from 'react';
2727import LoadingIcon from '../icons/LoadingIcon' ;
2828import { MediaPlaceholderTrack } from './MediaPlaceholderTrack' ;
2929
30- export default function MediaChat ( { channel : visibleChannel } : { channel : Channel } ) {
30+ export default function MediaChat ( {
31+ channel : visibleChannel ,
32+ } : {
33+ channel : Channel ;
34+ } ) {
3135 const channel = useChannel ( ) ;
3236 const userID : User | any = useUser ( ) ;
3337 const user = useUserRef ( ) ;
@@ -37,8 +41,8 @@ export default function MediaChat({ channel: visibleChannel }: { channel: Channe
3741 const setRoomName = useSetCurrentRoomName ( ) ;
3842 const currentRoom = useCurrentRoomRef ( ) ;
3943 const tracks = useTracks ( [
40- { source : Track . Source . Camera , withPlaceholder : true } ,
41- { source : Track . Source . ScreenShare , withPlaceholder : false }
44+ { source : Track . Source . Camera , withPlaceholder : true } ,
45+ { source : Track . Source . ScreenShare , withPlaceholder : false } ,
4246 ] ) ;
4347
4448 const modalRef = useRef < HTMLDialogElement > ( null ) ;
@@ -56,9 +60,9 @@ export default function MediaChat({ channel: visibleChannel }: { channel: Channe
5660
5761 useEffect ( ( ) => {
5862 if (
59- ! modalRef . current ?. open
60- && currentRoom . channel_id !== channel ?. channel_id
61- && connectionState === ConnectionState . Connected
63+ ! modalRef . current ?. open &&
64+ currentRoom . channel_id !== channel ?. channel_id &&
65+ connectionState === ConnectionState . Connected
6266 ) {
6367 modalRef . current ?. showModal ( ) ;
6468 }
@@ -102,7 +106,9 @@ export default function MediaChat({ channel: visibleChannel }: { channel: Channe
102106 < p >
103107 { `Looks like you're already connected to ${ currentRoom . name } ...` }
104108
105- { 'You\'ll need to end your current call before you can join another.' }
109+ {
110+ 'You\'ll need to end your current call before you can join another.'
111+ }
106112 </ p >
107113 </ div >
108114 </ Modal >
@@ -124,28 +130,33 @@ export default function MediaChat({ channel: visibleChannel }: { channel: Channe
124130 < div className = { `${ mediaStyle . gridContainer } overflow-y-auto` } >
125131 < div className = { 'bg-grey-800' } >
126132 { connectionState === ConnectionState . Connecting ? (
127- < div className = { `flex flex-row items-center relative top-11 mx-auto h-auto ${ mediaStyle . channelLoad } ` } >
128- < LoadingIcon className = 'w-7 h-7 stroke-frost-300 mr-2' />
133+ < div
134+ className = { `flex flex-row items-center relative top-11 mx-auto h-auto ${ mediaStyle . channelLoad } ` }
135+ >
136+ < LoadingIcon className = "w-7 h-7 stroke-frost-300 mr-2" />
129137 < span > Connecting...</ span >
130138 </ div >
131139 ) : (
132- < div
133- className = { `grid ${ mediaStyle . mediaGrid } ` }
134- >
135- { currentRoom . channel_id === channel ?. channel_id && connectionState === ConnectionState . Connected && (
140+ < div className = { `grid ${ mediaStyle . mediaGrid } ` } >
141+ { currentRoom . channel_id === channel ?. channel_id &&
142+ connectionState === ConnectionState . Connected &&
136143 tracks . map ( ( track ) => {
137144 if (
138- (
139- // @ts -expect-error Fck you livekit
140- ! ! track . publication
141- // @ts -expect-error Fck you livekit
142- && track . publication . source == Track . Source . Camera
143- && ! track . participant . isCameraEnabled
145+ // @ts -expect-error Fck you livekit
146+ ( ! ! track . publication &&
144147 // @ts -expect-error Fck you livekit
145- ) || track . publication === undefined ) {
148+ track . publication . source == Track . Source . Camera &&
149+ ! track . participant . isCameraEnabled ) ||
150+ // @ts -expect-error Fck you livekit
151+ track . publication === undefined
152+ ) {
146153 return (
147154 < >
148- { connectionState === ConnectionState . Connected && < MediaPlaceholderTrack participant = { track . participant } /> }
155+ { connectionState === ConnectionState . Connected && (
156+ < MediaPlaceholderTrack
157+ participant = { track . participant }
158+ />
159+ ) }
149160 </ >
150161 ) ;
151162 }
@@ -157,13 +168,13 @@ export default function MediaChat({ channel: visibleChannel }: { channel: Channe
157168 />
158169 ) ;
159170 }
160- } ) ) }
171+ } ) }
161172 </ div >
162173 ) }
163174 </ div >
164175 </ div >
165- < div className = ' w-full h-auto mb-1' >
166- < FloatingCallControl visibleChannel = { visibleChannel } token = { token } />
176+ < div className = " w-full h-auto mb-1" >
177+ < FloatingCallControl visibleChannel = { visibleChannel } token = { token } />
167178 </ div >
168179 </ >
169180 ) ;
0 commit comments