<commit_before>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

import UserAvatar from 'components/user-avatar';
import { observer } from 'mobx-react';
import Channel from 'models/chat/channel';
import core from 'osu-core-singleton';
import * as React from 'react';
import { classWithModifiers } from 'utils/css';

interface Props {
  channel: Channel;
}

@observer
export default class ConversationListItem extends React.Component<Props> {
  render(): React.ReactNode {
    const uiState = core.dataStore.chatState;
    const baseClassName = 'chat-conversation-list-item';

    const selected = this.props.channel.channelId === uiState.selectedChannel?.channelId;

    return (
      <div className={classWithModifiers(baseClassName, { selected })}>
        {this.props.channel.isUnread && !selected
          ? <div className={`${baseClassName}__unread-indicator`} />
          : null}

        {/* FIXME: temporarily don't show part button for announcement channels to prevent accidentally leaving */}
        {this.props.channel.type !== 'ANNOUNCE' && (
          <button className={`${baseClassName}__close-button`} onClick={this.part}>
            <i className='fas fa-times' />
          </button>
        )}

        <button className={`${baseClassName}__tile`} onClick={this.switch}>
          <div className={`${baseClassName}__avatar`}>
            <UserAvatar modifiers='full-circle' user={{ avatar_url: this.props.channel.icon }} />
          </div><commit_msg>show close button on announcement channel<commit_after>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

import UserAvatar from 'components/user-avatar';
import { observer } from 'mobx-react';
import Channel from 'models/chat/channel';
import core from 'osu-core-singleton';
import * as React from 'react';
import { classWithModifiers } from 'utils/css';

interface Props {
  channel: Channel;
}

@observer
export default class ConversationListItem extends React.Component<Props> {
  render(): React.ReactNode {
    const uiState = core.dataStore.chatState;
    const baseClassName = 'chat-conversation-list-item';

    const selected = this.props.channel.channelId === uiState.selectedChannel?.channelId;

    return (
      <div className={classWithModifiers(baseClassName, { selected })}>
        {this.props.channel.isUnread && !selected
          ? <div className={`${baseClassName}__unread-indicator`} />
          : null}

        <button className={`${baseClassName}__close-button`} onClick={this.part}>
          <i className='fas fa-times' />
        </button>

        <button className={`${baseClassName}__tile`} onClick={this.switch}>
          <div className={`${baseClassName}__avatar`}>
            <UserAvatar modifiers='full-circle' user={{ avatar_url: this.props.channel.icon }} />
          </div>
{'fraction_non_alphanumeric': 0.12928759894459102, 'fraction_numerical': 0.0013192612137203166, 'mean_word_length': 3.6094224924012157, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '6032478', 'n_tokens_mistral': 860, 'n_tokens_neox': 849, 'n_words': 225}