diff --git a/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem.vue b/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem.vue index 0106789de..856f5bfe6 100644 --- a/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem.vue +++ b/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem.vue @@ -22,9 +22,9 @@
Storage (${{ storagePrice }} per Gigabyte-Month)
-Egress (${{ egressPrice }} per GB)
-Segments (${{ segmentPrice }} per Segment-Month)
+Storage ({{ storagePrice }} per Gigabyte-Month)
+Egress ({{ egressPrice }} per GB)
+Segments ({{ segmentPrice }} per Segment-Month)
{{ period }}
@@ -53,7 +53,7 @@ import { ProjectUsageAndCharges, ProjectUsagePriceModel } from '@/types/payments import { Project } from '@/types/projects'; import { Size } from '@/utils/bytesSize'; import { SHORT_MONTHS_NAMES } from '@/utils/constants/date'; -import { decimalShift } from '@/utils/strings'; +import { decimalShift, formatPrice, CENTS_MB_TO_DOLLARS_GB_SHIFT } from '@/utils/strings'; import { AnalyticsHttpApi } from '@/api/analytics'; import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames'; import { useStore } from '@/utils/hooks'; @@ -68,12 +68,6 @@ const analytics: AnalyticsHttpApi = new AnalyticsHttpApi(); */ const HOURS_IN_MONTH = 720; -/** - * CENTS_MB_TO_DOLLARS_GB_SHIFT constant represents how many places to the left - * a decimal point must be shifted to convert from cents/MB to dollars/GB. - */ -const CENTS_MB_TO_DOLLARS_GB_SHIFT = -1; - const props = withDefaults(defineProps<{ /** * item represents usage and charges of current project by period. @@ -144,21 +138,21 @@ const segmentCountFormatted = computed((): string => { * Returns storage price per GB. */ const storagePrice = computed((): string => { - return decimalShift(priceModel.value.storageMBMonthCents, CENTS_MB_TO_DOLLARS_GB_SHIFT); + return formatPrice(decimalShift(priceModel.value.storageMBMonthCents, CENTS_MB_TO_DOLLARS_GB_SHIFT)); }); /** * Returns egress price per GB. */ const egressPrice = computed((): string => { - return decimalShift(priceModel.value.egressMBCents, CENTS_MB_TO_DOLLARS_GB_SHIFT); + return formatPrice(decimalShift(priceModel.value.egressMBCents, CENTS_MB_TO_DOLLARS_GB_SHIFT)); }); /** * Returns segment price. */ const segmentPrice = computed((): string => { - return decimalShift(priceModel.value.segmentMonthCents, 2); + return formatPrice(decimalShift(priceModel.value.segmentMonthCents, 2)); }); /** diff --git a/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem2.vue b/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem2.vue index a16ec7b71..b0c5ea3ee 100644 --- a/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem2.vue +++ b/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem2.vue @@ -26,9 +26,9 @@Storage (${{ storagePrice }} per Gigabyte-Month)
-Egress (${{ egressPrice }} per GB)
-Segments (${{ segmentPrice }} per Segment-Month)
+Storage ({{ storagePrice }} per Gigabyte-Month)
+Egress ({{ egressPrice }} per GB)
+Segments ({{ segmentPrice }} per Segment-Month)
{{ period }}
@@ -58,7 +58,7 @@ import { ProjectUsageAndCharges, ProjectUsagePriceModel } from '@/types/payments import { Project } from '@/types/projects'; import { Size } from '@/utils/bytesSize'; import { SHORT_MONTHS_NAMES } from '@/utils/constants/date'; -import { decimalShift } from '@/utils/strings'; +import { decimalShift, formatPrice, CENTS_MB_TO_DOLLARS_GB_SHIFT } from '@/utils/strings'; import { useStore } from '@/utils/hooks'; import GreyChevron from '@/../static/images/common/greyChevron.svg'; @@ -68,12 +68,6 @@ import GreyChevron from '@/../static/images/common/greyChevron.svg'; */ const HOURS_IN_MONTH = 720; -/** - * CENTS_MB_TO_DOLLARS_GB_SHIFT constant represents how many places to the left - * a decimal point must be shifted to convert from cents/MB to dollars/GB. - */ -const CENTS_MB_TO_DOLLARS_GB_SHIFT = -1; - const props = withDefaults(defineProps<{ /** * item represents usage and charges of current project by period. @@ -144,21 +138,21 @@ const segmentCountFormatted = computed((): string => { * Returns storage price per GB. */ const storagePrice = computed((): string => { - return decimalShift(priceModel.value.storageMBMonthCents, CENTS_MB_TO_DOLLARS_GB_SHIFT); + return formatPrice(decimalShift(priceModel.value.storageMBMonthCents, CENTS_MB_TO_DOLLARS_GB_SHIFT)); }); /** * Returns egress price per GB. */ const egressPrice = computed((): string => { - return decimalShift(priceModel.value.egressMBCents, CENTS_MB_TO_DOLLARS_GB_SHIFT); + return formatPrice(decimalShift(priceModel.value.egressMBCents, CENTS_MB_TO_DOLLARS_GB_SHIFT)); }); /** * Returns segment price. */ const segmentPrice = computed((): string => { - return decimalShift(priceModel.value.segmentMonthCents, 2); + return formatPrice(decimalShift(priceModel.value.segmentMonthCents, 2)); }); /** diff --git a/web/satellite/src/components/modals/AddPaymentMethodModal.vue b/web/satellite/src/components/modals/AddPaymentMethodModal.vue index 96fcb890c..32b5d7486 100644 --- a/web/satellite/src/components/modals/AddPaymentMethodModal.vue +++ b/web/satellite/src/components/modals/AddPaymentMethodModal.vue @@ -64,15 +64,16 @@100 request per second rate limit
$4
+{{ storagePrice }}
TB / month
$7
+{{ bandwidthPrice }}
TB