@@ -178,7 +178,7 @@ class ChannelDetails extends Component {
@
{user.username}
{' '}
--
+ -
{' '}
{user.name}
@@ -188,9 +188,7 @@ class ChannelDetails extends Component {
Invite Members
-
- {searchedUsers}
-
+
{searchedUsers}
Pending Invites:
{pendingInvites}
@@ -212,12 +210,11 @@ class ChannelDetails extends Component {
It may not be immediately in the sidebar
- Contact the admins at
+ Contact the admins at
{' '}
yo@dev.to
{' '}
-if
- this was a mistake
+ if this was a mistake
);
diff --git a/app/javascript/chat/codeEditor.jsx b/app/javascript/chat/codeEditor.jsx
index 4e98d9088..3bb6646e9 100644
--- a/app/javascript/chat/codeEditor.jsx
+++ b/app/javascript/chat/codeEditor.jsx
@@ -2,30 +2,30 @@ import { h, Component } from 'preact';
import PropTypes from 'prop-types';
export default class CodeEditor extends Component {
-
componentDidMount() {
- import('codemirror')
- .then(CodeMirror => {
- const editor = document.getElementById("codeeditor");
+ import('codemirror').then(CodeMirror => {
+ const editor = document.getElementById('codeeditor');
const myCodeMirror = CodeMirror(editor, {
- mode: "javascript",
- theme: "material",
+ mode: 'javascript',
+ theme: 'material',
autofocus: true,
});
- myCodeMirror.setSize("100%", "100%");
- //Initial trigger:
- const channel = window.pusher.channel(`presence-channel-${this.props.activeChannelId}`)
+ myCodeMirror.setSize('100%', '100%');
+ // Initial trigger:
+ const channel = window.pusher.channel(
+ `presence-channel-${this.props.activeChannelId}`,
+ );
channel.trigger('client-livecode', {
context: 'initializing-live-code-channel',
- channel: `presence-channel-${this.props.activeChannelId}`
+ channel: `presence-channel-${this.props.activeChannelId}`,
});
- //Coding trigger:
+ // Coding trigger:
myCodeMirror.on('keyup', cm => {
- channel.trigger('client-livecode', {
- keyPressed: true,
- value: cm.getValue(),
- cursorPos: cm.getCursor(),
- });
+ channel.trigger('client-livecode', {
+ keyPressed: true,
+ value: cm.getValue(),
+ cursorPos: cm.getCursor(),
+ });
});
});
}
@@ -35,11 +35,10 @@ export default class CodeEditor extends Component {
}
render() {
-
- return
-
+ return (
+
+ );
}
-
-}
\ No newline at end of file
+}
diff --git a/app/javascript/chat/compose.jsx b/app/javascript/chat/compose.jsx
index 1f0ec0c83..2e95df20f 100644
--- a/app/javascript/chat/compose.jsx
+++ b/app/javascript/chat/compose.jsx
@@ -5,7 +5,7 @@ export default class Chat extends Component {
static propTypes = {
handleKeyDown: PropTypes.func.isRequired,
handleSubmitOnClick: PropTypes.func.isRequired,
- activeChannelId: PropTypes.number
+ activeChannelId: PropTypes.number,
};
shouldComponentUpdate(nextProps) {
diff --git a/app/javascript/chat/video.jsx b/app/javascript/chat/video.jsx
index 035a0564c..9968c693e 100644
--- a/app/javascript/chat/video.jsx
+++ b/app/javascript/chat/video.jsx
@@ -12,109 +12,128 @@ export default class Video extends Component {
pageY: null,
token: null,
room: null,
- participants: []
- }
+ participants: [],
+ };
}
+
componentDidMount() {
- getTwilioToken('private-video-channel-'+this.props.activeChannelId, this.setupCallChannel)
+ getTwilioToken(
+ `private-video-channel-${this.props.activeChannelId}`,
+ this.setupCallChannel,
+ );
}
componentWillUnmount() {
this.state.room.disconnect();
}
- setupCallChannel = (response) => {
+ setupCallChannel = response => {
const component = this;
- import('twilio-video')
- .then(({ connect, createLocalVideoTrack }) => {
- connect(response.token,
+ import('twilio-video').then(({ connect, createLocalVideoTrack }) => {
+ connect(
+ response.token,
{
- name:`private-video-channel-${this.props.activeChannelId}`,
+ name: `private-video-channel-${this.props.activeChannelId}`,
audio: true,
type: 'peer-to-peer',
- video: { width: 640 }
- }).then(function(room) {
- component.setState({token: response.token, room: room})
- createLocalVideoTrack().then(track => {
- let localMediaContainer = document.getElementById('videolocalscreen');
- localMediaContainer.appendChild(track.attach());
- });
- let roomParticipants = []
- room.participants.forEach(participant => {
- component.triggerRemoteJoin(participant);
- roomParticipants.push(participant);
- });
- component.setState({participants: roomParticipants})
- room.on('participantConnected', function(participant) {
- component.triggerRemoteJoin(participant);
- let roomParticipants = []
+ video: { width: 640 },
+ },
+ ).then(
+ function(room) {
+ component.setState({ token: response.token, room });
+ createLocalVideoTrack().then(track => {
+ const localMediaContainer = document.getElementById(
+ 'videolocalscreen',
+ );
+ localMediaContainer.appendChild(track.attach());
+ });
+ const roomParticipants = [];
room.participants.forEach(participant => {
+ component.triggerRemoteJoin(participant);
roomParticipants.push(participant);
});
- component.setState({participants: roomParticipants})
- room.on('participantDisconnected', function(participant) {
- component.props.onExit()
+ component.setState({ participants: roomParticipants });
+ room.on('participantConnected', function(participant) {
+ component.triggerRemoteJoin(participant);
+ const roomParticipants = [];
+ room.participants.forEach(participant => {
+ roomParticipants.push(participant);
+ });
+ component.setState({ participants: roomParticipants });
+ room.on('participantDisconnected', function(participant) {
+ component.props.onExit();
+ });
});
- })
- }, function(error) {
- document.getElementById('videoremotescreen').innerHTML = "";
- console.error('Unable to connect to Room: ' + error.message);
- });
+ },
+ function(error) {
+ document.getElementById('videoremotescreen').innerHTML = '';
+ console.error(`Unable to connect to Room: ${error.message}`);
+ },
+ );
});
- }
+ };
- triggerRemoteJoin = (participant) => {
+ triggerRemoteJoin = participant => {
// document.getElementById('videoremotescreen').innerHTML = ""
participant.on('trackAdded', track => {
document.getElementById('videoremotescreen').appendChild(track.attach());
});
- }
+ };
handleDrag = e => {
if (!this.state.pageX) {
- this.setState({pageX:e.pageX,
+ this.setState({
+ pageX: e.pageX,
pageY: e.pageY,
offsetDiffX: e.pageX - e.target.offsetLeft,
offsetDiffY: e.pageY - e.target.offsetTop,
- })
- } else if (e.pageX != 0){
+ });
+ } else if (e.pageX != 0) {
this.setState({
- leftPx: this.state.pageX + e.pageX - this.state.pageX - this.state.offsetDiffX,
- topPx: this.state.pageY + e.pageY - this.state.pageY - this.state.offsetDiffY
- })
+ leftPx:
+ this.state.pageX +
+ e.pageX -
+ this.state.pageX -
+ this.state.offsetDiffX,
+ topPx:
+ this.state.pageY +
+ e.pageY -
+ this.state.pageY -
+ this.state.offsetDiffY,
+ });
} else if (e.pageX === 0) {
- this.setState({pageX:null,
+ this.setState({
+ pageX: null,
pageY: null,
offsetDiffX: null,
offsetDiffY: null,
- })
+ });
}
- }
+ };
render() {
return (
-
-
-
+ id="chat__videocall"
+ draggable="true"
+ onDrag={this.handleDrag}
+ style={{ left: `${this.state.leftPx}px`, top: `${this.state.topPx}px` }}
+ >
+
+
+
×
- )
+ );
}
}
-
-
-
-
-
-
-
-
-
diff --git a/app/javascript/chat/view.jsx b/app/javascript/chat/view.jsx
index 0a643b3fe..e26bce08b 100644
--- a/app/javascript/chat/view.jsx
+++ b/app/javascript/chat/view.jsx
@@ -1,29 +1,49 @@
-
-
import { h, Component } from 'preact';
export default class View extends Component {
+ channel = (props) => {
+ return (
+
+
{props.channel.channel_name}
+
+ {props.channel.description}
+
+
+ Accept
+
+
+ Decline
+
+
+ );
+ };
render() {
- const channels = this.props.channels.map((channel) => {
- return
-
{channel.channel_name}
-
{channel.description}
-
Accept
-
Decline
-
+ const channels = this.props.channels.map(channel => {
+ return
});
- return
-
- ×
-
Channel Invitations 🤗
- {channels}
-
-
+ return (
+
+
+
+ ×
+
+
Channel Invitations 🤗
+ {channels}
+
+
+ );
}
-
-}
\ No newline at end of file
+}
diff --git a/app/javascript/packs/Onboarding.jsx b/app/javascript/packs/Onboarding.jsx
index fc335199d..42f16aca8 100644
--- a/app/javascript/packs/Onboarding.jsx
+++ b/app/javascript/packs/Onboarding.jsx
@@ -21,12 +21,12 @@ function isUserSignedIn() {
function renderPage() {
import('../src/Onboarding')
.then(({ default: Onboarding }) => {
- let waitingForOnboarding = setInterval(function(){
- if (document.getElementById("main-head-stylesheet")) {
- render(
, document.getElementById('top-bar'))
+ const waitingForOnboarding = setInterval(function() {
+ if (document.getElementById('main-head-stylesheet')) {
+ render(
, document.getElementById('top-bar'));
clearInterval(waitingForOnboarding);
}
- }, 3)
+ }, 3);
})
.catch(error => {
// eslint-disable-next-line no-console
diff --git a/app/javascript/packs/articleForm.jsx b/app/javascript/packs/articleForm.jsx
index 33fe41dff..0a80fa35b 100644
--- a/app/javascript/packs/articleForm.jsx
+++ b/app/javascript/packs/articleForm.jsx
@@ -10,16 +10,16 @@ HTMLDocument.prototype.ready = new Promise(resolve => {
return null;
});
-document.ready.then(function(){
+document.ready.then(function() {
loadForm();
window.InstantClick.on('change', () => {
- if (document.getElementById('article-form')){
+ if (document.getElementById('article-form')) {
loadForm();
}
});
});
-function loadForm(){
+function loadForm() {
getUserDataAndCsrfToken().then(({ currentUser, csrfToken }) => {
window.currentUser = currentUser;
window.csrfToken = csrfToken;
@@ -32,5 +32,5 @@ function loadForm(){
root,
root.firstElementChild,
);
- })
-}
\ No newline at end of file
+ });
+}
diff --git a/app/javascript/packs/githubRepos.jsx b/app/javascript/packs/githubRepos.jsx
index d00fb0319..66ab76c3b 100644
--- a/app/javascript/packs/githubRepos.jsx
+++ b/app/javascript/packs/githubRepos.jsx
@@ -3,7 +3,7 @@ import { GithubRepos } from '../githubRepos/githubRepos';
function loadElement() {
const root = document.getElementById('github-repos-container');
- if (root){
+ if (root) {
render(
, root, root.firstElementChild);
}
}
diff --git a/app/javascript/sidebar-widget/SidebarWidget.jsx b/app/javascript/sidebar-widget/SidebarWidget.jsx
index 1e52ad9b6..268f70501 100644
--- a/app/javascript/sidebar-widget/SidebarWidget.jsx
+++ b/app/javascript/sidebar-widget/SidebarWidget.jsx
@@ -79,7 +79,9 @@ class SidebarWidget extends Component {
return (
diff --git a/app/javascript/src/Onboarding.jsx b/app/javascript/src/Onboarding.jsx
index 219914b0d..671647e72 100644
--- a/app/javascript/src/Onboarding.jsx
+++ b/app/javascript/src/Onboarding.jsx
@@ -222,8 +222,8 @@ class Onboarding extends Component {
const newCheckedUsers = checkedUsers.slice();
const index = checkedUsers.indexOf(user);
- if(index > -1){
- newCheckedUsers.splice(index,1);
+ if (index > -1) {
+ newCheckedUsers.splice(index, 1);
} else {
newCheckedUsers.push(user);
}
@@ -259,12 +259,7 @@ class Onboarding extends Component {
}
handleNextButton() {
- const {
- users,
- articles,
- checkedUsers,
- profileInfo,
- } = this.state;
+ const { users, articles, checkedUsers, profileInfo } = this.state;
let { pageNumber } = this.state;
if (pageNumber === 2 && users.length === 0 && articles.length === 0) {
this.getUsersToFollow();
diff --git a/app/javascript/src/components/OnboardingArticle.jsx b/app/javascript/src/components/OnboardingArticle.jsx
index ba4a1f6ec..3f4fcd01a 100644
--- a/app/javascript/src/components/OnboardingArticle.jsx
+++ b/app/javascript/src/components/OnboardingArticle.jsx
@@ -30,12 +30,14 @@ const OnboardingArticle = ({ article, isSaved, onSaveArticle }) => (
{' '}
+ />
+ {' '}
{article.positive_reactions_count}
{' '}
+ />
+ {' '}
{article.comments_count}