From 2c5b7da8165e3f8b90748e8ced1de0e3e8d52309 Mon Sep 17 00:00:00 2001 From: lazydancer Date: Sun, 22 Dec 2024 17:33:11 -0500 Subject: Initial --- frontend/src/InfoDisplay.js | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 frontend/src/InfoDisplay.js (limited to 'frontend/src/InfoDisplay.js') diff --git a/frontend/src/InfoDisplay.js b/frontend/src/InfoDisplay.js new file mode 100644 index 0000000..2253802 --- /dev/null +++ b/frontend/src/InfoDisplay.js @@ -0,0 +1,61 @@ +import React from 'react'; + +const InfoDisplay = ({ data }) => { + + // Convert profit rate from isk/s to isk/hr, round, and format + const profitRatePerHour = Math.round(data.profit_rate * 3600).toLocaleString('en-US'); + + // Format risk as percent and calculate risk cost, then round + const riskPercent = (Math.round(data.risk * 100 * 100) / 100).toFixed(2) + '%'; + const riskCost = Math.round(data.risk * data.capital).toLocaleString('en-US'); + + // Format capital + const capitalFormatted = Math.round(data.capital).toLocaleString('en-US'); + + // Convert transport time to minutes and seconds, then round + const minutes = Math.floor(data.transport_time / 60); + const seconds = Math.round(data.transport_time % 60); + const transportTimeFormatted = `${minutes}m ${seconds}s`; + + // Format and round gross profit + const grossProfitFormatted = Math.round(data.gross_profit).toLocaleString('en-US'); + + const netProfitFormatted = Math.round(data.net_profit).toLocaleString('en-US'); + + return ( +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Profit Rate:{profitRatePerHour} isk/hr
Risk:{riskPercent} ({riskCost} isk)
Capital:{capitalFormatted} isk
Transport Time:{transportTimeFormatted}
Gross Profit:{grossProfitFormatted} isk
Net Profit:{netProfitFormatted} isk
+
+ ); +} + +export default InfoDisplay; -- cgit v1.3