<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 UserGroupJson from 'interfaces/user-group-json';
import { route } from 'laroute';
import * as React from 'react';
import { classWithModifiers, Modifiers } from 'utils/css';

interface Props {
  group?: UserGroupJson;
  modifiers?: Modifiers;
}

export default function UserGroupBadge({group, modifiers}: Props) {
  if (group == null) {
    return null;
  }

  let children;
  let title = group.name;

  if (group.playmodes != null && group.playmodes.length > 0) {
    children = (
      <div className='user-group-badge__modes'>
        {group.playmodes.map((playmode) => (
          <i key={playmode} className={`fal fa-extra-mode-${playmode}`} />
        ))}
      </div>
    );

    const playmodeNames = group.playmodes
      .map((playmode) => osu.trans(`beatmaps.mode.${playmode}`))
      .join(', ');

    title += ` (${playmodeNames})`;
  }

  const props = {
    children,
    'className': classWithModifiers('user-group-badge', {
      probationary: group.is_probationary,
      [group.identifier]: true,
      ...modifiers,
    }),
    'data-label': group.short_name,
    'style': osu.groupColour(group),
    title,
  };

  return group.id < 0
    ? <div {...props} />
    : <a {...props} href={route('groups.show', { group: group.id })} />;
}<commit_msg>Fix condition for linking badge in TS badge component<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 UserGroupJson from 'interfaces/user-group-json';
import { route } from 'laroute';
import * as React from 'react';
import { classWithModifiers, Modifiers } from 'utils/css';

interface Props {
  group?: UserGroupJson;
  modifiers?: Modifiers;
}

export default function UserGroupBadge({group, modifiers}: Props) {
  if (group == null) {
    return null;
  }

  let children;
  let title = group.name;

  if (group.playmodes != null && group.playmodes.length > 0) {
    children = (
      <div className='user-group-badge__modes'>
        {group.playmodes.map((playmode) => (
          <i key={playmode} className={`fal fa-extra-mode-${playmode}`} />
        ))}
      </div>
    );

    const playmodeNames = group.playmodes
      .map((playmode) => osu.trans(`beatmaps.mode.${playmode}`))
      .join(', ');

    title += ` (${playmodeNames})`;
  }

  const props = {
    children,
    'className': classWithModifiers('user-group-badge', {
      probationary: group.is_probationary,
      [group.identifier]: true,
      ...modifiers,
    }),
    'data-label': group.short_name,
    'style': osu.groupColour(group),
    title,
  };

  return group.has_listing
    ? <a {...props} href={route('groups.show', { group: group.id })} />
    : <div {...props} />;
}
{'fraction_non_alphanumeric': 0.15839243498817968, 'fraction_numerical': 0.002364066193853428, 'mean_word_length': 3.0742778541953233, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 23, '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': '2637879', 'n_tokens_mistral': 991, 'n_tokens_neox': 959, 'n_words': 237}