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

added icon show typing for gamers #761

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions services/app/assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,13 @@ a {
.x-rounded-bottom-left {
border-bottom-left-radius: $border-radius !important;
}
.shown {
margin: 5px;
opacity: 1;
transition: all 250ms linear;
}
.hidden {
margin: 5px;
opacity: 0;
transition: all 250ms linear;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState, useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import _ from 'lodash';
import cn from 'classnames';
Expand Down Expand Up @@ -45,10 +45,25 @@ const renderSwitchThemeBtn = (switchTheme, theme) => {
);
};
const renderNameplate = (player = {}, onlineUsers) => {

const text = useSelector(state => selectors.editorTextsSelector(state));
const keys = Object.keys(text);
const leftGamerText = keys[1];
const [showTyping, setShowTyping] = useState(true);
useEffect(() => {
setShowTyping(true);
setTimeout(() => {
setShowTyping(false);
}, 500);
}, [text[leftGamerText]]);

const isOnline = _.find(onlineUsers, { id: player.id });

return (
<div className="d-flex align-items-center">
<div>
<FontAwesomeIcon icon="keyboard" className={`text-info ml-2 ${showTyping ? 'shown' : 'hidden'}`} />
</div>
<UserInfo user={player} />
<div>
{isOnline ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState, useEffect } from 'react';
import { useSelector } from 'react-redux';
import _ from 'lodash';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
Expand All @@ -9,6 +9,18 @@ import GameResultIcon from '../../components/GameResultIcon';
import EditorHeightButtons from './EditorHeightButtons';

const renderNameplate = (player = {}, onlineUsers) => {

const text = useSelector(state => selectors.editorTextsSelector(state));
const keys = Object.keys(text);
const rightGamerText = keys[0];
const [showTyping, setShowTyping] = useState(true);
useEffect(() => {
setShowTyping(true);
setTimeout(() => {
setShowTyping(false);
}, 500);
}, [text[rightGamerText]]);

const isOnline = _.find(onlineUsers, { id: player.id });

return (
Expand All @@ -21,6 +33,9 @@ const renderNameplate = (player = {}, onlineUsers) => {
<FontAwesomeIcon icon="skull-crossbones" className="text-secondary ml-2" />
)}
</div>
<div>
<FontAwesomeIcon icon="keyboard" className={`text-info ml-2 ${showTyping ? 'shown' : 'hidden'}`} />
</div>
</div>
);
};
Expand Down