<commit_before>import React from 'react';

import Menu from '../shared/Menu';
import Icon from '../shared/Icon';
import Permissions from '../shared/Permissions';

class SettingsMenu extends React.Component {
  static propTypes = {
    organization: React.PropTypes.shape({
      name: React.PropTypes.string.isRequired,
      slug: React.PropTypes.string.isRequired,
      members: React.PropTypes.shape({
        count: React.PropTypes.number.isRequired
      }),
      invitations: React.PropTypes.shape({
        count: React.PropTypes.number.isRequired
      }),
      permissions: React.PropTypes.shape({
        organizationUpdate: React.PropTypes.shape({
          allowed: React.PropTypes.bool.isRequired
        }),
        organizationMemberCreate: React.PropTypes.shape({
          allowed: React.PropTypes.bool.isRequired
        }),
        notificationServiceUpdate: React.PropTypes.shape({
          allowed: React.PropTypes.bool.isRequired
        }),
        organizationBillingUpdate: React.PropTypes.shape({
          allowed: React.PropTypes.bool.isRequired
        })
      })
    })
  };

  render() {
    return (
      <Permissions permissions={this.props.organization.permissions}>
        <Menu>
          <Menu.Header>{this.props.organization.name}</Menu.Header>

          <Permissions.Only allowed="organizationUpdate">
            <Menu.Button href={`/organizations/${this.props.organization.slug}/settings`}>
              <Icon icon="settings" className="icon-mr"/>Settings
            </Menu.Button>
          </Permissions.Only>

          <Permissions.Only allowed="organizationMemberCreate">
            <Menu.Button href={`/organizations/${this.props.organization.slug}/users`} badge={this.props.organization.members.count + this.props.organization.invitations.count}>
              <Icon icon="users"className="icon-mr"/>Users
            </Menu.Button>
          </Permissions.Only>

          <Permissions.Only allowed="notificationServiceUpdate">
            <Menu.Button href={`/organizations/${this.props.organization.slug}/services`}>
              <Icon icon="notification-services" className="icon-mr"/>Notification Services
            </Menu.Button>
          </Permissions.Only>

          <Permissions.Only allowed="organizationBillingUpdate">
            <Menu.Button href={`/organizations/${this.props.organization.slug}/billing`}>
              <Icon icon="billing" className="icon-mr"/>Billing
            </Menu.Button>
          </Permissions.Only>
        </Menu>

        <Menu>
          <Menu.Button href={`/user/settings`}>Personal Settings</Menu.Button>
        </Menu>
      </Permissions>
    );
  }
}

export default SettingsMenu;<commit_msg>Converted organization/SettingsMenu to a stateless function<commit_after>import React from 'react';

import Menu from '../shared/Menu';
import Icon from '../shared/Icon';
import Permissions from '../shared/Permissions';

const SettingsMenu = (props) =>
  <Permissions permissions={props.organization.permissions}>
    <Menu>
      <Menu.Header>{props.organization.name}</Menu.Header>

      <Permissions.Only allowed="organizationUpdate">
        <Menu.Button href={`/organizations/${props.organization.slug}/settings`}>
          <Icon icon="settings" className="icon-mr"/>Settings
        </Menu.Button>
      </Permissions.Only>

      <Permissions.Only allowed="organizationMemberCreate">
        <Menu.Button href={`/organizations/${props.organization.slug}/users`} badge={props.organization.members.count + props.organization.invitations.count}>
          <Icon icon="users"className="icon-mr"/>Users
        </Menu.Button>
      </Permissions.Only>

      <Permissions.Only allowed="notificationServiceUpdate">
        <Menu.Button href={`/organizations/${props.organization.slug}/services`}>
          <Icon icon="notification-services" className="icon-mr"/>Notification Services
        </Menu.Button>
      </Permissions.Only>

      <Permissions.Only allowed="organizationBillingUpdate">
        <Menu.Button href={`/organizations/${props.organization.slug}/billing`}>
          <Icon icon="billing" className="icon-mr"/>Billing
        </Menu.Button>
      </Permissions.Only>
    </Menu>

    <Menu>
      <Menu.Button href={`/user/settings`}>Personal Settings</Menu.Button>
    </Menu>
  </Permissions>

SettingsMenu.propTypes = {
  organization: React.PropTypes.shape({
    name: React.PropTypes.string.isRequired,
    slug: React.PropTypes.string.isRequired,
    members: React.PropTypes.shape({
      count: React.PropTypes.number.isRequired
    }).isRequired,
    invitations: React.PropTypes.shape({
      count: React.PropTypes.number.isRequired
    }).isRequired,
    permissions: React.PropTypes.shape({
      organizationUpdate: React.PropTypes.shape({
        allowed: React.PropTypes.bool.isRequired
      }).isRequired,
      organizationMemberCreate: React.PropTypes.shape({
        allowed: React.PropTypes.bool.isRequired
      }).isRequired,
      notificationServiceUpdate: React.PropTypes.shape({
        allowed: React.PropTypes.bool.isRequired
      }).isRequired,
      organizationBillingUpdate: React.PropTypes.shape({
        allowed: React.PropTypes.bool.isRequired
      }).isRequired
    })
  })
};

export default SettingsMenu;
{'fraction_non_alphanumeric': 0.13589840788476118, 'fraction_numerical': 0.0, 'mean_word_length': 2.952808988764045, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 64, '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': '6949479', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1404, 'n_words': 222}