Ran linter and autofixed most of the warnings in the new React code

This commit is contained in:
Oleksandr Zhurbenko 2016-04-22 16:19:17 -07:00
parent 8a97afb89e
commit b52738be8e
23 changed files with 604 additions and 549 deletions

View File

@ -14,7 +14,7 @@ module.exports = function (grunt) {
tasks: ['force:jscs:check'],
options: {
event: ['all'],
spawn: true
spawn: true,
},
},
},
@ -28,7 +28,7 @@ module.exports = function (grunt) {
esnext: true,
},
},
fix: {
autofix: {
src: ['**/*.js', '**/*.jsx'],
options: {
config: '.jscsrc',
@ -51,13 +51,11 @@ module.exports = function (grunt) {
limit: 3,
},
meteor_watch: {
tasks: ['shell:start_meteor', 'watch']
tasks: ['shell:start_meteor', 'watch'],
},
},
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-coffeelint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-force-task');
grunt.loadNpmTasks('grunt-contrib-watch');

View File

@ -5,10 +5,11 @@ import {Chat} from '/imports/ui/chat/Chat.jsx';
MainContainer = React.createClass({
handleShield() {
$(".tooltip").hide();
$('.tooltip').hide();
toggleShield();
return closeMenus();
},
render() {
return (
<div id="testing">
@ -20,5 +21,5 @@ MainContainer = React.createClass({
</div>
</div>
);
}
},
});

View File

@ -119,7 +119,6 @@ Handlebars.registerHelper('isCurrentUser', userId => {
return userId === null || userId === ((ref = BBB.getCurrentUser()) != null ? ref.userId : void 0);
});
//Retreives a username for a private chat tab from the database if it exists
Handlebars.registerHelper('privateChatName', () => {
let obj, ref;
@ -139,7 +138,7 @@ Handlebars.registerHelper('isCurrentUserSharingVideo', () => {
return BBB.amISharingVideo();
});
Handlebars.registerHelper("isCurrentUserPresenter", () => {
Handlebars.registerHelper('isCurrentUserPresenter', () => {
return BBB.isUserPresenter(getInSession('userId'));
});
@ -194,7 +193,7 @@ Handlebars.registerHelper('messageFontSize', () => {
});
//#TODO REMOVE
Handlebars.registerHelper("pointerLocation", () => {
Handlebars.registerHelper('pointerLocation', () => {
let currentPresentation, currentSlideDoc, pointer, presentationId, ref;
currentPresentation = Meteor.Presentations.findOne({
'presentation.current': true,
@ -239,7 +238,7 @@ Template.registerHelper('emojiIcons', function () {
{ name: 'confused', icon: 'confused-face', title: '' },
{ name: 'neutral', icon: 'neutral-face', title: '' },
{ name: 'away', icon: 'clock', title: '' },
{ name: 'raiseHand', icon: 'hand', title: 'Lower your Hand'}
{ name: 'raiseHand', icon: 'hand', title: 'Lower your Hand' },
];
});
@ -247,7 +246,7 @@ Template.registerHelper('emojiIcons', function () {
this.scaleWhiteboard = function (whiteboardPaperModel) {
let adjustedDimensions;
adjustedDimensions = scaleSlide(getInSession('slideOriginalWidth'), getInSession('slideOriginalHeight'));
if(typeof whiteboardPaperModel !== "undefined" && whiteboardPaperModel !== null) {
if (typeof whiteboardPaperModel !== 'undefined' && whiteboardPaperModel !== null) {
whiteboardPaperModel.scale(adjustedDimensions.width, adjustedDimensions.height);
}
/* if(callback) {

View File

@ -16,9 +16,11 @@ let loadLib;
loadLib = function (libname) {
let retryMessageCallback, successCallback;
successCallback = function () {};
retryMessageCallback = function (param) {
return console.log("Failed to load library", param);
return console.log('Failed to load library', param);
};
return Meteor.Loader.loadJs(`${window.location.origin}/client/lib/${libname}`, successCallback, 10000).fail(retryMessageCallback);
};
@ -35,7 +37,7 @@ Meteor.startup(() => {
set(key, value) {
Session.set.apply(this, arguments);
amplify.store.sessionStorage(key, value);
}
},
});
});
@ -45,17 +47,18 @@ Template.menu.events({
toggleSettingsMenu();
return $('.slideButton').blur();
},
'click .toggleChatButton'(event) {
return toggleChatbar();
}
},
});
Template.main.rendered = function () {
ReactDOM.render(<MainContainer />, document.getElementById("main"));
ReactDOM.render(<MainContainer />, document.getElementById('main'));
ReactDOM.render(<UserListContainer />, document.getElementById('user-contents'));
let lastOrientationWasLandscape;
$("#dialog").dialog({
$('#dialog').dialog({
modal: true,
draggable: false,
resizable: false,
@ -65,31 +68,34 @@ Template.main.rendered = function() {
{
text: 'Yes',
click: function () {
userLogout(BBB.getMeetingId(), getInSession("userId"), true);
return $(this).dialog("close");
userLogout(BBB.getMeetingId(), getInSession('userId'), true);
return $(this).dialog('close');
},
"class": 'btn btn-xs btn-primary active'
class: 'btn btn-xs btn-primary active',
}, {
text: 'No',
click: function () {
$(this).dialog("close");
return $(".tooltip").hide();
$(this).dialog('close');
return $('.tooltip').hide();
},
class: 'btn btn-xs btn-default',
},
"class": 'btn btn-xs btn-default'
}
],
open(event, ui) {
return $('.ui-widget-overlay').bind('click', () => {
if (isMobile()) {
return $("#dialog").dialog('close');
return $('#dialog').dialog('close');
}
});
},
position: {
my: 'right top',
at: 'right bottom',
of: '.signOutIcon'
}
of: '.signOutIcon',
},
});
lastOrientationWasLandscape = isLandscape();
$(window).resize(() => {
@ -110,10 +116,10 @@ Template.main.rendered = function() {
if (Meteor.config.app.autoJoinAudio) {
if (Meteor.config.app.skipCheck) {
return joinVoiceCall(this, {
isListenOnly: Meteor.config.app.listenOnly
isListenOnly: Meteor.config.app.listenOnly,
});
} else {
$("#settingsModal").foundation('reveal', 'open');
$('#settingsModal').foundation('reveal', 'open');
if (Meteor.config.app.listenOnly) {
return $('#joinMicrophone').prop('disabled', true);
}
@ -137,6 +143,7 @@ Template.main.gestures({
}
}
},
'panend #container'(event, template) {
let leftDrawerWidth, menuPanned, panIsValid, screenWidth;
if (isPortraitMobile()) {
@ -161,6 +168,7 @@ Template.main.gestures({
$('.toggleUserlistButton').addClass('menuToggledOn');
}
}
if (panIsValid && menuPanned === 'right' && parseInt($('.right-drawer').css('transform').split(',')[4]) !== leftDrawerWidth) {
if (parseInt($('.right-drawer').css('transform').split(',')[4]) > screenWidth - $('.right-drawer').width() / 2) {
$('.shield').removeClass('animatedShield');
@ -178,12 +186,14 @@ Template.main.gestures({
$('.toggleMenuButton').addClass('menuToggledOn');
}
}
$('.left-drawer').addClass('userlistMenu');
$('.userlistMenu').removeClass('left-drawer');
$('.right-drawer').addClass('settingsMenu');
return $('.settingsMenu').removeClass('right-drawer');
}
},
'panright #container, panleft #container'(event, template) {
let initTransformValue, leftDrawerWidth, menuPanned, panIsValid, rightDrawerWidth, screenWidth;
if (isPortraitMobile() && isPanHorizontal(event)) {
@ -213,6 +223,7 @@ Template.main.gestures({
} else {
setInSession('panIsValid', false);
}
setInSession('eventType', event.type);
if (getInSession('menuPanned') === 'left') {
if ($('.userlistMenu').css('transform') !== 'none') { // menu is already transformed
@ -225,6 +236,7 @@ Template.main.gestures({
} else {
setInSession('initTransform', 0);
}
$('.userlistMenu').addClass('left-drawer');
$('.left-drawer').removeClass('userlistMenu');
} else if (getInSession('menuPanned') === 'right') {
@ -238,10 +250,12 @@ Template.main.gestures({
} else {
setInSession('initTransform', 0);
}
$('.settingsMenu').addClass('right-drawer');
$('.right-drawer').removeClass('settingsMenu');
}
}
initTransformValue = getInSession('initTransform');
panIsValid = getInSession('panIsValid');
menuPanned = getInSession('menuPanned');
@ -257,10 +271,12 @@ Template.main.gestures({
if ($('.settingsMenu').hasClass('menuOut')) {
toggleSettingsMenu();
}
$('.left-drawer').css('transform', `translateX(${initTransformValue + event.deltaX}px)`);
if (!getInSession('panStarted')) {
$('.shield').addClass('animatedShield');
}
return $('.shield').css('opacity', 0.5 * (initTransformValue + event.deltaX) / leftDrawerWidth);
} else if (panIsValid &&
menuPanned === 'right' &&
@ -269,14 +285,16 @@ Template.main.gestures({
if ($('.userlistMenu').hasClass('menuOut')) {
toggleUserlistMenu();
}
$('.right-drawer').css('transform', `translateX(${initTransformValue + event.deltaX}px)`);
if (!getInSession('panStarted')) {
$('.shield').addClass('animatedShield');
}
return $('.shield').css('opacity', 0.5 * (screenWidth - initTransformValue - event.deltaX) / rightDrawerWidth);
}
}
}
},
});
Template.makeButton.rendered = function () {

View File

@ -15,8 +15,7 @@ export let EmojiIcon = React.createClass({
renderIcon() {
if (this.props.iconName === 'raiseHand') {
return (<i className={classNames(this.props.className, 'ion-android-hand')}></i>);
}
else if(this.props.iconName === 'happy') {
} else if (this.props.iconName === 'happy') {
return (
<svg width="25" height="25" viewBox="0 0 50 50">
<circle cx="25" cy="25" r="14" stroke="white" strokeWidth="3" fill="transparent"/>
@ -24,9 +23,8 @@ export let EmojiIcon = React.createClass({
<circle cx="31" cy="22" r="1" stroke="white" strokeWidth="2" fill="white"/>
<path d="m18 30 C 21 33, 29 33, 32 30" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" fill="none" />
</svg>
)
}
else if(this.props.iconName === 'neutral') {
);
} else if (this.props.iconName === 'neutral') {
return (
<svg width="25" height="25" viewBox="0 0 50 50">
<circle cx="25" cy="25" r="14" stroke="white" strokeWidth="3" fill="transparent"/>
@ -34,9 +32,8 @@ export let EmojiIcon = React.createClass({
<circle cx="31" cy="22" r="1" stroke="white" strokeWidth="2" fill="white"/>
<path d="m18 30 l 14 0" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" />
</svg>
)
}
else if(this.props.iconName === 'confused') {
);
} else if (this.props.iconName === 'confused') {
return (
<svg width="25" height="25" viewBox="0 0 50 50">
<circle cx="25" cy="25" r="14" stroke="white" strokeWidth="3" fill="transparent"/>
@ -44,9 +41,8 @@ export let EmojiIcon = React.createClass({
<circle cx="31" cy="22" r="1" stroke="white" strokeWidth="2" fill="white"/>
<path d="M18 30 C 20 28, 22 28, 25 30 S 30 32, 32 30" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" />
</svg>
)
}
else if(this.props.iconName === 'sad') {
);
} else if (this.props.iconName === 'sad') {
return (
<svg width="25" height="25" viewBox="0 0 50 50">
<circle cx="25" cy="25" r="14" stroke="white" strokeWidth="3" fill="transparent"/>
@ -54,24 +50,22 @@ export let EmojiIcon = React.createClass({
<circle cx="31" cy="22" r="1" stroke="white" strokeWidth="2" fill="white"/>
<path d="m18 30 C 21 27, 29 27, 32 30" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" fill="none" />
</svg>
)
}
else if(this.props.iconName === 'away') {
);
} else if (this.props.iconName === 'away') {
return (
<svg width="25" height="25" viewBox="0 0 50 50">
<circle cx="25" cy="25" r="14" stroke="white" strokeWidth="3" fill="transparent"/>
<path d="m25 25 l 0 -8" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" />
<path d="m25 25 l 5 5" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" />
</svg>
)
}
else if(this.props.iconName === 'plus') {
);
} else if (this.props.iconName === 'plus') {
return (
<svg width="25" height="25" viewBox="0 0 50 50">
<path d="m25 18 l 0 14" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" />
<path d="m18 25 l 14 0" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" />
</svg>
)
);
}
},
});

View File

@ -8,22 +8,23 @@ export let Chat = React.createClass({
getMeteorData() {
let chatMessages, privateChatName, chattingWith, user, messageFontSize, temp, user_exists;
messageFontSize = { fontSize: getInSession("messageFontSize") + 'px' };
messageFontSize = { fontSize: getInSession('messageFontSize') + 'px' };
chattingWith = getInSession('inChatWith');
if (chattingWith === 'PUBLIC_CHAT') { // find all public and system messages
chatMessages = Meteor.Chat.find({ 'message.chat_type': { $in: ["SYSTEM_MESSAGE", "PUBLIC_CHAT"] }},
chatMessages = Meteor.Chat.find({ 'message.chat_type': { $in: ['SYSTEM_MESSAGE', 'PUBLIC_CHAT'] } },
{ sort: { 'message.from_time': 1 } }).fetch();
} else {
chatMessages = Meteor.Chat.find({ 'message.chat_type': 'PRIVATE_CHAT', $or: [{ 'message.to_userid': chattingWith },
{ 'message.from_userid': chattingWith }]}).fetch();
{ 'message.from_userid': chattingWith }, ], }).fetch();
}
user = Meteor.Users.findOne({ userId: chattingWith });
if (user != null) {
privateChatName = user.user.name;
}
if(getInSession('inChatWith') === "PUBLIC_CHAT" || Meteor.Users.findOne({
userId: getInSession('inChatWith')
if (getInSession('inChatWith') === 'PUBLIC_CHAT' || Meteor.Users.findOne({
userId: getInSession('inChatWith'),
}) != null) {
user_exists = true;
} else {
@ -34,7 +35,7 @@ export let Chat = React.createClass({
chatMessages: chatMessages,
privateChatName: privateChatName,
messageFontSize: messageFontSize,
user_exists: user_exists
user_exists: user_exists,
};
},
@ -46,32 +47,35 @@ export let Chat = React.createClass({
let findDestinationTab;
findDestinationTab = function () {
let ref, ref1;
if(((ref = chatMessage.message) != null ? ref.chat_type : void 0) === "PUBLIC_CHAT") {
return "PUBLIC_CHAT";
if (((ref = chatMessage.message) != null ? ref.chat_type : void 0) === 'PUBLIC_CHAT') {
return 'PUBLIC_CHAT';
} else {
return (ref1 = chatMessage.message) != null ? ref1.from_userid : void 0;
}
};
return Tracker.autorun(comp => {
let destinationTab, tabsTime;
tabsTime = getInSession('userListRenderedTime');
if((tabsTime != null) && chatMessage.message.from_userid !== "SYSTEM_MESSAGE" && chatMessage.message.from_time - tabsTime > 0) {
if ((tabsTime != null) && chatMessage.message.from_userid !== 'SYSTEM_MESSAGE' && chatMessage.message.from_time - tabsTime > 0) {
populateNotifications(chatMessage); // check if we need to show a new notification
destinationTab = findDestinationTab();
if(destinationTab !== getInSession("inChatWith")) {
if (destinationTab !== getInSession('inChatWith')) {
setInSession('chats', getInSession('chats').map(tab => {
if (tab.userId === destinationTab) {
tab.gotMail = true;
tab.number++;
}
return tab;
}));
}
}
return comp.stop();
});
};
})(this)
})(this),
});
},
@ -93,6 +97,7 @@ export let Chat = React.createClass({
if ((parseFloat(msgs[j].message.from_time) - parseFloat(msgs[i].message.from_time)) >= 60000) { // 60 seconds/1 minute
break; // Messages are too far between, so them seperated and stop joining here
}
if (msgs[i].message.from_userid === msgs[j].message.from_userid) { // Both messages are from the same user
// insert a '\r' carriage return character between messages to put them on a new line
msgs[i].message.message += `${CARRIAGE_RETURN}${msgs[j].message.message}`; // Combine the messages
@ -104,15 +109,18 @@ export let Chat = React.createClass({
} else {
break; // This is the break point in the chat, don't merge
}
len = msgs.length;
if (!deleted) {
++j;
}
}
}
++i;
len = msgs.length;
}
return msgs;
},
@ -143,5 +151,5 @@ export let Chat = React.createClass({
: null }
</div>
);
}
},
});

File diff suppressed because one or more lines are too long

View File

@ -43,8 +43,9 @@ export let ChatMessage = React.createClass({
toClockTime: function (epochTime) {
let dateObj, hours, local, minutes, offset;
if (epochTime === null) {
return "";
return '';
}
local = new Date();
offset = local.getTimezoneOffset();
epochTime = epochTime - offset * 60000; // 1 min = 60 s = 60,000 ms
@ -54,6 +55,7 @@ export let ChatMessage = React.createClass({
if (minutes < 10) {
minutes = `0${minutes}`;
}
return `${hours}:${minutes}`;
},
@ -79,6 +81,7 @@ export let ChatMessage = React.createClass({
var messageColor = { color: colourToHex(this.props.message.message.from_color) };
var floatLeft = { float: 'left' };
function createMarkup(str) { return { __html: str }; };
return (
<li>
<span style={floatLeft}>
@ -95,5 +98,5 @@ export let ChatMessage = React.createClass({
{this.autoscroll()}
</li>
);
}
},
});

View File

@ -4,18 +4,18 @@ import { Button } from '../shared/Button.jsx';
export let PrivateChatToolBar = React.createClass({
componentDidMount: function () {
if (isLandscape() || isPortrait()) {
return $("#newMessageInput").focus();
return $('#newMessageInput').focus();
}
},
handleClick: function () {
console.log("I'm in the handleClick function");
setInSession('inChatWith', 'PUBLIC_CHAT');
return setInSession('chats', getInSession('chats').map(chat => {
if(chat.userId === "PUBLIC_CHAT") {
if (chat.userId === 'PUBLIC_CHAT') {
chat.gotMail = false;
chat.number = 0;
}
$('.ui-tooltip').hide();
return chat;
}));
},
@ -30,5 +30,5 @@ export let PrivateChatToolBar = React.createClass({
</div>
</div>
);
}
},
});

View File

@ -6,7 +6,7 @@ export let Header = React.createClass({
getMeteorData() {
let in_audio, whiteboard_title, in_listen_only, is_muted, is_talking;
in_audio = BBB.amIInAudio();
whiteboard_title = BBB.currentPresentationName() || "No active presentation";
whiteboard_title = BBB.currentPresentationName() || 'No active presentation';
in_listen_only = BBB.amIListenOnlyAudio();
is_muted = BBB.amIMuted();
is_talking = BBB.amITalking();
@ -22,8 +22,9 @@ export let Header = React.createClass({
handleLeaveAudioButton(event) {
return exitVoiceCall(event);
},
handleMuteButton(event) {
$(".tooltip").hide();
$('.tooltip').hide();
return toggleMic(this);
},
@ -36,26 +37,29 @@ export let Header = React.createClass({
} else {
toggleShield();
}
return toggleUserlistMenu();
}
},
handleToggleMenuButton(event) {
if ($('.userlistMenu').hasClass('menuOut')) {
toggleUserlistMenu();
} else {
toggleShield();
}
$('.toggleMenuButton').blur();
return toggleSettingsMenu();
},
handleSettingsButton(event) {
return $("#settingsModal").foundation('reveal', 'open');
return $('#settingsModal').foundation('reveal', 'open');
},
handleSignOutButton(event) {
$('.signOutIcon').blur();
return $("#logoutModal").foundation('reveal', 'open');
return $('#logoutModal').foundation('reveal', 'open');
},
render() {
@ -89,5 +93,5 @@ export let Header = React.createClass({
i_class="ion-android-more-vertical" rel="tooltip" title="Toggle Menu" span={true} />
</nav>
);
}
},
});

View File

@ -5,18 +5,19 @@ export let Button = React.createClass({
componentDidMount() {
return $('button[rel=tooltip]').tooltip();
},
hasGotUnreadMail(userId) {
let chats, i, j, len, len1, tabs;
chats = getInSession('chats');
if (chats !== void 0) {
if(userId === "all_chats") {
if (userId === 'all_chats') {
for (i = 0, len = chats.length; i < len; i++) {
tabs = chats[i];
if (tabs.gotMail === true) {
return true;
}
}
} else if(userId === "PUBLIC_CHAT") {
} else if (userId === 'PUBLIC_CHAT') {
for (j = 0, len1 = chats.length; j < len1; j++) {
tabs = chats[j];
if (tabs.userId === userId && tabs.gotMail === true) {
@ -25,12 +26,13 @@ export let Button = React.createClass({
}
}
}
return false;
},
getNumberOfUnreadMessages(userId) {
let chat, chats, i, len;
if(userId === "all_chats") {
if (userId === 'all_chats') {
return;
} else {
chats = getInSession('chats');
@ -39,7 +41,7 @@ export let Button = React.createClass({
chat = chats[i];
if (chat.userId === userId && chat.gotMail) {
if (chat.number > 9) {
return "9+";
return '9+';
} else {
return chat.number;
}
@ -50,11 +52,12 @@ export let Button = React.createClass({
},
getNotificationClass(userId) {
if(userId === "all_chats") {
return "unreadChat";
if (userId === 'all_chats') {
return 'unreadChat';
}
if(userId === "PUBLIC_CHAT") {
return "unreadChatNumber";
if (userId === 'PUBLIC_CHAT') {
return 'unreadChatNumber';
}
},
@ -67,7 +70,7 @@ export let Button = React.createClass({
<div className={_className}>
{_number}
</div>
)
);
}
},
@ -89,6 +92,6 @@ export let Button = React.createClass({
<EmojisSVG emoji={ this.props.emoji } size="50"/>
: null}
</button>
)
}
);
},
});

View File

@ -10,15 +10,16 @@ export let EmojiContainer = React.createClass ({
if (user != null) {
emoji_status = user.user.emoji_status;
} else {
emoji_status = "none";
emoji_status = 'none';
}
current_presentation = Meteor.Presentations.findOne({
'presentation.current': true
'presentation.current': true,
});
current_presentation ? current_presentation = true : current_presentation = false;
return {
emoji_status: emoji_status,
current_presentation: current_presentation
current_presentation: current_presentation,
};
},
@ -33,7 +34,7 @@ export let EmojiContainer = React.createClass ({
{ name: 'confused', icon: 'confused-face', title: '' },
{ name: 'neutral', icon: 'neutral-face', title: '' },
{ name: 'away', icon: 'clock', title: '' },
{ name: 'raiseHand', icon: 'hand', title: 'Lower your Hand'}
{ name: 'raiseHand', icon: 'hand', title: 'Lower your Hand' },
];
},
@ -58,7 +59,7 @@ export let EmojiContainer = React.createClass ({
getInSession('userId'),
getInSession('userId'),
getInSession('authToken'),
"none"
'none'
);
$('.FABTriggerButton').blur();
return toggleEmojisFAB();
@ -81,5 +82,5 @@ export let EmojiContainer = React.createClass ({
)}
</div>
);
}
},
});

View File

@ -2,7 +2,7 @@ import React from 'react';
export let EmojisSVG = React.createClass({
render() {
if(this.props.emoji == "happy-face") {
if (this.props.emoji == 'happy-face') {
return (<svg width={this.props.size} height={this.props.size} viewBox="0 0 50 50">
<circle cx="25" cy="25" r="14" stroke="white" strokeWidth="3" fill="transparent"/>
<circle cx="19" cy="22" r="1" stroke="white" strokeWidth="2" fill="white"/>
@ -10,8 +10,7 @@ export let EmojisSVG = React.createClass ({
<path d="m18 30 C 21 33, 29 33, 32 30" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" fill="none" />
</svg>
);
}
else if(this.props.emoji == "neutral-face") {
} else if (this.props.emoji == 'neutral-face') {
return (
<svg width={this.props.size} height={this.props.size} viewBox="0 0 50 50">
<circle cx="25" cy="25" r="14" stroke="white" strokeWidth="3" fill="transparent"/>
@ -20,8 +19,7 @@ export let EmojisSVG = React.createClass ({
<path d="m18 30 l 14 0" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" />
</svg>
);
}
else if(this.props.emoji == "confused-face") {
} else if (this.props.emoji == 'confused-face') {
return (
<svg width={this.props.size} height={this.props.size} viewBox="0 0 50 50">
<circle cx="25" cy="25" r="14" stroke="white" strokeWidth="3" fill="transparent"/>
@ -30,8 +28,7 @@ export let EmojisSVG = React.createClass ({
<path d="M18 30 C 20 28, 22 28, 25 30 S 30 32, 32 30" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" />
</svg>
);
}
else if(this.props.emoji == "sad-face") {
} else if (this.props.emoji == 'sad-face') {
return (
<svg width={this.props.size} height={this.props.size} viewBox="0 0 50 50">
<circle cx="25" cy="25" r="14" stroke="white" strokeWidth="3" fill="transparent"/>
@ -40,8 +37,7 @@ export let EmojisSVG = React.createClass ({
<path d="m18 30 C 21 27, 29 27, 32 30" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" fill="none" />
</svg>
);
}
else if(this.props.emoji == "clock") {
} else if (this.props.emoji == 'clock') {
return (
<svg width={this.props.size} height={this.props.size} viewBox="0 0 50 50">
<circle cx="25" cy="25" r="14" stroke="white" strokeWidth="3" fill="transparent"/>
@ -49,17 +45,15 @@ export let EmojisSVG = React.createClass ({
<path d="m25 25 l 5 5" stroke="white" strokeWidth="3" strokeLinecap="round" stroke-linejoin="round" />
</svg>
);
}
else if(this.props.emoji == "hand") {
} else if (this.props.emoji == 'hand') {
return (
<span rel="tooltip" data-placement="bottom" title="{{title}}">
<i className="ion-android-hand"></i>
</span>
);
}
else {
} else {
console.log("This shouldn't be happening");
return (<span></span>);
}
}
},
});

View File

@ -8,7 +8,7 @@ export let Polling = React.createClass({
let poll;
poll = BBB.getCurrentPoll(getInSession('userId'));
return {
poll: poll
poll: poll,
};
},
@ -27,12 +27,13 @@ export let Polling = React.createClass({
buttonStyle = {
width: 'calc(75%/' + number + ')',
marginLeft: 'calc(25%/' + number * 2 + ')',
marginRight: 'calc(25%/ ' + number * 2 + ')'
marginRight: 'calc(25%/ ' + number * 2 + ')',
};
answers = poll.poll_info.poll.answers;
for (j = 0; j < number; j++) {
answers[j].style = buttonStyle;
}
return answers;
}
},
@ -49,6 +50,6 @@ export let Polling = React.createClass({
label={question.key} style={question.style} key={question.id}/>
) : null }
</div>
)
}
);
},
});

View File

@ -41,5 +41,5 @@ export let PresentationList = React.createClass({
: null }
</ul>
);
}
},
});

View File

@ -7,13 +7,13 @@ this.scaleSlide = function(originalWidth, originalHeight) {
if (window.matchMedia('(orientation: landscape)').matches) {
// for landscape orientation we want "fit to height" so that we can
// minimize the empty space above and below the slide (for best readability)
boardWidth = $("#whiteboard-container").width();
boardHeight = $("#whiteboard-container").height();
boardWidth = $('#whiteboard-container').width();
boardHeight = $('#whiteboard-container').height();
} else {
// for portrait orientation we want "fit to width" so that we can
// minimize the empty space on the sides of the slide (for best readability)
boardWidth = $("#whiteboard-container").width();
boardHeight = 1.4 * $("#whiteboard-container").width();
boardWidth = $('#whiteboard-container').width();
boardHeight = 1.4 * $('#whiteboard-container').width();
}
// this is the best fitting pair
@ -40,11 +40,12 @@ this.scaleSlide = function(originalWidth, originalHeight) {
adjustedWidth = boardWidth;
}
}
return {
width: adjustedWidth,
height: adjustedHeight,
boardWidth: boardWidth,
boardHeight: boardHeight
boardHeight: boardHeight,
};
};
@ -56,7 +57,7 @@ export let Slide = React.createClass({
if (currentSlide != null) {
shapes = Meteor.Shapes.find({
whiteboardId: currentSlide.slide.id
whiteboardId: currentSlide.slide.id,
}).fetch();
}
@ -72,11 +73,13 @@ export let Slide = React.createClass({
},
componentWillUpdate: function () {
if(typeof this.whiteboardPaperModel !== "undefined" && this.whiteboardPaperModel !== null) {
if (typeof this.whiteboardPaperModel !== 'undefined' && this.whiteboardPaperModel !== null) {
wpm = this.whiteboardPaperModel;
wpm.clearShapes();
//this.manuallyDisplayShapes();
}
//console.log('componentWillUpdate');
},
@ -118,25 +121,28 @@ export let Slide = React.createClass({
clearSlide() {
let ref;
//clear the slide
if(typeof this.whiteboardPaperModel !== "undefined" && this.whiteboardPaperModel !== null) {
if (typeof this.whiteboardPaperModel !== 'undefined' && this.whiteboardPaperModel !== null) {
this.whiteboardPaperModel.removeAllImagesFromPaper();
}
//hide the cursor
return typeof this.whiteboardPaperModel !== "undefined" && this.whiteboardPaperModel !== null ? (ref = this.whiteboardPaperModel.cursor) != null ? ref.remove() : void 0 : void 0;
return typeof this.whiteboardPaperModel !== 'undefined' && this.whiteboardPaperModel !== null ? (ref = this.whiteboardPaperModel.cursor) != null ? ref.remove() : void 0 : void 0;
},
manuallyDisplayShapes: function () {
let currentSlide, i, j, len, len1, num, ref, ref1, ref2, results, s, shapeInfo, shapeType, shapes, wpm;
if (Meteor.WhiteboardCleanStatus.findOne({
in_progress: true
in_progress: true,
}) != null) {
return;
}
currentSlide = BBB.getCurrentSlide();
wpm = this.whiteboardPaperModel;
shapes = Meteor.Shapes.find({
whiteboardId: currentSlide != null ? (ref = currentSlide.slide) != null ? ref.id : void 0 : void 0
whiteboardId: currentSlide != null ? (ref = currentSlide.slide) != null ? ref.id : void 0 : void 0,
}).fetch();
results = [];
@ -144,7 +150,7 @@ export let Slide = React.createClass({
s = shapes[i];
shapeInfo = ((ref1 = s.shape) != null ? ref1.shape : void 0) || (s != null ? s.shape : void 0);
shapeType = shapeInfo != null ? shapeInfo.type : void 0;
if(shapeType !== "text") {
if (shapeType !== 'text') {
len = shapeInfo.points.length;
for (num = j = 0, ref2 = len; 0 <= ref2 ? j <= ref2 : j >= ref2; num = 0 <= ref2 ? ++j : --j) { // the coordinates must be in the range 0 to 1
if (shapeInfo != null) {
@ -152,18 +158,21 @@ export let Slide = React.createClass({
}
}
}
if (wpm != null) {
wpm.makeShape(shapeType, shapeInfo);
}
results.push(wpm != null ? wpm.updateShape(shapeType, shapeInfo) : void 0);
}
return results;
},
reactOnSlideChange: function () {
var _this = this;
var currentSlide, pic, ref;
currentSlide = BBB.getCurrentSlide("slide.rendered");
currentSlide = BBB.getCurrentSlide('slide.rendered');
pic = new Image();
pic.onload = function () {
var ref;
@ -174,38 +183,43 @@ export let Slide = React.createClass({
scaleWhiteboard(_this.whiteboardPaperModel);
}
});
if ((currentSlide != null ? (ref = currentSlide.slide) != null ? ref.img_uri : void 0 : void 0) != null) {
return _this.createWhiteboardPaper(function (wpm) {
return _this.displaySlide(wpm);
});
}
};
pic.src = currentSlide != null ? (ref = currentSlide.slide) != null ? ref.img_uri : void 0 : void 0;
return "";
return '';
},
updatePointerLocation(pointer) {
if(typeof this.whiteboardPaperModel !== "undefined" && this.whiteboardPaperModel !== null) {
if (typeof this.whiteboardPaperModel !== 'undefined' && this.whiteboardPaperModel !== null) {
this.whiteboardPaperModel.moveCursor(pointer.x, pointer.y);
}
},
renderShape(data) {
let i, len, num, ref, ref1, shapeInfo, shapeType, wpm;
// @data is the shape object coming from the {{#each}} in the html file
shapeInfo = ((ref = data.shape) != null ? ref.shape : void 0) || data.shape;
shapeType = shapeInfo != null ? shapeInfo.type : void 0;
if(shapeType !== "text") {
if (shapeType !== 'text') {
len = shapeInfo.points.length;
for (num = i = 0, ref1 = len; 0 <= ref1 ? i <= ref1 : i >= ref1; num = 0 <= ref1 ? ++i : --i) { // the coordinates must be in the range 0 to 1
shapeInfo.points[num] = shapeInfo.points[num] / 100;
}
}
if(typeof this.whiteboardPaperModel !== "undefined" && this.whiteboardPaperModel !== null) {
if (typeof this.whiteboardPaperModel !== 'undefined' && this.whiteboardPaperModel !== null) {
wpm = this.whiteboardPaperModel;
if (wpm != null) {
wpm.makeShape(shapeType, shapeInfo);
}
return wpm != null ? wpm.updateShape(shapeType, shapeInfo) : void 0;
}
},
@ -215,5 +229,5 @@ export let Slide = React.createClass({
<div id="whiteboard-paper">
</div>
);
}
},
});

View File

@ -13,10 +13,10 @@ export let UploaderControls = React.createClass ({
let ref, ref1;
return (ref = a.isUploading === b.isUploading) != null ? ref : {
0: (ref1 = a.isUploading) != null ? ref1 : -{
1: 1
}
1: 1,
},
};
}
},
}),
};
},
@ -27,11 +27,11 @@ export let UploaderControls = React.createClass ({
presentations = Meteor.Presentations.find({}, {
sort: {
'presentation.current': -1,
'presentation.name': 1
'presentation.name': 1,
},
fields: {
'presentation': 1
}
presentation: 1,
},
}).fetch();
return {
@ -42,11 +42,12 @@ export let UploaderControls = React.createClass ({
fakeUpload(file, list) {
return setTimeout((() => {
file.uploadedSize = file.uploadedSize + (Math.floor(Math.random() * file.size + file.uploadedSize) / 10);
file.percUploaded = Math.round((file.uploadedSize / file.size) * 100) + "%";
file.percUploaded = Math.round((file.uploadedSize / file.size) * 100) + '%';
if (!(file.size > file.uploadedSize)) {
file.uploadedSize = file.size;
file.isUploading = false;
}
list.update(file.name, file);
this.forceUpdate();
if (file.isUploading === true) {
@ -54,17 +55,19 @@ export let UploaderControls = React.createClass ({
} else {
list.remove(file.name); // TODO: Here we should remove and update te presentation on mongo
this.forceUpdate();
return
return;
}
}), 200);
},
isOpen() {
return this.props.isOpen.get() ? "is-open" : ""
return this.props.isOpen.get() ? 'is-open' : '';
},
files() {
return this.props.files ? this.props.files.fetch() : null;
},
presentations() {
return this.data.presentations.map(x => {
return x.presentation;
@ -78,7 +81,7 @@ export let UploaderControls = React.createClass ({
return _.each(files, file => {
file.isUploading = true;
file.uploadedSize = 0;
file.percUploaded = "0";
file.percUploaded = '0';
this.props.files.insert(file.name, file);
return this.fakeUpload(file, this.props.files);
});
@ -106,7 +109,7 @@ export let UploaderControls = React.createClass ({
render() {
return (
<div className={classNames('presenter-uploader-control', this.isOpen() ? "is-open" : "")} >
<div className={classNames('presenter-uploader-control', this.isOpen() ? 'is-open' : '')} >
<div className="presenter-uploader-container">
<PresentationList files={this.files()} presentations={this.presentations()} />
<div onDrop={this.handleInput} onDragOver={this.handleDragOver} onDragLeave={this.handleDragLeave} className="presenter-uploader-dropzone" data-dropzone>
@ -123,6 +126,6 @@ export let UploaderControls = React.createClass ({
</div>
<Button onClick={this.handleOpen} btn_class=" presenter-uploader-control-btn js-open" i_class="ion-ios-upload-outline"/>
</div>
)
}
);
},
});

View File

@ -6,7 +6,6 @@ import { Polling } from './Polling.jsx';
import { Button } from '../shared/Button.jsx';
import { WhiteboardControls } from './WhiteboardControls.jsx';
export let Whiteboard = React.createClass({
mixins: [ReactMeteorData],
getMeteorData() {
@ -33,6 +32,7 @@ export let Whiteboard = React.createClass({
whiteboard_size = 'viewer-whiteboard';
}
}
return {
whiteboard_size: whiteboard_size,
is_mobile: is_mobile,
@ -56,6 +56,7 @@ export let Whiteboard = React.createClass({
resize() {
return adjustChatInputHeight();
},
start() {
if ($('#chat').width() / $('#panels').width() > 0.2) { // chat shrinking can't make it smaller than one fifth of the whiteboard-chat area
return $('#whiteboard').resizable('option', 'maxWidth', $('#panels').width() - 200); // gives the chat enough space (200px)
@ -63,10 +64,11 @@ export let Whiteboard = React.createClass({
return $('#whiteboard').resizable('option', 'maxWidth', $('#whiteboard').width());
}
},
stop() {
$('#whiteboard').css('width', `${100 * $('#whiteboard').width() / $('#panels').width()}%`); // transforms width to %
return $('#whiteboard').resizable('option', 'maxWidth', null);
}
},
});
// whiteboard element needs to be available
@ -90,7 +92,7 @@ export let Whiteboard = React.createClass({
},
isFullScreen() {
if($( ".fullscreenButton" ).hasClass( "exitFullscreenButton" )) {
if ($('.fullscreenButton').hasClass('exitFullscreenButton')) {
return true;
} else {
return false;
@ -117,5 +119,5 @@ export let Whiteboard = React.createClass({
</div>
</div>
);
}
},
});

View File

@ -2,7 +2,6 @@ import React from 'react';
import { Button } from '../shared/Button.jsx';
import { UploaderControls } from './UploaderControls.jsx';
export let WhiteboardControls = React.createClass({
mixins: [ReactMeteorData],
getMeteorData() {
@ -10,24 +9,26 @@ export let WhiteboardControls = React.createClass ({
currentSlideNum = 0;
totalSlideNum = 0;
currentPresentation = Meteor.Presentations.findOne({
'presentation.current': true
'presentation.current': true,
});
if (currentPresentation != null) {
currentSlide = Meteor.Slides.findOne({
'presentationId': currentPresentation.presentation.id,
'slide.current': true
})
presentationId: currentPresentation.presentation.id,
'slide.current': true,
});
if (currentSlide != null) {
currentSlideNum = currentSlide.slide.num;
}
totalSlides = Meteor.Slides.find({ 'presentationId': currentPresentation.presentation.id });
totalSlides = Meteor.Slides.find({ presentationId: currentPresentation.presentation.id });
if (totalSlides != null) {
totalSlideNum = totalSlides.count();
}
}
return {
currentSlideNum: currentSlideNum,
totalSlideNum: totalSlideNum
totalSlideNum: totalSlideNum,
};
},
@ -69,6 +70,6 @@ export let WhiteboardControls = React.createClass ({
</div>
</div>
</div>
)
}
);
},
});

View File

@ -45,17 +45,17 @@ this.addShapeToCollection = function (meetingId, whiteboardId, shapeObject) {
// the mouse button was released - the drawing is complete
// TODO: pencil messages currently don't send draw_end and are labeled all as DRAW_START
} else if(shapeObject != null && (shapeObject.status === "DRAW_START" || shapeObject.status === "DRAW_UPDATE" || shapeObject.status === "DRAW_END")) {
} else if (shapeObject != null && (shapeObject.status === 'DRAW_START' || shapeObject.status === 'DRAW_UPDATE' || shapeObject.status === 'DRAW_END')) {
shape = Meteor.Shapes.findOne({
"shape.id": shapeObject.shape.id
'shape.id': shapeObject.shape.id,
});
if (shape != null) {
return id = Meteor.Shapes.update({
"shape.id": shapeObject.shape.id
'shape.id': shapeObject.shape.id,
}, {
$set: {
"shape.shape.points": shapeObject.shape.points
}
'shape.shape.points': shapeObject.shape.points,
},
});
} else {
entry = {

View File

@ -65,7 +65,7 @@ Meteor.RedisPubSub = (function () {
let eventName, message, messagesWeIgnore;
message = JSON.parse(jsonMsg);
eventName = message.header.name;
messagesWeIgnore = ["BbbPubSubPongMessage", "bbb_apps_is_alive_message", "broadcast_layout_message"];
messagesWeIgnore = ['BbbPubSubPongMessage', 'bbb_apps_is_alive_message', 'broadcast_layout_message'];
if (indexOf.call(messagesWeIgnore, eventName) < 0) {
// Uncomment for DEVELOPMENT purposes only
// Otherwise dynamic shapes' updates will slow down significantly

View File

@ -45,6 +45,7 @@ Meteor.startup(() => {
return '';
}
};
// Uncomment for DEVELOPMENT purposes only
// Otherwise dynamic shapes' updates will slow down significantly
//Meteor.log.info(`in callback after handleRedisMessage ${eventName}. ${lengthString()}`);
@ -107,6 +108,7 @@ Meteor.startup(() => {
Meteor.log.error('ERROR!! No header or payload');
callback();
}
if (eventName, indexOf.call(notLoggedEventTypes, eventName) < 0) {
// Uncomment for DEVELOPMENT purposes only
// Otherwise dynamic shapes' updates will slow down significantly