Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Room type with Converse.js replacing jitsi #385

Merged
merged 26 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5adf316
initial converse inclusion with creation of streaming room
Mar 14, 2021
7c00673
Merge branch 'master' into chat
Mar 14, 2021
f865b07
cleaned up converse init
Mar 14, 2021
671a839
pushing for andrew to look at
Mar 14, 2021
02165d2
initial configuration for converse
rene-grigory Mar 18, 2021
dfde39e
Merge branch 'master' into chat
rene-grigory Mar 18, 2021
1d57567
merged from upstream
rene-grigory Mar 18, 2021
c10398c
merged from upstream
rene-grigory Mar 18, 2021
dfcdb08
removed node_modules from git
rene-grigory Mar 18, 2021
09b1df7
created auto logout when leaving the room
Mar 19, 2021
1fe98b3
got rid of needless code
Mar 19, 2021
b85be73
ready for styling and cleanup
Mar 19, 2021
f155948
finished hijacking css
rene-grigory Mar 22, 2021
7c00179
Merge branch 'master' into chat
rene-grigory Mar 22, 2021
21f35c3
revered iframe link
rene-grigory Mar 22, 2021
fd36859
code clean up
rene-grigory Mar 22, 2021
d7599ec
Merge branch 'master' into chat
Mar 23, 2021
80adc18
fixed comment in rooms.proto
rene-grigory Mar 23, 2021
9c99bb2
logout user in beforeUnload
rene-grigory Mar 23, 2021
a093676
hide offline users and brought in the latest convers.js lib
rene-grigory Mar 26, 2021
85c5117
Merge branch 'master' into chat
rene-grigory Mar 26, 2021
5165ca7
format cleanup
rene-grigory Apr 1, 2021
30346f8
more cleanup and useing Config.baseUrl to point at the bash service
rene-grigory Apr 1, 2021
4eaa9ed
replaced old listener with MutationObserver since none of the convers…
rene-grigory Apr 1, 2021
83df75c
removed comment and fixed console.error
rene-grigory Apr 2, 2021
f3b7421
added style variables for the chat box
rene-grigory Apr 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ app/email_config.sh
app/config/overrides
app/client/styles/themes/_active.scss

# Node Modules
app/client/node_modules/

# Flask
.DS_Store
.env
Expand Down
2,161 changes: 2,161 additions & 0 deletions app/client/js/converse.min.js

Large diffs are not rendered by default.

100 changes: 100 additions & 0 deletions app/client/jsx/ChatStreamRoom.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import React, { useEffect } from "react";
import Config from "./Config.jsx";

/**
* This component is used to render a Converse.js chat component on the
* left side and an IFrame on the right. While this component does have
* the jitsi-video class in the render it is only for placement: there
* is no jitsi video in this component.
*
* This component works in conjunction with the CHATSTREAM room type.
*
* @param props a combo of roomData and jitsiData
* @returns
*/
export const ChatStreamRoom = ({
id: roomId,
displayName,
iframeOptions: { src },
}) => {
// register the 'jitsi-plugin' and initialize converse and cleanup after close
useEffect(() => {
let logout = null;
let plugins = null;

// configure the 'jitsi-plugin' to get our hands on the converse api logout
try {
window.converse.plugins.add("jitsi-plugin", {
initialize: function () {
logout = this._converse.api.user.logout;
plugins = this._converse.pluggable.plugins;
},
});
} catch (error) {
// do nothing since the plugin is already registered
console.error(error);
}

// initialize converse
window.converse.initialize({
authentication: "anonymous",
auto_login: true,
auto_join_rooms: [
{ jid: `${roomId}@muc.party.jitsi`, nick: displayName },
],
bosh_service_url: `${Config.baseUrl}jitsi/http-bind`,
jid: "guest.party.jitsi",
singleton: true,
hide_offline_users: true,
clear_cache_on_logout: true,
time_format: "hh:mm a",
visible_toolbar_buttons: {
call: false,
spoiler: false,
emoji: true,
toggle_occupants: false,
},
whitelisted_plugins: ["jitsi-plugin"],
view_mode: "embedded",
});

// use MutationObserver to restucture the chatbox
const observer = new MutationObserver((muts) => {
if (document.querySelector(".chatbox-title__buttons") !== null) {
document.querySelector(".chat-head").remove();
}

if (document.querySelector(".send-button") !== null) {
document.querySelector(".send-button").remove();
observer.disconnect();
}
});

observer.observe(document, {
childList: true,
attributes: true,
subtree: true,
});

// listen to beforeunload to logout and cleanup
window.addEventListener("beforeunload", () => {
plugins["jitsi-plugin"] = undefined;
logout();
});

// call the converse api logout at cleanup
return () => {
plugins["jitsi-plugin"] = undefined;
logout();
};
}, []);

return (
<div className="iframe-room">
<div className="jitsi-video"></div>
<div className="iframe-section">
<iframe src={src} height="100%" width="100%" frameBorder="0px"></iframe>
</div>
</div>
);
};
7 changes: 7 additions & 0 deletions app/client/jsx/Room.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { PokeNotification } from './Poke.jsx'
import { WebSocketApi } from './WebAPI.jsx'
import LocalStorage from './LocalStorage.jsx'
import Config from './Config.jsx'
import { ChatStreamRoom } from './ChatStreamRoom.jsx'

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff in this file is a little confusing because of what I presume is linting…is there any chance you could commit without the linting? That way our history will be cleaner and reviews will be easier!

class Room extends Component {
/*
Expand All @@ -38,6 +39,7 @@ class Room extends Component {
this.roomTypesWithMap = {
JITSI: true,
IFRAME: true,
CHATSTREAM: true,
CONTENT: true,
IMAGEMAP: true
}
Expand All @@ -46,6 +48,7 @@ class Room extends Component {
this.roomTypesWithDoors = {
JITSI: true,
IFRAME: true,
CHATSTREAM: true,
IMAGEMAP: true
}

Expand Down Expand Up @@ -85,10 +88,14 @@ class Room extends Component {
hideVideo: roomData.hideVideo,
disableSharing: roomData.type === 'IFRAME'
}

const combo = { ...roomData, ...jitsiData };

return {
ART: <ArtRoom jitsiData={jitsiData} art={roomData.art}></ArtRoom>,
JITSI: <JitsiVideo jitsiData={jitsiData}></JitsiVideo>,
IFRAME: <IFrameRoom jitsiData={jitsiData} iframeOptions={roomData.iframeOptions}></IFrameRoom>,
CHATSTREAM: <ChatStreamRoom {...combo}></ChatStreamRoom>,
ADVENTURE: <Adventure options={roomData} onClick={this.onAdventureClick.bind(this)}></Adventure>,
IMAGEMAP: <ImageMapRoom imageMapOptions={roomData.imageMapOptions}></ImageMapRoom>
}[roomData.type]
Expand Down
1 change: 1 addition & 0 deletions app/client/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
@import 'pages/room',
'pages/artRoom',
'pages/iframeRoom',
"pages/chatStreamRoom",
'pages/exit',
'pages/map',
'pages/imageMapRoom';
154 changes: 154 additions & 0 deletions app/client/styles/pages/_chatStreamRoom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
$mobile_landscape_height: 450px !default;
$mobile_portrait_length: 480px !default;

#conversejs {
position: absolute !important;
top: 10% !important;
bottom: auto !important;
width: 45vw !important;
left: 1vw !important;
height: 66% !important;
z-index: 9 !important;

.badge,
.chat-info,
.hide-occupants {
display: none !important;
}

.chat-head {
background-color: $background-color !important;
}

.occupants-heading {
color: $background-color !important;
}

.occupant-status {
vertical-align: sub;
}

.occupant-nick {
font-size: 0.9rem;
}

.chatroom {
// color themes
.separator {
border-bottom: 2px solid $chat-separator-bars !important;
}

.separator-text {
color: $chat-separator-text !important;
background-color: $chat-separator-text-bg !important;
}

.chat-content {
background-color: $chat-content;
}

.chat-msg__author {
color: $chat-msg-author !important;
}

.chat-msg__time {
color: $chat-msg-time !important;
}

.chat-msg__text {
color: $chat-msg-text !important;
}

.fa-bars {
color: $chat-msg-menu !important
}

.dropdown-menu {
background-color: $chat-msg-menu-bg !important;
}

.chat-msg__action {
color: $chat-msg-menu-items !important;
svg {
fill: $chat-msg-menu-items !important;
}
}

.chat-content__notifications {
background-color: $chat-notification-bg !important;
color: $chat-notification-text !important;
}

converse-muc-sidebar {
background-color: $chat-participants !important;
border-left-color: $chat-participants-resize !important;
}

.occupants-heading {
color: $participants-title !important;
}

.occupant-nick {
color: $participants-name !important;
}

.suggestion-box {
border-top: 1px solid $message-input-top-border !important;
}

.chat-textarea {
background-color: $message-area-bg !important;
margin-bottom: -5px !important;
color: $message-text !important;
&::placeholder {
color: lighten($message-text, 20%) !important;
}
&:focus {
outline: 0px !important;
border: 2px solid $message-focus !important;
border-bottom: 3px solid $message-focus !important;
}
}

.sendXMPPMessage {
background-color: $message-area-bg !important;
}

.emoji-picker__header,
.emoji-skintone-picker {
background-color: $emoji-header-footer !important;
}

.emoji-picker {
background-color: $emoji-separator !important;
}

.emoji-picker__lists {
background-color: $emoji-popup-bg !important;
}

.emoji-category__heading {
color: $emoji-category-heading !important;
}

.toggle-emojis:focus {
outline: 0px !important;
}

// other adjustments
.chat-content__help {
border: 0px !important;
}

converse-chat-toolbar {
border-top: 0px !important;
background-color: $toolbox-bg !important;

svg {
fill: $toolbox-emoji-color !important;
} .separator {
border-bottom: 2px solid $toolbox-bg !important;
}
}
}
}
44 changes: 36 additions & 8 deletions app/client/styles/themes/_tst.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,34 @@ $dark-grey: #404040;
$matte-blue: #294b7f;
$light-grey: #ece9e9;

// Chat color variables
$chat-separator-bars: $matte-blue; // separator bars at the top of the chat area
$chat-separator-text: $matte-blue; // text between the separators
$chat-separator-text-bg: $fuckyou-turquoise; // background for the text area
$chat-content: $fuckyou-turquoise; // the main chat area on the left
$chat-notification-bg: $fuckyou-turquoise; // entry/exit notification background
$chat-notification-text: $matte-blue; // entry/exit notification text color
$chat-msg-author: $matte-blue; // color of user name
$chat-msg-time: $matte-blue; // color of the chat time
$chat-msg-text: $matte-blue; // color the chat text
$chat-msg-menu: $matte-blue; // color the hamburgar menu to the right of the chat message
$chat-msg-menu-bg: $fuckyou-turquoise; // background color of the menu dropdown
$chat-msg-menu-items: $matte-blue; // color for the menu items
$toolbox-bg: $fuckyou-turquoise; // background color for the location of the emoji picker icon
$toolbox-emoji-color: $matte-blue; // the color for the emoji icon
$emoji-header-footer: $matte-blue; // color for the header and footer inside the emoji popup
$emoji-category-heading: $matte-blue; // color for the emoji heading text in the popup
$emoji-popup-bg: $matte-purple; // background color of the emoji popup
$emoji-separator: $fuckyou-turquoise; // color for th emoji separator bar
$message-area-bg: $fuckyou-turquoise; // background for the message text area
$message-input-top-border: $matte-blue; // the border at the top of the message area
$message-focus: $matte-blue; // the color of the message area border when focused
$message-text: $matte-blue; // the text color in the message area
$chat-participants: $fuckyou-turquoise; // the participants sidebar on the right of the chat
$chat-participants-resize: $matte-blue; // color of the participants resize handle
$participants-title: $matte-blue; // the title of the participants list
$participants-name: $matte-blue; // the name of each participant in the list
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding these comments, that's very helpful


// Hexing notifications & icon
$accent-color: $fuckyou-turquoise;

Expand Down Expand Up @@ -73,21 +101,21 @@ $modal-overlay-color: rgba(129, 62, 62, 0.25);
$art-image-border-color: color("grey-50"); //white

body {
font-family: $accent-font !important;
font-family: $accent-font !important;
}

.vestibule .header {
margin-bottom: 0 !important;
margin-bottom: 0 !important;
}

.custom-login-description {
text-align: center;
font-size: smaller;
opacity: 0.8;
text-align: center;
font-size: smaller;
opacity: 0.8;
}

// .tst,
// .room-header h2,
// .room-header h2,
// #map-info .room-name,
// .events-view .events-header,
// .events-view .event-list .event-info .event-name,
Expand All @@ -96,6 +124,6 @@ body {
// }

.room .room-content {
max-height: 120px;
padding: .5em 50px;
max-height: 120px;
padding: 0.5em 50px;
}
Loading