<commit_before>import React from 'react'
import classNames from 'classnames'
import { MiniPlusIcon, MiniCheckIcon } from '../iconography/Icons'


export const RelationshipPriority = {
  INACTIVE: { priority: 'inactive' },
  FRIEND: { priority: 'friend' },
  NOISE: { priority: 'noise' },
  SELF: { priority: 'self' },
  MUTE: { priority: 'mute' },
  BLOCK: { priority: 'block' },
  NONE: { priority: 'none' },
}

class RelationshipButton extends React.Component {
  constructor(props, context) {
    super(props, context)
    const { priority } = this.props
    this.state = {
      priority: priority || 'inactive',
    }
  }

  updatePriority(priority) {
    const { buttonWasClicked, userId } = this.props
    if (buttonWasClicked) {
      buttonWasClicked({ userId, priority, existing: this.state.priority })
    }
    // Render the state change instantly
    this.setState({ priority: priority })
  }

  renderAsInactive(klassNames) {
    return (
      <button {...this.props}
          className={klassNames}
          type="button"
          onClick={() => this.updatePriority('friend')}
          data-priority={this.state.priority}>
        <MiniPlusIcon />
        <span>Follow</span>
      </button>
    )
  }

  renderAsNone(klassNames) {
    return this.renderAsInactive(klassNames)
  }

  renderAsFriend(klassNames) {
    return (
      <button {...this.props}
          className={klassNames}
          type="button"
          onClick={() => this.updatePriority('inactive')}
          data-priority={this.state.priority}>
        <MiniCheckIcon />
        <span>Friend</span>
      </button>
    )
  }

  renderAsNoise(klassNames) {
    return (
      <button {...this.props}
          className={klassNames}
          type="button"
          data-priority={this.state.priority}>
        <MiniCheckIcon />
        <span>Noise</span>
      </button>
    )
  }

  renderAsMute(klassNames) {
    return (
      <button {...this.props}
          className={klassNames}
          type="button"
          data-priority={this.state.priority}>
        <span>Muted</span>
      </button>
    )
  }

  renderAsBlock(klassNames) {
    return (
      <button {...this.props}
          className={klassNames}
          type="button"
          data-priority={this.state.priority}>
        <span>Blocked</span>
      </button>
    )
  }

  renderAsSelf() {
  }

  render() {
    const { className, classListName } = this.props<commit_msg>Fix relationship button when self relationship.<commit_after>import React from 'react'
import classNames from 'classnames'
import { MiniPlusIcon, MiniCheckIcon } from '../iconography/Icons'


export const RelationshipPriority = {
  INACTIVE: { priority: 'inactive' },
  FRIEND: { priority: 'friend' },
  NOISE: { priority: 'noise' },
  SELF: { priority: 'self' },
  MUTE: { priority: 'mute' },
  BLOCK: { priority: 'block' },
  NONE: { priority: 'none' },
}

class RelationshipButton extends React.Component {
  constructor(props, context) {
    super(props, context)
    const { priority } = this.props
    this.state = {
      priority: priority || 'inactive',
    }
  }

  updatePriority(priority) {
    const { buttonWasClicked, userId } = this.props
    if (buttonWasClicked) {
      buttonWasClicked({ userId, priority, existing: this.state.priority })
    }
    // Render the state change instantly
    this.setState({ priority: priority })
  }

  renderAsInactive(klassNames) {
    return (
      <button {...this.props}
          className={klassNames}
          type="button"
          onClick={() => this.updatePriority('friend')}
          data-priority={this.state.priority}>
        <MiniPlusIcon />
        <span>Follow</span>
      </button>
    )
  }

  renderAsNone(klassNames) {
    return this.renderAsInactive(klassNames)
  }

  renderAsFriend(klassNames) {
    return (
      <button {...this.props}
          className={klassNames}
          type="button"
          onClick={() => this.updatePriority('inactive')}
          data-priority={this.state.priority}>
        <MiniCheckIcon />
        <span>Friend</span>
      </button>
    )
  }

  renderAsNoise(klassNames) {
    return (
      <button {...this.props}
          className={klassNames}
          type="button"
          data-priority={this.state.priority}>
        <MiniCheckIcon />
        <span>Noise</span>
      </button>
    )
  }

  renderAsMute(klassNames) {
    return (
      <button {...this.props}
          className={klassNames}
          type="button"
          data-priority={this.state.priority}>
        <span>Muted</span>
      </button>
    )
  }

  renderAsBlock(klassNames) {
    return (
      <button {...this.props}
          className={klassNames}
          type="button"
          data-priority={this.state.priority}>
        <span>Blocked</span>
      </button>
    )
  }

  renderAsSelf() {
    return null
  }

  render() {
    const { className, classListName } = this.props
{'fraction_non_alphanumeric': 0.13981331168831168, 'fraction_numerical': 0.0, 'mean_word_length': 2.3783413296778617, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 53, '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': '5553850', 'n_tokens_mistral': 1504, 'n_tokens_neox': 1511, 'n_words': 272}