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) => {
13
13
case "initStream" : {
14
14
return { ...state , stream : action . stream } ;
15
15
}
16
+ case "info" : {
17
+ return { ...state , viewers : action . viewers } ;
18
+ }
19
+
16
20
default : {
17
21
return { ...state } ;
18
22
}
@@ -21,6 +25,7 @@ const appReducer = (state, action) => {
21
25
22
26
const initialState = {
23
27
stream : null ,
28
+ viewers : null ,
24
29
} ;
25
30
26
31
const App = ( ) => {
@@ -96,6 +101,11 @@ const App = () => {
96
101
console . log ( "Candidate" ) ;
97
102
pc . addIceCandidate ( offerCandidate ) ;
98
103
return ;
104
+ case "info" :
105
+ dispatch ( {
106
+ type : "info" ,
107
+ viewers : JSON . parse ( msg . data ) . no_connections ,
108
+ } ) ;
99
109
}
100
110
} ;
101
111
}
@@ -106,7 +116,7 @@ const App = () => {
106
116
< MainContainer >
107
117
< VideoContainer >
108
118
< VideoPlayer src = { state . stream } />
109
- < VideoDetails />
119
+ < VideoDetails viewers = { state . viewers } />
110
120
</ VideoContainer >
111
121
< LiveChat > </ LiveChat >
112
122
</ MainContainer >
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
+ import PropTypes from "prop-types" ;
2
3
import {
3
4
DetailHeadingBox ,
4
5
VideoDetailsContainer ,
5
6
DetailsTitle ,
6
7
DetailsHeading ,
8
+ DetailsTop ,
7
9
AlphaTag ,
10
+ ViewerTag ,
8
11
} from "../styles/videoDetailsStyles" ;
9
12
import { LightspeedLogoURL } from "../assets/constants" ;
10
13
11
- const VideoDetails = ( ) => {
14
+ const VideoDetails = ( { viewers } ) => {
12
15
return (
13
16
< 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 >
14
27
< DetailHeadingBox >
15
28
< 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 >
23
30
</ DetailsTitle >
24
31
< img id = "detail-img" src = { LightspeedLogoURL } > </ img >
25
32
</ DetailHeadingBox >
@@ -28,3 +35,7 @@ const VideoDetails = () => {
28
35
} ;
29
36
30
37
export 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`
6
6
position: relative;
7
7
color: #fff;
8
8
margin: 0 2.5em;
9
- min-width: 20em ;
9
+ min-width: 25em ;
10
10
11
11
@media only screen and (max-width: 1024px) {
12
12
margin: 1em 0.3em;
Original file line number Diff line number Diff line change 1
1
import styled from "styled-components" ;
2
2
3
- export const VideoDetailsContainer = styled . div `
3
+ export const VideoDetailsContainer = styled . div `
4
4
width: 100%;
5
5
background-color: #242731;
6
6
text-align: left;
@@ -9,33 +9,60 @@ export const VideoDetailsContainer = styled.div`
9
9
border-radius: 32px;
10
10
` ;
11
11
12
- export const DetailHeadingBox = styled . div `
12
+ export const DetailHeadingBox = styled . div `
13
13
display: flex;
14
14
flex-direction: row;
15
- justify-content: space-evenly ;
15
+ justify-content: space-between ;
16
16
margin: 0 2em 3em 2em;
17
17
18
18
img {
19
19
height: 130px;
20
20
width: 130px;
21
- margin: auto;
21
+
22
22
23
23
@media only screen and (max-width: 1024px) {
24
24
display: none;
25
25
}
26
26
}
27
27
` ;
28
28
29
- export const DetailsTitle = styled . div `
29
+ export const DetailsTitle = styled . div `
30
30
display: flex;
31
31
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;
32
41
` ;
33
42
34
- export const DetailsHeading = styled . h4 `
43
+ export const DetailsHeading = styled . h4 `
35
44
font-size: 30px;
36
45
` ;
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
+
37
53
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 `
39
66
display: flex;
40
67
flex-direction: row;
41
68
justify-content: space-evenly;
@@ -52,4 +79,4 @@ export const AlphaTag = styled.div`
52
79
span {
53
80
margin: auto 0;
54
81
}
55
- ` ;
82
+ ` ;
You can’t perform that action at this time.
0 commit comments