From 6da577d4ae239589022d316a38eff58a0db09906 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 8 Apr 2021 10:46:09 +0200 Subject: [PATCH] reorganized react components --- .../payment-schedule-summary.tsx | 12 +++---- .../payment-schedules-dashboard.tsx | 12 +++---- .../payment-schedules-list.tsx | 14 ++++---- .../payment-schedules-table.tsx | 27 +++++++------- .../select-schedule.tsx | 6 ++-- .../{ => payzen}/payzen-keys-form.tsx | 12 +++---- .../{ => payzen}/payzen-settings.tsx | 14 ++++---- .../components/select-gateway-modal.tsx | 4 +-- .../{ => stripe}/stripe-card-update.tsx | 6 ++-- .../{ => stripe}/stripe-confirm.tsx | 0 .../{ => stripe}/stripe-elements.tsx | 4 +-- .../components/{ => stripe}/stripe-form.tsx | 6 ++-- .../{ => stripe}/stripe-keys-form.tsx | 12 +++---- .../components/{ => stripe}/stripe-modal.tsx | 36 +++++++++---------- 14 files changed, 83 insertions(+), 82 deletions(-) rename app/frontend/src/javascript/components/{ => payment-schedule}/payment-schedule-summary.tsx (92%) rename app/frontend/src/javascript/components/{ => payment-schedule}/payment-schedules-dashboard.tsx (91%) rename app/frontend/src/javascript/components/{ => payment-schedule}/payment-schedules-list.tsx (92%) rename app/frontend/src/javascript/components/{ => payment-schedule}/payment-schedules-table.tsx (96%) rename app/frontend/src/javascript/components/{ => payment-schedule}/select-schedule.tsx (91%) rename app/frontend/src/javascript/components/{ => payzen}/payzen-keys-form.tsx (96%) rename app/frontend/src/javascript/components/{ => payzen}/payzen-settings.tsx (94%) rename app/frontend/src/javascript/components/{ => stripe}/stripe-card-update.tsx (95%) rename app/frontend/src/javascript/components/{ => stripe}/stripe-confirm.tsx (100%) rename app/frontend/src/javascript/components/{ => stripe}/stripe-elements.tsx (89%) rename app/frontend/src/javascript/components/{ => stripe}/stripe-form.tsx (96%) rename app/frontend/src/javascript/components/{ => stripe}/stripe-keys-form.tsx (95%) rename app/frontend/src/javascript/components/{ => stripe}/stripe-modal.tsx (88%) diff --git a/app/frontend/src/javascript/components/payment-schedule-summary.tsx b/app/frontend/src/javascript/components/payment-schedule/payment-schedule-summary.tsx similarity index 92% rename from app/frontend/src/javascript/components/payment-schedule-summary.tsx rename to app/frontend/src/javascript/components/payment-schedule/payment-schedule-summary.tsx index e9332b6b4..b6bde67a4 100644 --- a/app/frontend/src/javascript/components/payment-schedule-summary.tsx +++ b/app/frontend/src/javascript/components/payment-schedule/payment-schedule-summary.tsx @@ -2,12 +2,12 @@ import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { react2angular } from 'react2angular'; import moment from 'moment'; -import { IApplication } from '../models/application'; -import '../lib/i18n'; -import { PaymentSchedule } from '../models/payment-schedule'; -import { Loader } from './base/loader'; -import { FabModal } from './base/fab-modal'; -import { IFablab } from '../models/fablab'; +import '../../lib/i18n'; +import { Loader } from '../base/loader'; +import { FabModal } from '../base/fab-modal'; +import { IFablab } from '../../models/fablab'; +import { PaymentSchedule } from '../../models/payment-schedule'; +import { IApplication } from '../../models/application'; declare var Application: IApplication; declare var Fablab: IFablab; diff --git a/app/frontend/src/javascript/components/payment-schedules-dashboard.tsx b/app/frontend/src/javascript/components/payment-schedule/payment-schedules-dashboard.tsx similarity index 91% rename from app/frontend/src/javascript/components/payment-schedules-dashboard.tsx rename to app/frontend/src/javascript/components/payment-schedule/payment-schedules-dashboard.tsx index c189c9dc9..cccf35790 100644 --- a/app/frontend/src/javascript/components/payment-schedules-dashboard.tsx +++ b/app/frontend/src/javascript/components/payment-schedule/payment-schedules-dashboard.tsx @@ -1,13 +1,13 @@ import React, { useEffect, useState } from 'react'; -import { IApplication } from '../models/application'; import { useTranslation } from 'react-i18next'; -import { Loader } from './base/loader'; import { react2angular } from 'react2angular'; -import PaymentScheduleAPI from '../api/payment-schedule'; import { PaymentSchedulesTable } from './payment-schedules-table'; -import { FabButton } from './base/fab-button'; -import { User } from '../models/user'; -import { PaymentSchedule } from '../models/payment-schedule'; +import { FabButton } from '../base/fab-button'; +import { Loader } from '../base/loader'; +import { User } from '../../models/user'; +import { PaymentSchedule } from '../../models/payment-schedule'; +import { IApplication } from '../../models/application'; +import PaymentScheduleAPI from '../../api/payment-schedule'; declare var Application: IApplication; diff --git a/app/frontend/src/javascript/components/payment-schedules-list.tsx b/app/frontend/src/javascript/components/payment-schedule/payment-schedules-list.tsx similarity index 92% rename from app/frontend/src/javascript/components/payment-schedules-list.tsx rename to app/frontend/src/javascript/components/payment-schedule/payment-schedules-list.tsx index bc3df3ce4..65354d370 100644 --- a/app/frontend/src/javascript/components/payment-schedules-list.tsx +++ b/app/frontend/src/javascript/components/payment-schedule/payment-schedules-list.tsx @@ -1,14 +1,14 @@ import React, { useEffect, useState } from 'react'; -import { IApplication } from '../models/application'; import { useTranslation } from 'react-i18next'; -import { Loader } from './base/loader'; import { react2angular } from 'react2angular'; -import PaymentScheduleAPI from '../api/payment-schedule'; -import { DocumentFilters } from './document-filters'; +import { DocumentFilters } from '../document-filters'; import { PaymentSchedulesTable } from './payment-schedules-table'; -import { FabButton } from './base/fab-button'; -import { User } from '../models/user'; -import { PaymentSchedule } from '../models/payment-schedule'; +import { FabButton } from '../base/fab-button'; +import { Loader } from '../base/loader'; +import { User } from '../../models/user'; +import { PaymentSchedule } from '../../models/payment-schedule'; +import { IApplication } from '../../models/application'; +import PaymentScheduleAPI from '../../api/payment-schedule'; declare var Application: IApplication; diff --git a/app/frontend/src/javascript/components/payment-schedules-table.tsx b/app/frontend/src/javascript/components/payment-schedule/payment-schedules-table.tsx similarity index 96% rename from app/frontend/src/javascript/components/payment-schedules-table.tsx rename to app/frontend/src/javascript/components/payment-schedule/payment-schedules-table.tsx index 0880f0274..2f6d41ecd 100644 --- a/app/frontend/src/javascript/components/payment-schedules-table.tsx +++ b/app/frontend/src/javascript/components/payment-schedule/payment-schedules-table.tsx @@ -1,20 +1,21 @@ import React, { ReactEventHandler, ReactNode, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { Loader } from './base/loader'; +import { Loader } from '../base/loader'; import moment from 'moment'; -import { IFablab } from '../models/fablab'; import _ from 'lodash'; -import { PaymentSchedule, PaymentScheduleItem, PaymentScheduleItemState } from '../models/payment-schedule'; -import { FabButton } from './base/fab-button'; -import { FabModal } from './base/fab-modal'; -import PaymentScheduleAPI from '../api/payment-schedule'; -import { StripeElements } from './stripe-elements'; -import { StripeConfirm } from './stripe-confirm'; -import stripeLogo from '../../../images/powered_by_stripe.png'; -import mastercardLogo from '../../../images/mastercard.png'; -import visaLogo from '../../../images/visa.png'; -import { StripeCardUpdate } from './stripe-card-update'; -import { User, UserRole } from '../models/user'; +import { FabButton } from '../base/fab-button'; +import { FabModal } from '../base/fab-modal'; +import { StripeElements } from '../stripe/stripe-elements'; +import { StripeConfirm } from '../stripe/stripe-confirm'; +import { StripeCardUpdate } from '../stripe/stripe-card-update'; +import { User, UserRole } from '../../models/user'; +import { IFablab } from '../../models/fablab'; +import { PaymentSchedule, PaymentScheduleItem, PaymentScheduleItemState } from '../../models/payment-schedule'; +import PaymentScheduleAPI from '../../api/payment-schedule'; + +import stripeLogo from '../../../../images/powered_by_stripe.png'; +import mastercardLogo from '../../../../images/mastercard.png'; +import visaLogo from '../../../../images/visa.png'; declare var Fablab: IFablab; diff --git a/app/frontend/src/javascript/components/select-schedule.tsx b/app/frontend/src/javascript/components/payment-schedule/select-schedule.tsx similarity index 91% rename from app/frontend/src/javascript/components/select-schedule.tsx rename to app/frontend/src/javascript/components/payment-schedule/select-schedule.tsx index 289d9e59b..6be8451aa 100644 --- a/app/frontend/src/javascript/components/select-schedule.tsx +++ b/app/frontend/src/javascript/components/payment-schedule/select-schedule.tsx @@ -2,9 +2,9 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { react2angular } from 'react2angular'; import Switch from 'react-switch'; -import { IApplication } from '../models/application'; -import { Loader } from './base/loader'; -import '../lib/i18n'; +import '../../lib/i18n'; +import { Loader } from '../base/loader'; +import { IApplication } from '../../models/application'; declare var Application: IApplication; diff --git a/app/frontend/src/javascript/components/payzen-keys-form.tsx b/app/frontend/src/javascript/components/payzen/payzen-keys-form.tsx similarity index 96% rename from app/frontend/src/javascript/components/payzen-keys-form.tsx rename to app/frontend/src/javascript/components/payzen/payzen-keys-form.tsx index bae765a4f..ecbd8df71 100644 --- a/app/frontend/src/javascript/components/payzen-keys-form.tsx +++ b/app/frontend/src/javascript/components/payzen/payzen-keys-form.tsx @@ -1,13 +1,13 @@ import React, { ReactNode, useEffect, useState } from 'react'; -import { Loader } from './base/loader'; import { useTranslation } from 'react-i18next'; -import SettingAPI from '../api/setting'; -import { SettingName } from '../models/setting'; -import { FabInput } from './base/fab-input'; import { enableMapSet } from 'immer'; import { useImmer } from 'use-immer'; -import PayzenAPI from '../api/payzen'; -import { HtmlTranslate } from './base/html-translate'; +import { HtmlTranslate } from '../base/html-translate'; +import { FabInput } from '../base/fab-input'; +import { Loader } from '../base/loader'; +import { SettingName } from '../../models/setting'; +import SettingAPI from '../../api/setting'; +import PayzenAPI from '../../api/payzen'; enableMapSet(); diff --git a/app/frontend/src/javascript/components/payzen-settings.tsx b/app/frontend/src/javascript/components/payzen/payzen-settings.tsx similarity index 94% rename from app/frontend/src/javascript/components/payzen-settings.tsx rename to app/frontend/src/javascript/components/payzen/payzen-settings.tsx index 7661775f6..36c265557 100644 --- a/app/frontend/src/javascript/components/payzen-settings.tsx +++ b/app/frontend/src/javascript/components/payzen/payzen-settings.tsx @@ -1,14 +1,14 @@ import React, { useEffect, useState } from 'react'; -import { Loader } from './base/loader'; import { react2angular } from 'react2angular'; -import { IApplication } from '../models/application'; import { useTranslation } from 'react-i18next'; -import SettingAPI from '../api/setting'; -import { SettingName } from '../models/setting'; import { useImmer } from 'use-immer'; -import { FabInput } from './base/fab-input'; -import { FabButton } from './base/fab-button'; -import { HtmlTranslate } from './base/html-translate'; +import { FabInput } from '../base/fab-input'; +import { FabButton } from '../base/fab-button'; +import { Loader } from '../base/loader'; +import { HtmlTranslate } from '../base/html-translate'; +import { SettingName } from '../../models/setting'; +import { IApplication } from '../../models/application'; +import SettingAPI from '../../api/setting'; declare var Application: IApplication; diff --git a/app/frontend/src/javascript/components/select-gateway-modal.tsx b/app/frontend/src/javascript/components/select-gateway-modal.tsx index 63d056680..6d9a6879c 100644 --- a/app/frontend/src/javascript/components/select-gateway-modal.tsx +++ b/app/frontend/src/javascript/components/select-gateway-modal.tsx @@ -11,10 +11,10 @@ import { useTranslation } from 'react-i18next'; import { FabModal, ModalSize } from './base/fab-modal'; import { User } from '../models/user'; import { Gateway } from '../models/gateway'; -import { StripeKeysForm } from './stripe-keys-form'; +import { StripeKeysForm } from './stripe/stripe-keys-form'; import { SettingBulkResult, SettingName } from '../models/setting'; import SettingAPI from '../api/setting'; -import { PayZenKeysForm } from './payzen-keys-form'; +import { PayZenKeysForm } from './payzen/payzen-keys-form'; declare var Application: IApplication; diff --git a/app/frontend/src/javascript/components/stripe-card-update.tsx b/app/frontend/src/javascript/components/stripe/stripe-card-update.tsx similarity index 95% rename from app/frontend/src/javascript/components/stripe-card-update.tsx rename to app/frontend/src/javascript/components/stripe/stripe-card-update.tsx index 3bbf618f4..aa79c0633 100644 --- a/app/frontend/src/javascript/components/stripe-card-update.tsx +++ b/app/frontend/src/javascript/components/stripe/stripe-card-update.tsx @@ -1,9 +1,9 @@ import React, { FormEvent } from 'react'; import { CardElement, useElements, useStripe } from '@stripe/react-stripe-js'; import { SetupIntent } from "@stripe/stripe-js"; -import PaymentAPI from '../api/payment'; -import { PaymentConfirmation } from '../models/payment'; -import { User } from '../models/user'; +import { PaymentConfirmation } from '../../models/payment'; +import { User } from '../../models/user'; +import PaymentAPI from '../../api/payment'; interface StripeCardUpdateProps { onSubmit: () => void, diff --git a/app/frontend/src/javascript/components/stripe-confirm.tsx b/app/frontend/src/javascript/components/stripe/stripe-confirm.tsx similarity index 100% rename from app/frontend/src/javascript/components/stripe-confirm.tsx rename to app/frontend/src/javascript/components/stripe/stripe-confirm.tsx diff --git a/app/frontend/src/javascript/components/stripe-elements.tsx b/app/frontend/src/javascript/components/stripe/stripe-elements.tsx similarity index 89% rename from app/frontend/src/javascript/components/stripe-elements.tsx rename to app/frontend/src/javascript/components/stripe/stripe-elements.tsx index 60faf9315..fb348a71a 100644 --- a/app/frontend/src/javascript/components/stripe-elements.tsx +++ b/app/frontend/src/javascript/components/stripe/stripe-elements.tsx @@ -1,8 +1,8 @@ import React, { memo, useEffect, useState } from 'react'; import { Elements } from '@stripe/react-stripe-js'; import { loadStripe } from "@stripe/stripe-js"; -import SettingAPI from '../api/setting'; -import { SettingName } from '../models/setting'; +import { SettingName } from '../../models/setting'; +import SettingAPI from '../../api/setting'; // initial request to the API const stripePublicKey = SettingAPI.get(SettingName.StripePublicKey); diff --git a/app/frontend/src/javascript/components/stripe-form.tsx b/app/frontend/src/javascript/components/stripe/stripe-form.tsx similarity index 96% rename from app/frontend/src/javascript/components/stripe-form.tsx rename to app/frontend/src/javascript/components/stripe/stripe-form.tsx index ba0cdcfba..56130f59e 100644 --- a/app/frontend/src/javascript/components/stripe-form.tsx +++ b/app/frontend/src/javascript/components/stripe/stripe-form.tsx @@ -1,10 +1,10 @@ import React, { FormEvent } from 'react'; import { CardElement, useElements, useStripe } from '@stripe/react-stripe-js'; import { SetupIntent } from "@stripe/stripe-js"; -import PaymentAPI from '../api/payment'; -import { CartItems, PaymentConfirmation } from '../models/payment'; import { useTranslation } from 'react-i18next'; -import { User } from '../models/user'; +import { CartItems, PaymentConfirmation } from '../../models/payment'; +import { User } from '../../models/user'; +import PaymentAPI from '../../api/payment'; interface StripeFormProps { onSubmit: () => void, diff --git a/app/frontend/src/javascript/components/stripe-keys-form.tsx b/app/frontend/src/javascript/components/stripe/stripe-keys-form.tsx similarity index 95% rename from app/frontend/src/javascript/components/stripe-keys-form.tsx rename to app/frontend/src/javascript/components/stripe/stripe-keys-form.tsx index f3d71e993..331106023 100644 --- a/app/frontend/src/javascript/components/stripe-keys-form.tsx +++ b/app/frontend/src/javascript/components/stripe/stripe-keys-form.tsx @@ -1,11 +1,11 @@ import React, { ReactNode, useEffect, useRef, useState } from 'react'; -import { Loader } from './base/loader'; import { useTranslation } from 'react-i18next'; -import SettingAPI from '../api/setting'; -import { SettingName } from '../models/setting'; -import { FabInput } from './base/fab-input'; -import StripeAPI from '../api/stripe'; -import { HtmlTranslate } from './base/html-translate'; +import { HtmlTranslate } from '../base/html-translate'; +import { FabInput } from '../base/fab-input'; +import { Loader } from '../base/loader'; +import { SettingName } from '../../models/setting'; +import StripeAPI from '../../api/stripe'; +import SettingAPI from '../../api/setting'; interface StripeKeysFormProps { diff --git a/app/frontend/src/javascript/components/stripe-modal.tsx b/app/frontend/src/javascript/components/stripe/stripe-modal.tsx similarity index 88% rename from app/frontend/src/javascript/components/stripe-modal.tsx rename to app/frontend/src/javascript/components/stripe/stripe-modal.tsx index 3df77bb5f..97378e2be 100644 --- a/app/frontend/src/javascript/components/stripe-modal.tsx +++ b/app/frontend/src/javascript/components/stripe/stripe-modal.tsx @@ -1,27 +1,27 @@ import React, { ReactNode, useEffect, useState } from 'react'; import { react2angular } from 'react2angular'; -import { Loader } from './base/loader'; -import { IApplication } from '../models/application'; -import { StripeElements } from './stripe-elements'; import { useTranslation } from 'react-i18next'; -import { FabModal, ModalSize } from './base/fab-modal'; import { SetupIntent } from '@stripe/stripe-js'; -import { WalletInfo } from './wallet-info'; -import { User } from '../models/user'; -import CustomAssetAPI from '../api/custom-asset'; -import { CustomAssetName } from '../models/custom-asset'; -import { PaymentSchedule } from '../models/payment-schedule'; -import { IFablab } from '../models/fablab'; -import WalletLib from '../lib/wallet'; +import WalletLib from '../../lib/wallet'; +import { StripeElements } from './stripe-elements'; import { StripeForm } from './stripe-form'; -import { CartItems, PaymentConfirmation } from '../models/payment'; -import WalletAPI from '../api/wallet'; -import PriceAPI from '../api/price'; -import { HtmlTranslate } from './base/html-translate'; +import { WalletInfo } from '../wallet-info'; +import { FabModal, ModalSize } from '../base/fab-modal'; +import { HtmlTranslate } from '../base/html-translate'; +import { Loader } from '../base/loader'; +import { IApplication } from '../../models/application'; +import { CustomAssetName } from '../../models/custom-asset'; +import { IFablab } from '../../models/fablab'; +import { CartItems, PaymentConfirmation } from '../../models/payment'; +import { PaymentSchedule } from '../../models/payment-schedule'; +import { User } from '../../models/user'; +import CustomAssetAPI from '../../api/custom-asset'; +import PriceAPI from '../../api/price'; +import WalletAPI from '../../api/wallet'; -import stripeLogo from '../../../images/powered_by_stripe.png'; -import mastercardLogo from '../../../images/mastercard.png'; -import visaLogo from '../../../images/visa.png'; +import stripeLogo from '../../../../images/powered_by_stripe.png'; +import mastercardLogo from '../../../../images/mastercard.png'; +import visaLogo from '../../../../images/visa.png'; declare var Application: IApplication; declare var Fablab: IFablab;