<commit_before>import * as React from 'react';
import { QueueItem } from '../../types';
import { ResourceList } from '@shopify/polaris';
import QueueItemInfo from './QueueItemInfo';
import { generateItemProps } from '../../utils/queueItem';

export interface Props {
  readonly hit: QueueItem;
  readonly onReturn: (hitID: string) => void;
}

const QueueCard = ({ hit, onReturn }: Props) => {
  const { hitId, reward, timeLeft } = hit;
  const handleReturn = () => {
    onReturn(hit.hitId);
  };

  const actions = [
    {
      content: 'Return',
      accessibilityLabel: 'Return',
      onClick: handleReturn
    },
    {
      primary: true,
      external: true,
      content: 'Work',
      accessibilityLabel: 'Work',
      url: `https://www.mturk.com/mturk/continue?hitId=${hitId}`
    }
  ];

  return (
    <ResourceList.Item
      actions={actions}
      {...generateItemProps(hit)}
      attributeThree={<QueueItemInfo reward={reward} timeLeft={timeLeft} />}
    />
  );
};

export default QueueCard;<commit_msg>QueueCard is now a PureComponent.<commit_after>import * as React from 'react';
import { QueueItem } from '../../types';
import { ResourceList } from '@shopify/polaris';
import QueueItemInfo from './QueueItemInfo';
import { generateItemProps } from '../../utils/queueItem';

export interface Props {
  readonly hit: QueueItem;
}

export interface Handlers {
  readonly onReturn: (hitID: string) => void;
}

class QueueCard extends React.PureComponent<Props & Handlers, never> {
  private handleReturn = () => {
    this.props.onReturn(this.props.hit.hitId);
  };

  public render() {
    const { hitId, reward, timeLeft } = this.props.hit;
    const actions = [
      {
        content: 'Return',
        accessibilityLabel: 'Return',
        onClick: this.handleReturn
      },
      {
        external: true,
        content: 'Work',
        accessibilityLabel: 'Work',
        url: `https://www.mturk.com/mturk/continue?hitId=${hitId}`
      }
    ];

    return (
      <ResourceList.Item
        actions={actions}
        {...generateItemProps(this.props.hit)}
        attributeThree={<QueueItemInfo reward={reward} timeLeft={timeLeft} />}
      />
    );
  }
}

export default QueueCard;
{'fraction_non_alphanumeric': 0.14659449706811006, 'fraction_numerical': 0.0, 'mean_word_length': 2.9049295774647885, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '7569887', 'n_tokens_mistral': 682, 'n_tokens_neox': 683, 'n_words': 153}