canape/frontend/js/components/admins/torrentsStat.js
Grégoire Delattre bcadc48d5a Launch prettier with the --fix option
They've changed their default settings, this changes a lot of stuff in
our code base.
2020-04-01 17:55:34 +02:00

22 lines
542 B
JavaScript

import React from "react";
import PropTypes from "prop-types";
export const TorrentsStat = ({ count, torrentCount, torrentCountById }) => {
if (torrentCount === undefined) {
return <span>No torrents</span>;
}
const percentage = Math.floor((torrentCountById * 100) / count);
return (
<span>
{percentage}% with torrents
<small>&nbsp; - {torrentCount} total</small>
</span>
);
};
TorrentsStat.propTypes = {
count: PropTypes.number,
torrentCount: PropTypes.number,
torrentCountById: PropTypes.number,
};