Skip to content

Commit 3cbc303

Browse files
committed
Fix disconnect button being off center in mobile and chat messages breaking when having malformed og meta data
1 parent 5201dcb commit 3cbc303

File tree

7 files changed

+15
-31
lines changed

7 files changed

+15
-31
lines changed

streams-react/src/components/ChatHeader/ChatHeader.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
import { useContext } from "react";
2-
import { ChatContext } from "../../context/ChatContext";
32
import { SocketContext } from "../../context/SocketContext";
43
import styles from "./ChatHeader.module.css";
54

65
const ChatHeader = () => {
76
const {users, roomName} = useContext(SocketContext);
8-
const {setIsChatOpen} = useContext(ChatContext);
97
const totalOnline = Object.keys(users).length;
108

11-
const handleClick = () => {
12-
setIsChatOpen(prev => !prev);
13-
};
14-
159
return(
1610
<div className={styles.container}>
17-
<button className={styles.close__button} onClick={handleClick}>
18-
<i className={`fas fa-times ${styles.close__icon}`}></i>
19-
</button>
2011
<h2 className={styles.chat__header}>{roomName}</h2>
2112
<p className={styles.chat__online}>Currently Online: {totalOnline}</p>
2213
</div>

streams-react/src/components/ChatHeader/ChatHeader.module.css

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,4 @@
2929
}
3030
.chat__online {
3131
align-self: flex-start;
32-
}
33-
.close__button {
34-
position: absolute;
35-
top: 5px;
36-
right: 5px;
37-
color: #EEEEEE;
38-
cursor: pointer;
39-
transition: all 0.1s ease-out;
40-
}
41-
.close__button:hover, .close__button:focus {
42-
color: white;
43-
}
44-
.close__icon {
45-
font-size: 2em;
4632
}

streams-react/src/components/ChatUserMessage/ChatUserMessage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ const ChatUserMessage = ({message, ogMeta}) => {
7676
{!hasURL && ogMeta.success &&
7777
<div className={styles.ogCard__container}>
7878
<a href={ogMeta.requestUrl} className={styles.ogCard__link} target="_blank" rel="noopener noreferrer">
79-
<div className={styles.ogCard__image__container}>
80-
<img src={ogMeta.ogImage.url} alt={ogMeta.ogTitle} className={styles.ogCard__image} />
79+
<div className={`${styles.ogCard__image__container} ${ogMeta.ogImage ? "" : styles.hidden}`}>
80+
<img src={ogMeta.ogImage?.url} alt={ogMeta.ogTitle} className={styles.ogCard__image} />
8181
</div>
8282
<div className={styles.ogCard__description__container}>
8383
<p className={styles.ogCard__description}>{ogMeta.ogTitle}</p>

streams-react/src/components/ChatUserMessage/ChatUserMessage.module.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,7 @@ iframe {
7878
height: 100%;
7979
width: 100%;
8080
overflow: hidden;
81+
}
82+
.hidden {
83+
display: none;
8184
}

streams-react/src/components/VideoControls/VideoControls.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ const VideoControls = ({stream, hasWebcam, displayName, gainStreams, handleMuted
181181
<VideoControlsButton
182182
type="button"
183183
buttonClass={`${styles.disconnect__button} ${styles.disconnect__button__padding}`}
184+
spanClass={`${styles.disconnect__inner}`}
184185
title="Disconnect from call"
185186
iconClass={`fas fa-phone-slash ${styles.controls__icon} ${styles.disconnect__icon}`}
186187
handleClick={handleDisconnectClick}

streams-react/src/components/VideoControls/VideoControls.module.css

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,24 @@ div[data-video-stream="video-stream"]:hover + .video__tray .controls__tray {
8686
pointer-events: none;
8787
}
8888
.disconnect__button {
89-
display: flex;
90-
align-items: center;
91-
justify-content: center;
9289
background-color: #DA3E52;
9390
border-radius: 100%;
9491
border: 2px solid #212121;
9592
min-width: auto;
96-
height: 0;
93+
height: 0px;
9794
width: var(--disconnect__width);
9895
pointer-events: all;
9996
}
10097
.disconnect__button.disconnect__button__padding {
10198
padding-top: calc((var(--disconnect__width) / 2) - 2px);
10299
padding-bottom: calc((var(--disconnect__width) / 2) - 2px);
103100
}
101+
.disconnect__inner {
102+
display: flex;
103+
align-items: center;
104+
justify-content: center;
105+
height: 100%;
106+
}
104107
.button--stop {
105108
color: #DA3E52;
106109
}

streams-react/src/components/VideoControlsButton/VideoControlsButton.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styles from "./VideoControlsButton.module.css";
22

3-
const VideoControlsButton = ({buttonClass, title, iconClass, handleClick, handleFocus}) => {
3+
const VideoControlsButton = ({buttonClass, spanClass, title, iconClass, handleClick, handleFocus}) => {
44
return(
55
<button
66
type="button"
@@ -10,7 +10,7 @@ const VideoControlsButton = ({buttonClass, title, iconClass, handleClick, handle
1010
onFocus={handleFocus}
1111
onBlur={handleFocus}
1212
>
13-
<i className={iconClass}></i>
13+
<span className={`${spanClass}`}><i className={iconClass}></i></span>
1414
</button>
1515
);
1616
};

0 commit comments

Comments
 (0)