fix js errors when loading jamserver.js

This commit is contained in:
Nuwan 2022-01-18 20:20:45 +05:30
parent 87278e6adb
commit a4d8bc70b0
18 changed files with 81 additions and 60 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,17 +14,17 @@ const Main = props => {
const breakpoints = {
xs: '320px',
sm: '576px',
md: '960px',
lg: '1280px',
xl: '1800px'
md: '768px',
lg: '992px',
xl: '1200px'
};
const breakpointsMax = {
xs: '319px',
sm: '575px',
md: '959px',
lg: '1279px',
xl: '1799px'
md: '767px',
lg: '991px',
xl: '1199px'
};
const [isFluid, setIsFluid] = useState(getItemFromStore('isFluid', settings.isFluid));

View File

@ -7,3 +7,4 @@
@import './custom/nav';
@import './custom/user';
@import './custom/form';
@import './custom/common';

View File

@ -0,0 +1,3 @@
.table-responsive {
display: table;
}

View File

@ -1,4 +1,4 @@
import React, { useContext, useEffect, useRef } from 'react';
import React, { useContext, useEffect, useRef, useState } from 'react';
import { Switch, Route, Redirect } from 'react-router-dom';
import PrivateRoute from '../../helpers/privateRoute';
@ -6,7 +6,7 @@ import NavbarTop from '../navbar/JKNavbarTop';
import NavbarVertical from '../navbar/JKNavbarVertical';
import Footer from '../footer/JKFooter';
import { ToastContainer, toast } from 'react-toastify';
import { toast } from 'react-toastify';
import AppContext from '../../context/Context';
import { getPageName } from '../../helpers/utils';
@ -25,11 +25,17 @@ import JKPrivacy from '../page/JKPrivacy';
//import JKPeople from '../page/JKPeople';
import JKPeopleFilter from '../page/JKPeopleFilter';
import JKNotifications from '../page/JKNotifications';
import JKMessageModal from '../profile/JKMessageModal';
//import loadable from '@loadable/component';
//const DashboardRoutes = loadable(() => import('../../layouts/JKDashboardRoutes'));
//const PublicRoutes = loadable(() => import('../../layouts/JKPublicRoutes'))
const Msg = ({ closeToast, toastProps, title }) => (
<div>
<a href='#'>{title}</a>
</div>
)
function JKDashboardMain() {
const { isFluid, isVertical, navbarStyle } = useContext(AppContext);
@ -39,6 +45,9 @@ function JKDashboardMain() {
const scriptLoaded = useRef(false)
const [showMessageModal, setShowMessageModal] = useState(false)
const [messageUser, setMessageUser] = useState(null)
useEffect(() => {
//DashboardRoutes.preload();
//PublicRoutes.preload();
@ -96,15 +105,16 @@ function JKDashboardMain() {
dispatch(addMessage(msg));
// const TextMessageToast = ({ closeToast, toastProps }) => (
// <div>
// Lorem ipsum dolor {toastProps.position}
// <button>Retry</button>
// <button onClick={closeToast}>Close</button>
// </div>
// )
// toast(<TextMessageToast />)
//toast(<Msg title={`${msg.senderName} has sent a new message`} />)
toast.info(`${msg.senderName} has sent a new message`, {
hideProgressBar: true,
closeOnClick: true,
pauseOnHover: true,
onClick: () => {
setMessageUser({ id: msg.senderId, name: msg.senderName })
setShowMessageModal(true)
}
})
handleNotification(payload, header.type);
});
@ -171,8 +181,11 @@ function JKDashboardMain() {
</Switch>
{!isKanban && <Footer />}
<ToastContainer />
</div>
{ messageUser &&
<JKMessageModal show={showMessageModal} setShow={setShowMessageModal} user={messageUser} />
}
{/* <SidePanelModal path={location.pathname} /> */}
</div>
);

View File

@ -26,7 +26,7 @@ function JKNotification(props) {
userId: currentUser.id,
notificationId: notification_id
}
console.log('before removeNotification', options);
//console.log('before removeNotification', options);
await dispatch(removeNotification(options))
.unwrap()
.then(resp => {

View File

@ -414,7 +414,7 @@ function JKPeopleFilter() {
) : isIterableArray(people) ? (
//Start Find Friends table hidden on small screens
<>
{greaterThan.xs ? (
{greaterThan.sm ? (
<Row className="mb-3 justify-content-between d-none d-md-block">
<div className="table-responsive-xl px-2" ref={peopleListRef}>
<JKPeopleList

View File

@ -40,7 +40,7 @@ const JKPerson = props => {
return (
<>
{greaterThan.xs ? (
{greaterThan.sm ? (
<tr className="align-middle" key={`people-list-item-${id}`}>
<td className="text-nowrap">
<a href="/#" onClick={toggleMoreDetails} className="d-flex align-items-center mb-1 fs-0">

View File

@ -40,7 +40,7 @@ context.JK.ClientInit = class ClientInit
nativeClientInit: () =>
@gearUtils.bootstrapDefaultPlaybackProfile();
window.VideoActions.checkPromptConfigureVideo()
context.VideoActions.checkPromptConfigureVideo()

View File

@ -178,34 +178,7 @@
}
}
function _heartbeat() {
if(isLatencyTester()) {
logger.info("latency-tester debug: heartbeat" + app.heartbeatActive)
}
if (app.heartbeatActive) {
//console.log("heartbeat active?: " + active)
var message = context.JK.MessageFactory.heartbeat(notificationLastSeen, notificationLastSeenAt, active);
notificationLastSeenAt = undefined;
notificationLastSeen = undefined;
// for debugging purposes, see if the last time we've sent a heartbeat is way off (500ms) of the target interval
var now = new Date();
if(lastHeartbeatSentTime) {
var drift = new Date().getTime() - lastHeartbeatSentTime.getTime() - heartbeatMS;
if (drift > 500) {
logger.warn("significant drift between heartbeats: " + drift + 'ms beyond target interval')
}
}
lastHeartbeatSentTime = now;
console.log("DEBUG - context.JK.JamServer", $self);
context.JK.JamServer.send(message);
lastHeartbeatFound = false;
}
}
function isClientMode() {
return mode == "client";
@ -925,6 +898,34 @@
context.JK.JamServer = server;
function _heartbeat() {
if(isLatencyTester()) {
logger.info("latency-tester debug: heartbeat" + app.heartbeatActive)
}
if (app.heartbeatActive) {
//console.log("heartbeat active?: " + active)
var message = context.JK.MessageFactory.heartbeat(notificationLastSeen, notificationLastSeenAt, active);
notificationLastSeenAt = undefined;
notificationLastSeen = undefined;
// for debugging purposes, see if the last time we've sent a heartbeat is way off (500ms) of the target interval
var now = new Date();
if(lastHeartbeatSentTime) {
var drift = new Date().getTime() - lastHeartbeatSentTime.getTime() - heartbeatMS;
if (drift > 500) {
logger.warn("significant drift between heartbeats: " + drift + 'ms beyond target interval')
}
}
lastHeartbeatSentTime = now;
//context.JK.JamServer.send(message);
server.send(message)
lastHeartbeatFound = false;
}
}
// Callbacks from jamClient
if (context.jamClient !== undefined && context.jamClient.IsNativeClient()) {
context.jamClient.SendP2PMessage.connect(server.sendP2PMessage);
@ -945,7 +946,7 @@
console.log("Init JK scripts....", context.JK.JamServer);
context.JK.JamServer.send("fuck u")
context.JK.JamServer.send("hello")
// $inSituBanner = $('.server-connection');
// $inSituBannerHolder = $('.no-websocket-connection');

View File

@ -9,6 +9,9 @@
//= require globals
//= require AAB_message_factory
//= require layout
//= require wizard/gear_utils
//= require reflux
//= require react-components/actions/VideoActions
//= require client_init
//= require utils
//= require jamkazam