Remove avatars from frontend

This commit is contained in:
Jannik Volkland
2020-10-14 13:33:55 +02:00
parent d7c3991b59
commit 146e6d342c
9 changed files with 15 additions and 87 deletions

View File

@@ -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
/>
`