From 69b937b17dabe14b2f493053a925756827e75a8e Mon Sep 17 00:00:00 2001 From: Ovidio Rodriguez Date: Thu, 2 Dec 2021 12:30:23 -0400 Subject: [PATCH] refactor selectors to utilities --- src/components/AddPaymentForm.js | 2 +- src/components/AddProjectDetails.js | 2 +- src/components/AddProjectForm.js | 2 +- src/components/AllocationAddSpecifics.js | 2 +- src/components/AllocationClientSpecifics.js | 2 +- src/components/AllocationProposeSpecifics.js | 2 +- src/components/AllocationTile.js | 2 +- src/components/ClientInfo.js | 2 +- src/components/ClientPaymentsManager.js | 2 +- src/components/ContributorInfoTile.js | 2 +- src/components/ContributorTile.js | 2 +- src/components/EditAllocationInfo.js | 2 +- src/components/Navigation.js | 2 +- src/components/PaymentEditDialog.js | 2 +- src/components/PaymentTile.js | 2 +- src/components/PaymentsAddForm.js | 2 +- src/components/ProjectContributors.js | 2 +- src/components/ProjectEditDialog.js | 3 +-- src/components/ProjectPayments.js | 2 +- src/components/ProjectPaymentsSummary.js | 2 +- src/components/ProjectProposedAllocationsTile.js | 2 +- src/components/ProjectSummary.js | 2 +- src/components/RateMaxBudgetForm.js | 2 +- src/components/RateProratedMonthlyForm.js | 2 +- src/scripts/{selectors.js => utilities.js} | 0 25 files changed, 24 insertions(+), 25 deletions(-) rename src/scripts/{selectors.js => utilities.js} (100%) diff --git a/src/components/AddPaymentForm.js b/src/components/AddPaymentForm.js index 560ce210..b16eb6c7 100644 --- a/src/components/AddPaymentForm.js +++ b/src/components/AddPaymentForm.js @@ -25,7 +25,7 @@ import { GET_CLIENT_PAYMENTS } from '../operations/queries/PaymentQueries' import { CREATE_PAYMENT } from '../operations/mutations/PaymentMutations' import { selectCurrencyInformation -} from '../scripts/selectors' +} from '../scripts/utilities' const AddPaymentForm = (props) => { diff --git a/src/components/AddProjectDetails.js b/src/components/AddProjectDetails.js index 8ac4359a..8d521d3d 100644 --- a/src/components/AddProjectDetails.js +++ b/src/components/AddProjectDetails.js @@ -20,7 +20,7 @@ import CurrencyTextField from '@unicef/material-ui-currency-textfield' import { EXPECTED_BUDGET_TIMEFRAME_OPTIONS, MAX_INT } from '../constants' import { selectCurrencyInformation -} from '../scripts/selectors' +} from '../scripts/utilities' const AddProjectDetails = (props) => { diff --git a/src/components/AddProjectForm.js b/src/components/AddProjectForm.js index 43681d15..45ba091f 100644 --- a/src/components/AddProjectForm.js +++ b/src/components/AddProjectForm.js @@ -23,7 +23,7 @@ import { sessionUser } from '../reactivities/variables' import { verifyGithubURL, verifyTogglURL -} from '../scripts/selectors' +} from '../scripts/utilities' import { EXPECTED_BUDGET_TIMEFRAME_OPTIONS } from '../constants' import { GET_CLIENT_INFO } from '../operations/queries/ClientQueries' import { ADD_PROJECT, SYNC_TOGGL_PROJECT } from '../operations/mutations/ProjectMutations' diff --git a/src/components/AllocationAddSpecifics.js b/src/components/AllocationAddSpecifics.js index c5cf0a02..c2775a22 100644 --- a/src/components/AllocationAddSpecifics.js +++ b/src/components/AllocationAddSpecifics.js @@ -30,7 +30,7 @@ import { formatAmount, selectCurrencyInformation, selectCurrencySymbol -} from '../scripts/selectors' +} from '../scripts/utilities' const AllocationAddSpecifics = (props) => { diff --git a/src/components/AllocationClientSpecifics.js b/src/components/AllocationClientSpecifics.js index 5159586a..9bf9024d 100644 --- a/src/components/AllocationClientSpecifics.js +++ b/src/components/AllocationClientSpecifics.js @@ -32,7 +32,7 @@ import { GET_CLIENT_PROJECTS } from '../operations/queries/ClientQueries' import { formatAmount, selectCurrencyInformation -} from '../scripts/selectors' +} from '../scripts/utilities' const AllocationClientSpecifics = (props) => { diff --git a/src/components/AllocationProposeSpecifics.js b/src/components/AllocationProposeSpecifics.js index 60d9d1f1..000aea07 100644 --- a/src/components/AllocationProposeSpecifics.js +++ b/src/components/AllocationProposeSpecifics.js @@ -29,7 +29,7 @@ import { GET_ALL_PROJECTS, GET_PROJECT_CLIENT_PAYMENTS } from '../operations/que import { formatAmount, selectCurrencyInformation -} from '../scripts/selectors' +} from '../scripts/utilities' const AllocationProposeSpecifics = (props) => { diff --git a/src/components/AllocationTile.js b/src/components/AllocationTile.js index 3984e05b..b721b479 100644 --- a/src/components/AllocationTile.js +++ b/src/components/AllocationTile.js @@ -16,7 +16,7 @@ import AllocationOverview from './AllocationOverview' import { formatAmount, selectCurrencyInformation -} from '../scripts/selectors' +} from '../scripts/utilities' import { grey, orange, red, setlifeBlue } from '../styles/colors.scss' const AllocationTile = (props) => { diff --git a/src/components/ClientInfo.js b/src/components/ClientInfo.js index 136624ed..9c0e7d28 100644 --- a/src/components/ClientInfo.js +++ b/src/components/ClientInfo.js @@ -15,7 +15,7 @@ import EuroIcon from '@material-ui/icons/Euro' import ClientEditDialog from './ClientEditDialog' import LoadingProgress from './LoadingProgress' -import { selectCurrencySymbol } from '../scripts/selectors' +import { selectCurrencySymbol } from '../scripts/utilities' import { lightGrey } from '../styles/colors.scss' import { GET_CLIENT_INFO } from '../operations/queries/ClientQueries' diff --git a/src/components/ClientPaymentsManager.js b/src/components/ClientPaymentsManager.js index 3896be08..eb26954a 100644 --- a/src/components/ClientPaymentsManager.js +++ b/src/components/ClientPaymentsManager.js @@ -11,7 +11,7 @@ import AddIcon from '@material-ui/icons/Add' import { gql, useQuery } from '@apollo/client' import LoadingProgress from './LoadingProgress' -import { formatAmount, selectCurrencyInformation } from '../scripts/selectors' +import { formatAmount, selectCurrencyInformation } from '../scripts/utilities' import { GET_CLIENT_TOTAL_PAID } from '../operations/queries/ClientQueries' const ClientPaymentsManager = ({ diff --git a/src/components/ContributorInfoTile.js b/src/components/ContributorInfoTile.js index a7ce9d81..88596c53 100644 --- a/src/components/ContributorInfoTile.js +++ b/src/components/ContributorInfoTile.js @@ -22,7 +22,7 @@ import { GET_CONTRIBUTOR_INFO } from '../operations/queries/ContributorQueries' import { formatAmount, selectCurrencyInformation -} from '../scripts/selectors' +} from '../scripts/utilities' const ContributorInfoTile = (props) => { diff --git a/src/components/ContributorTile.js b/src/components/ContributorTile.js index 6a6b0f33..10b4912e 100644 --- a/src/components/ContributorTile.js +++ b/src/components/ContributorTile.js @@ -22,7 +22,7 @@ import { selectActiveAndUpcomingAllocations, selectCurrencyInformation, getExpectedHours -} from '../scripts/selectors' +} from '../scripts/utilities' const ContributorTile = (props) => { diff --git a/src/components/EditAllocationInfo.js b/src/components/EditAllocationInfo.js index a334ec9e..5292604a 100644 --- a/src/components/EditAllocationInfo.js +++ b/src/components/EditAllocationInfo.js @@ -19,7 +19,7 @@ import { isEqual } from 'lodash' -import { formatAmount, selectCurrencyInformation } from '../scripts/selectors' +import { formatAmount, selectCurrencyInformation } from '../scripts/utilities' const EditAllocationInfo = (props) => { diff --git a/src/components/Navigation.js b/src/components/Navigation.js index 9ef39490..b9150a75 100644 --- a/src/components/Navigation.js +++ b/src/components/Navigation.js @@ -12,7 +12,7 @@ import { split } from 'lodash' import { lightBlue } from '../styles/colors.scss' import { LOGO_URL, SMALL_LOGO_URL } from '../constants' -import { capitalizeWord, matchTitlePage } from '../scripts/selectors' +import { capitalizeWord, matchTitlePage } from '../scripts/utilities' import { pageName } from '../reactivities/variables' const Navigation = (props) => { diff --git a/src/components/PaymentEditDialog.js b/src/components/PaymentEditDialog.js index bbed57bd..054ec3b2 100644 --- a/src/components/PaymentEditDialog.js +++ b/src/components/PaymentEditDialog.js @@ -24,7 +24,7 @@ import LoadingProgress from './LoadingProgress' import { EDIT_PAYMENT } from '../operations/mutations/PaymentMutations' import { selectCurrencyInformation -} from '../scripts/selectors' +} from '../scripts/utilities' const PaymentEditDialog = (props) => { diff --git a/src/components/PaymentTile.js b/src/components/PaymentTile.js index 2bae9cde..28a8ce49 100644 --- a/src/components/PaymentTile.js +++ b/src/components/PaymentTile.js @@ -28,7 +28,7 @@ import { import { formatAmount, selectCurrencyInformation -} from '../scripts/selectors' +} from '../scripts/utilities' const PaymentTile = (props) => { diff --git a/src/components/PaymentsAddForm.js b/src/components/PaymentsAddForm.js index a0ef7e74..d3ad4e53 100644 --- a/src/components/PaymentsAddForm.js +++ b/src/components/PaymentsAddForm.js @@ -25,7 +25,7 @@ import { GET_CLIENT_PAYMENTS } from '../operations/queries/PaymentQueries' import { CREATE_PAYMENT } from '../operations/mutations/PaymentMutations' import { selectCurrencyInformation -} from '../scripts/selectors' +} from '../scripts/utilities' const PaymentsAddForm = (props) => { diff --git a/src/components/ProjectContributors.js b/src/components/ProjectContributors.js index 2f1a63a2..a20c1bb0 100644 --- a/src/components/ProjectContributors.js +++ b/src/components/ProjectContributors.js @@ -22,7 +22,7 @@ import { pageName } from '../reactivities/variables' import { getAllocatedContributors, getActiveAndUpcomingAllocations -} from '../scripts/selectors' +} from '../scripts/utilities' const ProjectContributors = (props) => { diff --git a/src/components/ProjectEditDialog.js b/src/components/ProjectEditDialog.js index 017a7906..72c6354d 100644 --- a/src/components/ProjectEditDialog.js +++ b/src/components/ProjectEditDialog.js @@ -30,12 +30,11 @@ import { selectCurrencyInformation, verifyGithubURL, verifyTogglURL -} from '../scripts/selectors' +} from '../scripts/utilities' import { SYNC_TOGGL_PROJECT, UPDATE_PROJECT } from '../operations/mutations/ProjectMutations' import { EXPECTED_BUDGET_TIMEFRAME_OPTIONS, MAX_INT } from '../constants' - const ProjectEditDialog = (props) => { const { diff --git a/src/components/ProjectPayments.js b/src/components/ProjectPayments.js index fd63bcb1..90c484ed 100644 --- a/src/components/ProjectPayments.js +++ b/src/components/ProjectPayments.js @@ -24,7 +24,7 @@ import { calculateTotalPayments, formatAmount, selectCurrencyInformation -} from '../scripts/selectors' +} from '../scripts/utilities' import { white } from '../styles/colors.scss' const ProjectPayments = (props) => { diff --git a/src/components/ProjectPaymentsSummary.js b/src/components/ProjectPaymentsSummary.js index 431310d9..500c5a0c 100644 --- a/src/components/ProjectPaymentsSummary.js +++ b/src/components/ProjectPaymentsSummary.js @@ -7,7 +7,7 @@ import { } from '@material-ui/core' import { GET_PROJECT_PAYMENTS_SUMMARY } from '../operations/queries/ProjectQueries' -import { formatAmount } from '../scripts/selectors' +import { formatAmount } from '../scripts/utilities' const ProjectPaymentsSummary = (props) => { diff --git a/src/components/ProjectProposedAllocationsTile.js b/src/components/ProjectProposedAllocationsTile.js index 8a7804da..ed83ecdf 100644 --- a/src/components/ProjectProposedAllocationsTile.js +++ b/src/components/ProjectProposedAllocationsTile.js @@ -13,7 +13,7 @@ import { import AllocationOverview from './AllocationOverview' import { GET_PROJECT_TOTAL_PROPOSED } from '../operations/queries/ProjectQueries' -import { formatAmount } from '../scripts/selectors' +import { formatAmount } from '../scripts/utilities' import moment from 'moment' import ExpandMoreIcon from '@material-ui/icons/ExpandMore' diff --git a/src/components/ProjectSummary.js b/src/components/ProjectSummary.js index f53afbff..aebd8d16 100644 --- a/src/components/ProjectSummary.js +++ b/src/components/ProjectSummary.js @@ -13,7 +13,7 @@ import { formatAmount, selectCurrencyInformation, selectCurrencySymbol -} from '../scripts/selectors' +} from '../scripts/utilities' import ProjectEditDialog from './ProjectEditDialog' const ProjectSummary = (props) => { diff --git a/src/components/RateMaxBudgetForm.js b/src/components/RateMaxBudgetForm.js index 2a383c4d..f71955a7 100644 --- a/src/components/RateMaxBudgetForm.js +++ b/src/components/RateMaxBudgetForm.js @@ -11,7 +11,7 @@ import { import CurrencyTextField from '@unicef/material-ui-currency-textfield' import { CURRENCIES } from '../constants' -import { selectCurrencyInformation } from '../scripts/selectors' +import { selectCurrencyInformation } from '../scripts/utilities' import { validatePositiveNumbers } from '../scripts/validation' const RateMaxBudgetForm = (props) => { diff --git a/src/components/RateProratedMonthlyForm.js b/src/components/RateProratedMonthlyForm.js index 120e7eae..161fa3d0 100644 --- a/src/components/RateProratedMonthlyForm.js +++ b/src/components/RateProratedMonthlyForm.js @@ -13,7 +13,7 @@ import { CURRENCIES } from '../constants' import { formatAmount, selectCurrencyInformation -} from '../scripts/selectors' +} from '../scripts/utilities' import { validatePositiveNumbers } from '../scripts/validation' const RateProratedMonthlyForm = (props) => { diff --git a/src/scripts/selectors.js b/src/scripts/utilities.js similarity index 100% rename from src/scripts/selectors.js rename to src/scripts/utilities.js