From 146e6d342c7e84079321a7ac31e2a8efe4aa6a67 Mon Sep 17 00:00:00 2001 From: Jannik Volkland Date: Wed, 14 Oct 2020 13:33:55 +0200 Subject: [PATCH 1/2] Remove avatars from frontend --- webroot/js/app-standalone-chat.js | 11 ++++------- webroot/js/app.js | 11 +---------- webroot/js/components/chat/chat.js | 10 ++++------ webroot/js/components/chat/message.js | 19 ++----------------- webroot/js/components/chat/username.js | 16 ++++------------ webroot/js/utils/constants.js | 1 - webroot/js/utils/helpers.js | 10 ---------- webroot/styles/chat.css | 16 ---------------- webroot/styles/standalone-chat.css | 8 -------- 9 files changed, 15 insertions(+), 87 deletions(-) diff --git a/webroot/js/app-standalone-chat.js b/webroot/js/app-standalone-chat.js index b57b32255..86e4873d1 100644 --- a/webroot/js/app-standalone-chat.js +++ b/webroot/js/app-standalone-chat.js @@ -4,8 +4,8 @@ const html = htm.bind(h); import Chat from './components/chat/chat.js'; import Websocket from './utils/websocket.js'; -import { getLocalStorage, generateAvatar, generateUsername } from './utils/helpers.js'; -import { KEY_USERNAME, KEY_AVATAR } from './utils/constants.js'; +import { getLocalStorage, generateUsername } from './utils/helpers.js'; +import { KEY_USERNAME } from './utils/constants.js'; export default class StandaloneChat extends Component { constructor(props, context) { @@ -15,28 +15,25 @@ export default class StandaloneChat extends Component { websocket: new Websocket(), chatEnabled: true, // always true for standalone chat username: getLocalStorage(KEY_USERNAME) || generateUsername(), - userAvatarImage: getLocalStorage(KEY_AVATAR) || generateAvatar(`${this.username}${Date.now()}`), }; this.websocket = null; this.handleUsernameChange = this.handleUsernameChange.bind(this); } - handleUsernameChange(newName, newAvatar) { + handleUsernameChange(newName) { this.setState({ username: newName, - userAvatarImage: newAvatar, }); } render(props, state) { - const { username, userAvatarImage, websocket } = state; + const { username, websocket } = state; return ( html` <${Chat} websocket=${websocket} username=${username} - userAvatarImage=${userAvatarImage} messagesOnly /> ` diff --git a/webroot/js/app.js b/webroot/js/app.js index 71beb289f..672e2b1af 100644 --- a/webroot/js/app.js +++ b/webroot/js/app.js @@ -14,7 +14,6 @@ import { classNames, clearLocalStorage, debounce, - generateAvatar, generateUsername, getLocalStorage, pluralize, @@ -22,7 +21,6 @@ import { } from './utils/helpers.js'; import { HEIGHT_SHORT_WIDE, - KEY_AVATAR, KEY_CHAT_DISPLAYED, KEY_USERNAME, MESSAGE_OFFLINE, @@ -50,9 +48,6 @@ export default class App extends Component { displayChat: chatStorage === null ? true : chatStorage, chatInputEnabled: false, // chat input box state username: getLocalStorage(KEY_USERNAME) || generateUsername(), - userAvatarImage: - getLocalStorage(KEY_AVATAR) || - generateAvatar(`${this.username}${Date.now()}`), configData: {}, extraUserContent: '', @@ -282,10 +277,9 @@ export default class App extends Component { } - handleUsernameChange(newName, newAvatar) { + handleUsernameChange(newName) { this.setState({ username: newName, - userAvatarImage: newAvatar, }); } @@ -330,7 +324,6 @@ export default class App extends Component { playerActive, streamOnline, streamStatusMessage, - userAvatarImage, username, viewerCount, websocket, @@ -415,7 +408,6 @@ export default class App extends Component { > <${UsernameForm} username=${username} - userAvatarImage=${userAvatarImage} handleUsernameChange=${this.handleUsernameChange} />