Skip to content
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

Open
wants to merge 20 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"type": "git",
"url": "https://github.com/zurichat/zc_main"
},

"bugs": {
"url": "https://github.com/zurichat/zc_main/issues"
},
Expand Down Expand Up @@ -49,3 +48,4 @@
},
"dependencies": {}
}

34 changes: 0 additions & 34 deletions packages/main/src/components/media-chat/VideoChat.jsx

This file was deleted.

129 changes: 129 additions & 0 deletions packages/main/src/components/media-chat/video/VideoRoom.jsx
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`
Copy link
Collaborator

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

)
.then(response => {
if (response.status === 200) {
setToken(response.data.data.token);
setVideoCall(true);
}
})
.catch(error => console.log(error));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user isn't going to open the log
Handle the error properly

};
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;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useTranslation } from "react-i18next";

const EditWorkspaceModal = ({ workSpace, editDetails, setEditDetails }) => {
const { t } = useTranslation();

Copy link
Collaborator

Choose a reason for hiding this comment

The 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"));
Expand Down
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";
Copy link
Collaborator

Choose a reason for hiding this comment

The 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 = [];

Expand Down Expand Up @@ -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}
Expand All @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

.item__img {
margin-left: 0.1rem;
width: 14px;
}

.item__list,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@
}

.subCon2 {
height: 100%;
height: 90vh;
width: unset;
display: flex;
flex-direction: column;
justify-content: space-between;
gap: 20px;
}

.subCon2::-webkit-scrollbar {
Expand Down Expand Up @@ -264,3 +268,32 @@
.displayCategory {
display: block;
}

.videoCall {
height: 50px;
border-top: 2px solid rgba(128, 128, 128, 0.5);
display: flex;
justify-content: flex-start;
align-items: center;
gap: 20px;
padding: 0px 20px;
cursor: pointer;
}

.videoCall:hover {
background-color: #7ed5af;
}

.videoCall:active {
background-color: #7ed5af;
}
.videoCall > div {
width: 100%;
}

.videoCall > div > div {
display: flex;
justify-content: space-between;
align-items: center;
gap: 20px;
}
Loading