import React from 'react'; import Tinode from 'tinode-sdk'; import { stringHash } from '../lib/strformat.js'; export default class LetterTile extends React.PureComponent { render() { let avatar; if (this.props.avatar === true) { const isGroup = (Tinode.topicType(this.props.topic) == 'grp'); const iconColor = (isGroup ? 'light-color' : 'dark-color') + (Math.abs(stringHash(this.props.topic)) % 16); if (this.props.topic && this.props.title && this.props.title.trim()) { const letter = this.props.title.trim().charAt(0); const className = 'lettertile ' + iconColor; avatar = (