From 37446bb804e75cc4e611373bcd3daafbb5aa2596 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Mon, 31 May 2021 10:44:24 +0430 Subject: [PATCH] reza added videocall --- src/AppRouter.js | 5 +- src/views/List/IOSSwitch/IOSSwitch.js | 60 +++++++++++++++++ src/views/List/List.js | 56 +--------------- src/views/VideoCall/Avatar/Avatar.js | 67 +++++++++++++++++++ .../VideoCall/BottomControl/BottomControl.js | 41 ++++++++++++ .../BottomControl/BottomControl.scss | 16 +++++ src/views/VideoCall/CallEnd/CallEnd.js | 26 +++++++ src/views/VideoCall/CallStart/CallStart.js | 26 +++++++ src/views/VideoCall/Calling/Calling.js | 36 ++++++++++ src/views/VideoCall/Calling/Calling.scss | 62 +++++++++++++++++ src/views/VideoCall/VideoCall.js | 42 ++++++++++++ src/views/VideoCall/VideoCall.scss | 7 ++ 12 files changed, 388 insertions(+), 56 deletions(-) create mode 100644 src/views/List/IOSSwitch/IOSSwitch.js create mode 100644 src/views/VideoCall/Avatar/Avatar.js create mode 100644 src/views/VideoCall/BottomControl/BottomControl.js create mode 100644 src/views/VideoCall/BottomControl/BottomControl.scss create mode 100644 src/views/VideoCall/CallEnd/CallEnd.js create mode 100644 src/views/VideoCall/CallStart/CallStart.js create mode 100644 src/views/VideoCall/Calling/Calling.js create mode 100644 src/views/VideoCall/Calling/Calling.scss create mode 100644 src/views/VideoCall/VideoCall.js create mode 100644 src/views/VideoCall/VideoCall.scss diff --git a/src/AppRouter.js b/src/AppRouter.js index 3641753..a29acdf 100644 --- a/src/AppRouter.js +++ b/src/AppRouter.js @@ -5,7 +5,7 @@ import proxy from './Redux/proxy'; import Home from './views/Home/Home'; import Auth from './views/Auth/Auth'; import List from './views/List/List'; - +import VideoCall from './views/VideoCall/VideoCall'; class AppRouter extends Component { constructor(props) { super(props); @@ -27,6 +27,9 @@ class AppRouter extends Component { + + + ); diff --git a/src/views/List/IOSSwitch/IOSSwitch.js b/src/views/List/IOSSwitch/IOSSwitch.js new file mode 100644 index 0000000..294b8fa --- /dev/null +++ b/src/views/List/IOSSwitch/IOSSwitch.js @@ -0,0 +1,60 @@ + +import React, { Component } from 'react'; +import { withStyles } from "@material-ui/core/styles"; +import Switch from "@material-ui/core/Switch"; + + +const IOSSwitch = withStyles((theme) => ({ + root: { + width: 42, + height: 26, + padding: 0, + margin: theme.spacing(1), + }, + switchBase: { + padding: 1, + "&$checked": { + transform: "translateX(16px)", + color: theme.palette.common.white, + "& + $track": { + backgroundColor: "#52d869", + opacity: 1, + border: "none", + }, + }, + "&$focusVisible $thumb": { + color: "#52d869", + border: "6px solid #fff", + }, + }, + thumb: { + width: 24, + height: 24, + }, + track: { + borderRadius: 26 / 2, + border: `1px solid ${theme.palette.grey[400]}`, + backgroundColor: theme.palette.grey[50], + opacity: 1, + transition: theme.transitions.create(["background-color", "border"]), + }, + checked: {}, + focusVisible: {}, +}))(({ classes, ...props }) => { + return ( + + ); +}); + +export default IOSSwitch; diff --git a/src/views/List/List.js b/src/views/List/List.js index 1e9d9c3..0b3163a 100644 --- a/src/views/List/List.js +++ b/src/views/List/List.js @@ -1,7 +1,6 @@ import React, { Component } from "react"; import FormControlLabel from "@material-ui/core/FormControlLabel"; -import { withStyles } from "@material-ui/core/styles"; -import Switch from "@material-ui/core/Switch"; +import IOSSwitch from "./IOSSwitch/IOSSwitch"; import ChevronLeftIcon from "@material-ui/icons/ChevronLeft"; import Search from "./Search/Search"; import RowItem from "./RowItem/RowItem"; @@ -179,56 +178,3 @@ export default class List extends Component { ); } } - -const IOSSwitch = withStyles((theme) => ({ - root: { - width: 42, - height: 26, - padding: 0, - margin: theme.spacing(1), - }, - switchBase: { - padding: 1, - "&$checked": { - transform: "translateX(16px)", - color: theme.palette.common.white, - "& + $track": { - backgroundColor: "#52d869", - opacity: 1, - border: "none", - }, - }, - "&$focusVisible $thumb": { - color: "#52d869", - border: "6px solid #fff", - }, - }, - thumb: { - width: 24, - height: 24, - }, - track: { - borderRadius: 26 / 2, - border: `1px solid ${theme.palette.grey[400]}`, - backgroundColor: theme.palette.grey[50], - opacity: 1, - transition: theme.transitions.create(["background-color", "border"]), - }, - checked: {}, - focusVisible: {}, -}))(({ classes, ...props }) => { - return ( - - ); -}); diff --git a/src/views/VideoCall/Avatar/Avatar.js b/src/views/VideoCall/Avatar/Avatar.js new file mode 100644 index 0000000..4025157 --- /dev/null +++ b/src/views/VideoCall/Avatar/Avatar.js @@ -0,0 +1,67 @@ +import React from "react"; +import Badge from "@material-ui/core/Badge"; +import Avatar from "@material-ui/core/Avatar"; +import { makeStyles, withStyles } from "@material-ui/core/styles"; + +const StyledBadge = withStyles((theme) => ({ + badge: { + backgroundColor: "#44b700", + color: "#44b700", + boxShadow: `0 0 0 2px ${theme.palette.background.paper}`, + "&::after": { + position: "absolute", + top: 0, + left: 0, + width: "100%", + height: "100%", + borderRadius: "50%", + animation: "$ripple 1.2s infinite ease-in-out", + border: "1px solid currentColor", + content: '""', + }, + }, + "@keyframes ripple": { + "0%": { + transform: "scale(.8)", + opacity: 1, + }, + "100%": { + transform: "scale(2.4)", + opacity: 0, + }, + }, +}))(Badge); + +const useStyles = makeStyles((theme) => ({ + root: { + display: "flex", + "& > *": { + margin: 0, + }, + }, +})); + +export default function StatusAvatar(props) { + const classes = useStyles(); + + return ( +
+ {props.status ? ( + + + + ) : ( + + + + )} +
+ ); +} diff --git a/src/views/VideoCall/BottomControl/BottomControl.js b/src/views/VideoCall/BottomControl/BottomControl.js new file mode 100644 index 0000000..380c8ff --- /dev/null +++ b/src/views/VideoCall/BottomControl/BottomControl.js @@ -0,0 +1,41 @@ +import React, { Component } from "react"; +import MicIcon from '@material-ui/icons/Mic'; +import MicOffIcon from '@material-ui/icons/MicOff'; +import VideocamOffIcon from '@material-ui/icons/VideocamOff'; +import VideocamIcon from '@material-ui/icons/Videocam'; +import FlipCameraIosIcon from "@material-ui/icons/FlipCameraIos"; +import FormControlLabel from '@material-ui/core/FormControlLabel'; +import Checkbox from '@material-ui/core/Checkbox'; + + +import "./BottomControl.scss"; +export default class BottomControl extends Component { + render() { + return ( +
+ } + checkedIcon={} + name="checkedI" + /> + } + label="" + /> + } + checkedIcon={} + name="checkedI" + /> + } + label="" + /> + + +
+ ); + } +} diff --git a/src/views/VideoCall/BottomControl/BottomControl.scss b/src/views/VideoCall/BottomControl/BottomControl.scss new file mode 100644 index 0000000..e67042f --- /dev/null +++ b/src/views/VideoCall/BottomControl/BottomControl.scss @@ -0,0 +1,16 @@ +.bottom-control{ + width: 100%; + height: 70px; + align-items: center; + justify-content:space-between; + padding : 0px 30px; + position: fixed; + bottom: 0px; + left : 0px; + .MuiFormControlLabel-root{ + margin : 0px !important; + } + .PrivateSwitchBase-root-4{ + padding : 0px !important; + } +} \ No newline at end of file diff --git a/src/views/VideoCall/CallEnd/CallEnd.js b/src/views/VideoCall/CallEnd/CallEnd.js new file mode 100644 index 0000000..eb37a0e --- /dev/null +++ b/src/views/VideoCall/CallEnd/CallEnd.js @@ -0,0 +1,26 @@ +import React, { Component } from "react"; +import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; + +import StatusAvatar from '../Avatar/Avatar'; + +export default class CallEnd extends Component { + constructor(props) { + super(props); + this.state = { + }; + } + render() { + const {brand,user} = this.props; + return ( +
+
+
{brand}
+
+ +
+
+ +
+ ); + } +} diff --git a/src/views/VideoCall/CallStart/CallStart.js b/src/views/VideoCall/CallStart/CallStart.js new file mode 100644 index 0000000..5bc4cfc --- /dev/null +++ b/src/views/VideoCall/CallStart/CallStart.js @@ -0,0 +1,26 @@ +import React, { Component } from "react"; +import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; + +import StatusAvatar from '../Avatar/Avatar'; + +export default class CallStart extends Component { + constructor(props) { + super(props); + this.state = { + }; + } + render() { + const {brand,user} = this.props; + return ( +
+
+
{brand}
+
+ +
+
+ +
+ ); + } +} diff --git a/src/views/VideoCall/Calling/Calling.js b/src/views/VideoCall/Calling/Calling.js new file mode 100644 index 0000000..ecd2a2f --- /dev/null +++ b/src/views/VideoCall/Calling/Calling.js @@ -0,0 +1,36 @@ +import React, { Component } from "react"; +import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; +import CallEndIcon from "@material-ui/icons/CallEnd"; + +import BottomControl from "../BottomControl/BottomControl"; +import StatusAvatar from "../Avatar/Avatar"; + +import "./Calling.scss"; +export default class Calling extends Component { + constructor(props) { + super(props); + this.state = {}; + } + render() { + const { brand, user, phase } = this.props; + return ( +
+
+

{brand}

+
+ +
+
+
+ +
+

{user.name}

+
{phase}
+ + +
+ ); + } +} diff --git a/src/views/VideoCall/Calling/Calling.scss b/src/views/VideoCall/Calling/Calling.scss new file mode 100644 index 0000000..bd48a2f --- /dev/null +++ b/src/views/VideoCall/Calling/Calling.scss @@ -0,0 +1,62 @@ +.video-calling{ + width: 100%; + height: 100%; + align-items: center; + padding : 15px; + position: relative; + &__header{ + justify-content : center; + align-items: center; + width: 100%; + margin-bottom: 25px; + font-size: 16px; + position: fixed; + top : 20px; + left : 0px; + h1{ + font-size: 18px; + margin : 0px; + font-weight: 100; + letter-spacing: 1px; + // position : fixed; + // left : calc(50% - 35px); + // top : 100px; + } + &--expand{ + position: absolute; + left: 0px; + top : 0px; + } + } + &__avatar{ + position: fixed; + left: calc(50% - 45px); + top : 55px; + } + h2{ + font-size: 22px; + margin-top: 20px; + position: fixed; + left: calc(50% - 25px); + top : 140px; + } + &__phase{ + margin-top: 15px; + position: fixed; + left: calc(50% - 25px); + top : 200px; + } + &__endButton{ + width: 56px; + height: 56px; + border: none; + background-color:rgb(209, 52, 52); + display: flex; + justify-content: center; + align-items: center; + border-radius: 50%; + position: fixed; + bottom : 100px; + left : calc(50% - 28px); + } +} \ No newline at end of file diff --git a/src/views/VideoCall/VideoCall.js b/src/views/VideoCall/VideoCall.js new file mode 100644 index 0000000..f67fa6f --- /dev/null +++ b/src/views/VideoCall/VideoCall.js @@ -0,0 +1,42 @@ +import React, { Component } from "react"; + +import Calling from "./Calling/Calling"; +import CallStart from "./CallStart/CallStart"; +import CallEnd from "./CallEnd/CallEnd"; + +import pic from "../../assets/images/pic.png"; + +import "./VideoCall.scss"; +export default class VideoCall extends Component { + constructor(props) { + super(props); + this.state = { + phase: "Calling", + }; + } + render() { + const { phase } = this.state; + return ( +
+ {phase === "Calling" ? ( + + ) : null} + {phase === "Start" ? : null} + {phase === "End" ? : null} +
+ ); + } +} + +VideoCall.defaultProps = { + brand: "نام برند", + user: { + status: 0, + src: pic, + name: "حسن", + }, +}; diff --git a/src/views/VideoCall/VideoCall.scss b/src/views/VideoCall/VideoCall.scss new file mode 100644 index 0000000..8529af9 --- /dev/null +++ b/src/views/VideoCall/VideoCall.scss @@ -0,0 +1,7 @@ +.video-call{ + height: 100vh; + width: 100vw; + overflow: hidden; + background-color: rgba(6, 14, 8, 0.849); + color: white; +} \ No newline at end of file