{"size": 2499, "ext": "js", "max_stars_repo_path": "Web/VinylExchange.Web/ClientApp/src/components/releases/release/releaseSales/ReleaseSalesComponent.js", "max_stars_repo_name": "HeLted/vinyl-exchange", "max_stars_repo_stars_event_min_datetime": "2020-01-19T11:37:43.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-18T19:21:28.000Z", "max_issues_repo_path": "Web/VinylExchange.Web/ClientApp/src/components/releases/release/releaseSales/ReleaseSalesComponent.js", "max_issues_repo_name": "deyvidnenchev/vinyl-exchange", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Web/VinylExchange.Web/ClientApp/src/components/releases/release/releaseSales/ReleaseSalesComponent.js", "max_forks_repo_name": "deyvidnenchev/vinyl-exchange", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.8518518519, "max_line_length": 79, "alphanum_fraction": 0.5710284114}
import React from "react";
import GoToSaleButton from "./../../../common/GoToSaleButton";
import BorderSpinner from "./../../../common/spinners/BorderSpinner";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
  faBars,
  faUserCircle,
  faEuroSign
} from "@fortawesome/free-solid-svg-icons";
import GradeBadge from "./../../../common/badges/GradeBadge";
import UserThumbnail from "./../../../common/UserThumbnail";
import PriceTagBadge from "./../../../common/badges/PriceTagBadge"

function ReleaseSalesComponent(props) {
  const salesRows = props.data.sales.map(saleObj => {
    return (
      <tr key={saleObj.id}>
        <td>
          {" "}
          <UserThumbnail data={{ userId: saleObj.sellerId }} />
        </td>
        <td className="property-text-nm">{saleObj.sellerUsername}</td>
        <td>
          <GradeBadge data={{ grade: saleObj.vinylGrade }} />
        </td>
        <td>
          <GradeBadge data={{ grade: saleObj.sleeveGrade }} />
        </td>
        <td className="property-text-nm">
          <PriceTagBadge data={{ price: saleObj.price }} />{" "}
        
        </td>
        <td>
          <GoToSaleButton data={{ saleId: saleObj.id }} />
        </td>
      </tr>
    );
  });

  const component = props.data.isLoading ? (
    <tr>
      <td colSpan="6">
        <BorderSpinner />
      </td>
    </tr>
  ) : salesRows.length > 0 ? (
    salesRows
  ) : (
    <tr className="border">
      <td colSpan="6" className="no-addresses-container">
        <h6>There are currently no active sales for this release</h6>
      </td>
    </tr>
  );

  return (
    <div className="release-sales-table  table-responsive table-responsive-sm">
      <table className="table table-bordered table-hover text-center">
        <thead>
          <tr>
            <th className="border-left border-right">
              {" "}
              <FontAwesomeIcon icon={faUserCircle} />
            </th>
            <th className="border-left border-right">Seller</th>
            <th className="border-left border-right">Vinyl Grade</th>
            <th className="border-left border-right">Sleeve Grade</th>
            <th className="border-left border-right">Price</th>
            <th className="border-left border-right">
              <FontAwesomeIcon icon={faBars} />
            </th>
          </tr>
        </thead>
        <tbody className="normal-tbody">{component}</tbody>
      </table>
    </div>
  );
}

export default ReleaseSalesComponent;
