<commit_before>/* @flow */

import Link from "found/lib/Link";
import Paper from "material-ui/Paper";
import { List, ListItem } from "material-ui/List";
import getMuiTheme from "material-ui/styles/getMuiTheme";
import GridOff from "material-ui/svg-icons/image/grid-off";
import PropTypes from "prop-types";
import * as React from "react";
import { createFragmentContainer, graphql } from "react-relay";

import theme from "../theme";

type Props = {
  organization: {
    groups: Array<{
      id: string,
      name: string,
      email: string,
      externallyHidden: boolean,
      members: Array<any>,
    }>,
  },
};

class Groups extends React.Component<Props> {
  static childContextTypes = {
    muiTheme: PropTypes.object.isRequired,
  };

  muiTheme: {};

  constructor(props) {
    super(props);
    this.muiTheme = getMuiTheme(theme);
  }

  getChildContext() {
    return { muiTheme: this.muiTheme };
  }

  render() {
    const { organization } = this.props;
    const { groups } = organization;
    return (
      <section>
        <Paper className="row">
          <h1>Alle grupper</h1>
          <List>
            {groups.map((group) => {
              return (
                <ListItem
                  disabled
                  key={group.id}
                  rightIcon={group.externallyHidden ? <GridOff /> : null}
                  primaryText={
                    <Link to={`/group/${group.id}`}>{group.name}</Link>
                  }
                  secondaryText={`${group.members.length} ${group.email || ""}`}
                />
              );
            })}
          </List>
        </Paper>
      </section>
    );
  }
}

export default createFragmentContainer(Groups, {
  organization: graphql`
    fragment Groups_organization on Organization {
      groups {
        id
        name
        externallyHidden
        members {
          id
        }
        email
      }
    }
  `,
  viewer: graphql`
    fragment Groups_viewer on User {
      id
    }
  `,
});<commit_msg>Show more info in Group listings<commit_after>/* @flow */

import Link from "found/lib/Link";
import Paper from "material-ui/Paper";
import { List, ListItem } from "material-ui/List";
import getMuiTheme from "material-ui/styles/getMuiTheme";
import GridOff from "material-ui/svg-icons/image/grid-off";
import PropTypes from "prop-types";
import * as React from "react";
import { createFragmentContainer, graphql } from "react-relay";
import type Organization from "./__generated__/Groups_organization.graphql";

import theme from "../theme";

type Props = {
  organization: Organization,
};

class Groups extends React.Component<Props> {
  static childContextTypes = {
    muiTheme: PropTypes.object.isRequired,
  };

  muiTheme: {};

  constructor(props) {
    super(props);
    this.muiTheme = getMuiTheme(theme);
  }

  getChildContext() {
    return { muiTheme: this.muiTheme };
  }

  render() {
    const { organization } = this.props;
    const { groups } = organization;
    return (
      <section>
        <Paper className="row">
          <h1>Alle grupper</h1>
          <List>
            {groups.map((group) => {
              return (
                <ListItem
                  disabled
                  key={group.id}
                  rightIcon={group.externallyHidden ? <GridOff /> : null}
                  primaryText={
                    <span>
                      <Link to={`/group/${group.id}`}>{group.name}</Link> (
                      {group.members.length})
                    </span>
                  }
                  secondaryText={`${group.email ||
                    ""} ${group.groupLeaderEmail || ""}`}
                />
              );
            })}
          </List>
        </Paper>
      </section>
    );
  }
}

export default createFragmentContainer(Groups, {
  organization: graphql`
    fragment Groups_organization on Organization {
      groups {
        id
        name
        externallyHidden
        members {
          id
        }
        email
        groupLeaderEmail
      }
    }
  `,
  viewer: graphql`
    fragment Groups_viewer on User {
      id
    }
  `,
});
{'fraction_non_alphanumeric': 0.12409638554216867, 'fraction_numerical': 0.0009638554216867469, 'mean_word_length': 1.8392612859097128, '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': '1761411', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1174, 'n_words': 255}