<commit_before>import React from 'react';
import {Paper} from 'material-ui';

import ChatStore from 'stores/ChatStore';
import PeerActions from 'actions/PeerActions';
import ChatUserStore from 'stores/ChatUserStore';

class ChatList extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      vector: [0,0,0,0,0,0,0,0,0,0],
      chatItems: ChatStore.getChatItems()
    };
  }
  componentDidMount() {
    this._onChange = this.onChange.bind(this);
    ChatStore.addListener('change', this._onChange);
    this._onChatUserChange = this.onChatUserChange.bind(this);
    ChatUserStore.addListener('change', this._onChatUserChange);
  }
  componentWillUnmount() {
    ChatStore.removeListener('change', this._onChange);
    ChatUserStore.removeListener('change', this._onChatUserChange);
  }
  onChange() {
    this.setState({
      vector: this.state.vector,
      chatItems: ChatStore.getChatItems()
    });
  }
  onChatUserChange() {
    const profile = ChatUserStore.getLocalProfile();
    this.setState({
      vector: profile.featureVector,
      chatItems: this.state.chatItems
    });
  }
  render() {
    var items = this.state.chatItems.map(renderItem);
    return (
      <div className="chatList col-xs">
        {items}
      </div>
    );
  }
}

function renderItem(item) {
  const distance = ChatUserStore.getDistanceToLocal(item.featureVector);
  const offsetX = distance * 50;
  const offsetY = Math.max(0, Math.min(1, distance)) * 50;
  let scale = Math.max(0, 1 - distance);
  scale *= scale;
  const itemStyles = {
    position: 'relative',
    left: `${offsetX}%`,
    transform: `scale(${scale})`,
    width: `${scale * 100}%`,<commit_msg>scale based on features<commit_after>import React from 'react';
import {Paper} from 'material-ui';

import ChatStore from 'stores/ChatStore';
import PeerActions from 'actions/PeerActions';
import ChatUserStore from 'stores/ChatUserStore';

class ChatList extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      vector: [0,0,0,0,0,0,0,0,0,0],
      chatItems: ChatStore.getChatItems()
    };
  }
  componentDidMount() {
    this._onChange = this.onChange.bind(this);
    ChatStore.addListener('change', this._onChange);
    this._onChatUserChange = this.onChatUserChange.bind(this);
    ChatUserStore.addListener('change', this._onChatUserChange);
  }
  componentWillUnmount() {
    ChatStore.removeListener('change', this._onChange);
    ChatUserStore.removeListener('change', this._onChatUserChange);
  }
  onChange() {
    this.setState({
      vector: this.state.vector,
      chatItems: ChatStore.getChatItems()
    });
  }
  onChatUserChange() {
    const profile = ChatUserStore.getLocalProfile();
    this.setState({
      vector: profile.featureVector,
      chatItems: this.state.chatItems
    });
  }
  render() {
    var items = this.state.chatItems.map(renderItem);
    return (
      <div className="chatList col-xs">
        {items}
      </div>
    );
  }
}

function renderItem(item) {
  let distance = Math.sqrt(ChatUserStore.getDistanceToLocal(item.featureVector));
  const offsetX = distance * 100;
  //const offsetY = Math.max(0, Math.min(1, distance)) * 50;
  let scale = Math.max(0, 1 - distance);
  scale *= scale;
  const itemStyles = {
    position: 'relative',
    left: `${offsetX}%`,
    transform: `scale(${scale})`,
    width: `${scale * 100}%`,
{'fraction_non_alphanumeric': 0.14205882352941177, 'fraction_numerical': 0.012647058823529412, 'mean_word_length': 3.691034482758621, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '743945', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1086, 'n_words': 208}