<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 * as React from 'react';

interface Props {
  currentValue: string;
  modifiers?: string[];
  showTitle?: boolean;
  title?: string;
  transPrefix: string;
  values: string[];
  onChange(event: React.MouseEvent<HTMLButtonElement>): void;
}

export class Sort extends React.PureComponent<Props> {
  static readonly defaultProps = {
    showTitle: true,
    transPrefix: 'sort.',
  };

  render() {
    const items = this.props.values.map((value) => {
      let cssClasses = 'sort__item sort__item--button';
      if (this.props.currentValue === value) {
        cssClasses += ' sort__item--active';
      }

      return (
        <button
          className={cssClasses}
          data-value={value}
          key={value}
          onClick={this.props.onChange}
        >
          {/* FIXME: add icon support */}
          {value === 'rank'
            ? <span>
              <i className={`fas fa-extra-mode-${currentUser.playmode ?? 'osu'}`} /> {osu.trans('sort.rank')}
            </span>
            : osu.trans(`${this.props.transPrefix}${value}`)
          }
        </button>
      );
    });

    return (
      <div className={osu.classWithModifiers('sort', this.props.modifiers)}>
        <div className='sort__items'>
          {this.props.showTitle && (
            <span className='sort__item sort__item--title'>{this.props.title ?? osu.trans('sort._')}</span>
          )}
          {items}
        </div>
      </div>
    );
  }
}<commit_msg>less weird indent<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 * as React from 'react';

interface Props {
  currentValue: string;
  modifiers?: string[];
  showTitle?: boolean;
  title?: string;
  transPrefix: string;
  values: string[];
  onChange(event: React.MouseEvent<HTMLButtonElement>): void;
}

export class Sort extends React.PureComponent<Props> {
  static readonly defaultProps = {
    showTitle: true,
    transPrefix: 'sort.',
  };

  render() {
    const items = this.props.values.map((value) => {
      let cssClasses = 'sort__item sort__item--button';
      if (this.props.currentValue === value) {
        cssClasses += ' sort__item--active';
      }

      return (
        <button
          className={cssClasses}
          data-value={value}
          key={value}
          onClick={this.props.onChange}
        >
          {/* FIXME: add icon support */}
          {value === 'rank'
            ? (
              <span>
                <i className={`fas fa-extra-mode-${currentUser.playmode ?? 'osu'}`} /> {osu.trans('sort.rank')}
              </span>
            ) : osu.trans(`${this.props.transPrefix}${value}`)
          }
        </button>
      );
    });

    return (
      <div className={osu.classWithModifiers('sort', this.props.modifiers)}>
        <div className='sort__items'>
          {this.props.showTitle && (
            <span className='sort__item sort__item--title'>{this.props.title ?? osu.trans('sort._')}</span>
          )}
          {items}
        </div>
      </div>
    );
  }
}
{'fraction_non_alphanumeric': 0.1497294046903187, 'fraction_numerical': 0.0012026458208057728, 'mean_word_length': 2.239532619279455, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 35, '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': '4486395', 'n_tokens_mistral': 1002, 'n_tokens_neox': 1003, 'n_words': 222}