File tree Expand file tree Collapse file tree 4 files changed +66
-18
lines changed Expand file tree Collapse file tree 4 files changed +66
-18
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ const appReducer = (state, action) => {
1313 case "initStream" : {
1414 return { ...state , stream : action . stream } ;
1515 }
16+ case "info" : {
17+ return { ...state , viewers : action . viewers } ;
18+ }
19+
1620 default : {
1721 return { ...state } ;
1822 }
@@ -21,6 +25,7 @@ const appReducer = (state, action) => {
2125
2226const initialState = {
2327 stream : null ,
28+ viewers : null ,
2429} ;
2530
2631const App = ( ) => {
@@ -96,6 +101,11 @@ const App = () => {
96101 console . log ( "Candidate" ) ;
97102 pc . addIceCandidate ( offerCandidate ) ;
98103 return ;
104+ case "info" :
105+ dispatch ( {
106+ type : "info" ,
107+ viewers : JSON . parse ( msg . data ) . no_connections ,
108+ } ) ;
99109 }
100110 } ;
101111 }
@@ -106,7 +116,7 @@ const App = () => {
106116 < MainContainer >
107117 < VideoContainer >
108118 < VideoPlayer src = { state . stream } />
109- < VideoDetails />
119+ < VideoDetails viewers = { state . viewers } />
110120 </ VideoContainer >
111121 < LiveChat > </ LiveChat >
112122 </ MainContainer >
Original file line number Diff line number Diff line change 11import React from "react" ;
2+ import PropTypes from "prop-types" ;
23import {
34 DetailHeadingBox ,
45 VideoDetailsContainer ,
56 DetailsTitle ,
67 DetailsHeading ,
8+ DetailsTop ,
79 AlphaTag ,
10+ ViewerTag ,
811} from "../styles/videoDetailsStyles" ;
912import { LightspeedLogoURL } from "../assets/constants" ;
1013
11- const VideoDetails = ( ) => {
14+ const VideoDetails = ( { viewers } ) => {
1215 return (
1316 < VideoDetailsContainer >
17+ < DetailsTop >
18+ < AlphaTag >
19+ < i className = "fas fa-construction badge-icon" > </ i >
20+ < span > Alpha</ span >
21+ </ AlphaTag >
22+ < ViewerTag >
23+ < i className = "fas fa-user-friends" > </ i >
24+ < span > { viewers } </ span >
25+ </ ViewerTag >
26+ </ DetailsTop >
1427 < DetailHeadingBox >
1528 < DetailsTitle >
16- < AlphaTag >
17- < i className = "fas fa-construction badge-icon" > </ i >
18- < span > Alpha</ span >
19- </ AlphaTag >
20- < DetailsHeading >
21- Welcome to Project Lightspeed - The future of live entertainment
22- </ DetailsHeading >
29+ < DetailsHeading > Welcome to Project Lightspeed</ DetailsHeading >
2330 </ DetailsTitle >
2431 < img id = "detail-img" src = { LightspeedLogoURL } > </ img >
2532 </ DetailHeadingBox >
@@ -28,3 +35,7 @@ const VideoDetails = () => {
2835} ;
2936
3037export default VideoDetails ;
38+
39+ VideoDetails . propTypes = {
40+ viewers : PropTypes . number ,
41+ } ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export const ChatContainer = styled.div`
66 position: relative;
77 color: #fff;
88 margin: 0 2.5em;
9- min-width: 20em ;
9+ min-width: 25em ;
1010
1111 @media only screen and (max-width: 1024px) {
1212 margin: 1em 0.3em;
Original file line number Diff line number Diff line change 11import styled from "styled-components" ;
22
3- export const VideoDetailsContainer = styled . div `
3+ export const VideoDetailsContainer = styled . div `
44 width: 100%;
55 background-color: #242731;
66 text-align: left;
@@ -9,33 +9,60 @@ export const VideoDetailsContainer = styled.div`
99 border-radius: 32px;
1010` ;
1111
12- export const DetailHeadingBox = styled . div `
12+ export const DetailHeadingBox = styled . div `
1313 display: flex;
1414 flex-direction: row;
15- justify-content: space-evenly ;
15+ justify-content: space-between ;
1616 margin: 0 2em 3em 2em;
1717
1818 img {
1919 height: 130px;
2020 width: 130px;
21- margin: auto;
21+
2222
2323 @media only screen and (max-width: 1024px) {
2424 display: none;
2525 }
2626 }
2727` ;
2828
29- export const DetailsTitle = styled . div `
29+ export const DetailsTitle = styled . div `
3030 display: flex;
3131 flex-direction: column;
32+ justify-content: center;
33+ ` ;
34+
35+ export const DetailsTop = styled . div `
36+ display: flex;
37+ flex-direction: row;
38+ justify-content: space-between;
39+ margin-bottom: 1rem;
40+ padding-left: 2rem;
3241` ;
3342
34- export const DetailsHeading = styled . h4 `
43+ export const DetailsHeading = styled . h4 `
3544 font-size: 30px;
3645` ;
46+ export const ViewerTag = styled . div `
47+ display: flex;
48+ flex-direction: row;
49+ justify-content: space-evenly;
50+ height: 35px;
51+ width: 110px;
52+
3753
38- export const AlphaTag = styled . div `
54+ border-radius: 8px;
55+
56+ i {
57+ margin: auto 0;
58+ }
59+
60+ span {
61+ margin: auto 0;
62+ font-weight: 600;
63+ }
64+ ` ;
65+ export const AlphaTag = styled . div `
3966 display: flex;
4067 flex-direction: row;
4168 justify-content: space-evenly;
@@ -52,4 +79,4 @@ export const AlphaTag = styled.div`
5279 span {
5380 margin: auto 0;
5481 }
55- ` ;
82+ ` ;
You can’t perform that action at this time.
0 commit comments