<commit_before>/**
 * Copyright 2018-present Facebook.
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 * @format
 */

import React, {Component, ReactElement} from 'react';
import {
  Glyph,
  Popover,
  FlexColumn,
  FlexRow,
  Button,
  Checkbox,
  styled,
  Input,
} from 'flipper';
import GK from '../fb-stubs/GK';
import * as UserFeedback from '../fb-stubs/UserFeedback';
import {FeedbackPrompt} from '../fb-stubs/UserFeedback';

type Props = {
  onRatingChanged: (rating: number) => void;
};

type State = {
  promptData: FeedbackPrompt | null;
  isShown: boolean;
};

type NextAction = 'select-rating' | 'leave-comment' | 'finished';

class PredefinedComment extends Component<{
  comment: string;
  selected: boolean;
  onClick: (_: unknown) => unknown;
}> {
  render() {
    return (
      <div onClick={this.props.onClick}>
        {this.props.comment + (this.props.selected ? ' - Y' : ' - N')}
      </div>
    );
  }
}

const Row = styled(FlexRow)({
  marginTop: 5,
  marginBottom: 5,
  justifyContent: 'center',
  textAlign: 'center',
  color: '#9a9a9a',
});

class FeedbackComponent extends Component<<commit_msg>Render predefined comments<commit_after>/**
 * Copyright 2018-present Facebook.
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 * @format
 */

import React, {Component, ReactElement} from 'react';
import {
  Glyph,
  Popover,
  FlexColumn,
  FlexRow,
  Button,
  Checkbox,
  styled,
  Input,
} from 'flipper';
import GK from '../fb-stubs/GK';
import * as UserFeedback from '../fb-stubs/UserFeedback';
import {FeedbackPrompt} from '../fb-stubs/UserFeedback';

type Props = {
  onRatingChanged: (rating: number) => void;
};

type State = {
  promptData: FeedbackPrompt | null;
  isShown: boolean;
};

type NextAction = 'select-rating' | 'leave-comment' | 'finished';

class PredefinedComment extends Component<{
  comment: string;
  selected: boolean;
  onClick: (_: unknown) => unknown;
}> {
  static Container = styled('div')((props: {selected: boolean}) => {
    return {
      border: '1px solid #f2f3f5',
      cursor: 'pointer',
      borderRadius: 24,
      backgroundColor: props.selected ? '#ecf3ff' : '#f2f3f5',
      marginBottom: 4,
      marginRight: 4,
      padding: '4px 8px',
      color: props.selected ? 'rgb(56, 88, 152)' : undefined,
      borderColor: props.selected ? '#3578e5' : undefined,
      ':hover': {
        borderColor: '#3578e5',
      },
    };
  });
  render() {
    return (
      <PredefinedComment.Container
        onClick={this.props.onClick}
        selected={this.props.selected}>
        {this.props.comment}
      </PredefinedComment.Container>
    );
  }
}

const Row = styled(FlexRow)({
  marginTop: 5,
  marginBottom: 5,
  justifyContent: 'center',
  textAlign: 'center',
  color: '#9a9a9a',
  flexWrap: 'wrap',
});

class FeedbackComponent extends Component<
{'fraction_non_alphanumeric': 0.14185346269655402, 'fraction_numerical': 0.01639344262295082, 'mean_word_length': 3.416543574593796, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4794673', 'n_tokens_mistral': 1011, 'n_tokens_neox': 979, 'n_words': 263}