Skip to content

Commit f3a5b6f

Browse files
authored
Merge pull request #57 from FrostCord/hotfix
update imports for css file
2 parents 883383f + 575afb4 commit f3a5b6f

7 files changed

Lines changed: 131 additions & 74 deletions

File tree

components/forms/AddChannel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Input } from './Styles';
2-
import styles from '@/styles/Components.module.css';
2+
import styles from '@/styles/Livekit.module.css';
33

44
import { Dispatch, SetStateAction, useState } from 'react';
55
import {

components/forms/AddServer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import CameraIcon from '@/components/icons/CameraIcon';
22
import { Input } from './Styles';
3-
import styles from '@/styles/Components.module.css';
3+
import styles from '@/styles/Livekit.module.css';
44
import PlusIcon from '@/components/icons/PlusIcon';
55
import {
66
useRef,

components/home/FloatingCallControl.tsx

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
1-
import { DisconnectButton, TrackToggle, useConnectionState, useLocalParticipant } from '@livekit/components-react';
1+
import {
2+
DisconnectButton,
3+
TrackToggle,
4+
useConnectionState,
5+
useLocalParticipant,
6+
} from '@livekit/components-react';
27
import ScreenShareOff from '../icons/ScreenShareOff';
38
import ScreenShareIcon from '../icons/ScreenShareIcon';
4-
import mediaStyle from '@/styles/Components.module.css';
9+
import mediaStyle from '@/styles/Livekit.module.css';
510
import { ConnectionState, Track } from 'livekit-client';
6-
import { useSetConnectionState, useSetCurrentRoomId, useSetCurrentRoomName, useSetCurrentRoomServerId, useSetToken, useConnectionRef, useSetUserSettings, useUserSettings } from '@/lib/store';
11+
import {
12+
useSetConnectionState,
13+
useSetCurrentRoomId,
14+
useSetCurrentRoomName,
15+
useSetCurrentRoomServerId,
16+
useSetToken,
17+
useConnectionRef,
18+
useSetUserSettings,
19+
useUserSettings,
20+
} from '@/lib/store';
721
import { Channel } from '@/types/dbtypes';
822
import CameraOffIcon from '../icons/CameraOffIcon';
923
import CameraIcon from '../icons/CameraIcon';
@@ -12,7 +26,13 @@ import HangUpIcon from '../icons/HangUpIcon';
1226
import MicrophoneIcon from '../icons/MicrophoneIcon';
1327
import MicrophoneOff from '../icons/MicroPhoneOff';
1428

15-
export function FloatingCallControl({ visibleChannel, token }: { visibleChannel?: Channel, token?: string }) {
29+
export function FloatingCallControl({
30+
visibleChannel,
31+
token,
32+
}: {
33+
visibleChannel?: Channel;
34+
token?: string;
35+
}) {
1636
const connectionState = useConnectionState();
1737
const currentParticipant = useLocalParticipant();
1838
const setConnectionState = useSetConnectionState();
@@ -50,9 +70,13 @@ export function FloatingCallControl({ visibleChannel, token }: { visibleChannel?
5070
draggable
5171
>
5272
{connectionState !== ConnectionState.Connected ? (
53-
<button disabled className='w-7 h-7 bg-grey-900 rounded-lg text-lg flex items-center justify-center'>
54-
<CameraIcon className='text-grey-600'/>
55-
</button>) : (
73+
<button
74+
disabled
75+
className="w-7 h-7 bg-grey-900 rounded-lg text-lg flex items-center justify-center"
76+
>
77+
<CameraIcon className="text-grey-600" />
78+
</button>
79+
) : (
5680
<TrackToggle
5781
showIcon={false}
5882
className={
@@ -61,24 +85,23 @@ export function FloatingCallControl({ visibleChannel, token }: { visibleChannel?
6185
source={Track.Source.Camera}
6286
>
6387
{currentParticipant.isCameraEnabled ? (
64-
<CameraOffIcon
65-
/>
88+
<CameraOffIcon />
6689
) : (
67-
<CameraIcon
68-
/>
90+
<CameraIcon />
6991
)}
7092
</TrackToggle>
7193
)}
7294
{connectionState !== ConnectionState.Connected ? (
73-
<button disabled
74-
className={`w-7 h-7 bg-grey-900 rounded-lg text-lg flex items-center justify-center ${mediaStyle.disappear}`}>
75-
<ScreenShareIcon className='text-grey-600'/>
76-
</button>) : (
95+
<button
96+
disabled
97+
className={`w-7 h-7 bg-grey-900 rounded-lg text-lg flex items-center justify-center ${mediaStyle.disappear}`}
98+
>
99+
<ScreenShareIcon className="text-grey-600" />
100+
</button>
101+
) : (
77102
<TrackToggle
78103
showIcon={false}
79-
className={
80-
`w-7 h-7 bg-grey-900 hover:bg-grey-800 rounded-lg text-lg flex items-center justify-center ${mediaStyle.disappear}`
81-
}
104+
className={`w-7 h-7 bg-grey-900 hover:bg-grey-800 rounded-lg text-lg flex items-center justify-center ${mediaStyle.disappear}`}
82105
source={Track.Source.ScreenShare}
83106
disabled={true}
84107
>
@@ -95,14 +118,18 @@ export function FloatingCallControl({ visibleChannel, token }: { visibleChannel?
95118
{userSettings ? (
96119
<button
97120
onClick={() => settingsRef(false)}
98-
className={'w-7 h-7 rounded-lg p-1 bg-grey-900 hover:bg-grey-800 flex items-center justify-center'}
121+
className={
122+
'w-7 h-7 rounded-lg p-1 bg-grey-900 hover:bg-grey-800 flex items-center justify-center'
123+
}
99124
>
100-
<MicrophoneIcon width={6} height={6}/>
125+
<MicrophoneIcon width={6} height={6} />
101126
</button>
102127
) : (
103128
<button
104129
onClick={() => settingsRef(true)}
105-
className={'w-7 h-7 rounded-lg p-1 bg-grey-900 hover:bg-grey-800 flex items-center justify-center'}
130+
className={
131+
'w-7 h-7 rounded-lg p-1 bg-grey-900 hover:bg-grey-800 flex items-center justify-center'
132+
}
106133
>
107134
<MicrophoneOff width={6} height={6} />
108135
</button>
@@ -112,11 +139,11 @@ export function FloatingCallControl({ visibleChannel, token }: { visibleChannel?
112139
<TrackToggle
113140
showIcon={false}
114141
source={Track.Source.Microphone}
115-
onClick={() => settingsRef(false)}
116-
className='w-7 h-7 rounded-lg p-1 bg-grey-900 hover:bg-grey-800 flex items-center justify-center'
142+
onClick={() => settingsRef(false)}
143+
className="w-7 h-7 rounded-lg p-1 bg-grey-900 hover:bg-grey-800 flex items-center justify-center"
117144
>
118145
{currentParticipant.isMicrophoneEnabled ? (
119-
<MicrophoneIcon width={6} height={6}/>
146+
<MicrophoneIcon width={6} height={6} />
120147
) : (
121148
<MicrophoneOff width={6} height={6} />
122149
)}

components/home/MediaChat.tsx

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
useUserRef,
88
} from '@/lib/store';
99
import styles from '@/styles/Chat.module.css';
10-
import mediaStyle from '@/styles/Components.module.css';
10+
import mediaStyle from '@/styles/Livekit.module.css';
1111
import { ChannelMediaIcon } from '../icons/ChannelMediaIcon';
1212
import ChannelMessageIcon from '../icons/ChannelMessageIcon';
1313
import { useUser } from '@supabase/auth-helpers-react';
@@ -27,7 +27,11 @@ import { useEffect, useRef, useState } from 'react';
2727
import LoadingIcon from '../icons/LoadingIcon';
2828
import { 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
);

components/home/Modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect, RefObject } from 'react';
2-
import styles from '@/styles/Components.module.css';
2+
import styles from '@/styles/Livekit.module.css';
33
import { KeyboardEventHandler } from 'react';
44

55
export default function Modal({

components/home/ServerList.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import AddServerIcon from '@/components/icons/AddServerIcon';
22
import { SearchBar } from '@/components/forms/Styles';
3-
import mediaStyle from '@/styles/Components.module.css';
3+
import mediaStyle from '@/styles/Livekit.module.css';
44
import { useEffect, useState } from 'react';
55
import Server from '@/components/home/Server';
66
import { useSupabaseClient, useUser } from '@supabase/auth-helpers-react';
@@ -31,7 +31,7 @@ export default function ServerList() {
3131
const supabase = useSupabaseClient();
3232

3333
const servers = useServers();
34-
const [ filteredServers, setFilteredServers ] = useState(servers);
34+
const [filteredServers, setFilteredServers] = useState(servers);
3535
const getServers = useGetServers();
3636

3737
const getUserServerPerms = useGetUserPermsForServer();
@@ -49,6 +49,13 @@ export default function ServerList() {
4949
}
5050
}, [getServers, supabase, user, getUserServerPerms, expanded]);
5151

52+
// HACK: At the time of component render, the servers are not yet loaded into the store.
53+
useEffect(() => {
54+
if (servers) {
55+
setFilteredServers(servers);
56+
}
57+
}, [servers]);
58+
5259
//TODO: add isServer check
5360

5461
return (
@@ -102,7 +109,9 @@ export default function ServerList() {
102109

103110
// Filter servers
104111
const filteredServers = servers.filter((server) => {
105-
return server.servers.name.toLowerCase().includes(value.toLowerCase());
112+
return server.servers.name
113+
.toLowerCase()
114+
.includes(value.toLowerCase());
106115
});
107116

108117
setFilteredServers(filteredServers);
@@ -140,8 +149,8 @@ export default function ServerList() {
140149
}
141150
})}
142151
</div>
143-
{ isInVoice && (
144-
<div className={`w-full self-end mb-7 ${mediaStyle.disappear}` }>
152+
{isInVoice && (
153+
<div className={`w-full self-end mb-7 ${mediaStyle.disappear}`}>
145154
<SidebarCallControl />
146155
</div>
147156
)}

0 commit comments

Comments
 (0)