<commit_before>// @flow
import { Link } from "react-router-dom";
import { Balance, Tooltip } from "shared";
import { ProgressRing } from "indicators";
import { FormattedMessage as T, injectIntl, defineMessages } from "react-intl";
import {
  TRANSACTION_DIR_SENT,
  TRANSACTION_DIR_RECEIVED,
  TRANSACTION_DIR_TRANSFERRED,
  TICKET,
  VOTE,
  REVOCATION
} from "constants/Decrediton";
import "style/Header.less";

const messages = defineMessages({
  [TICKET]: {
    id: "notifications.type.ticket",
    defaultMessage: "Ticket"
  },
  [VOTE]: {
    id: "notifications.type.vote",
    defaultMessage: "Voted"
  },
  [REVOCATION]: {
    id: "notifications.type.revocation",
    defaultMessage: "Revoked"
  },
  [TRANSACTION_DIR_SENT]: {
    id: "notifications.type.send",
    defaultMessage: "Sent"
  },
  [TRANSACTION_DIR_TRANSFERRED]: {
    id: "notifications.type.transfer",
    defaultMessage: "Transferred"
  },
  [TRANSACTION_DIR_RECEIVED]: {
    id: "notifications.type.receive",
    defaultMessage: "Received"
  }
});

const Transaction = ({
  type,
  message,
  onDismissMessage,
  intl,
  topNotification,
  progress
}) => (
  <>
    {topNotification && (
      <div className="snackbar-close-button-top" onClick={onDismissMessage}>
        <ProgressRing radius={13} stroke={2} progress={progress} />
      </div>
    )}
    <div className="snackbar-information-row">
      <div className="snackbar-information-row-type">
        <T id="notification.new" m="New Transaction" />,{" "}
        <span className="snackbar-information-row-type-bold">
          {intl.formatMessage(messages[type])}
        </span>
      </div>
      <div className="snackbar-information-row-amount">
        <Balance flat amount={message.amount} />
      </div>
    </div>
    {message.fee > 0 && (
      <div className="snackbar-information-row">
        <div className="snackbar-information-row-type">
          <T id="notification.transfer.fee" m="Transaction Fee" />
        </div>
        <div className="snackbar-information-row-fee">
          <Balance flat amount={message.fee} />
        </div>
      </div>
    )}
    <div className="snackbar-information-row">
      <div className="snackbar-information-row-type">
        <T
          id="notification.seeTransactionDetails"
          m="See Transaction Details"
        />
      </div>
      <div className="snackbar-information-row-tx">
        <Tooltip width={300} text={`${message.txHash}`}>
          <Link
            onClick={onDismissMessage}
            to={`/transactions/history/${message.txHash}`}>
            {message.txHash}
          </Link>
        </Tooltip>
      </div>
    </div>
  </>
);

export default injectIntl(Transaction);<commit_msg>fix tx going to wrong place (#2594)<commit_after>// @flow
import { Link } from "react-router-dom";
import { Balance, Tooltip } from "shared";
import { ProgressRing } from "indicators";
import { FormattedMessage as T, injectIntl, defineMessages } from "react-intl";
import {
  TRANSACTION_DIR_SENT,
  TRANSACTION_DIR_RECEIVED,
  TRANSACTION_DIR_TRANSFERRED,
  TICKET,
  VOTE,
  REVOCATION
} from "constants/Decrediton";
import "style/Header.less";

const messages = defineMessages({
  [TICKET]: {
    id: "notifications.type.ticket",
    defaultMessage: "Ticket"
  },
  [VOTE]: {
    id: "notifications.type.vote",
    defaultMessage: "Voted"
  },
  [REVOCATION]: {
    id: "notifications.type.revocation",
    defaultMessage: "Revoked"
  },
  [TRANSACTION_DIR_SENT]: {
    id: "notifications.type.send",
    defaultMessage: "Sent"
  },
  [TRANSACTION_DIR_TRANSFERRED]: {
    id: "notifications.type.transfer",
    defaultMessage: "Transferred"
  },
  [TRANSACTION_DIR_RECEIVED]: {
    id: "notifications.type.receive",
    defaultMessage: "Received"
  }
});

const Transaction = ({
  type,
  message,
  onDismissMessage,
  intl,
  topNotification,
  progress
}) => (
  <>
    {topNotification && (
      <div className="snackbar-close-button-top" onClick={onDismissMessage}>
        <ProgressRing radius={13} stroke={2} progress={progress} />
      </div>
    )}
    <div className="snackbar-information-row">
      <div className="snackbar-information-row-type">
        <T id="notification.new" m="New Transaction" />,{" "}
        <span className="snackbar-information-row-type-bold">
          {intl.formatMessage(messages[type])}
        </span>
      </div>
      <div className="snackbar-information-row-amount">
        <Balance flat amount={message.amount} />
      </div>
    </div>
    {message.fee > 0 && (
      <div className="snackbar-information-row">
        <div className="snackbar-information-row-type">
          <T id="notification.transfer.fee" m="Transaction Fee" />
        </div>
        <div className="snackbar-information-row-fee">
          <Balance flat amount={message.fee} />
        </div>
      </div>
    )}
    <div className="snackbar-information-row">
      <div className="snackbar-information-row-type">
        <T
          id="notification.seeTransactionDetails"
          m="See Transaction Details"
        />
      </div>
      <div className="snackbar-information-row-tx">
        <Tooltip width={300} text={`${message.txHash}`}>
          <Link
            onClick={onDismissMessage}
            to={`/transaction/history/${message.txHash}`}>
            {message.txHash}
          </Link>
        </Tooltip>
      </div>
    </div>
  </>
);

export default injectIntl(Transaction);
{'fraction_non_alphanumeric': 0.1516822945394374, 'fraction_numerical': 0.003309431880860452, 'mean_word_length': 2.8940586972083033, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 75, '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': '4734394', 'n_tokens_mistral': 1776, 'n_tokens_neox': 1759, 'n_words': 301}