Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Commit 7e21d24

Browse files
authored
Merge pull request #91 from djcruz93/ftr-notification
Notification on new message
2 parents 09667c5 + 2233884 commit 7e21d24

10 files changed

Lines changed: 196 additions & 82 deletions

File tree

client/public/chime.mp3

5.13 KB
Binary file not shown.

client/public/door.mp3

29.4 KB
Binary file not shown.

client/public/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
</head>
2525
<body>
2626
<noscript>You need to enable JavaScript to run this app.</noscript>
27+
<audio id="custom-sound-chime" src="/chime.mp3"></audio>
28+
<audio id="custom-sound-door" src="/door.mp3"></audio>
2729
<div id="root"></div>
2830
<!--
2931
This HTML file is a template.

client/src/components/ChatWindow/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
position: relative;
55
}
66

7+
.hide-chatWindow-container {
8+
display: none !important;
9+
}
10+
711
.loading-chatWindow {
812
background-color: #2f343d;
913
position: absolute;

client/src/components/ChatWindow/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function ChatWindow(props) {
77
useEffect(() => {
88
document.getElementsByTagName(
99
"iframe"
10-
)[0].src = `${rcApiDomain}${pathname}/?layout=embedded`;
10+
)[0].src = `${rcApiDomain}${pathname}?layout=embedded`;
1111
// eslint-disable-next-line
1212
}, []);
1313
useEffect(() => {
@@ -18,7 +18,12 @@ export default function ChatWindow(props) {
1818
);
1919
}, [pathname]);
2020
return (
21-
<div className="chatWindow-container">
21+
<div
22+
className={`chatWindow-container ${
23+
(pathname === "/home" || pathname === "/") &&
24+
"hide-chatWindow-container"
25+
}`}
26+
>
2227
<div className="loading-chatWindow hide-chatWindow"></div>
2328
<iframe
2429
src={`${rcApiDomain}/home/?layout=embedded`}

client/src/components/CommunityListItem/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ export default function CommunityListItem(props) {
66
return (
77
<div className="community-wrapper">
88
<div className="community-title">{community_name}</div>
9-
{community.map((room) => {
10-
// Here the second condition holds when new room is created as the response from server doesn't return open field on creation
9+
{community && Object.keys(community).map((roomId) => {
10+
let room = community[roomId];
1111
if (room.open || room.open === undefined)
12+
// Here the second condition holds when new room is created as the response from server doesn't return open field on creation
1213
return <RoomItem room={room} key={room._id}></RoomItem>;
14+
return null;
1315
})}
1416
</div>
1517
);

client/src/components/MainLayout/index.js

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,40 +42,23 @@ export default function MainLayout(props) {
4242
const {authState, stats} = props;
4343

4444
return (
45-
<Switch>
46-
<Route
47-
//TODO Shift this to programmatically check if repo is associated to hide activity
48-
//_community (without repo) -> custom field (not repo)
49-
//abcd (without repo) -> custom field (not repo)
50-
path={["/direct", "(.*)_community"]}
51-
render={(props) => {
52-
return (
53-
<div className="mainLayout-wrapper">
54-
<ChatWindow {...props} />
55-
</div>
56-
);
57-
}}
58-
/>
59-
<Route
60-
path={["/channel", "/group"]}
61-
render={(props) => {
62-
return (
63-
<div className="mainLayout-wrapper">
64-
<ChatWindow {...props} />
65-
<RightSidebar {...props} authState={authState} />
66-
</div>
67-
);
68-
}}
69-
/>
70-
<Route
71-
exact
72-
path={["/home", "/"]}
73-
render={(props) => {
74-
return (
75-
<Home {...props} authState={authState} stats={stats}/>
76-
);
77-
}}
78-
/>
79-
</Switch>
45+
<div className="mainLayout-wrapper">
46+
<ChatWindow {...props} />
47+
<Switch>
48+
<Route
49+
path={["/channel", "/group"]}
50+
render={(props) => {
51+
return <RightSidebar {...props} authState={authState} />;
52+
}}
53+
/>
54+
<Route
55+
exact
56+
path={["/home", "/"]}
57+
render={(props) => {
58+
return <Home {...props} authState={authState} stats={stats} />;
59+
}}
60+
/>
61+
</Switch>
62+
</div>
8063
);
8164
}

client/src/components/RoomItem/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@
2929

3030
.active-room {
3131
background-color: #41464f;
32+
}
33+
34+
.highlight-room {
35+
color: white !important;
3236
}

client/src/components/RoomItem/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function RoomItem({room}) {
1010
to={`/${
1111
room["t"] === "c" ? "channel" : room["t"] === "p" ? "group" : "direct"
1212
}/${room.username || room.name}`}
13-
className="room-wrapper"
13+
className={`room-wrapper ${room.alert && "highlight-room"}`}
1414
activeClassName="active-room"
1515
>
1616
<img
@@ -31,7 +31,8 @@ export default function RoomItem({room}) {
3131
)}
3232
<span className="room-name">
3333
{(room.fname && (room.fname.split(/_(.+)/)[1] || room.fname)) ||
34-
room.name || room.username}
34+
room.name ||
35+
room.username}
3536
</span>
3637
</NavLink>
3738
);

0 commit comments

Comments
 (0)