-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/fe 60 implement agora video call using agora UIKIT #2842
base: dev
Are you sure you want to change the base?
Changes from all commits
1af2b75
c1ed3f5
ceb89b4
8529361
ebd8113
4d9554a
79059a0
d206e66
d7b40a1
ee07c26
ba43efb
db2f2b0
79e35c8
ce9e9fe
ee88331
177f507
f3d1ef0
076f39f
3a76289
f21a340
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import { useState, useEffect } from "react"; | ||
import AgoraUIKit from "agora-react-uikit"; | ||
import { AGORA_APP_ID, AGORA_TOKEN } from "@zuri/utilities"; | ||
import styles from "./styles/videoRoom.css"; | ||
import axios from "axios"; | ||
|
||
const VideoRoom = ({ workspaceId }) => { | ||
const [videoCall, setVideoCall] = useState(false); | ||
const [token, setToken] = useState(null); | ||
const fetchToken = () => { | ||
axios | ||
.get( | ||
`https://staging.api.zuri.chat/rtc/${workspaceId}/publisher/userAccount` | ||
) | ||
.then(response => { | ||
if (response.status === 200) { | ||
setToken(response.data.data.token); | ||
setVideoCall(true); | ||
} | ||
}) | ||
.catch(error => console.log(error)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The user isn't going to open the log |
||
}; | ||
useEffect(() => { | ||
fetchToken(); | ||
}, []); | ||
const rtcProps = { | ||
appId: AGORA_APP_ID, | ||
channel: workspaceId, | ||
token: token | ||
}; | ||
const callbacks = { | ||
EndCall: () => setVideoCall(false) | ||
}; | ||
|
||
const styleProps = { | ||
videoMode: { max: "cover" }, | ||
UIKitContainer: { | ||
position: "relative", | ||
background: "#838383", | ||
overflow: "hidden" | ||
}, | ||
minViewContainer: { | ||
maxWidth: "auto", | ||
maxHeight: "168px", | ||
position: "absolute", | ||
top: "0px", | ||
right: "0px", | ||
display: "flex", | ||
justifyContent: "flex-end" | ||
}, | ||
minViewStyles: { | ||
maxWidth: "128px", | ||
maxHeight: "128px", | ||
margin: "32px 40px 0 0", | ||
overflow: "hidden", | ||
borderRadius: "10px", | ||
boxShadow: "1px 1px 15px 3px rgba(184, 88, 32, 0.2)" | ||
}, | ||
minViewOverlayContainer: { | ||
background: "red" | ||
}, | ||
|
||
maxViewContainer: { | ||
position: "absolute", | ||
width: "100%", | ||
height: "100%" | ||
}, | ||
maxViewStyles: {}, | ||
localBtnContainer: { | ||
background: "#00b87c" | ||
}, | ||
localBtnStyles: { | ||
endCall: { | ||
minHeight: "48px", | ||
minWidth: "48px", | ||
background: "rgb(220,60,60)", | ||
border: "none" | ||
}, | ||
muteLocalAudio: { | ||
minHeight: "48px", | ||
minWidth: "48px", | ||
background: "transparent", | ||
border: "none" | ||
}, | ||
muteLocalVideo: { | ||
minHeight: "48px", | ||
minWidth: "48px", | ||
background: "transparent", | ||
border: "none" | ||
} | ||
} | ||
}; | ||
return videoCall ? ( | ||
<div | ||
style={{ | ||
display: "flex", | ||
width: "100%", | ||
height: "100vh", | ||
padding: "10px" | ||
}} | ||
> | ||
<AgoraUIKit | ||
styleProps={styleProps} | ||
rtcProps={rtcProps} | ||
callbacks={callbacks} | ||
/> | ||
</div> | ||
) : ( | ||
<div | ||
style={{ | ||
justifyContent: "center", | ||
display: "flex", | ||
alignItems: "center", | ||
height: "100%", | ||
width: "100%" | ||
}} | ||
> | ||
<button | ||
colorScheme="blue" | ||
onClick={() => setVideoCall(true)} | ||
className={styles.joinBtn} | ||
> | ||
Join Video Chat | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default VideoRoom; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.joinBtn { | ||
padding: 12px 24px; | ||
font-size: 21px; | ||
background-color: #20c997; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import { useTranslation } from "react-i18next"; | |
|
||
const EditWorkspaceModal = ({ workSpace, editDetails, setEditDetails }) => { | ||
const { t } = useTranslation(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove stray changes like this and the one you made in the package.json |
||
// getting current workspace id | ||
const currentWorkspace = localStorage.getItem("currentWorkspace"); | ||
const orgs = JSON.parse(sessionStorage.getItem("organisations")); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
import { useState, useEffect, useRef, useCallback } from "react"; | ||
import { navigateToUrl } from "single-spa"; | ||
import styles from "../styles/Sidebar.module.css"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
// import videoIcon from "../assets/icons/videos.svg"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove commented out code |
||
import threadIcon from "../assets/icons/thread-icon.svg"; | ||
import dmIcon from "../assets/icons/dm-icon.svg"; | ||
import liveicon from "../assets/icons/newlive.svg"; | ||
import phoneicon from "../assets/icons/phone.svg"; | ||
import draftIcon from "../assets/icons/draft-icon.svg"; | ||
import { subscribeToChannel } from "@zuri/utilities"; | ||
import { ACTIONS } from "../reducers/sidebar.reducer"; | ||
import Header from "./Header"; | ||
import Room from "./Room"; | ||
import SingleRoom from "./SingleRoom"; | ||
import Category from "./Category"; | ||
import Starred from "./Starred"; | ||
import { storeSideBarInfo } from "../../../../utils/cache-sidebar"; | ||
import { FiVideo } from "react-icons/fi"; | ||
|
||
const categories = []; | ||
|
||
|
@@ -231,7 +230,7 @@ const Sidebar = props => { | |
<div className={styles.sb__content}> | ||
<Header state={props.state} /> | ||
<div className={`${styles.subCon2}`}> | ||
<> | ||
<div> | ||
<SingleRoom | ||
name={`${t("workspace_chat.threads")}`} | ||
image={threadIcon} | ||
|
@@ -242,30 +241,28 @@ const Sidebar = props => { | |
image={dmIcon} | ||
link={`/workspace/${currentWorkspaceShort}/plugin-chat/all-dms`} | ||
/> | ||
<SingleRoom | ||
name="Video Chat" | ||
image={dmIcon} | ||
link={`/workspace/${currentWorkspaceShort}/video-chat`} | ||
/> | ||
<SingleRoom | ||
name={`${t("workspace_chat.drafts")}`} | ||
image={draftIcon} | ||
/> | ||
<SingleRoom | ||
name="LiveBroadcast" | ||
image={liveicon} | ||
link={`/workspace/${currentWorkspaceShort}/LiveBroadcast`} | ||
/> | ||
<SingleRoom | ||
name="Voice Call" | ||
image={phoneicon} | ||
link={`/workspace/${currentWorkspaceShort}/voice-call`} | ||
/> | ||
Comment on lines
-254
to
-263
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Broadcast and voice call are no longer available? |
||
<div className={styles.sb__divider} /> | ||
<Starred starredRooms={starredRooms} /> | ||
{singleItems} | ||
{categorizedItems} | ||
</> | ||
</div> | ||
<div> | ||
<div | ||
className={styles.videoCall} | ||
onClick={() => | ||
navigateToUrl( | ||
`/workspace/${currentWorkspaceShort}/video-chat` | ||
) | ||
} | ||
> | ||
<FiVideo /> | ||
Video call | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ | |
|
||
.item__img { | ||
margin-left: 0.1rem; | ||
width: 14px; | ||
} | ||
|
||
.item__list, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the hardcoded variables not this one