From 47a766328f65907724940580bbe288491fcdb09d Mon Sep 17 00:00:00 2001 From: VitaliiShpital Date: Thu, 21 May 2020 20:01:56 +0300 Subject: [PATCH] web/satellite: deposit and billing history splitted to be shown separately WHAT: 1. Deposit & Billing history view was divided to be shown separately as Deposit History and Billing History 2. Datepicker was removed from billing page WHY: billing UX enhancements Change-Id: Ie183849ef0965169997674ce37b71db38a562fc2 --- satellite/console/service.go | 2 +- web/satellite/src/api/payments.ts | 16 +- .../account/billing/BillingArea.vue | 255 +----------------- .../billing/billingHistory/BillingHistory.vue | 157 ----------- .../DetailedHistory.vue | 150 +++++++++++ .../PaymentsHistoryItemDate.vue} | 12 +- .../PaymentsItem.vue} | 33 ++- .../PeriodSelection.vue | 247 +++++++++++++++++ .../SmallDepositHistory.vue} | 40 +-- .../SortingHeader.vue | 26 +- .../billing/paymentMethods/AddCardForm.vue | 1 - .../billing/paymentMethods/AddStorjForm.vue | 4 +- .../billing/paymentMethods/PaymentMethods.vue | 1 - .../paymentMethods/TokenDepositSelection.vue | 2 +- .../src/components/header/AccountButton.vue | 2 +- .../steps/CreateProjectStep.vue | 2 +- .../steps/paymentStates/AddCardState.vue | 1 - .../tokenSubSteps/PayingStep.vue | 4 +- .../components/project/NewProjectPopup.vue | 2 +- web/satellite/src/router/index.ts | 11 +- web/satellite/src/store/modules/payments.ts | 68 ++--- web/satellite/src/types/payments.ts | 24 +- web/satellite/src/views/DashboardArea.vue | 6 +- .../static/images/account/billing/back.svg | 5 +- .../images/account/billing/selected.svg | 4 + .../billingHistory/BillingHistory.spec.ts | 63 ----- .../billingHistory/DepositAndBilling.spec.ts | 61 ----- .../__snapshots__/BillingHistory.spec.ts.snap | 20 -- .../DepositAndBilling.spec.ts.snap | 16 -- .../DetailedHistory.spec.ts | 95 +++++++ .../PaymentsHistoryItemDate.spec.ts} | 26 +- .../PaymentsItem.spec.ts} | 18 +- .../PeriodSelection.spec.ts | 99 +++++++ .../SmallDepositHistory.spec.ts | 63 +++++ .../SortingHeader.spec.ts | 2 +- .../DetailedHistory.spec.ts.snap | 27 ++ .../PaymentsHistoryItemDate.spec.ts.snap} | 8 +- .../__snapshots__/PaymentsItem.spec.ts.snap} | 12 +- .../PeriodSelection.spec.ts.snap | 34 +++ .../SmallDepositHistory.spec.ts.snap | 16 ++ .../__snapshots__/SortingHeader.spec.ts.snap | 10 +- .../paymentMethods/AddStorjForm.spec.ts | 8 +- .../components/header/NewProjectArea.spec.ts | 12 +- web/satellite/tests/unit/mock/api/payments.ts | 4 +- .../steps/paymentStates/AddStorjState.spec.ts | 19 +- 45 files changed, 934 insertions(+), 754 deletions(-) delete mode 100644 web/satellite/src/components/account/billing/billingHistory/BillingHistory.vue create mode 100644 web/satellite/src/components/account/billing/depositAndBillingHistory/DetailedHistory.vue rename web/satellite/src/components/account/billing/{billingHistory/BillingHistoryItemDate.vue => depositAndBillingHistory/PaymentsHistoryItemDate.vue} (88%) rename web/satellite/src/components/account/billing/{billingHistory/BillingItem.vue => depositAndBillingHistory/PaymentsItem.vue} (74%) create mode 100644 web/satellite/src/components/account/billing/depositAndBillingHistory/PeriodSelection.vue rename web/satellite/src/components/account/billing/{billingHistory/DepositAndBilling.vue => depositAndBillingHistory/SmallDepositHistory.vue} (60%) rename web/satellite/src/components/account/billing/{billingHistory => depositAndBillingHistory}/SortingHeader.vue (65%) create mode 100644 web/satellite/static/images/account/billing/selected.svg delete mode 100644 web/satellite/tests/unit/account/billing/billingHistory/BillingHistory.spec.ts delete mode 100644 web/satellite/tests/unit/account/billing/billingHistory/DepositAndBilling.spec.ts delete mode 100644 web/satellite/tests/unit/account/billing/billingHistory/__snapshots__/BillingHistory.spec.ts.snap delete mode 100644 web/satellite/tests/unit/account/billing/billingHistory/__snapshots__/DepositAndBilling.spec.ts.snap create mode 100644 web/satellite/tests/unit/account/billing/depositAndBillingHistory/DetailedHistory.spec.ts rename web/satellite/tests/unit/account/billing/{billingHistory/BillingHistoryItemDate.spec.ts => depositAndBillingHistory/PaymentsHistoryItemDate.spec.ts} (72%) rename web/satellite/tests/unit/account/billing/{billingHistory/BillingItem.spec.ts => depositAndBillingHistory/PaymentsItem.spec.ts} (50%) create mode 100644 web/satellite/tests/unit/account/billing/depositAndBillingHistory/PeriodSelection.spec.ts create mode 100644 web/satellite/tests/unit/account/billing/depositAndBillingHistory/SmallDepositHistory.spec.ts rename web/satellite/tests/unit/account/billing/{billingHistory => depositAndBillingHistory}/SortingHeader.spec.ts (79%) create mode 100644 web/satellite/tests/unit/account/billing/depositAndBillingHistory/__snapshots__/DetailedHistory.spec.ts.snap rename web/satellite/tests/unit/account/billing/{billingHistory/__snapshots__/BillingHistoryItemDate.spec.ts.snap => depositAndBillingHistory/__snapshots__/PaymentsHistoryItemDate.spec.ts.snap} (61%) rename web/satellite/tests/unit/account/billing/{billingHistory/__snapshots__/BillingItem.spec.ts.snap => depositAndBillingHistory/__snapshots__/PaymentsItem.spec.ts.snap} (78%) create mode 100644 web/satellite/tests/unit/account/billing/depositAndBillingHistory/__snapshots__/PeriodSelection.spec.ts.snap create mode 100644 web/satellite/tests/unit/account/billing/depositAndBillingHistory/__snapshots__/SmallDepositHistory.spec.ts.snap rename web/satellite/tests/unit/account/billing/{billingHistory => depositAndBillingHistory}/__snapshots__/SortingHeader.spec.ts.snap (59%) diff --git a/satellite/console/service.go b/satellite/console/service.go index ef170bb40..e36bacc3b 100644 --- a/satellite/console/service.go +++ b/satellite/console/service.go @@ -315,7 +315,7 @@ func (paymentService PaymentsService) BillingHistory(ctx context.Context) (billi Description: coupon.Description, Amount: coupon.Amount, Remaining: remaining, - Status: "Added to balance", + Status: "Added as Free Credits", Link: "", Start: coupon.Created, Type: Coupon, diff --git a/web/satellite/src/api/payments.ts b/web/satellite/src/api/payments.ts index b51187b8d..f40797d8a 100644 --- a/web/satellite/src/api/payments.ts +++ b/web/satellite/src/api/payments.ts @@ -4,9 +4,9 @@ import { ErrorUnauthorized } from '@/api/errors/ErrorUnauthorized'; import { AccountBalance, - BillingHistoryItem, CreditCard, PaymentsApi, + PaymentsHistoryItem, ProjectUsageAndCharges, TokenDeposit, } from '@/types/payments'; @@ -194,12 +194,12 @@ export class PaymentsHttpApi implements PaymentsApi { } /** - * Returns a list of invoices, transactions and all others billing history items for payment account. + * Returns a list of invoices, transactions and all others payments history items for payment account. * - * @returns list of billing history items + * @returns list of payments history items * @throws Error */ - public async billingHistory(): Promise { + public async paymentsHistory(): Promise { const path = `${this.ROOT_PATH}/billing-history`; const response = await this.client.get(path); @@ -210,11 +210,11 @@ export class PaymentsHttpApi implements PaymentsApi { throw new Error('can not list billing history'); } - const billingHistoryItems = await response.json(); + const paymentsHistoryItems = await response.json(); - if (billingHistoryItems) { - return billingHistoryItems.map(item => - new BillingHistoryItem( + if (paymentsHistoryItems) { + return paymentsHistoryItems.map(item => + new PaymentsHistoryItem( item.id, item.description, item.amount, diff --git a/web/satellite/src/components/account/billing/BillingArea.vue b/web/satellite/src/components/account/billing/BillingArea.vue index 5bf2c1a8c..a99e84534 100644 --- a/web/satellite/src/components/account/billing/BillingArea.vue +++ b/web/satellite/src/components/account/billing/BillingArea.vue @@ -27,36 +27,19 @@ STORJ Balance: {{ balance.coins | centsToDollars }} - + - + @@ -367,44 +175,6 @@ export default class BillingArea extends Vue { color: #768394; } } - - &__options-area { - display: flex; - align-items: center; - - &__option { - display: flex; - align-items: center; - justify-content: center; - padding: 15px 20px; - background-color: #fff; - border-radius: 6px; - margin-left: 16px; - cursor: pointer; - - &__label { - font-family: 'font_medium', sans-serif; - font-size: 14px; - line-height: 14px; - color: #384b65; - } - - &.active { - background-color: #2683ff; - - .account-billing-area__title-area__options-area__option__label { - color: #fff; - } - - .account-billing-area__title-area__options-area__option__image { - - .date-picker-svg-path { - fill: #fff !important; - } - } - } - } - } } &__notification-container { @@ -441,13 +211,4 @@ export default class BillingArea extends Vue { .custom-position { margin: 30px 0 20px 0; } - - .datepicker { - padding: 12px; - } - - /deep/ .datepickbox { - max-height: 0; - max-width: 0; - } diff --git a/web/satellite/src/components/account/billing/billingHistory/BillingHistory.vue b/web/satellite/src/components/account/billing/billingHistory/BillingHistory.vue deleted file mode 100644 index 6d311936b..000000000 --- a/web/satellite/src/components/account/billing/billingHistory/BillingHistory.vue +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - - - - - - diff --git a/web/satellite/src/components/account/billing/depositAndBillingHistory/DetailedHistory.vue b/web/satellite/src/components/account/billing/depositAndBillingHistory/DetailedHistory.vue new file mode 100644 index 000000000..433955f50 --- /dev/null +++ b/web/satellite/src/components/account/billing/depositAndBillingHistory/DetailedHistory.vue @@ -0,0 +1,150 @@ +// Copyright (C) 2019 Storj Labs, Inc. +// See LICENSE for copying information. + + + + + + diff --git a/web/satellite/src/components/account/billing/billingHistory/BillingHistoryItemDate.vue b/web/satellite/src/components/account/billing/depositAndBillingHistory/PaymentsHistoryItemDate.vue similarity index 88% rename from web/satellite/src/components/account/billing/billingHistory/BillingHistoryItemDate.vue rename to web/satellite/src/components/account/billing/depositAndBillingHistory/PaymentsHistoryItemDate.vue index 69340498f..0d379b110 100644 --- a/web/satellite/src/components/account/billing/billingHistory/BillingHistoryItemDate.vue +++ b/web/satellite/src/components/account/billing/depositAndBillingHistory/PaymentsHistoryItemDate.vue @@ -18,10 +18,10 @@ @@ -60,26 +60,31 @@ export default class BillingItem extends Vue { .container { display: flex; - padding: 0 30px; align-items: center; - width: calc(100% - 60px); - border-top: 1px solid rgba(169, 181, 193, 0.3); + width: 100%; + border-top: 1px solid #c7cdd2; &__item { - min-width: 25%; + min-width: 20%; font-family: 'font_medium', sans-serif; font-size: 16px; text-align: left; - color: #61666b; + color: #768394; + margin: 30px 0; } } + .date { + font-family: 'font_bold', sans-serif; + margin: 0; + } + .description { min-width: 31%; } .status { - min-width: 12%; + min-width: 17%; } .amount { diff --git a/web/satellite/src/components/account/billing/depositAndBillingHistory/PeriodSelection.vue b/web/satellite/src/components/account/billing/depositAndBillingHistory/PeriodSelection.vue new file mode 100644 index 000000000..02b23db2e --- /dev/null +++ b/web/satellite/src/components/account/billing/depositAndBillingHistory/PeriodSelection.vue @@ -0,0 +1,247 @@ +// Copyright (C) 2020 Storj Labs, Inc. +// See LICENSE for copying information. + + + + + + \ No newline at end of file diff --git a/web/satellite/src/components/account/billing/billingHistory/DepositAndBilling.vue b/web/satellite/src/components/account/billing/depositAndBillingHistory/SmallDepositHistory.vue similarity index 60% rename from web/satellite/src/components/account/billing/billingHistory/DepositAndBilling.vue rename to web/satellite/src/components/account/billing/depositAndBillingHistory/SmallDepositHistory.vue index a63a14078..aad3ea80c 100644 --- a/web/satellite/src/components/account/billing/billingHistory/DepositAndBilling.vue +++ b/web/satellite/src/components/account/billing/depositAndBillingHistory/SmallDepositHistory.vue @@ -2,14 +2,14 @@ // See LICENSE for copying information.