From 7ac1e38e281f86ee0251d0b8a7c938bfa2cf6bba Mon Sep 17 00:00:00 2001 From: Vitalii Date: Tue, 1 Nov 2022 16:42:41 +0200 Subject: [PATCH] web/satellite: reworked new Add coupon modal to use common VModal component Reworked new Add coupon modal to use common VModal component to improve UX. Issue: https://github.com/storj/storj/issues/5104 Change-Id: Idd186ffd30a529761d15052bee4fac7cee4f5814 --- .../account/billing/billingTabs/Coupons.vue | 10 +- .../billing/coupons/AddCouponCode2.vue | 127 ------------------ ...2.vue => NewBillingAddCouponCodeInput.vue} | 53 +------- .../components/modals/AddCouponCodeModal.vue | 7 +- .../src/components/modals/AllModals.vue | 10 ++ .../modals/NewBillingAddCouponCodeModal.vue | 72 ++++++++++ web/satellite/src/store/modules/appState.ts | 4 + web/satellite/src/store/mutationConstants.ts | 1 + 8 files changed, 94 insertions(+), 190 deletions(-) delete mode 100644 web/satellite/src/components/account/billing/coupons/AddCouponCode2.vue rename web/satellite/src/components/common/{AddCouponCodeInput2.vue => NewBillingAddCouponCodeInput.vue} (67%) create mode 100644 web/satellite/src/components/modals/NewBillingAddCouponCodeModal.vue diff --git a/web/satellite/src/components/account/billing/billingTabs/Coupons.vue b/web/satellite/src/components/account/billing/billingTabs/Coupons.vue index c25ebcb3e..5365f9d5b 100644 --- a/web/satellite/src/components/account/billing/billingTabs/Coupons.vue +++ b/web/satellite/src/components/account/billing/billingTabs/Coupons.vue @@ -42,10 +42,6 @@ - @@ -57,20 +53,18 @@ import { PAYMENTS_ACTIONS } from '@/store/modules/payments'; import { Coupon } from '@/types/payments'; import { AnalyticsHttpApi } from '@/api/analytics'; import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames'; +import { APP_STATE_MUTATIONS } from '@/store/mutationConstants'; -import AddCouponCode2 from '@/components/account/billing/coupons/AddCouponCode2.vue'; import VLoader from '@/components/common/VLoader.vue'; // @vue/component @Component({ components: { VLoader, - AddCouponCode2, }, }) export default class Coupons extends Vue { public isCouponFetching = true; - public showCreateCode = false; private readonly analytics: AnalyticsHttpApi = new AnalyticsHttpApi(); @@ -93,7 +87,7 @@ export default class Coupons extends Vue { */ public toggleCreateModal(): void { this.analytics.eventTriggered(AnalyticsEvent.APPLY_NEW_COUPON_CLICKED); - this.showCreateCode = !this.showCreateCode; + this.$store.commit(APP_STATE_MUTATIONS.TOGGLE_NEW_BILLING_ADD_COUPON_MODAL_SHOWN); } /** diff --git a/web/satellite/src/components/account/billing/coupons/AddCouponCode2.vue b/web/satellite/src/components/account/billing/coupons/AddCouponCode2.vue deleted file mode 100644 index b019feb34..000000000 --- a/web/satellite/src/components/account/billing/coupons/AddCouponCode2.vue +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (C) 2021 Storj Labs, Inc. -// See LICENSE for copying information. - - - - - - diff --git a/web/satellite/src/components/common/AddCouponCodeInput2.vue b/web/satellite/src/components/common/NewBillingAddCouponCodeInput.vue similarity index 67% rename from web/satellite/src/components/common/AddCouponCodeInput2.vue rename to web/satellite/src/components/common/NewBillingAddCouponCodeInput.vue index 4686bd07c..1a99eb586 100644 --- a/web/satellite/src/components/common/AddCouponCodeInput2.vue +++ b/web/satellite/src/components/common/NewBillingAddCouponCodeInput.vue @@ -4,13 +4,8 @@ diff --git a/web/satellite/src/components/modals/NewBillingAddCouponCodeModal.vue b/web/satellite/src/components/modals/NewBillingAddCouponCodeModal.vue new file mode 100644 index 000000000..d7e2423bb --- /dev/null +++ b/web/satellite/src/components/modals/NewBillingAddCouponCodeModal.vue @@ -0,0 +1,72 @@ +// Copyright (C) 2022 Storj Labs, Inc. +// See LICENSE for copying information. + + + + + + diff --git a/web/satellite/src/store/modules/appState.ts b/web/satellite/src/store/modules/appState.ts index f515390dc..8f8776066 100644 --- a/web/satellite/src/store/modules/appState.ts +++ b/web/satellite/src/store/modules/appState.ts @@ -43,6 +43,7 @@ class ViewsState { public isNewFolderModalShown = false, public isObjectDetailsModalShown = false, public isAddCouponModalShown = false, + public isNewBillingAddCouponModalShown = false, public isBillingNotificationShown = true, public onbAGStepBackRoute = '', @@ -168,6 +169,9 @@ export const appStateModule = { [APP_STATE_MUTATIONS.TOGGLE_ADD_COUPON_MODAL_SHOWN](state: State): void { state.appState.isAddCouponModalShown = !state.appState.isAddCouponModalShown; }, + [APP_STATE_MUTATIONS.TOGGLE_NEW_BILLING_ADD_COUPON_MODAL_SHOWN](state: State): void { + state.appState.isNewBillingAddCouponModalShown = !state.appState.isNewBillingAddCouponModalShown; + }, [APP_STATE_MUTATIONS.TOGGLE_NEW_FOLDER_MODAL_SHOWN](state: State): void { state.appState.isNewFolderModalShown = !state.appState.isNewFolderModalShown; }, diff --git a/web/satellite/src/store/mutationConstants.ts b/web/satellite/src/store/mutationConstants.ts index 0fbbcf64a..c29c98851 100644 --- a/web/satellite/src/store/mutationConstants.ts +++ b/web/satellite/src/store/mutationConstants.ts @@ -42,6 +42,7 @@ export const APP_STATE_MUTATIONS = { TOGGLE_DELETE_BUCKET_MODAL_SHOWN: 'TOGGLE_DELETE_BUCKET_MODAL_SHOWN', TOGGLE_OBJECT_DETAILS_MODAL_SHOWN: 'TOGGLE_OBJECT_DETAILS_MODAL_SHOWN', TOGGLE_ADD_COUPON_MODAL_SHOWN: 'TOGGLE_ADD_COUPON_MODAL_SHOWN', + TOGGLE_NEW_BILLING_ADD_COUPON_MODAL_SHOWN: 'TOGGLE_NEW_BILLING_ADD_COUPON_MODAL_SHOWN', TOGGLE_NEW_FOLDER_MODAL_SHOWN: 'TOGGLE_NEW_FOLDER_MODAL_SHOWN', SHOW_DELETE_PAYMENT_METHOD_POPUP: 'SHOW_DELETE_PAYMENT_METHOD_POPUP', SHOW_SET_DEFAULT_PAYMENT_METHOD_POPUP: 'SHOW_SET_DEFAULT_PAYMENT_METHOD_POPUP',