Skip to content

Commit 98677f9

Browse files
committed
Overhaul billing view
This overhauled billing view displays revenue and spending as a NET activity to avoid confusion about the source of the spending itself since we can't attribute that as accuratley as the previous dashboard format implied.
1 parent 81aa69c commit 98677f9

File tree

7 files changed

+235
-65
lines changed

7 files changed

+235
-65
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "althea-dash",
33
"productName": "althea",
4-
"version": "0.4.14",
4+
"version": "0.4.16",
55
"private": true,
66
"scripts": {
77
"analyze": "source-map-explorer 'build/static/js/*.js'",
@@ -118,4 +118,4 @@
118118
"glob-all": "^3.1.0",
119119
"purgecss-webpack-plugin": "^4.1.3"
120120
}
121-
}
121+
}

src/Finances/Billing.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
33
import { Alert, Button, Card, CardBody, Input, Table } from "reactstrap";
44
import Pagination from "../Pagination";
55
import { get, useStore } from "store";
6-
import { groupUsage } from "utils";
6+
import { groupClientUsageData } from "utils";
77
import ExportCSV from "./ExportCSV";
88

99
import { enUS as en, es, fr } from "date-fns/locale";
@@ -52,9 +52,8 @@ const Billing = (operatorAddress, ipAddress) => {
5252

5353
const [rows, data] = useMemo(
5454
() =>
55-
groupUsage(
55+
groupClientUsageData(
5656
info,
57-
true,
5857
usage,
5958
period,
6059
symbol_or_star,

src/SellingBandwidth/RevenueHistory.js

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
33
import { Alert, Button, Card, CardBody, Input, Table } from "reactstrap";
44
import Pagination from "../Pagination";
55
import { get, useStore } from "store";
6-
import { groupUsage } from "utils";
6+
import { groupRelayUsageData } from "utils";
77
import ExportCSV from "../Finances/ExportCSV";
88

99
import { enUS as en, es, fr } from "date-fns/locale";
@@ -13,7 +13,8 @@ const RevenueHistory = () => {
1313
const locale = { en, es, fr }[i18n.language];
1414

1515
const [period, setPeriod] = useState("w");
16-
const [usage, setUsage] = useState([]);
16+
const [clientUsage, setClientUsage] = useState([]);
17+
const [relayUsage, setRelayUsage] = useState([]);
1718
const [{ symbol }] = useStore();
1819
const [page, setPage] = useState(1);
1920
const [exporting, setExporting] = useState(false);
@@ -40,10 +41,12 @@ const RevenueHistory = () => {
4041
(async () => {
4142
try {
4243
let payments = await get("/usage/payments");
43-
let usage = await get("/usage/relay");
44+
let clientUsage = await get("/usage/client");
45+
let relayUsage = await get("/usage/relay");
4446
let info = await get("/info");
4547
let localization = await get("/localization");
46-
if (!(usage instanceof Error)) setUsage(usage);
48+
if (!(clientUsage instanceof Error)) setClientUsage(clientUsage);
49+
if (!(relayUsage instanceof Error)) setRelayUsage(relayUsage);
4750
if (!(localization instanceof Error)) setLocalization(localization);
4851
if (!(info instanceof Error)) setInfo(info);
4952
if (!(payments instanceof Error)) setPayments(payments);
@@ -56,18 +59,28 @@ const RevenueHistory = () => {
5659

5760
const [rows, data] = useMemo(
5861
() =>
59-
groupUsage(
62+
groupRelayUsageData(
6063
info,
61-
false,
62-
usage,
64+
clientUsage,
65+
relayUsage,
6366
period,
6467
symbol_or_star,
6568
locale,
6669
page,
6770
limit,
6871
payments
6972
),
70-
[info, usage, period, symbol_or_star, locale, page, limit, payments]
73+
[
74+
info,
75+
relayUsage,
76+
period,
77+
symbol_or_star,
78+
locale,
79+
page,
80+
limit,
81+
payments,
82+
clientUsage,
83+
]
7184
);
7285

7386
return (
@@ -110,12 +123,13 @@ const RevenueHistory = () => {
110123
</div>
111124
</div>
112125
</div>
126+
<p>{t("revenueDescription")}</p>
113127
<div className="table-responsive">
114128
<Table className="table-striped">
115129
<thead>
116130
<tr>
117131
<th>{t("period")}</th>
118-
<th className="text-right">{t("usage")}</th>
132+
<th className="text-right">{t("relayUsage")}</th>
119133
<th className="text-right">{t("totalRevenue")}</th>
120134
</tr>
121135
</thead>

src/locales/en/translations.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@
5555
"withdrawalInProgress": "Your withdrawal request has been submitted. The funds will be converted to ETH before being sent to your address.",
5656
"withdrawAllSuccess": "Your withdrawal request has been submitted. Once any Dai funds have been converted to ETH, the entire ETH balance will be withdrawn.",
5757
"withdrawAll": "Withdraw All Funds",
58-
"totalRevenue": "Total Revenue",
58+
"totalRevenue": "Net Revenue",
5959
"revenueHistory": "Revenue History",
60+
"revenueDescription": "This display shows net revenue, the total change in the router wallet balance. If the value is positive your router is earning money as a relay. If the value is negative relay bandwidth is offsetting spending on your own data usage.",
61+
"relayUsage": "Relayed Data",
6062
"beforeYouChange": "Before you change the pricing, you should <a href='https://althea.net'>read more about best practices</a> of selling your bandwidth and pricing.",
6163
"theAmountYouPay": "The amount you pay your network operator every month. This value can be increased above the default to facilitate payment plans. But can not be reduced below the base operator fee set by your operator.",
6264
"theseSettings": "These settings typically do not need to be updated and are used by technicians during the initial setup. Be sure you know what you're doing, as changes here may cause a service interruption.",

src/locales/es/translations.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
"withdrawAll": "Retirar todos los fondos",
4343
"totalRevenue": "Total Revenue",
4444
"revenueHistory": " Historial de ingresos ",
45+
"revenueDescription": "Esta pantalla muestra los ingresos netos, el cambio total en el saldo de la billetera del enrutador. Si el valor es positivo, su enrutador está ganando dinero como retransmisor. Si el valor es negativo, el ancho de banda de retransmisión está compensando el gasto en su propio uso de datos",
46+
"relayUsage": "Datos transmitidos",
4547
"beforeYouChange": "Antes de cambiar el precio, debe <a href='https://althea.net'>leer más sobre las mejores prácticas</a> para vender su ancho de banda y precios.",
4648
"theAmountYouPay": "La cantidad que paga al organizador de su red cada mes",
4749
"theseSettings": "Estas configuraciones generalmente no necesitan actualizarse y son utilizadas por los técnicos durante la configuración inicial. Asegúrese de saber lo que está haciendo, ya que los cambios aquí pueden causar una interrupción del servicio.",

0 commit comments

Comments
 (0)