Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SpeakEzy_Frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Thisara Kavinda
SpeakEzy_Frontend
Commits
37f6fb5d
Commit
37f6fb5d
authored
Mar 14, 2024
by
Thisara Kavinda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: created MeetingLoading component
parent
b188752b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
102 deletions
+135
-102
src/Components/MeetingLoading/MeetingLoading.tsx
src/Components/MeetingLoading/MeetingLoading.tsx
+130
-0
src/Services/AgoraManager/AgoraManager.tsx
src/Services/AgoraManager/AgoraManager.tsx
+5
-102
No files found.
src/Components/MeetingLoading/MeetingLoading.tsx
0 → 100644
View file @
37f6fb5d
import
{
Box
,
Button
,
CircularProgress
,
Typography
}
from
'
@mui/material
'
import
{
useTheme
,
type
Theme
}
from
'
@mui/material/styles
'
interface
Props
{
variant
:
'
joining
'
|
'
loading
'
|
'
error
'
}
const
MeetingLoading
=
({
variant
}:
Props
)
=>
{
const
theme
:
Theme
=
useTheme
()
const
renderComponent
=
():
JSX
.
Element
=>
{
switch
(
variant
)
{
case
'
joining
'
:
return
(
<
Box
sx=
{
{
height
:
'
100%
'
,
width
:
'
100%
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
}
}
>
<
Typography
variant=
'h3'
textAlign=
{
'
center
'
}
sx=
{
{
fontSize
:
'
18px
'
,
color
:
theme
.
palette
.
common
.
white
,
fontWeight
:
'
600
'
}
}
>
Joining the meeting...
</
Typography
>
</
Box
>
)
case
'
loading
'
:
return
(
<
Box
sx=
{
{
height
:
'
100%
'
,
width
:
'
100%
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
}
}
>
<
Box
sx=
{
{
display
:
'
flex
'
,
flexDirection
:
'
row
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
}
}
>
<
CircularProgress
size=
{
'
md
'
}
sx=
{
{
color
:
theme
.
palette
.
common
.
white
,
height
:
'
20px
'
,
width
:
'
20px
'
,
marginRight
:
'
20px
'
,
}
}
/>
<
Typography
variant=
'h3'
textAlign=
{
'
center
'
}
sx=
{
{
fontSize
:
'
18px
'
,
color
:
theme
.
palette
.
common
.
white
,
fontWeight
:
'
600
'
}
}
>
Loading devices
</
Typography
>
</
Box
>
</
Box
>
)
case
'
error
'
:
return
(
<
Box
sx=
{
{
height
:
'
100%
'
,
width
:
'
100%
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
}
}
>
<
Box
sx=
{
{
backgroundColor
:
'
#262625
'
,
borderRadius
:
'
20px
'
,
padding
:
'
20px 40px
'
,
width
:
'
30%
'
,
display
:
'
flex
'
,
flexDirection
:
'
column
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
}
}
>
<
Typography
variant=
'h3'
textAlign=
{
'
center
'
}
sx=
{
{
fontSize
:
'
18px
'
,
color
:
theme
.
palette
.
common
.
white
,
fontWeight
:
'
600
'
,
marginTop
:
'
10px
'
,
}
}
>
Unexpected error occurred. Please try reloading the page. 😞
</
Typography
>
<
Button
variant=
'text'
sx=
{
{
color
:
theme
.
palette
.
primary
.
main
,
borderRadius
:
'
10px
'
,
padding
:
'
10px 20px
'
,
marginTop
:
'
10px
'
,
fontWeight
:
'
600
'
,
}
}
onClick=
{
()
=>
window
.
location
.
reload
()
}
>
Reload
</
Button
>
</
Box
>
</
Box
>
)
default
:
return
<></>
}
}
return
renderComponent
()
}
export
default
MeetingLoading
src/Services/AgoraManager/AgoraManager.tsx
View file @
37f6fb5d
...
@@ -12,8 +12,9 @@ import {
...
@@ -12,8 +12,9 @@ import {
import
React
,
{
createContext
,
useContext
,
useEffect
}
from
'
react
'
import
React
,
{
createContext
,
useContext
,
useEffect
}
from
'
react
'
import
type
{
IMicrophoneAudioTrack
,
ICameraVideoTrack
}
from
'
agora-rtc-sdk-ng
'
import
type
{
IMicrophoneAudioTrack
,
ICameraVideoTrack
}
from
'
agora-rtc-sdk-ng
'
import
{
Box
,
Button
,
CircularProgress
,
Typography
}
from
'
@mui/material
'
import
{
Box
}
from
'
@mui/material
'
import
{
useTheme
,
type
Theme
}
from
'
@mui/material/styles
'
import
{
useTheme
,
type
Theme
}
from
'
@mui/material/styles
'
import
MeetingLoading
from
'
../../Components/MeetingLoading/MeetingLoading
'
interface
AgoraContextType
{
interface
AgoraContextType
{
localCameraTrack
:
ICameraVideoTrack
|
null
localCameraTrack
:
ICameraVideoTrack
|
null
...
@@ -82,59 +83,9 @@ export const AgoraManager = ({ children }: { children: React.ReactNode }) => {
...
@@ -82,59 +83,9 @@ export const AgoraManager = ({ children }: { children: React.ReactNode }) => {
return
(
return
(
<
Box
sx=
{
{
width
:
'
100%
'
,
height
:
'
100%
'
,
backgroundColor
:
theme
.
palette
.
background
.
default
}
}
>
<
Box
sx=
{
{
width
:
'
100%
'
,
height
:
'
100%
'
,
backgroundColor
:
theme
.
palette
.
background
.
default
}
}
>
{
isJoining
?
(
{
isJoining
?
(
<
Box
<
MeetingLoading
variant=
'joining'
/>
sx=
{
{
height
:
'
100%
'
,
width
:
'
100%
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
}
}
>
<
Typography
variant=
'h3'
textAlign=
{
'
center
'
}
sx=
{
{
fontSize
:
'
18px
'
,
color
:
theme
.
palette
.
common
.
white
,
fontWeight
:
'
600
'
}
}
>
Joining the meeting...
</
Typography
>
</
Box
>
)
:
isLoadingCam
||
isLoadingMic
?
(
)
:
isLoadingCam
||
isLoadingMic
?
(
<
Box
<
MeetingLoading
variant=
'loading'
/>
sx=
{
{
height
:
'
100%
'
,
width
:
'
100%
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
}
}
>
<
Box
sx=
{
{
display
:
'
flex
'
,
flexDirection
:
'
row
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
}
}
>
<
CircularProgress
size=
{
'
md
'
}
sx=
{
{
color
:
theme
.
palette
.
common
.
white
,
height
:
'
20px
'
,
width
:
'
20px
'
,
marginRight
:
'
20px
'
,
}
}
/>
<
Typography
variant=
'h3'
textAlign=
{
'
center
'
}
sx=
{
{
fontSize
:
'
18px
'
,
color
:
theme
.
palette
.
common
.
white
,
fontWeight
:
'
600
'
}
}
>
Loading devices
</
Typography
>
</
Box
>
</
Box
>
)
:
isJoined
?
(
)
:
isJoined
?
(
<
AgoraProvider
<
AgoraProvider
localCameraTrack=
{
localCameraTrack
}
localCameraTrack=
{
localCameraTrack
}
...
@@ -155,58 +106,10 @@ export const AgoraManager = ({ children }: { children: React.ReactNode }) => {
...
@@ -155,58 +106,10 @@ export const AgoraManager = ({ children }: { children: React.ReactNode }) => {
</
div
>
</
div
>
</
AgoraProvider
>
</
AgoraProvider
>
)
:
joinError
?
(
)
:
joinError
?
(
<
Box
<
MeetingLoading
variant=
'error'
/>
sx=
{
{
height
:
'
100%
'
,
width
:
'
100%
'
,
display
:
'
flex
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
}
}
>
<
Box
sx=
{
{
backgroundColor
:
'
#262625
'
,
borderRadius
:
'
20px
'
,
padding
:
'
20px 40px
'
,
width
:
'
30%
'
,
display
:
'
flex
'
,
flexDirection
:
'
column
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
}
}
>
<
Typography
variant=
'h3'
textAlign=
{
'
center
'
}
sx=
{
{
fontSize
:
'
18px
'
,
color
:
theme
.
palette
.
common
.
white
,
fontWeight
:
'
600
'
,
marginTop
:
'
10px
'
,
}
}
>
Unexpected error occurred. Please try reloading the page. 😞
</
Typography
>
<
Button
variant=
'text'
sx=
{
{
color
:
theme
.
palette
.
primary
.
main
,
borderRadius
:
'
10px
'
,
padding
:
'
10px 20px
'
,
marginTop
:
'
10px
'
,
fontWeight
:
'
600
'
,
}
}
onClick=
{
()
=>
window
.
location
.
reload
()
}
>
Reload
</
Button
>
</
Box
>
</
Box
>
)
:
null
}
)
:
null
}
</
Box
>
</
Box
>
)
)
}
}
// Export the AgoraManager component as the default export
export
default
AgoraManager
export
default
AgoraManager
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment