diff --git a/__tests__/pages/api/MpdxWebHandoff.test.ts b/__tests__/pages/api/MpdxWebHandoff.test.ts
index b194f80fa..9955b8db6 100644
--- a/__tests__/pages/api/MpdxWebHandoff.test.ts
+++ b/__tests__/pages/api/MpdxWebHandoff.test.ts
@@ -1,7 +1,7 @@
import { getToken } from 'next-auth/jwt';
import { createMocks } from 'node-mocks-http';
-import mpdxWebHandoff from '../../../pages/api/mpdx-web-handoff.page';
-import { taskFiltersTabs } from '../../../src/utils/tasks/taskFilterTabs';
+import mpdxWebHandoff from 'pages/api/mpdx-web-handoff.page';
+import { taskFiltersTabs } from 'src/utils/tasks/taskFilterTabs';
jest.mock('next-auth/jwt', () => ({ getToken: jest.fn() }));
diff --git a/__tests__/pages/api/handoff.test.ts b/__tests__/pages/api/handoff.test.ts
index 566e1a13b..cbbe7ee8f 100644
--- a/__tests__/pages/api/handoff.test.ts
+++ b/__tests__/pages/api/handoff.test.ts
@@ -1,7 +1,7 @@
import { getToken } from 'next-auth/jwt';
import { createMocks } from 'node-mocks-http';
+import handoff from 'pages/api/handoff.page';
import makeSsrClient from 'src/lib/apollo/ssrClient';
-import handoff from '../../../pages/api/handoff.page';
jest.mock('next-auth/jwt', () => ({ getToken: jest.fn() }));
jest.mock('src/lib/apollo/ssrClient', () => jest.fn());
diff --git a/__tests__/pages/api/stopImpersonating.test.ts b/__tests__/pages/api/stopImpersonating.test.ts
index 77948942b..f1c1e96f1 100644
--- a/__tests__/pages/api/stopImpersonating.test.ts
+++ b/__tests__/pages/api/stopImpersonating.test.ts
@@ -1,7 +1,7 @@
import { getToken } from 'next-auth/jwt';
import { createMocks } from 'node-mocks-http';
+import stopImpersonating from 'pages/api/stop-impersonating.page';
import makeSsrClient from 'src/lib/apollo/ssrClient';
-import stopImpersonating from '../../../pages/api/stop-impersonating.page';
jest.mock('next-auth/jwt', () => ({ getToken: jest.fn() }));
jest.mock('src/lib/apollo/ssrClient', () => jest.fn());
diff --git a/__tests__/util/testingLibraryReactMock.tsx b/__tests__/util/testingLibraryReactMock.tsx
index 51f462bb5..562e115c4 100644
--- a/__tests__/util/testingLibraryReactMock.tsx
+++ b/__tests__/util/testingLibraryReactMock.tsx
@@ -2,8 +2,8 @@
import React, { ReactElement } from 'react';
import { RenderOptions, RenderResult, render } from '@testing-library/react';
import { I18nextProvider } from 'react-i18next';
+import i18n from 'src/lib/i18n';
import translation from '../../public/locales/en/translation.json';
-import i18n from '../../src/lib/i18n';
i18n.addResourceBundle('en', 'translation', translation);
diff --git a/next.config.js b/next.config.js
index a85f22fea..cc1dacf82 100644
--- a/next.config.js
+++ b/next.config.js
@@ -100,6 +100,9 @@ const config = {
},
experimental: {
modularizeImports: {
+ lodash: {
+ transform: 'lodash/{{member}}',
+ },
'@mui/material': {
transform: '@mui/material/{{member}}',
},
diff --git a/pages/_app.page.tsx b/pages/_app.page.tsx
index 04cea5ab7..5e8c263a1 100644
--- a/pages/_app.page.tsx
+++ b/pages/_app.page.tsx
@@ -5,8 +5,7 @@ import React, { ReactElement, useMemo } from 'react';
import { ApolloProvider as RawApolloProvider } from '@apollo/client';
import createEmotionCache from '@emotion/cache';
import { CacheProvider } from '@emotion/react';
-import { Box } from '@mui/material';
-import StyledEngineProvider from '@mui/material/StyledEngineProvider';
+import { Box, StyledEngineProvider } from '@mui/material';
import { ThemeProvider } from '@mui/material/styles';
import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon';
import {
@@ -14,7 +13,6 @@ import {
LocalizationProvider as RawLocalizationProvider,
} from '@mui/x-date-pickers/LocalizationProvider';
import { ErrorBoundary, Provider } from '@rollbar/react';
-import { AnimatePresence } from 'framer-motion';
import { DateTime } from 'luxon';
import { Session } from 'next-auth';
import { SessionProvider } from 'next-auth/react';
@@ -40,12 +38,6 @@ import theme from 'src/theme';
import './helpscout.css';
import './print.css';
-const handleExitComplete = (): void => {
- if (typeof window !== 'undefined') {
- window.scrollTo({ top: 0 });
- }
-};
-
export type PageWithLayout = NextPage & {
layout?: React.FC;
};
@@ -139,6 +131,11 @@ const App = ({
/>
+
-
- {/* On the login page and error pages, the user isn't not authenticated and doesn't have an API token,
- so don't include the session or Apollo providers because they require an API token */}
- {nonAuthenticatedPages.has(router.pathname) ? (
- pageContent
- ) : (
-
-
- {pageContent}
-
-
- )}
-
+ {/* On the login page and error pages, the user isn't not authenticated and doesn't have an API token,
+ so don't include the session or Apollo providers because they require an API token */}
+ {nonAuthenticatedPages.has(router.pathname) ? (
+ pageContent
+ ) : (
+
+ {pageContent}
+
+ )}
diff --git a/pages/_document.page.tsx b/pages/_document.page.tsx
index 85c8cf22e..5882bf865 100644
--- a/pages/_document.page.tsx
+++ b/pages/_document.page.tsx
@@ -10,7 +10,7 @@ import Document, {
import Script from 'next/script';
import React, { ReactElement } from 'react';
import { ServerStyleSheets } from '@mui/styles';
-import theme from '../src/theme';
+import theme from 'src/theme';
class MyDocument extends Document {
render(): ReactElement {
diff --git a/pages/accountLists.page.tsx b/pages/accountLists.page.tsx
index a0087d941..070a75e50 100644
--- a/pages/accountLists.page.tsx
+++ b/pages/accountLists.page.tsx
@@ -5,10 +5,10 @@ import { Session } from 'next-auth';
import { getSession } from 'next-auth/react';
import { useTranslation } from 'react-i18next';
import { logErrorOnRollbar } from 'pages/api/utils/rollBar';
+import AccountLists from 'src/components/AccountLists';
+import BaseLayout from 'src/components/Layouts/Primary';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
import makeSsrClient from 'src/lib/apollo/ssrClient';
-import AccountLists from '../src/components/AccountLists';
-import BaseLayout from '../src/components/Layouts/Primary';
import {
GetAccountListsDocument,
GetAccountListsQuery,
diff --git a/pages/accountLists/[accountListId].page.tsx b/pages/accountLists/[accountListId].page.tsx
index 03a1974d6..5b0a6d93c 100644
--- a/pages/accountLists/[accountListId].page.tsx
+++ b/pages/accountLists/[accountListId].page.tsx
@@ -4,15 +4,15 @@ import React, { ReactElement, useEffect, useState } from 'react';
import { Session } from 'next-auth';
import { getSession } from 'next-auth/react';
import { logErrorOnRollbar } from 'pages/api/utils/rollBar';
+import Dashboard from 'src/components/Dashboard';
import {
AddMenuItemsEnum,
renderDialog,
} from 'src/components/Layouts/Primary/TopBar/Items/AddMenu/AddMenu';
+import useGetAppSettings from 'src/hooks/useGetAppSettings';
+import useTaskModal from 'src/hooks/useTaskModal';
import makeSsrClient from 'src/lib/apollo/ssrClient';
import { suggestArticles } from 'src/lib/helpScout';
-import Dashboard from '../../src/components/Dashboard';
-import useGetAppSettings from '../../src/hooks/useGetAppSettings';
-import useTaskModal from '../../src/hooks/useTaskModal';
import {
GetDashboardDocument,
GetDashboardQuery,
diff --git a/pages/accountLists/[accountListId]/contacts/ContactsPage.test.tsx b/pages/accountLists/[accountListId]/contacts/ContactsWrapper.test.tsx
similarity index 93%
rename from pages/accountLists/[accountListId]/contacts/ContactsPage.test.tsx
rename to pages/accountLists/[accountListId]/contacts/ContactsWrapper.test.tsx
index 7b55b4b75..7ecd289f9 100644
--- a/pages/accountLists/[accountListId]/contacts/ContactsPage.test.tsx
+++ b/pages/accountLists/[accountListId]/contacts/ContactsWrapper.test.tsx
@@ -5,6 +5,11 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { render, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import {
+ ContactsContext,
+ ContactsType,
+} from 'src/components/Contacts/ContactsContext/ContactsContext';
import { FilterPanel } from 'src/components/Shared/Filters/FilterPanel';
import {
filterPanelDefaultMock,
@@ -14,9 +19,7 @@ import {
} from 'src/components/Shared/Filters/FilterPanel.mocks';
import { ContactFilterStatusEnum } from 'src/graphql/types.generated';
import theme from 'src/theme';
-import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
-import { ContactsContext, ContactsType } from './ContactsContext';
-import { ContactsPage } from './ContactsPage';
+import { ContactsWrapper } from './ContactsWrapper';
const onSelectedFiltersChanged = jest.fn();
const onClose = jest.fn();
@@ -34,7 +37,7 @@ jest.mock('notistack', () => ({
},
}));
-describe('Contacts', () => {
+describe('ContactsWrapper', () => {
it('opens and selects a saved filter X2', async () => {
const routeReplace = jest.fn();
const router = {
@@ -58,7 +61,7 @@ describe('Contacts', () => {
-
+
{
onClose={onClose}
onSelectedFiltersChanged={onSelectedFiltersChanged}
/>
-
+
@@ -144,9 +147,9 @@ describe('Contacts', () => {
-
+
-
+
diff --git a/pages/accountLists/[accountListId]/contacts/ContactsPage.tsx b/pages/accountLists/[accountListId]/contacts/ContactsWrapper.tsx
similarity index 92%
rename from pages/accountLists/[accountListId]/contacts/ContactsPage.tsx
rename to pages/accountLists/[accountListId]/contacts/ContactsWrapper.tsx
index 033e8b7fc..729776471 100644
--- a/pages/accountLists/[accountListId]/contacts/ContactsPage.tsx
+++ b/pages/accountLists/[accountListId]/contacts/ContactsWrapper.tsx
@@ -1,15 +1,15 @@
import { useRouter } from 'next/router';
import React, { useEffect, useMemo, useState } from 'react';
-import _ from 'lodash';
+import { ContactsProvider } from 'src/components/Contacts/ContactsContext/ContactsContext';
import { ContactFilterSetInput } from 'src/graphql/types.generated';
import { suggestArticles } from 'src/lib/helpScout';
import { sanitizeFilters } from 'src/lib/sanitizeFilters';
-import { ContactsProvider } from './ContactsContext';
interface Props {
children?: React.ReactNode;
}
-export const ContactsPage: React.FC = ({ children }) => {
+
+export const ContactsWrapper: React.FC = ({ children }) => {
const router = useRouter();
const { query, replace, pathname, isReady } = router;
diff --git a/pages/accountLists/[accountListId]/contacts/[[...contactId]].page.tsx b/pages/accountLists/[accountListId]/contacts/[[...contactId]].page.tsx
index a8c7aaa99..cbe165cb5 100644
--- a/pages/accountLists/[accountListId]/contacts/[[...contactId]].page.tsx
+++ b/pages/accountLists/[accountListId]/contacts/[[...contactId]].page.tsx
@@ -1,17 +1,81 @@
-import React from 'react';
-import _ from 'lodash';
+import Head from 'next/head';
+import React, { useContext } from 'react';
+import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
-import { ContactsContainer } from 'src/components/Contacts/ContactsContainer';
-import { ContactsPage } from './ContactsPage';
+import {
+ ContactsContext,
+ ContactsType,
+} from 'src/components/Contacts/ContactsContext/ContactsContext';
+import { ContactsLeftPanel } from 'src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel';
+import { ContactsMainPanel } from 'src/components/Contacts/ContactsMainPanel/ContactsMainPanel';
+import { DynamicContactsRightPanel } from 'src/components/Contacts/ContactsRightPanel/DynamicContactsRightPanel';
+import { SidePanelsLayout } from 'src/components/Layouts/SidePanelsLayout';
+import Loading from 'src/components/Loading';
+import {
+ TableViewModeEnum,
+ headerHeight,
+} from 'src/components/Shared/Header/ListHeader';
+import useGetAppSettings from 'src/hooks/useGetAppSettings';
+import { ContactsWrapper } from './ContactsWrapper';
+
+const Contacts: React.FC = ({}) => {
+ const { t } = useTranslation();
+ const {
+ accountListId,
+ filterPanelOpen,
+ contactDetailsOpen,
+ viewMode,
+ setContactFocus,
+ } = useContext(ContactsContext) as ContactsType;
+ const { appName } = useGetAppSettings();
-const Contacts: React.FC = () => {
return (
-
-
-
+ <>
+
+
+ {appName} |{' '}
+ {viewMode === TableViewModeEnum.Flows
+ ? t('Contact Flows')
+ : viewMode === TableViewModeEnum.Map
+ ? t('Contacts Map')
+ : t('Contacts')}
+
+
+ {accountListId ? (
+ }
+ leftOpen={filterPanelOpen}
+ leftWidth="290px"
+ mainContent={}
+ rightPanel={
+
+ setContactFocus(
+ undefined,
+ true,
+ viewMode === TableViewModeEnum.Flows,
+ viewMode === TableViewModeEnum.Map,
+ )
+ }
+ />
+ }
+ rightOpen={contactDetailsOpen}
+ rightWidth="60%"
+ headerHeight={headerHeight}
+ />
+ ) : (
+
+ )}
+ >
);
};
-export const getServerSideProps = loadSession;
+const ContactsPage: React.FC = () => (
+
+
+
+);
-export default Contacts;
+export default ContactsPage;
+
+export const getServerSideProps = loadSession;
diff --git a/pages/accountLists/[accountListId]/contacts/[[...contactId]].stories.tsx b/pages/accountLists/[accountListId]/contacts/[[...contactId]].stories.tsx
new file mode 100644
index 000000000..4fe5bf11e
--- /dev/null
+++ b/pages/accountLists/[accountListId]/contacts/[[...contactId]].stories.tsx
@@ -0,0 +1,15 @@
+import React, { ReactElement } from 'react';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import ContactsPage from './[[...contactId]].page';
+
+export default {
+ title: 'Contacts/Page',
+};
+
+export const Default = (): ReactElement => {
+ return (
+
+
+
+ );
+};
diff --git a/pages/accountLists/[accountListId]/contacts/contacts.test.tsx b/pages/accountLists/[accountListId]/contacts/contacts.test.tsx
index 22169c9a2..18b437d3f 100644
--- a/pages/accountLists/[accountListId]/contacts/contacts.test.tsx
+++ b/pages/accountLists/[accountListId]/contacts/contacts.test.tsx
@@ -3,16 +3,16 @@ import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { VirtuosoMockContext } from 'react-virtuoso';
+import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ListHeaderCheckBoxState } from 'src/components/Shared/Header/ListHeader';
import {
PledgeFrequencyEnum,
SendNewsletterEnum,
StatusEnum,
} from 'src/graphql/types.generated';
-import TestRouter from '../../../../__tests__/util/TestRouter';
-import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
-import { ListHeaderCheckBoxState } from '../../../../src/components/Shared/Header/ListHeader';
-import { useMassSelection } from '../../../../src/hooks/useMassSelection';
-import theme from '../../../../src/theme';
+import { useMassSelection } from 'src/hooks/useMassSelection';
+import theme from 'src/theme';
import { ContactsQuery } from './Contacts.generated';
import Contacts from './[[...contactId]].page';
@@ -51,7 +51,7 @@ const mockResponse = {
},
};
-jest.mock('../../../../src/hooks/useMassSelection');
+jest.mock('src/hooks/useMassSelection');
(useMassSelection as jest.Mock).mockReturnValue({
ids: [],
diff --git a/pages/accountLists/[accountListId]/contacts/flows/setup.page.tsx b/pages/accountLists/[accountListId]/contacts/flows/setup.page.tsx
index 2195b0cca..6fd629a8f 100644
--- a/pages/accountLists/[accountListId]/contacts/flows/setup.page.tsx
+++ b/pages/accountLists/[accountListId]/contacts/flows/setup.page.tsx
@@ -1,34 +1,34 @@
import Head from 'next/head';
import React, { useCallback, useEffect, useState } from 'react';
-import Box from '@mui/material/Box';
+import { Box } from '@mui/material';
import { styled } from '@mui/material/styles';
-import _ from 'lodash';
+import { isEqual } from 'lodash';
import { useSnackbar } from 'notistack';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import { useTranslation } from 'react-i18next';
import { v4 as uuidv4 } from 'uuid';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
-import { ContactFilterStatusEnum } from 'src/graphql/types.generated';
-import theme from 'src/theme';
import {
ContactFlowOption,
colorMap,
statusMap,
-} from '../../../../../src/components/Contacts/ContactFlow/ContactFlow';
-import { ContactFlowSetupColumn } from '../../../../../src/components/Contacts/ContactFlow/ContactFlowSetup/Column/ContactFlowSetupColumn';
-import { UnusedStatusesColumn } from '../../../../../src/components/Contacts/ContactFlow/ContactFlowSetup/Column/UnusedStatusesColumn';
-import { ContactFlowSetupDragLayer } from '../../../../../src/components/Contacts/ContactFlow/ContactFlowSetup/DragLayer/ContactFlowSetupDragLayer';
-import { ContactFlowSetupHeader } from '../../../../../src/components/Contacts/ContactFlow/ContactFlowSetup/Header/ContactFlowSetupHeader';
-import { useUpdateUserOptionsMutation } from '../../../../../src/components/Contacts/ContactFlow/ContactFlowSetup/UpdateUserOptions.generated';
+} from 'src/components/Contacts/ContactFlow/ContactFlow';
+import { ContactFlowSetupColumn } from 'src/components/Contacts/ContactFlow/ContactFlowSetup/Column/ContactFlowSetupColumn';
+import { UnusedStatusesColumn } from 'src/components/Contacts/ContactFlow/ContactFlowSetup/Column/UnusedStatusesColumn';
+import { ContactFlowSetupDragLayer } from 'src/components/Contacts/ContactFlow/ContactFlowSetup/DragLayer/ContactFlowSetupDragLayer';
+import { ContactFlowSetupHeader } from 'src/components/Contacts/ContactFlow/ContactFlowSetup/Header/ContactFlowSetupHeader';
+import { useUpdateUserOptionsMutation } from 'src/components/Contacts/ContactFlow/ContactFlowSetup/UpdateUserOptions.generated';
import {
GetUserOptionsDocument,
GetUserOptionsQuery,
useGetUserOptionsQuery,
-} from '../../../../../src/components/Contacts/ContactFlow/GetUserOptions.generated';
-import Loading from '../../../../../src/components/Loading';
-import { useAccountListId } from '../../../../../src/hooks/useAccountListId';
-import useGetAppSettings from '../../../../../src/hooks/useGetAppSettings';
+} from 'src/components/Contacts/ContactFlow/GetUserOptions.generated';
+import Loading from 'src/components/Loading';
+import { ContactFilterStatusEnum } from 'src/graphql/types.generated';
+import { useAccountListId } from 'src/hooks/useAccountListId';
+import useGetAppSettings from 'src/hooks/useGetAppSettings';
+import theme from 'src/theme';
const StickyBox = styled(Box)(() => ({
['@media (min-width:900px)']: {
@@ -180,7 +180,7 @@ const ContactFlowSetupPage: React.FC = () => {
const originalOptions = userOptions?.userOptions.find(
(option) => option.key === 'flows',
)?.value;
- if (!_.isEqual(originalOptions, flowOptions)) {
+ if (!isEqual(originalOptions, flowOptions)) {
updateOptions(flowOptions);
}
};
diff --git a/pages/accountLists/[accountListId]/contacts/helpers.ts b/pages/accountLists/[accountListId]/contacts/helpers.ts
index 2414e0e90..acf908b08 100644
--- a/pages/accountLists/[accountListId]/contacts/helpers.ts
+++ b/pages/accountLists/[accountListId]/contacts/helpers.ts
@@ -1,8 +1,8 @@
import { DateTime } from 'luxon';
+import { Coordinates } from 'src/components/Contacts/ContactsMap/coordinates';
import { TableViewModeEnum } from 'src/components/Shared/Header/ListHeader';
-import { dateFormatShort } from 'src/lib/intlFormat/intlFormat';
+import { dateFormatShort } from 'src/lib/intlFormat';
import { ContactsQuery } from './Contacts.generated';
-import { Coordinates } from './map/map';
export const getRedirectPathname = ({
routerPathname,
@@ -63,7 +63,7 @@ export const coordinatesFromContacts = (
contacts: ContactsQuery['contacts'],
locale: string,
): Coordinates[] =>
- contacts.nodes.map((contact): Coordinates => {
+ contacts.nodes.map((contact) => {
const address = contact.primaryAddress;
if (!address?.geo) {
return {
diff --git a/pages/accountLists/[accountListId]/reports/coaching.page.tsx b/pages/accountLists/[accountListId]/reports/coaching.page.tsx
index 191364333..7b0fa12f8 100644
--- a/pages/accountLists/[accountListId]/reports/coaching.page.tsx
+++ b/pages/accountLists/[accountListId]/reports/coaching.page.tsx
@@ -6,10 +6,10 @@ import {
AccountListTypeEnum,
CoachingDetail,
} from 'src/components/Coaching/CoachingDetail/CoachingDetail';
+import Loading from 'src/components/Loading';
+import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
import { suggestArticles } from 'src/lib/helpScout';
-import Loading from '../../../../src/components/Loading';
-import { useAccountListId } from '../../../../src/hooks/useAccountListId';
const CoachingReportPage = (): ReactElement => {
const { t } = useTranslation();
diff --git a/pages/accountLists/[accountListId]/reports/designationAccounts.page.tsx b/pages/accountLists/[accountListId]/reports/designationAccounts.page.tsx
index 370759f2d..df3626875 100644
--- a/pages/accountLists/[accountListId]/reports/designationAccounts.page.tsx
+++ b/pages/accountLists/[accountListId]/reports/designationAccounts.page.tsx
@@ -1,6 +1,6 @@
import Head from 'next/head';
import React, { useEffect, useState } from 'react';
-import Box from '@mui/material/Box';
+import { Box } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
diff --git a/pages/accountLists/[accountListId]/reports/donations/[[...contactId]].page.tsx b/pages/accountLists/[accountListId]/reports/donations/[[...contactId]].page.tsx
index 5706db243..20945c7fc 100644
--- a/pages/accountLists/[accountListId]/reports/donations/[[...contactId]].page.tsx
+++ b/pages/accountLists/[accountListId]/reports/donations/[[...contactId]].page.tsx
@@ -1,11 +1,11 @@
import Head from 'next/head';
import { useRouter } from 'next/router';
import React, { useEffect, useState } from 'react';
-import Box from '@mui/material/Box';
+import { Box } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
-import { ContactsRightPanel } from 'src/components/Contacts/ContactsRightPanel/ContactsRightPanel';
+import { DynamicContactsRightPanel } from 'src/components/Contacts/ContactsRightPanel/DynamicContactsRightPanel';
import { SidePanelsLayout } from 'src/components/Layouts/SidePanelsLayout';
import Loading from 'src/components/Loading';
import { DonationsReport } from 'src/components/Reports/DonationsReport/DonationsReport';
@@ -17,7 +17,7 @@ import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
import { suggestArticles } from 'src/lib/helpScout';
import { getQueryParam } from 'src/utils/queryParam';
-import { ContactsPage } from '../../contacts/ContactsPage';
+import { ContactsWrapper } from '../../contacts/ContactsWrapper';
const DonationsReportPageWrapper = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.common.white,
@@ -82,9 +82,11 @@ const DonationsReportPage: React.FC = () => {
}
rightPanel={
selectedContactId ? (
-
- handleSelectContact('')} />
-
+
+ handleSelectContact('')}
+ />
+
) : undefined
}
rightOpen={typeof selectedContactId !== 'undefined'}
diff --git a/pages/accountLists/[accountListId]/reports/partnerCurrency/[[...contactId]].page.test.tsx b/pages/accountLists/[accountListId]/reports/partnerCurrency/[[...contactId]].page.test.tsx
index 62a5d8da4..2582589f2 100644
--- a/pages/accountLists/[accountListId]/reports/partnerCurrency/[[...contactId]].page.test.tsx
+++ b/pages/accountLists/[accountListId]/reports/partnerCurrency/[[...contactId]].page.test.tsx
@@ -66,12 +66,12 @@ describe('partnerCurrency page', () => {
).toBeInTheDocument();
});
- it('renders contact panel', () => {
- const { getByRole } = render(
+ it('renders contact panel', async () => {
+ const { findByRole } = render(
,
);
- expect(getByRole('tab', { name: 'Tasks' })).toBeInTheDocument();
+ expect(await findByRole('tab', { name: 'Tasks' })).toBeInTheDocument();
});
it('toggles filter panel', async () => {
diff --git a/pages/accountLists/[accountListId]/reports/partnerCurrency/[[...contactId]].page.tsx b/pages/accountLists/[accountListId]/reports/partnerCurrency/[[...contactId]].page.tsx
index c9d81e530..277ee217f 100644
--- a/pages/accountLists/[accountListId]/reports/partnerCurrency/[[...contactId]].page.tsx
+++ b/pages/accountLists/[accountListId]/reports/partnerCurrency/[[...contactId]].page.tsx
@@ -1,11 +1,11 @@
import Head from 'next/head';
import { useRouter } from 'next/router';
import React, { useEffect, useState } from 'react';
-import Box from '@mui/material/Box';
+import { Box } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
-import { ContactsRightPanel } from 'src/components/Contacts/ContactsRightPanel/ContactsRightPanel';
+import { DynamicContactsRightPanel } from 'src/components/Contacts/ContactsRightPanel/DynamicContactsRightPanel';
import { SidePanelsLayout } from 'src/components/Layouts/SidePanelsLayout';
import Loading from 'src/components/Loading';
import { FourteenMonthReport } from 'src/components/Reports/FourteenMonthReports/FourteenMonthReport';
@@ -18,7 +18,7 @@ import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
import { suggestArticles } from 'src/lib/helpScout';
import { getQueryParam } from 'src/utils/queryParam';
-import { ContactsPage } from '../../contacts/ContactsPage';
+import { ContactsWrapper } from '../../contacts/ContactsWrapper';
const PartnerCurrencyReportPageWrapper = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.common.white,
@@ -83,9 +83,11 @@ const PartnerCurrencyReportPage: React.FC = () => {
}
rightPanel={
selectedContactId ? (
-
- handleSelectContact('')} />
-
+
+ handleSelectContact('')}
+ />
+
) : undefined
}
rightOpen={typeof selectedContactId !== 'undefined'}
diff --git a/pages/accountLists/[accountListId]/reports/partnerGivingAnalysis/[[...contactId]].page.test.tsx b/pages/accountLists/[accountListId]/reports/partnerGivingAnalysis/[[...contactId]].page.test.tsx
index fd91ef2af..0907ff862 100644
--- a/pages/accountLists/[accountListId]/reports/partnerGivingAnalysis/[[...contactId]].page.test.tsx
+++ b/pages/accountLists/[accountListId]/reports/partnerGivingAnalysis/[[...contactId]].page.test.tsx
@@ -5,10 +5,10 @@ import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
import TestRouter from '__tests__/util/TestRouter';
import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactsProvider } from 'src/components/Contacts/ContactsContext/ContactsContext';
import { GetPartnerGivingAnalysisReportQuery } from 'src/components/Reports/PartnerGivingAnalysisReport/PartnerGivingAnalysisReport.generated';
import theme from 'src/theme';
import { ContactFiltersQuery } from '../../contacts/Contacts.generated';
-import { ContactsProvider } from '../../contacts/ContactsContext';
import PartnerGivingAnalysisPage from './[[...contactId]].page';
const push = jest.fn();
@@ -108,12 +108,12 @@ describe('partnerGivingAnalysis page', () => {
).toBeInTheDocument();
});
- it('renders contact panel', () => {
- const { getByRole } = render(
+ it('renders contact panel', async () => {
+ const { findByRole } = render(
,
);
- expect(getByRole('tab', { name: 'Tasks' })).toBeInTheDocument();
+ expect(await findByRole('tab', { name: 'Tasks' })).toBeInTheDocument();
});
it('renders navigation panel', () => {
diff --git a/pages/accountLists/[accountListId]/reports/partnerGivingAnalysis/[[...contactId]].page.tsx b/pages/accountLists/[accountListId]/reports/partnerGivingAnalysis/[[...contactId]].page.tsx
index 15aeb37b0..bbdd7426b 100644
--- a/pages/accountLists/[accountListId]/reports/partnerGivingAnalysis/[[...contactId]].page.tsx
+++ b/pages/accountLists/[accountListId]/reports/partnerGivingAnalysis/[[...contactId]].page.tsx
@@ -5,7 +5,8 @@ import { sortBy } from 'lodash';
import { useTranslation } from 'react-i18next';
import { ReportContactFilterSetInput } from 'pages/api/graphql-rest.page.generated';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
-import { ContactsRightPanel } from 'src/components/Contacts/ContactsRightPanel/ContactsRightPanel';
+import { ContactsProvider } from 'src/components/Contacts/ContactsContext/ContactsContext';
+import { DynamicContactsRightPanel } from 'src/components/Contacts/ContactsRightPanel/DynamicContactsRightPanel';
import { SidePanelsLayout } from 'src/components/Layouts/SidePanelsLayout';
import Loading from 'src/components/Loading';
import {
@@ -13,7 +14,7 @@ import {
PartnerGivingAnalysisReport,
PartnerGivingAnalysisReportRef,
} from 'src/components/Reports/PartnerGivingAnalysisReport/PartnerGivingAnalysisReport';
-import { FilterPanel } from 'src/components/Shared/Filters/FilterPanel';
+import { DynamicFilterPanel } from 'src/components/Shared/Filters/DynamicFilterPanel';
import {
MultiPageMenu,
NavTypeEnum,
@@ -24,8 +25,7 @@ import useGetAppSettings from 'src/hooks/useGetAppSettings';
import { suggestArticles } from 'src/lib/helpScout';
import { getQueryParam } from 'src/utils/queryParam';
import { useContactFiltersQuery } from '../../contacts/Contacts.generated';
-import { ContactsProvider } from '../../contacts/ContactsContext';
-import { ContactsPage } from '../../contacts/ContactsPage';
+import { ContactsWrapper } from '../../contacts/ContactsWrapper';
// The order here is also the sort order and the display order
const reportFilters = [
@@ -134,7 +134,7 @@ const PartnerGivingAnalysisReportPage: React.FC = () => {
contactId={[]}
searchTerm={''}
>
- {
}
rightPanel={
selectedContactId ? (
-
- handleSelectContact('')} />
-
+
+ handleSelectContact('')}
+ />
+
) : undefined
}
rightOpen={typeof selectedContactId !== 'undefined'}
diff --git a/pages/accountLists/[accountListId]/reports/responsibilityCenters.page.tsx b/pages/accountLists/[accountListId]/reports/responsibilityCenters.page.tsx
index d9d219a9e..0eba1be51 100644
--- a/pages/accountLists/[accountListId]/reports/responsibilityCenters.page.tsx
+++ b/pages/accountLists/[accountListId]/reports/responsibilityCenters.page.tsx
@@ -1,6 +1,6 @@
import Head from 'next/head';
import React, { useEffect, useState } from 'react';
-import Box from '@mui/material/Box';
+import { Box } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
diff --git a/pages/accountLists/[accountListId]/reports/salaryCurrency/[[...contactId]].page.test.tsx b/pages/accountLists/[accountListId]/reports/salaryCurrency/[[...contactId]].page.test.tsx
index 3932bdc76..c202f718e 100644
--- a/pages/accountLists/[accountListId]/reports/salaryCurrency/[[...contactId]].page.test.tsx
+++ b/pages/accountLists/[accountListId]/reports/salaryCurrency/[[...contactId]].page.test.tsx
@@ -66,12 +66,12 @@ describe('salaryCurrency page', () => {
).toBeInTheDocument();
});
- it('renders contact panel', () => {
- const { getByRole } = render(
+ it('renders contact panel', async () => {
+ const { findByRole } = render(
,
);
- expect(getByRole('tab', { name: 'Tasks' })).toBeInTheDocument();
+ expect(await findByRole('tab', { name: 'Tasks' })).toBeInTheDocument();
});
it('toggles filter panel', async () => {
diff --git a/pages/accountLists/[accountListId]/reports/salaryCurrency/[[...contactId]].page.tsx b/pages/accountLists/[accountListId]/reports/salaryCurrency/[[...contactId]].page.tsx
index 0fae84254..b143d37ac 100644
--- a/pages/accountLists/[accountListId]/reports/salaryCurrency/[[...contactId]].page.tsx
+++ b/pages/accountLists/[accountListId]/reports/salaryCurrency/[[...contactId]].page.tsx
@@ -1,11 +1,11 @@
import Head from 'next/head';
import { useRouter } from 'next/router';
import React, { useEffect, useState } from 'react';
-import Box from '@mui/material/Box';
+import { Box } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
-import { ContactsRightPanel } from 'src/components/Contacts/ContactsRightPanel/ContactsRightPanel';
+import { DynamicContactsRightPanel } from 'src/components/Contacts/ContactsRightPanel/DynamicContactsRightPanel';
import { SidePanelsLayout } from 'src/components/Layouts/SidePanelsLayout';
import Loading from 'src/components/Loading';
import { FourteenMonthReport } from 'src/components/Reports/FourteenMonthReports/FourteenMonthReport';
@@ -18,7 +18,7 @@ import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
import { suggestArticles } from 'src/lib/helpScout';
import { getQueryParam } from 'src/utils/queryParam';
-import { ContactsPage } from '../../contacts/ContactsPage';
+import { ContactsWrapper } from '../../contacts/ContactsWrapper';
const SalaryCurrencyReportPageWrapper = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.common.white,
@@ -83,9 +83,11 @@ const SalaryCurrencyReportPage: React.FC = () => {
}
rightPanel={
selectedContactId ? (
-
- handleSelectContact('')} />
-
+
+ handleSelectContact('')}
+ />
+
) : undefined
}
rightOpen={typeof selectedContactId !== 'undefined'}
diff --git a/pages/accountLists/[accountListId]/settings/preferences.page.test.tsx b/pages/accountLists/[accountListId]/settings/preferences.page.test.tsx
index 06242311f..70c3d0ad5 100644
--- a/pages/accountLists/[accountListId]/settings/preferences.page.test.tsx
+++ b/pages/accountLists/[accountListId]/settings/preferences.page.test.tsx
@@ -1,9 +1,9 @@
import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
-import TestRouter from '../../../../__tests__/util/TestRouter';
-import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
-import theme from '../../../../src/theme';
+import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import theme from 'src/theme';
import Preferences from './preferences.page';
const accountListId = 'account-list-1';
diff --git a/pages/accountLists/[accountListId]/tasks/Tasks.test.tsx b/pages/accountLists/[accountListId]/tasks/Tasks.test.tsx
index 7e16d11a3..3a4e75833 100644
--- a/pages/accountLists/[accountListId]/tasks/Tasks.test.tsx
+++ b/pages/accountLists/[accountListId]/tasks/Tasks.test.tsx
@@ -3,11 +3,11 @@ import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { VirtuosoMockContext } from 'react-virtuoso';
+import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import useTaskModal from 'src/hooks/useTaskModal';
import { dispatch } from 'src/lib/analytics';
-import TestRouter from '../../../../__tests__/util/TestRouter';
-import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
-import useTaskModal from '../../../../src/hooks/useTaskModal';
-import theme from '../../../../src/theme';
+import theme from 'src/theme';
import { TasksQuery } from './Tasks.generated';
import Tasks from './[[...contactId]].page';
@@ -24,13 +24,14 @@ const task = {
contacts: { nodes: [{ id: '2', name: 'Test Person' }] },
};
-jest.mock('../../../../src/hooks/useTaskModal');
+jest.mock('src/hooks/useTaskModal');
const openTaskModal = jest.fn();
beforeEach(() => {
(useTaskModal as jest.Mock).mockReturnValue({
openTaskModal,
+ preloadTaskModal: jest.fn(),
});
});
@@ -72,59 +73,60 @@ const MocksProviders = (props: { children: JSX.Element }) => (
);
-it('should render list of tasks', async () => {
- const { getByText } = render(
-
-
- ,
- );
- await waitFor(() => expect(getByText('Test Person')).toBeInTheDocument());
- await waitFor(() => expect(getByText('Test Subject')).toBeInTheDocument());
-});
+describe('tasks page', () => {
+ it('should render list of tasks', async () => {
+ const { getByText } = render(
+
+
+ ,
+ );
+ await waitFor(() => expect(getByText('Test Person')).toBeInTheDocument());
+ await waitFor(() => expect(getByText('Test Subject')).toBeInTheDocument());
+ });
-it('should render contact detail panel', async () => {
- const { findAllByRole, getByText } = render(
-
-
- ,
- );
- await waitFor(() => expect(getByText('Test Subject')).toBeInTheDocument());
- const row = getByText('Test Person');
+ it('should render contact detail panel', async () => {
+ const { findAllByRole, getByText } = render(
+
+
+ ,
+ );
+ await waitFor(() => expect(getByText('Test Subject')).toBeInTheDocument());
+ const row = getByText('Test Person');
- userEvent.click(row);
+ userEvent.click(row);
- const detailsTabList = (await findAllByRole('tablist'))[0];
+ const detailsTabList = (await findAllByRole('tablist'))[0];
- expect(detailsTabList).toBeInTheDocument();
-});
+ expect(detailsTabList).toBeInTheDocument();
+ });
-it('should open add task panel', async () => {
- const { getByText } = render(
-
-
- ,
- );
- await waitFor(() => expect(getByText('Test Person')).toBeInTheDocument());
- await waitFor(() => expect(getByText('Test Subject')).toBeInTheDocument());
- userEvent.click(getByText('Add Task'));
- await waitFor(() => expect(openTaskModal).toHaveBeenCalled());
-});
+ it('should open add task panel', async () => {
+ const { getByText } = render(
+
+
+ ,
+ );
+ await waitFor(() => expect(getByText('Test Person')).toBeInTheDocument());
+ await waitFor(() => expect(getByText('Test Subject')).toBeInTheDocument());
+ userEvent.click(getByText('Add Task'));
+ await waitFor(() => expect(openTaskModal).toHaveBeenCalled());
+ });
-it('should show Completed', async () => {
- const { getByText } = render(
-
-
- ,
- );
-
- await waitFor(() => expect(getByText('Completed')).toBeInTheDocument());
- await waitFor(() => expect(getByText('Overdue')).toBeInTheDocument());
- await waitFor(() => expect(getByText('Today')).toBeInTheDocument());
- userEvent.click(getByText('Completed'));
- userEvent.click(getByText('Overdue'));
- userEvent.click(getByText('Today'));
- await waitFor(() =>
- expect(router).toMatchInlineSnapshot(`
+ it('should show Completed', async () => {
+ const { getByText } = render(
+
+
+ ,
+ );
+
+ await waitFor(() => expect(getByText('Completed')).toBeInTheDocument());
+ await waitFor(() => expect(getByText('Overdue')).toBeInTheDocument());
+ await waitFor(() => expect(getByText('Today')).toBeInTheDocument());
+ userEvent.click(getByText('Completed'));
+ userEvent.click(getByText('Overdue'));
+ userEvent.click(getByText('Today'));
+ await waitFor(() =>
+ expect(router).toMatchInlineSnapshot(`
Object {
"isReady": true,
"query": Object {
@@ -132,64 +134,65 @@ it('should show Completed', async () => {
},
}
`),
- );
-});
+ );
+ });
-it('should dispatch one analytics event per task', async () => {
- const { getAllByTestId, getByRole } = render(
-
-
- mocks={{
- Tasks: {
- tasks: {
- nodes: [
- { id: '1', subject: 'Task 1' },
- { id: '2', subject: 'Task 2' },
- { id: '3', subject: 'Task 3' },
- ],
- totalCount: 3,
- pageInfo: { hasNextPage: false },
+ it('should dispatch one analytics event per task', async () => {
+ const { getAllByTestId, getByRole, findByRole } = render(
+
+
+ mocks={{
+ Tasks: {
+ tasks: {
+ nodes: [
+ { id: '1', subject: 'Task 1' },
+ { id: '2', subject: 'Task 2' },
+ { id: '3', subject: 'Task 3' },
+ ],
+ totalCount: 3,
+ pageInfo: { hasNextPage: false },
+ },
},
- },
- }}
- >
-
-
- ,
- );
-
- await waitFor(() => expect(getAllByTestId('task-row')).toHaveLength(3));
- userEvent.click(getAllByTestId('task-row')[0]);
- userEvent.click(getAllByTestId('task-row')[1]);
- userEvent.click(getAllByTestId('task-row')[2]);
- userEvent.click(getByRole('button', { name: 'Actions' }));
- userEvent.click(getByRole('menuitem', { name: 'Complete Tasks' }));
- userEvent.click(getByRole('button', { name: 'Yes' }));
- await waitFor(() => expect(dispatch).toHaveBeenCalledTimes(3));
-});
+ }}
+ >
+
+
+ ,
+ );
+
+ await waitFor(() => expect(getAllByTestId('task-row')).toHaveLength(3));
+ userEvent.click(getAllByTestId('task-row')[0]);
+ userEvent.click(getAllByTestId('task-row')[1]);
+ userEvent.click(getAllByTestId('task-row')[2]);
+ userEvent.click(getByRole('button', { name: 'Actions' }));
+ userEvent.click(getByRole('menuitem', { name: 'Complete Tasks' }));
+ userEvent.click(await findByRole('button', { name: 'Yes' }));
+ await waitFor(() => expect(dispatch).toHaveBeenCalledTimes(3));
+ });
-it('should update URL which in turns updates the buttons classes.', async () => {
- const { getByText } = render(
-
-
- ,
- );
-
- await waitFor(() => expect(getByText('Upcoming')).toBeInTheDocument());
- userEvent.click(getByText('Upcoming'));
- await waitFor(() =>
- expect(getByText('Upcoming')).toHaveClass('MuiButton-contained'),
- );
-
- await waitFor(() => expect(getByText('No Due Date')).toBeInTheDocument());
- userEvent.click(getByText('No Due Date'));
- await waitFor(() =>
- expect(getByText('No Due Date')).toHaveClass('MuiButton-contained'),
- );
-
- await waitFor(() => expect(getByText('All Tasks')).toBeInTheDocument());
- userEvent.click(getByText('All Tasks'));
- await waitFor(() =>
- expect(getByText('All Tasks')).toHaveClass('MuiButton-contained'),
- );
+ it('should update URL which in turns updates the buttons classes.', async () => {
+ const { getByText } = render(
+
+
+ ,
+ );
+
+ await waitFor(() => expect(getByText('Upcoming')).toBeInTheDocument());
+ userEvent.click(getByText('Upcoming'));
+ await waitFor(() =>
+ expect(getByText('Upcoming')).toHaveClass('MuiButton-contained'),
+ );
+
+ await waitFor(() => expect(getByText('No Due Date')).toBeInTheDocument());
+ userEvent.click(getByText('No Due Date'));
+ await waitFor(() =>
+ expect(getByText('No Due Date')).toHaveClass('MuiButton-contained'),
+ );
+
+ await waitFor(() => expect(getByText('All Tasks')).toBeInTheDocument());
+ userEvent.click(getByText('All Tasks'));
+ await waitFor(() =>
+ expect(getByText('All Tasks')).toHaveClass('MuiButton-contained'),
+ );
+ });
});
diff --git a/pages/accountLists/[accountListId]/tasks/[[...contactId]].page.tsx b/pages/accountLists/[accountListId]/tasks/[[...contactId]].page.tsx
index ed69828f1..2b5a7fb49 100644
--- a/pages/accountLists/[accountListId]/tasks/[[...contactId]].page.tsx
+++ b/pages/accountLists/[accountListId]/tasks/[[...contactId]].page.tsx
@@ -5,37 +5,37 @@ import AddIcon from '@mui/icons-material/Add';
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
import { Box, Button, ButtonGroup, Hidden } from '@mui/material';
import { styled } from '@mui/material/styles';
-import debounce from 'lodash/debounce';
+import { debounce } from 'lodash';
import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
-import { ContactsRightPanel } from 'src/components/Contacts/ContactsRightPanel/ContactsRightPanel';
+import { ContactsProvider } from 'src/components/Contacts/ContactsContext/ContactsContext';
+import { DynamicContactsRightPanel } from 'src/components/Contacts/ContactsRightPanel/DynamicContactsRightPanel';
+import { InfiniteList } from 'src/components/InfiniteList/InfiniteList';
import { navBarHeight } from 'src/components/Layouts/Primary/Primary';
+import { SidePanelsLayout } from 'src/components/Layouts/SidePanelsLayout';
+import Loading from 'src/components/Loading';
+import { DynamicFilterPanel } from 'src/components/Shared/Filters/DynamicFilterPanel';
+import { UserOptionFragment } from 'src/components/Shared/Filters/FilterPanel.generated';
+import NullState from 'src/components/Shared/Filters/NullState/NullState';
+import {
+ ListHeader,
+ headerHeight,
+} from 'src/components/Shared/Header/ListHeader';
+import { TaskRow } from 'src/components/Task/TaskRow/TaskRow';
import { TaskFilterSetInput } from 'src/graphql/types.generated';
import { useGetTaskIdsForMassSelectionQuery } from 'src/hooks/GetIdsForMassSelection.generated';
+import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
+import { useMassSelection } from 'src/hooks/useMassSelection';
import useTaskModal from 'src/hooks/useTaskModal';
import { suggestArticles } from 'src/lib/helpScout';
import { sanitizeFilters } from 'src/lib/sanitizeFilters';
import theme from 'src/theme';
-import { InfiniteList } from '../../../../src/components/InfiniteList/InfiniteList';
-import { SidePanelsLayout } from '../../../../src/components/Layouts/SidePanelsLayout';
-import Loading from '../../../../src/components/Loading';
-import { FilterPanel } from '../../../../src/components/Shared/Filters/FilterPanel';
-import { UserOptionFragment } from '../../../../src/components/Shared/Filters/FilterPanel.generated';
-import NullState from '../../../../src/components/Shared/Filters/NullState/NullState';
-import {
- ListHeader,
- headerHeight,
-} from '../../../../src/components/Shared/Header/ListHeader';
-import { TaskRow } from '../../../../src/components/Task/TaskRow/TaskRow';
-import { useAccountListId } from '../../../../src/hooks/useAccountListId';
-import { useMassSelection } from '../../../../src/hooks/useMassSelection';
import {
TaskFilterTabsTypes,
taskFiltersTabs,
-} from '../../../../src/utils/tasks/taskFilterTabs';
-import { ContactsProvider } from '../contacts/ContactsContext';
+} from 'src/utils/tasks/taskFilterTabs';
import {
TaskFiltersQuery,
useTaskFiltersQuery,
@@ -315,7 +315,7 @@ const TasksPage: React.FC = () => {
{
}
rightPanel={
contactDetailsId ? (
- setContactFocus(undefined)}
/>
) : undefined
diff --git a/pages/accountLists/[accountListId]/tools/appeals.page.tsx b/pages/accountLists/[accountListId]/tools/appeals.page.tsx
index 685c01930..b45e93234 100644
--- a/pages/accountLists/[accountListId]/tools/appeals.page.tsx
+++ b/pages/accountLists/[accountListId]/tools/appeals.page.tsx
@@ -5,11 +5,11 @@ import { motion } from 'framer-motion';
import { useTranslation } from 'react-i18next';
import { makeStyles } from 'tss-react/mui';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
+import Loading from 'src/components/Loading';
+import AddAppealForm from 'src/components/Tool/Appeal/AddAppealForm';
+import Appeals from 'src/components/Tool/Appeal/Appeals';
+import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
-import Loading from '../../../../src/components/Loading';
-import AddAppealForm from '../../../../src/components/Tool/Appeal/AddAppealForm';
-import Appeals from '../../../../src/components/Tool/Appeal/Appeals';
-import { useAccountListId } from '../../../../src/hooks/useAccountListId';
const useStyles = makeStyles()((theme: Theme) => ({
container: {
diff --git a/pages/accountLists/[accountListId]/tools/appeals/[appealId].page.tsx b/pages/accountLists/[accountListId]/tools/appeals/[appealId].page.tsx
index 3c61b9a8d..19330855f 100644
--- a/pages/accountLists/[accountListId]/tools/appeals/[appealId].page.tsx
+++ b/pages/accountLists/[accountListId]/tools/appeals/[appealId].page.tsx
@@ -4,10 +4,10 @@ import { Box, Container, Theme } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { makeStyles } from 'tss-react/mui';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
+import { AppealProvider } from 'src/components/Tool/Appeal/AppealContextProvider/AppealContextProvider';
+import AppealDetailsMain from 'src/components/Tool/Appeal/AppealDetails/AppealDetailsMain';
+import AppealDrawer from 'src/components/Tool/Appeal/AppealDrawer/AppealDrawer';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
-import { AppealProvider } from '../../../../../src/components/Tool/Appeal/AppealContextProvider/AppealContextProvider';
-import AppealDetailsMain from '../../../../../src/components/Tool/Appeal/AppealDetails/AppealDetailsMain';
-import AppealDrawer from '../../../../../src/components/Tool/Appeal/AppealDrawer/AppealDrawer';
import { testAppeal2 } from './testAppeal';
const useStyles = makeStyles()((theme: Theme) => ({
diff --git a/pages/accountLists/[accountListId]/tools/fixCommitmentInfo.page.tsx b/pages/accountLists/[accountListId]/tools/fixCommitmentInfo.page.tsx
index a61dab337..527e3d63d 100644
--- a/pages/accountLists/[accountListId]/tools/fixCommitmentInfo.page.tsx
+++ b/pages/accountLists/[accountListId]/tools/fixCommitmentInfo.page.tsx
@@ -2,10 +2,10 @@ import Head from 'next/head';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
+import Loading from 'src/components/Loading';
+import FixCommitmentInfo from 'src/components/Tool/FixCommitmentInfo/FixCommitmentInfo';
+import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
-import Loading from '../../../../src/components/Loading';
-import FixCommitmentInfo from '../../../../src/components/Tool/FixCommitmentInfo/FixCommitmentInfo';
-import { useAccountListId } from '../../../../src/hooks/useAccountListId';
const FixCommitmentInfoPage: React.FC = () => {
const { t } = useTranslation();
diff --git a/pages/accountLists/[accountListId]/tools/fixEmailAddresses.page.tsx b/pages/accountLists/[accountListId]/tools/fixEmailAddresses.page.tsx
index 5934d84f4..9d60eae40 100644
--- a/pages/accountLists/[accountListId]/tools/fixEmailAddresses.page.tsx
+++ b/pages/accountLists/[accountListId]/tools/fixEmailAddresses.page.tsx
@@ -2,10 +2,10 @@ import Head from 'next/head';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
+import Loading from 'src/components/Loading';
+import { FixEmailAddresses } from 'src/components/Tool/FixEmailAddresses/FixEmailAddresses';
+import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
-import Loading from '../../../../src/components/Loading';
-import { FixEmailAddresses } from '../../../../src/components/Tool/FixEmailAddresses/FixEmailAddresses';
-import { useAccountListId } from '../../../../src/hooks/useAccountListId';
const FixEmailAddressesPage: React.FC = () => {
const { t } = useTranslation();
diff --git a/pages/accountLists/[accountListId]/tools/fixMailingAddresses.page.tsx b/pages/accountLists/[accountListId]/tools/fixMailingAddresses.page.tsx
index b083c3136..e8ff7f206 100644
--- a/pages/accountLists/[accountListId]/tools/fixMailingAddresses.page.tsx
+++ b/pages/accountLists/[accountListId]/tools/fixMailingAddresses.page.tsx
@@ -2,10 +2,10 @@ import Head from 'next/head';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
+import Loading from 'src/components/Loading';
+import FixMailingAddresses from 'src/components/Tool/FixMailingAddresses/FixMailingAddresses';
+import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
-import Loading from '../../../../src/components/Loading';
-import FixMailingAddresses from '../../../../src/components/Tool/FixMailingAddresses/FixMailingAddresses';
-import { useAccountListId } from '../../../../src/hooks/useAccountListId';
const FixMailingAddressesPage: React.FC = () => {
const { t } = useTranslation();
diff --git a/pages/accountLists/[accountListId]/tools/fixPhoneNumbers.page.tsx b/pages/accountLists/[accountListId]/tools/fixPhoneNumbers.page.tsx
index 3ec8034f2..16e2123e2 100644
--- a/pages/accountLists/[accountListId]/tools/fixPhoneNumbers.page.tsx
+++ b/pages/accountLists/[accountListId]/tools/fixPhoneNumbers.page.tsx
@@ -2,10 +2,10 @@ import Head from 'next/head';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
+import Loading from 'src/components/Loading';
+import FixPhoneNumbers from 'src/components/Tool/FixPhoneNumbers/FixPhoneNumbers';
+import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
-import Loading from '../../../../src/components/Loading';
-import FixPhoneNumbers from '../../../../src/components/Tool/FixPhoneNumbers/FixPhoneNumbers';
-import { useAccountListId } from '../../../../src/hooks/useAccountListId';
const FixPhoneNumbersPage: React.FC = () => {
const { t } = useTranslation();
diff --git a/pages/accountLists/[accountListId]/tools/fixSendNewsletter.page.tsx b/pages/accountLists/[accountListId]/tools/fixSendNewsletter.page.tsx
index b976e6c9b..3559c3c8b 100644
--- a/pages/accountLists/[accountListId]/tools/fixSendNewsletter.page.tsx
+++ b/pages/accountLists/[accountListId]/tools/fixSendNewsletter.page.tsx
@@ -2,10 +2,10 @@ import Head from 'next/head';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
+import Loading from 'src/components/Loading';
+import FixSendNewsletter from 'src/components/Tool/FixSendNewsletter/FixSendNewsletter';
+import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
-import Loading from '../../../../src/components/Loading';
-import FixSendNewsletter from '../../../../src/components/Tool/FixSendNewsletter/FixSendNewsletter';
-import { useAccountListId } from '../../../../src/hooks/useAccountListId';
const FixSendNewsletterPage: React.FC = () => {
const { t } = useTranslation();
diff --git a/pages/accountLists/[accountListId]/tools/mergeContacts.page.tsx b/pages/accountLists/[accountListId]/tools/mergeContacts.page.tsx
index 659b2fa07..6606fd09c 100644
--- a/pages/accountLists/[accountListId]/tools/mergeContacts.page.tsx
+++ b/pages/accountLists/[accountListId]/tools/mergeContacts.page.tsx
@@ -2,10 +2,10 @@ import Head from 'next/head';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
+import Loading from 'src/components/Loading';
+import MergeContacts from 'src/components/Tool/MergeContacts/MergeContacts';
+import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
-import Loading from '../../../../src/components/Loading';
-import MergeContacts from '../../../../src/components/Tool/MergeContacts/MergeContacts';
-import { useAccountListId } from '../../../../src/hooks/useAccountListId';
const MergeContactsPage: React.FC = () => {
const { t } = useTranslation();
diff --git a/pages/accountLists/[accountListId]/tools/mergePeople.page.tsx b/pages/accountLists/[accountListId]/tools/mergePeople.page.tsx
index 69b84842d..1136b2038 100644
--- a/pages/accountLists/[accountListId]/tools/mergePeople.page.tsx
+++ b/pages/accountLists/[accountListId]/tools/mergePeople.page.tsx
@@ -2,10 +2,10 @@ import Head from 'next/head';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
+import Loading from 'src/components/Loading';
+import MergePeople from 'src/components/Tool/MergePeople/MergePeople';
+import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';
-import Loading from '../../../../src/components/Loading';
-import MergePeople from '../../../../src/components/Tool/MergePeople/MergePeople';
-import { useAccountListId } from '../../../../src/hooks/useAccountListId';
const MergePeoplePage: React.FC = () => {
const { t } = useTranslation();
diff --git a/pages/api/Schema/Settings/Integrations/Mailchimp/updateMailchimpAccount/datahandler.ts b/pages/api/Schema/Settings/Integrations/Mailchimp/updateMailchimpAccount/datahandler.ts
index 1d3b3856b..44e9ec9a9 100644
--- a/pages/api/Schema/Settings/Integrations/Mailchimp/updateMailchimpAccount/datahandler.ts
+++ b/pages/api/Schema/Settings/Integrations/Mailchimp/updateMailchimpAccount/datahandler.ts
@@ -1,4 +1,4 @@
-import { snakeToCamel } from '../../../../../../../src/lib/snakeToCamel';
+import { snakeToCamel } from 'src/lib/snakeToCamel';
export interface UpdateMailchimpAccountResponse {
attributes: Omit;
diff --git a/pages/api/auth/apiOauthSignIn.ts b/pages/api/auth/apiOauthSignIn.ts
index faebc8e2f..c81eb4a08 100644
--- a/pages/api/auth/apiOauthSignIn.ts
+++ b/pages/api/auth/apiOauthSignIn.ts
@@ -1,8 +1,7 @@
/* eslint-disable */
-import * as Types from 'src/graphql/types.generated';
-
-import { gql } from '@apollo/client';
-import * as Apollo from '@apollo/client';
+import type * as Types from 'src/graphql/types.generated';
+import { gql, useMutation } from '@apollo/client';
+import type * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type ApiOauthSignInMutationVariables = Types.Exact<{
accessToken: Types.Scalars['String'];
@@ -74,10 +73,10 @@ export function useApiOauthSignInMutation(
>,
) {
const options = { ...defaultOptions, ...baseOptions };
- return Apollo.useMutation<
- ApiOauthSignInMutation,
- ApiOauthSignInMutationVariables
- >(ApiOauthSignInDocument, options);
+ return useMutation(
+ ApiOauthSignInDocument,
+ options,
+ );
}
export type ApiOauthSignInMutationHookResult = ReturnType<
typeof useApiOauthSignInMutation
diff --git a/pages/api/mpdx-web-handoff.page.ts b/pages/api/mpdx-web-handoff.page.ts
index 7abcf84b7..61426b6f1 100644
--- a/pages/api/mpdx-web-handoff.page.ts
+++ b/pages/api/mpdx-web-handoff.page.ts
@@ -1,6 +1,6 @@
import { NextApiRequest, NextApiResponse } from 'next';
import { getToken } from 'next-auth/jwt';
-import { taskFiltersTabs } from '../../src/utils/tasks/taskFilterTabs';
+import { taskFiltersTabs } from 'src/utils/tasks/taskFilterTabs';
import {
clearNextAuthSessionCookies,
cookieDefaultInfo,
diff --git a/src/components/AccountLists/AccountLists.tsx b/src/components/AccountLists/AccountLists.tsx
index 7ee375c92..9b84ba3a4 100644
--- a/src/components/AccountLists/AccountLists.tsx
+++ b/src/components/AccountLists/AccountLists.tsx
@@ -12,8 +12,8 @@ import {
import { motion } from 'framer-motion';
import { useTranslation } from 'react-i18next';
import { makeStyles } from 'tss-react/mui';
+import { GetAccountListsQuery } from 'pages/GetAccountLists.generated';
import { useLocale } from 'src/hooks/useLocale';
-import { GetAccountListsQuery } from '../../../pages/GetAccountLists.generated';
import { currencyFormat, percentageFormat } from '../../lib/intlFormat';
import AnimatedCard from '../AnimatedCard';
import PageHeading from '../PageHeading';
diff --git a/src/components/Coaching/AppealProgress/AppealProgress.tsx b/src/components/Coaching/AppealProgress/AppealProgress.tsx
index dff3cccc1..ccc7eae5c 100644
--- a/src/components/Coaching/AppealProgress/AppealProgress.tsx
+++ b/src/components/Coaching/AppealProgress/AppealProgress.tsx
@@ -1,6 +1,5 @@
import React, { ReactElement } from 'react';
-import Box from '@mui/material/Box';
-import Typography from '@mui/material/Typography';
+import { Box, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import StyledProgress from 'src/components/StyledProgress';
diff --git a/src/components/Coaching/CoachingDetail/CoachingSidebar.tsx b/src/components/Coaching/CoachingDetail/CoachingSidebar.tsx
index 34546a860..2dd7b6dd9 100644
--- a/src/components/Coaching/CoachingDetail/CoachingSidebar.tsx
+++ b/src/components/Coaching/CoachingDetail/CoachingSidebar.tsx
@@ -15,8 +15,7 @@ import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
import { GetTaskAnalyticsQuery } from 'src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.generated';
import { useLocale } from 'src/hooks/useLocale';
-import { currencyFormat } from 'src/lib/intlFormat';
-import { dateFormat } from 'src/lib/intlFormat/intlFormat';
+import { currencyFormat, dateFormat } from 'src/lib/intlFormat';
import theme from 'src/theme';
import { CollapsibleEmailList } from '../../Shared/CollapsibleContactInfo/CollapsibleEmailList';
import { CollapsiblePhoneList } from '../../Shared/CollapsibleContactInfo/CollapsiblePhoneList';
diff --git a/src/components/Coaching/CoachingDetail/MonthlyCommitment/MonthlyCommitment.tsx b/src/components/Coaching/CoachingDetail/MonthlyCommitment/MonthlyCommitment.tsx
index b64ce129b..b5f758ed8 100644
--- a/src/components/Coaching/CoachingDetail/MonthlyCommitment/MonthlyCommitment.tsx
+++ b/src/components/Coaching/CoachingDetail/MonthlyCommitment/MonthlyCommitment.tsx
@@ -1,6 +1,11 @@
import React from 'react';
-import { Box, CardContent, CardHeader, Typography } from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
+import {
+ Box,
+ CardContent,
+ CardHeader,
+ Skeleton,
+ Typography,
+} from '@mui/material';
import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
import {
diff --git a/src/components/Coaching/CoachingDetail/StyledComponents.tsx b/src/components/Coaching/CoachingDetail/StyledComponents.ts
similarity index 100%
rename from src/components/Coaching/CoachingDetail/StyledComponents.tsx
rename to src/components/Coaching/CoachingDetail/StyledComponents.ts
diff --git a/src/components/Coaching/CoachingList.stories.tsx b/src/components/Coaching/CoachingList.stories.tsx
index 9c845f6c6..abeeabe2d 100644
--- a/src/components/Coaching/CoachingList.stories.tsx
+++ b/src/components/Coaching/CoachingList.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { MockedProvider } from '@apollo/client/testing';
-import { GqlMockedProvider } from '../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { CoachingList } from './CoachingList';
import {
LoadCoachingListDocument,
diff --git a/src/components/Coaching/CoachingList.tsx b/src/components/Coaching/CoachingList.tsx
index 06fea7868..947a3cb95 100644
--- a/src/components/Coaching/CoachingList.tsx
+++ b/src/components/Coaching/CoachingList.tsx
@@ -1,8 +1,7 @@
import React from 'react';
-import { Box, Divider, Typography } from '@mui/material';
+import { Box, Divider, Skeleton, Typography } from '@mui/material';
// TODO: This icon is not defined on @mui/icons-material, find replacement.
// import { EcoOutlined } from '@mui/icons-material';
-import Skeleton from '@mui/material/Skeleton';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { CoachingRow } from './CoachingRow/CoachingRow';
diff --git a/src/components/Coaching/CoachingRow/CoachingRow.stories.tsx b/src/components/Coaching/CoachingRow/CoachingRow.stories.tsx
index d6488a766..0237a7a2c 100644
--- a/src/components/Coaching/CoachingRow/CoachingRow.stories.tsx
+++ b/src/components/Coaching/CoachingRow/CoachingRow.stories.tsx
@@ -1,5 +1,5 @@
import React, { ReactElement } from 'react';
-import { gqlMock } from '../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import {
CoachedPersonFragment,
CoachedPersonFragmentDoc,
diff --git a/src/components/Coaching/CoachingRow/CoachingRow.tsx b/src/components/Coaching/CoachingRow/CoachingRow.tsx
index 6ecdf6b50..0cd7e60d2 100644
--- a/src/components/Coaching/CoachingRow/CoachingRow.tsx
+++ b/src/components/Coaching/CoachingRow/CoachingRow.tsx
@@ -1,10 +1,7 @@
import NextLink from 'next/link';
import React, { useState } from 'react';
import VisibilityOff from '@mui/icons-material/VisibilityOff';
-import { Link } from '@mui/material';
-import Box from '@mui/material/Box';
-import Button from '@mui/material/Button';
-import Typography from '@mui/material/Typography';
+import { Box, Button, Link, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { useRequiredSession } from 'src/hooks/useRequiredSession';
diff --git a/src/components/Coaching/LoadCoachingList.test.tsx b/src/components/Coaching/LoadCoachingList.test.tsx
index cb3a59f27..466afd4e8 100644
--- a/src/components/Coaching/LoadCoachingList.test.tsx
+++ b/src/components/Coaching/LoadCoachingList.test.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { renderHook } from '@testing-library/react-hooks';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { render } from '__tests__/util/testingLibraryReactMock';
-import { GqlMockedProvider } from '../../../__tests__/util/graphqlMocking';
import { CoachingList } from './CoachingList';
import {
LoadCoachingListQuery,
diff --git a/src/components/Constants/UseApiConstants.test.tsx b/src/components/Constants/UseApiConstants.test.tsx
index d37053911..3bea5f63d 100644
--- a/src/components/Constants/UseApiConstants.test.tsx
+++ b/src/components/Constants/UseApiConstants.test.tsx
@@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react-hooks';
-import { GqlMockedProvider } from '../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { useApiConstants } from './UseApiConstants';
describe('LoadConstants', () => {
diff --git a/src/components/Contacts/CelebrationIcons/CelebrationIcons.tsx b/src/components/Contacts/CelebrationIcons/CelebrationIcons.tsx
index 80a9307e6..c76927488 100644
--- a/src/components/Contacts/CelebrationIcons/CelebrationIcons.tsx
+++ b/src/components/Contacts/CelebrationIcons/CelebrationIcons.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import Cake from '@mui/icons-material/Cake';
-import Box from '@mui/material/Box';
+import { Box } from '@mui/material';
import { styled } from '@mui/material/styles';
import { DateTime, Interval } from 'luxon';
import { useTranslation } from 'react-i18next';
diff --git a/src/components/Contacts/CelebrationIcons/Celebrationicons.test.tsx b/src/components/Contacts/CelebrationIcons/Celebrationicons.test.tsx
index ee5835226..6e9e8c482 100644
--- a/src/components/Contacts/CelebrationIcons/Celebrationicons.test.tsx
+++ b/src/components/Contacts/CelebrationIcons/Celebrationicons.test.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { DateTime } from 'luxon';
-import { gqlMock } from '../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import { CelebrationIcons } from './CelebrationIcons';
import {
CelebrationItemsFragment,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailContext.tsx b/src/components/Contacts/ContactDetails/ContactDetailContext.tsx
index cc57c068b..ee92bd47a 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailContext.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailContext.tsx
@@ -1,7 +1,7 @@
import { useRouter } from 'next/router';
import React, { useState } from 'react';
import { TabKey } from './ContactDetails';
-import { DonationTabKey } from './ContactDonationsTab/ContactDonationsTab';
+import { DonationTabKey } from './ContactDonationsTab/DonationTabKey';
export type ContactDetailsType = {
selectedTabKey: TabKey;
diff --git a/src/components/Contacts/ContactDetails/ContactDetails.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetails.stories.tsx
index 5f14bb6cd..e8c6a8895 100644
--- a/src/components/Contacts/ContactDetails/ContactDetails.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetails.stories.tsx
@@ -1,8 +1,8 @@
import React, { ReactElement } from 'react';
import { MockedProvider } from '@apollo/client/testing';
import TestRouter from '__tests__/util/TestRouter';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
-import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import { ContactDetailProvider } from './ContactDetailContext';
import { ContactDetails } from './ContactDetails';
import { GetContactDetailsHeaderDocument } from './ContactDetailsHeader/ContactDetailsHeader.generated';
@@ -23,11 +23,11 @@ export const Default = (): ReactElement => {
return (
-
+
{}} />
-
+
);
@@ -51,11 +51,11 @@ export const Loading = (): ReactElement => {
},
]}
>
-
+
{}} />
-
+
);
diff --git a/src/components/Contacts/ContactDetails/ContactDetails.test.tsx b/src/components/Contacts/ContactDetails/ContactDetails.test.tsx
index 2fb9cb54b..41570f127 100644
--- a/src/components/Contacts/ContactDetails/ContactDetails.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetails.test.tsx
@@ -4,8 +4,8 @@ import { render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
import TestRouter from '__tests__/util/TestRouter';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
-import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import theme from '../../../theme';
import { ContactDetailProvider } from './ContactDetailContext';
import { ContactDetails } from './ContactDetails';
@@ -24,11 +24,11 @@ describe('ContactDetails', () => {
-
+
{}} />
-
+
diff --git a/src/components/Contacts/ContactDetails/ContactDetails.tsx b/src/components/Contacts/ContactDetails/ContactDetails.tsx
index 0356d6309..82e6691d3 100644
--- a/src/components/Contacts/ContactDetails/ContactDetails.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetails.tsx
@@ -5,20 +5,32 @@ import TabPanel from '@mui/lab/TabPanel';
import { Box, Tab } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
+import theme from '../../../theme';
import {
ContactsContext,
ContactsType,
-} from '../../../../pages/accountLists/[accountListId]/contacts/ContactsContext';
-import theme from '../../../theme';
+} from '../ContactsContext/ContactsContext';
import {
ContactDetailContext,
ContactDetailsType,
} from './ContactDetailContext';
import { ContactDetailsHeader } from './ContactDetailsHeader/ContactDetailsHeader';
-import { ContactDetailsTab } from './ContactDetailsTab/ContactDetailsTab';
-import { ContactDonationsTab } from './ContactDonationsTab/ContactDonationsTab';
-import { ContactNotesTab } from './ContactNotesTab/ContactNotesTab';
-import { ContactReferralTab } from './ContactReferralTab/ContactReferralTab';
+import {
+ DynamicContactDetailsTab,
+ preloadContactDetailsTab,
+} from './ContactDetailsTab/DynamicContactDetailsTab';
+import {
+ DynamicContactDonationsTab,
+ preloadContactDonationsTab,
+} from './ContactDonationsTab/DynamicContactDonationsTab';
+import {
+ DynamicContactNotesTab,
+ preloadContactNotesTab,
+} from './ContactNotesTab/DynamicContactNotesTab';
+import {
+ DynamicContactReferralTab,
+ preloadContactReferralTab,
+} from './ContactReferralTab/DynamicContactReferralTab';
import { ContactTasksTab } from './ContactTasksTab/ContactTasksTab';
interface Props {
@@ -103,13 +115,26 @@ export const ContactDetails: React.FC = ({ onClose }) => {
TabIndicatorProps={{ children: }}
>
-
-
+
+
+
-
@@ -123,22 +148,24 @@ export const ContactDetails: React.FC = ({ onClose }) => {
{contactId && accountListId && (
-
)}
-
+ {contactId && accountListId && (
+
+ )}
{contactId && accountListId && (
- = ({ onClose }) => {
{contactId && accountListId && (
-
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.stories.tsx
index 5270346a4..ed14915e3 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.stories.tsx
@@ -1,7 +1,7 @@
import React, { ReactElement } from 'react';
import { MockedProvider } from '@apollo/client/testing';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import { ContactDetailProvider } from '../ContactDetailContext';
import { ContactDetailsHeader } from './ContactDetailsHeader';
import { GetContactDetailsHeaderDocument } from './ContactDetailsHeader.generated';
@@ -16,7 +16,7 @@ export default {
export const Default = (): ReactElement => {
return (
-
+
{
/>
-
+
);
};
export const Loading = (): ReactElement => {
return (
-
+
{
/>
-
+
);
};
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.test.tsx
index a96e248a5..55282fd23 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.test.tsx
@@ -4,9 +4,9 @@ import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
import TestRouter from '__tests__/util/TestRouter';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import theme from 'src/theme';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
import { ContactDetailProvider } from '../ContactDetailContext';
import { ContactDetailsHeader } from './ContactDetailsHeader';
import { GetContactDetailsHeaderQuery } from './ContactDetailsHeader.generated';
@@ -37,7 +37,7 @@ describe('ContactDetails', () => {
-
+
{
contactDetailsLoaded={false}
/>
-
+
@@ -75,7 +75,7 @@ describe('ContactDetails', () => {
},
}}
>
-
+
{
contactDetailsLoaded={false}
/>
-
+
@@ -107,7 +107,7 @@ describe('ContactDetails', () => {
}>
mocks={mocks}
>
-
+
{
contactDetailsLoaded={false}
/>
-
+
@@ -139,7 +139,7 @@ describe('ContactDetails', () => {
}>
mocks={mocks}
>
-
+
{
contactDetailsLoaded={false}
/>
-
+
@@ -174,7 +174,7 @@ describe('ContactDetails', () => {
}>
mocks={mocks}
>
-
+
{
contactDetailsLoaded={false}
/>
-
+
@@ -212,7 +212,7 @@ describe('ContactDetails', () => {
}>
mocks={mocks}
>
-
+
{
contactDetailsLoaded={false}
/>
-
+
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.tsx
index cb8f4d235..a24537348 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsHeader.tsx
@@ -1,7 +1,6 @@
import React, { useEffect } from 'react';
import Close from '@mui/icons-material/Close';
-import { Avatar, Box, IconButton, Typography } from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
+import { Avatar, Box, IconButton, Skeleton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { StatusEnum } from 'src/graphql/types.generated';
@@ -11,8 +10,8 @@ import {
ContactDetailContext,
ContactDetailsType,
} from '../ContactDetailContext';
-import { ContactDetailEditIcon } from '../ContactDetailsTab/ContactDetailsTab';
import { EditContactDetailsModal } from '../ContactDetailsTab/People/Items/EditContactDetailsModal/EditContactDetailsModal';
+import { EditIcon } from '../ContactDetailsTab/StyledComponents';
import { useGetContactDetailsHeaderQuery } from './ContactDetailsHeader.generated';
import { ContactDetailsMoreAcitions } from './ContactDetailsMoreActions/ContactDetailsMoreActions';
import { ContactHeaderAddressSection } from './ContactHeaderSection/ContactHeaderAddressSection';
@@ -112,7 +111,7 @@ export const ContactDetailsHeader: React.FC = ({
onClick={() => setEditModalOpen(true)}
aria-label={t('Edit Icon')}
>
-
+
>
) : null}
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsMoreActions/ContactDetailsMoreActions.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsMoreActions/ContactDetailsMoreActions.test.tsx
index 19d0667b2..33cc151a5 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsMoreActions/ContactDetailsMoreActions.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsMoreActions/ContactDetailsMoreActions.test.tsx
@@ -3,10 +3,10 @@ import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
+import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import { StatusEnum } from 'src/graphql/types.generated';
-import TestRouter from '../../../../../../__tests__/util/TestRouter';
-import { GqlMockedProvider } from '../../../../../../__tests__/util/graphqlMocking';
import useTaskModal from '../../../../../hooks/useTaskModal';
import theme from '../../../../../theme';
import { ContactDetailProvider } from '../../ContactDetailContext';
@@ -41,6 +41,7 @@ const openTaskModal = jest.fn();
beforeEach(() => {
(useTaskModal as jest.Mock).mockReturnValue({
openTaskModal,
+ preloadTaskModal: jest.fn(),
});
});
@@ -51,7 +52,7 @@ describe('ContactDetailsMoreActions', () => {
-
+
{
onClose={onClose}
/>
-
+
@@ -81,7 +82,7 @@ describe('ContactDetailsMoreActions', () => {
-
+
{
onClose={onClose}
/>
-
+
@@ -114,7 +115,7 @@ describe('ContactDetailsMoreActions', () => {
-
+
{
onClose={onClose}
/>
-
+
@@ -142,7 +143,7 @@ describe('ContactDetailsMoreActions', () => {
});
it('handles hiding contact', async () => {
- const { queryByText, getByRole, getByText } = render(
+ const { queryByText, getByRole, getByText, findByText } = render(
@@ -159,7 +160,7 @@ describe('ContactDetailsMoreActions', () => {
},
}}
>
-
+
{
onClose={onClose}
/>
-
+
@@ -179,7 +180,7 @@ describe('ContactDetailsMoreActions', () => {
);
expect(getByText('Hide Contact')).toBeInTheDocument();
userEvent.click(getByText('Hide Contact'));
- userEvent.click(getByText('Hide'));
+ userEvent.click(await findByText('Hide'));
await waitFor(() =>
expect(mockEnqueue).toHaveBeenCalledWith('Contact hidden successfully!', {
variant: 'success',
@@ -200,7 +201,7 @@ describe('ContactDetailsMoreActions', () => {
-
+
{
onClose={onClose}
/>
-
+
@@ -233,12 +234,13 @@ describe('ContactDetailsMoreActions', () => {
getByLabelText,
getByText,
getByRole,
+ findByText,
} = render(
-
+
{
onClose={onClose}
/>
-
+
@@ -259,7 +261,7 @@ describe('ContactDetailsMoreActions', () => {
expect(getByText('Delete Contact')).toBeInTheDocument();
expect(queryByText('Cancel')).not.toBeInTheDocument();
userEvent.click(queryAllByText('Delete Contact')[0]);
- expect(getByText('Cancel')).toBeInTheDocument();
+ expect(await findByText('Cancel')).toBeInTheDocument();
userEvent.click(getByLabelText('Close'));
await waitFor(() => expect(queryByText('Cancel')).not.toBeInTheDocument());
});
@@ -270,7 +272,7 @@ describe('ContactDetailsMoreActions', () => {
-
+
{
onClose={onClose}
/>
-
+
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsMoreActions/ContactDetailsMoreActions.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsMoreActions/ContactDetailsMoreActions.tsx
index 63f5c00d2..ef6fad0d2 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsMoreActions/ContactDetailsMoreActions.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsMoreActions/ContactDetailsMoreActions.tsx
@@ -1,3 +1,4 @@
+import { useRouter } from 'next/router';
import React, { ReactElement, useState } from 'react';
import DeleteIcon from '@mui/icons-material/Delete';
import EditIcon from '@mui/icons-material/Edit';
@@ -16,8 +17,11 @@ import {
import {
ContactsContext,
ContactsType,
-} from 'pages/accountLists/[accountListId]/contacts/ContactsContext';
-import { CreateMultipleContacts } from 'src/components/Layouts/Primary/TopBar/Items/AddMenu/Items/CreateMultipleContacts/CreateMultipleContacts';
+} from 'src/components/Contacts/ContactsContext/ContactsContext';
+import {
+ DynamicCreateMultipleContacts,
+ preloadCreateMultipleContacts,
+} from 'src/components/Layouts/Primary/TopBar/Items/AddMenu/Items/CreateMultipleContacts/DynamicCreateMultipleContacts';
import { StatusEnum } from 'src/graphql/types.generated';
import useTaskModal from '../../../../../hooks/useTaskModal';
import Modal from '../../../../common/Modal/Modal';
@@ -27,8 +31,14 @@ import {
} from '../../ContactDetailContext';
import { useDeleteContactMutation } from '../../ContactDetailsTab/ContactDetailsTab.generated';
import { useUpdateContactOtherMutation } from '../../ContactDetailsTab/Other/EditContactOtherModal/EditContactOther.generated';
-import { DeleteContactModal } from '../DeleteContactModal/DeleteContactModal';
-import { MoreActionHideContactModal } from './MoreActionHideContactModal';
+import {
+ DynamicDeleteContactModal,
+ preloadDeleteContactModal,
+} from '../DeleteContactModal/DynamicDeleteContactModal';
+import {
+ DynamicMoreActionHideContactModal,
+ preloadMoreActionHideContactModal,
+} from './DynamicMoreActionHideContactModal';
type AddMenuItem = {
visibility: boolean;
@@ -36,6 +46,7 @@ type AddMenuItem = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
icon: any;
onClick: () => void;
+ onMouseEnter: () => void;
};
const MoreButtonIcon = styled(MoreVert)(({ theme }) => ({
@@ -86,8 +97,13 @@ const ActionPanel = ({
{actionContent
.filter((i: AddMenuItem) => i.visibility)
- .map(({ text, icon, onClick }, index) => (
-
+ .map(({ text, icon, onClick, onMouseEnter }, index) => (
+
{icon}
@@ -105,9 +121,10 @@ interface ContactDetailsMoreAcitionsProps {
export const ContactDetailsMoreAcitions: React.FC<
ContactDetailsMoreAcitionsProps
> = ({ contactId, status, onClose }) => {
- const { openTaskModal } = useTaskModal();
+ const { openTaskModal, preloadTaskModal } = useTaskModal();
const { t } = useTranslation();
- const { accountListId, searchTerm, router } = React.useContext(
+ const { query, push } = useRouter();
+ const { accountListId, searchTerm } = React.useContext(
ContactsContext,
) as ContactsType;
@@ -126,7 +143,6 @@ export const ContactDetailsMoreAcitions: React.FC<
const [openHideModal, setOpenHideModal] = useState(false);
const [updateHiding, setUpdateHiding] = useState(false);
- const { query, push } = router;
const { contactId: _, ...queryWithoutContactId } = query;
const hideContact = async (): Promise => {
setUpdateHiding(true);
@@ -206,6 +222,7 @@ export const ContactDetailsMoreAcitions: React.FC<
setReferralsModalOpen(true);
setAnchorEl(undefined);
},
+ onMouseEnter: preloadCreateMultipleContacts,
},
{
visibility: true,
@@ -218,6 +235,7 @@ export const ContactDetailsMoreAcitions: React.FC<
});
setAnchorEl(undefined);
},
+ onMouseEnter: () => preloadTaskModal('add'),
},
{
visibility: true,
@@ -230,6 +248,7 @@ export const ContactDetailsMoreAcitions: React.FC<
});
setAnchorEl(undefined);
},
+ onMouseEnter: () => preloadTaskModal('log'),
},
{
visibility: status !== StatusEnum.NeverAsk,
@@ -239,6 +258,7 @@ export const ContactDetailsMoreAcitions: React.FC<
setOpenHideModal(true);
setAnchorEl(undefined);
},
+ onMouseEnter: preloadMoreActionHideContactModal,
},
{
visibility: true,
@@ -248,6 +268,7 @@ export const ContactDetailsMoreAcitions: React.FC<
setDeleteModalOpen(true);
setAnchorEl(undefined);
},
+ onMouseEnter: preloadDeleteContactModal,
},
];
@@ -283,26 +304,28 @@ export const ContactDetailsMoreAcitions: React.FC<
fullWidth
size={'xl'} // TODO: Expand logic as more menu modals are added
>
- {
-
- }
+
-
-
+ {deleteModalOpen && (
+
+ )}
+ {openHideModal && (
+
+ )}
>
);
};
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsMoreActions/DynamicMoreActionHideContactModal.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsMoreActions/DynamicMoreActionHideContactModal.tsx
new file mode 100644
index 000000000..8e5a27cb0
--- /dev/null
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactDetailsMoreActions/DynamicMoreActionHideContactModal.tsx
@@ -0,0 +1,12 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadMoreActionHideContactModal = () =>
+ import(
+ /* webpackChunkName: "MoreActionHideContactModal" */ './MoreActionHideContactModal'
+ ).then(({ MoreActionHideContactModal }) => MoreActionHideContactModal);
+
+export const DynamicMoreActionHideContactModal = dynamic(
+ preloadMoreActionHideContactModal,
+ { loading: DynamicModalPlaceholder },
+);
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.stories.tsx
index 6851bf884..098f36f26 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { DateTime } from 'luxon';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import {
ContactDetailsHeaderFragment,
ContactDetailsHeaderFragmentDoc,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.test.tsx
index e6ac44b36..2c1492cc1 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.test.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from '@testing-library/react';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import {
ContactDetailsHeaderFragment,
ContactDetailsHeaderFragmentDoc,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.tsx
index 0b38b43c4..8a0ab07e1 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderAddressSection.tsx
@@ -1,7 +1,6 @@
import React, { ReactElement } from 'react';
import LocationOn from '@mui/icons-material/LocationOn';
-import { Box, Link, Typography } from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
+import { Box, Link, Skeleton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import theme from '../../../../../theme';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.stories.tsx
index 69b7f42b6..e8102e074 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { DateTime } from 'luxon';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import {
ContactDetailsHeaderFragment,
ContactDetailsHeaderFragmentDoc,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.test.tsx
index a2987bdc0..e72b6143f 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.test.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from '@testing-library/react';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import {
ContactDetailsHeaderFragment,
ContactDetailsHeaderFragmentDoc,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.tsx
index 203ff7ba3..bbfe17fe7 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderEmailSection.tsx
@@ -1,7 +1,6 @@
import React, { ReactElement } from 'react';
import Email from '@mui/icons-material/Email';
-import { Link, Typography } from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
+import { Link, Skeleton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import theme from '../../../../../theme';
import { ContactHeaderEmailFragment } from './ContactHeaderEmail.generated';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderNewsletterSection.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderNewsletterSection.test.tsx
index 59fc6d4e9..f8f4ab605 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderNewsletterSection.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderNewsletterSection.test.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { render } from '@testing-library/react';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import { SendNewsletterEnum } from 'src/graphql/types.generated';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
import {
ContactDetailsHeaderFragment,
ContactDetailsHeaderFragmentDoc,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderNewsletterSection.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderNewsletterSection.tsx
index f1959b00e..7110eac15 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderNewsletterSection.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderNewsletterSection.tsx
@@ -1,8 +1,7 @@
import React, { ReactElement } from 'react';
import { mdiNewspaperVariantOutline } from '@mdi/js';
import Icon from '@mdi/react';
-import Skeleton from '@mui/material/Skeleton';
-import Typography from '@mui/material/Typography';
+import { Skeleton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { getLocalizedSendNewsletter } from 'src/utils/functions/getLocalizedSendNewsletter';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPartnerSection.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPartnerSection.tsx
index 7c85ea34b..54595f47b 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPartnerSection.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPartnerSection.tsx
@@ -1,6 +1,5 @@
import React, { Fragment } from 'react';
-import { Typography } from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
+import { Skeleton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { ContactHeaderSection } from './ContactHeaderSection';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.stories.tsx
index 05ff92aed..657d8c1fb 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { DateTime } from 'luxon';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import {
ContactDetailsHeaderFragment,
ContactDetailsHeaderFragmentDoc,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.test.tsx
index e0c5c7a9e..4dd3c9e57 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.test.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from '@testing-library/react';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import {
ContactDetailsHeaderFragment,
ContactDetailsHeaderFragmentDoc,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.tsx
index bfd05de70..c3d4935c3 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderPhoneSection.tsx
@@ -1,7 +1,6 @@
import React, { ReactElement } from 'react';
import Phone from '@mui/icons-material/Phone';
-import { Box, Link, Typography } from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
+import { Box, Link, Skeleton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import theme from '../../../../../theme';
import { ContactHeaderPhoneFragment } from './ContactHeaderPhone.generated';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderSection.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderSection.tsx
index d00f16584..8c1b33430 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderSection.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderSection.tsx
@@ -1,5 +1,5 @@
import React, { ReactElement, ReactNode } from 'react';
-import Box from '@mui/material/Box';
+import { Box } from '@mui/material';
import { styled } from '@mui/material/styles';
interface Props {
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.stories.tsx
index cb037f3a9..227bd5db3 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.stories.tsx
@@ -1,7 +1,7 @@
import React, { ReactElement } from 'react';
import { DateTime } from 'luxon';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import { StatusEnum } from 'src/graphql/types.generated';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
import {
ContactDetailsHeaderFragment,
ContactDetailsHeaderFragmentDoc,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.test.tsx
index 6e82f0b6b..fec1871d8 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.test.tsx
@@ -2,11 +2,11 @@ import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { render } from '@testing-library/react';
import { I18nextProvider } from 'react-i18next';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import {
StatusEnum as ContactPartnershipStatusEnum,
PledgeFrequencyEnum,
} from 'src/graphql/types.generated';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
import i18n from '../../../../../lib/i18n';
import theme from '../../../../../theme';
import {
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.tsx
index aa9cafd49..896732ab0 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/ContactHeaderStatusSection.tsx
@@ -1,9 +1,6 @@
import React, { useMemo, useState } from 'react';
import CreateIcon from '@mui/icons-material/Create';
-import Box from '@mui/material/Box';
-import IconButton from '@mui/material/IconButton';
-import Skeleton from '@mui/material/Skeleton';
-import Typography from '@mui/material/Typography';
+import { Box, IconButton, Skeleton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/HandshakeIcon.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/HandshakeIcon.tsx
index 74b57f45a..4fbcfcec4 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/HandshakeIcon.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/ContactHeaderSection/HandshakeIcon.tsx
@@ -1,5 +1,5 @@
import React, { ReactElement } from 'react';
-import SvgIcon from '@mui/material/SvgIcon';
+import { SvgIcon } from '@mui/material';
import { styled } from '@mui/material/styles';
import theme from '../../../../../theme';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/DeleteContactModal/DynamicDeleteContactModal.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/DeleteContactModal/DynamicDeleteContactModal.tsx
new file mode 100644
index 000000000..aa74b670c
--- /dev/null
+++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/DeleteContactModal/DynamicDeleteContactModal.tsx
@@ -0,0 +1,11 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadDeleteContactModal = () =>
+ import(
+ /* webpackChunkName: "DeleteContactModal" */ './DeleteContactModal'
+ ).then(({ DeleteContactModal }) => DeleteContactModal);
+
+export const DynamicDeleteContactModal = dynamic(preloadDeleteContactModal, {
+ loading: DynamicModalPlaceholder,
+});
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.stories.tsx
index f54d0a89c..5de8f1928 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.stories.tsx
@@ -2,7 +2,7 @@ import React, { ReactElement } from 'react';
import { MockedProvider } from '@apollo/client/testing';
import { CssBaseline } from '@mui/material';
import { ThemeProvider } from '@mui/material/styles';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import theme from '../../../../theme';
import { ContactDetailProvider } from '../ContactDetailContext';
import { ContactDetailsTab } from './ContactDetailsTab';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.test.tsx
index ce062d112..730e8c5d5 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.test.tsx
@@ -8,9 +8,9 @@ import userEvent from '@testing-library/user-event';
import { ApolloErgonoMockMap } from 'graphql-ergonomock';
import { SnackbarProvider } from 'notistack';
import { DeepPartial } from 'ts-essentials';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
-import TestRouter from '../../../../../__tests__/util/TestRouter';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import theme from '../../../../theme';
import { ContactDetailProvider } from '../ContactDetailContext';
import { ContactDetailsTab } from './ContactDetailsTab';
@@ -97,7 +97,7 @@ const TestComponent: React.FC = (props) => (
mocks={(props.mocks ?? mocks) as ApolloErgonoMockMap}
>
-
+
= (props) => (
onContactSelected={onContactSelected}
/>
-
+
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.tsx
index 9d96f7808..3945a7faf 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/ContactDetailsTab.tsx
@@ -1,7 +1,5 @@
import React from 'react';
-import CreateIcon from '@mui/icons-material/Create';
-import { Box, Divider, Typography } from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
+import { Box, Divider, Skeleton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import {
@@ -33,13 +31,6 @@ const ContactDetailHeadingContainer = styled(Box)(() => ({
alignItems: 'center',
}));
-export const ContactDetailEditIcon = styled(CreateIcon)(({ theme }) => ({
- width: '18px',
- height: '18px',
- margin: theme.spacing(0),
- color: theme.palette.cruGrayMedium.main,
-}));
-
const ContactDetailHeadingText = styled(Typography)(() => ({
flexGrow: 5,
fontWeight: 'bold',
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/DynamicContactDetailsTab.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/DynamicContactDetailsTab.tsx
new file mode 100644
index 000000000..376ba4748
--- /dev/null
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/DynamicContactDetailsTab.tsx
@@ -0,0 +1,11 @@
+import dynamic from 'next/dynamic';
+import { DynamicComponentPlaceholder } from 'src/components/DynamicPlaceholders/DynamicComponentPlaceholder';
+
+export const preloadContactDetailsTab = () =>
+ import(
+ /* webpackChunkName: "ContactDetailsTab" */ './ContactDetailsTab'
+ ).then(({ ContactDetailsTab }) => ContactDetailsTab);
+
+export const DynamicContactDetailsTab = dynamic(preloadContactDetailsTab, {
+ loading: DynamicComponentPlaceholder,
+});
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/AddAddressModal/AddAddressModal.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/AddAddressModal/AddAddressModal.test.tsx
index a70f6fb13..f5ecb6267 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/AddAddressModal/AddAddressModal.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/AddAddressModal/AddAddressModal.test.tsx
@@ -4,7 +4,7 @@ import { act, render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
import { placePromise, setupMocks } from '__tests__/util/googlePlacesMock';
-import { GqlMockedProvider } from '../../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import theme from '../../../../../../theme';
import { AddAddressModal } from './AddAddressModal';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.stories.tsx
index 06628cf7a..6a83dbdb9 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { Box } from '@mui/material';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import { ContactDetailProvider } from '../../ContactDetailContext';
import { ContactDetailsTabMailing } from './ContactDetailsTabMailing';
import {
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.test.tsx
index dfbec1b8f..554d238aa 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.test.tsx
@@ -3,7 +3,7 @@ import { render, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import TestRouter from '__tests__/util/TestRouter';
import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import { SendNewsletterEnum } from 'src/graphql/types.generated';
import theme from '../../../../../theme';
import { ContactDetailProvider } from '../../ContactDetailContext';
@@ -63,14 +63,14 @@ describe('ContactDetailsTabMailing', () => {
-
+
-
+
,
@@ -84,14 +84,14 @@ describe('ContactDetailsTabMailing', () => {
-
+
-
+
,
@@ -114,14 +114,14 @@ describe('ContactDetailsTabMailing', () => {
-
+
-
+
,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.tsx
index c233aac8e..36804fb31 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/ContactDetailsTabMailing.tsx
@@ -6,19 +6,14 @@ import { styled } from '@mui/material/styles';
import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
import { useLocale } from 'src/hooks/useLocale';
-import { dateFormat } from 'src/lib/intlFormat/intlFormat';
+import { dateFormat } from 'src/lib/intlFormat';
import { getLocalizedSendNewsletter } from 'src/utils/functions/getLocalizedSendNewsletter';
import { sourceToStr } from 'src/utils/sourceToStr';
import {
ContactDetailContext,
ContactDetailsType,
} from '../../ContactDetailContext';
-import { ContactDetailEditIcon } from '../ContactDetailsTab';
-import {
- ContactDetailsAddButton,
- ContactDetailsAddIcon,
- ContactDetailsAddText,
-} from '../People/ContactDetailsTabPeople';
+import { AddButton, AddIcon, AddText, EditIcon } from '../StyledComponents';
import { AddAddressModal } from './AddAddressModal/AddAddressModal';
import { ContactMailingFragment } from './ContactMailing.generated';
import { EditContactAddressModal } from './EditContactAddressModal/EditContactAddressModal';
@@ -230,7 +225,7 @@ export const ContactDetailsTabMailing: React.FC = ({
onClick={() => setEditMailingModalOpen(true)}
aria-label={t('Edit Mailing')}
>
-
+
{/* Envelope Name Section */}
@@ -252,12 +247,10 @@ export const ContactDetailsTabMailing: React.FC = ({
- setAddAddressModalOpen(true)}>
-
-
- {t('Add Address')}
-
-
+ setAddAddressModalOpen(true)}>
+
+ {t('Add Address')}
+
{selectedAddress ? (
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.test.tsx
index 53c82793a..1ff480dc6 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.test.tsx
@@ -4,10 +4,7 @@ import { act, render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
import { placePromise, setupMocks } from '__tests__/util/googlePlacesMock';
-import {
- GqlMockedProvider,
- gqlMock,
-} from '../../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider, gqlMock } from '__tests__/util/graphqlMocking';
import theme from '../../../../../../theme';
import {
ContactMailingFragment,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditMailingInfoModal/EditMailingInfoModal.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditMailingInfoModal/EditMailingInfoModal.test.tsx
index 574f59704..afd9fd45d 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditMailingInfoModal/EditMailingInfoModal.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditMailingInfoModal/EditMailingInfoModal.test.tsx
@@ -3,8 +3,8 @@ import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { SendNewsletterEnum } from 'src/graphql/types.generated';
-import { GqlMockedProvider } from '../../../../../../../__tests__/util/graphqlMocking';
import theme from '../../../../../../theme';
import { EditMailingInfoModal } from './EditMailingInfoModal';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/ContactDetailsOther.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/ContactDetailsOther.stories.tsx
index 21340f614..196bad7ee 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/ContactDetailsOther.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/ContactDetailsOther.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { Box } from '@mui/material';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import { ContactDetailProvider } from '../../ContactDetailContext';
import { ContactDetailsOther } from './ContactDetailsOther';
import {
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/ContactDetailsOther.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/ContactDetailsOther.tsx
index 00a44c628..2b56e4b15 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/ContactDetailsOther.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/ContactDetailsOther.tsx
@@ -1,12 +1,10 @@
import React from 'react';
-import Box from '@mui/material/Box';
-import IconButton from '@mui/material/IconButton';
-import Typography from '@mui/material/Typography';
+import { Box, IconButton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import i18n from 'i18next';
import { useTranslation } from 'react-i18next';
import { PreferredContactMethodEnum } from 'src/graphql/types.generated';
-import { ContactDetailEditIcon } from '../ContactDetailsTab';
+import { EditIcon } from '../StyledComponents';
import { ContactOtherFragment } from './ContactOther.generated';
const ContactOtherContainer = styled(Box)(({ theme }) => ({
@@ -96,7 +94,7 @@ export const ContactDetailsOther: React.FC = ({
aria-label={t('Edit Other Icon')}
style={{ marginLeft: 16 }}
>
-
+
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/EditContactOtherModal/EditContactOtherModal.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/EditContactOtherModal/EditContactOtherModal.test.tsx
index 279afdb67..151c5640c 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/EditContactOtherModal/EditContactOtherModal.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/EditContactOtherModal/EditContactOtherModal.test.tsx
@@ -4,13 +4,10 @@ import { act, render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
import TestRouter from '__tests__/util/TestRouter';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
+import { GqlMockedProvider, gqlMock } from '__tests__/util/graphqlMocking';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import { ContactOptionsQuery } from 'src/components/Task/Modal/Form/Inputs/ContactsAutocomplete/ContactsAutocomplete.generated';
import { PreferredContactMethodEnum } from 'src/graphql/types.generated';
-import {
- GqlMockedProvider,
- gqlMock,
-} from '../../../../../../../__tests__/util/graphqlMocking';
import theme from '../../../../../../theme';
import { ContactDetailProvider } from '../../../ContactDetailContext';
import {
@@ -67,7 +64,7 @@ describe('EditContactOtherModal', () => {
-
+
{
referral={referral}
/>
-
+
@@ -112,7 +109,7 @@ describe('EditContactOtherModal', () => {
},
}}
>
-
+
{
referral={referral}
/>
-
+
@@ -157,7 +154,7 @@ describe('EditContactOtherModal', () => {
},
}}
>
-
+
{
referral={referral}
/>
-
+
@@ -192,7 +189,7 @@ describe('EditContactOtherModal', () => {
-
+
{
referral={referral}
/>
-
+
@@ -220,7 +217,7 @@ describe('EditContactOtherModal', () => {
-
+
{
referral={referral}
/>
-
+
@@ -250,7 +247,7 @@ describe('EditContactOtherModal', () => {
-
+
{
referral={undefined}
/>
-
+
@@ -286,7 +283,7 @@ describe('EditContactOtherModal', () => {
-
+
{
referral={undefined}
/>
-
+
@@ -379,7 +376,7 @@ describe('EditContactOtherModal', () => {
},
}}
>
-
+
{
referral={referral}
/>
-
+
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/EditContactOtherModal/EditContactOtherModal.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/EditContactOtherModal/EditContactOtherModal.tsx
index 89f13561f..3df961517 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/EditContactOtherModal/EditContactOtherModal.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Other/EditContactOtherModal/EditContactOtherModal.tsx
@@ -15,7 +15,7 @@ import {
} from '@mui/material';
import { styled } from '@mui/material/styles';
import { Formik } from 'formik';
-import debounce from 'lodash/fp/debounce';
+import { debounce } from 'lodash';
import { useSnackbar } from 'notistack';
import { useTranslation } from 'react-i18next';
import * as yup from 'yup';
@@ -109,9 +109,9 @@ export const EditContactOtherModal: React.FC = ({
const [searchTerm, setSearchTerm] = useState(referral?.referredBy.name ?? '');
const handleSearchTermChange = useCallback(
- debounce(500, (event) => {
+ debounce((event) => {
setSearchTerm(event.target.value);
- }),
+ }, 500),
[],
);
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/PartnerAccounts/ContactDetailsPartnerAccounts.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/PartnerAccounts/ContactDetailsPartnerAccounts.test.tsx
index 9b3c0c214..ab8ba0796 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/PartnerAccounts/ContactDetailsPartnerAccounts.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/PartnerAccounts/ContactDetailsPartnerAccounts.test.tsx
@@ -4,7 +4,7 @@ import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
import TestRouter from '__tests__/util/TestRouter';
-import { GqlMockedProvider } from '../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import theme from '../../../../../theme';
import { ContactDetailProvider } from '../../ContactDetailContext';
import { ContactDetailsPartnerAccounts } from './ContactDetailsPartnerAccounts';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/PartnerAccounts/ContactDetailsPartnerAccounts.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/PartnerAccounts/ContactDetailsPartnerAccounts.tsx
index 558665f90..7d904d1a8 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/PartnerAccounts/ContactDetailsPartnerAccounts.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/PartnerAccounts/ContactDetailsPartnerAccounts.tsx
@@ -1,10 +1,7 @@
import React, { ReactElement, useState } from 'react';
import Add from '@mui/icons-material/Add';
import Delete from '@mui/icons-material/Delete';
-import { TextField } from '@mui/material';
-import Box from '@mui/material/Box';
-import IconButton from '@mui/material/IconButton';
-import Typography from '@mui/material/Typography';
+import { Box, IconButton, TextField, Typography } from '@mui/material';
import { styled } from '@mui/system';
import { Formik } from 'formik';
import { useSnackbar } from 'notistack';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.stories.tsx
index 308a0d9fc..ecd1a0452 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { Box } from '@mui/material';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import { ContactDetailProvider } from '../../ContactDetailContext';
import { ContactDetailsTabPeople } from './ContactDetailsTabPeople';
import {
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.test.tsx
index 623d4570f..cd3e5f022 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.test.tsx
@@ -6,12 +6,12 @@ import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
import TestRouter from '__tests__/util/TestRouter';
import { GqlMockedProvider, gqlMock } from '__tests__/util/graphqlMocking';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
import {
render,
waitFor,
within,
-} from '../../../../../../__tests__/util/testingLibraryReactMock';
+} from '__tests__/util/testingLibraryReactMock';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import theme from '../../../../../theme';
import { ContactDetailProvider } from '../../ContactDetailContext';
import { ContactDetailsTabPeople } from './ContactDetailsTabPeople';
@@ -123,14 +123,14 @@ describe('ContactDetailsTabPeople', () => {
-
+
-
+
,
@@ -152,14 +152,14 @@ describe('ContactDetailsTabPeople', () => {
-
+
-
+
@@ -182,14 +182,14 @@ describe('ContactDetailsTabPeople', () => {
-
+
-
+
,
@@ -230,14 +230,14 @@ describe('ContactDetailsTabPeople', () => {
-
+
-
+
,
@@ -270,14 +270,14 @@ describe('ContactDetailsTabPeople', () => {
-
+
-
+
,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.tsx
index 7a057e350..661084114 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/ContactDetailsTabPeople.tsx
@@ -1,14 +1,11 @@
import React, { useState } from 'react';
-import AddIcon from '@mui/icons-material/Add';
import Cake from '@mui/icons-material/Cake';
-import CreateIcon from '@mui/icons-material/Create';
import Email from '@mui/icons-material/Email';
import MergeIcon from '@mui/icons-material/Merge';
import Phone from '@mui/icons-material/Phone';
import {
Avatar,
Box,
- Button,
Grid,
IconButton,
Link,
@@ -20,12 +17,13 @@ import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { MergePeopleModal } from 'src/components/Contacts/MassActions/MergePeople/MergePeopleModal';
import { useLocale } from 'src/hooks/useLocale';
-import { dateFromParts } from 'src/lib/intlFormat/intlFormat';
+import { dateFromParts } from 'src/lib/intlFormat';
import { RingIcon } from '../../../RingIcon';
import {
ContactDetailContext,
ContactDetailsType,
} from '../../ContactDetailContext';
+import { AddButton, AddIcon, AddText, EditIcon } from '../StyledComponents';
import {
ContactPeopleFragment,
ContactPersonFragment,
@@ -70,31 +68,10 @@ const ContactPersonIconContainer = styled(Box)(() => ({
marginRight: '35px',
}));
-const ContactDetailEditIcon = styled(CreateIcon)(({ theme }) => ({
- width: '18px',
- height: '18px',
- margin: theme.spacing(0),
- color: theme.palette.cruGrayMedium.main,
-}));
-
-export const ContactDetailsAddButton = styled(Button)(({ theme }) => ({
- margin: theme.spacing(1),
-}));
-
-export const ContactDetailsAddIcon = styled(AddIcon)(({ theme }) => ({
+const MergePeopleIcon = styled(MergeIcon)(({ theme }) => ({
color: theme.palette.info.main,
}));
-export const MergePeopleIcon = styled(MergeIcon)(({ theme }) => ({
- color: theme.palette.info.main,
-}));
-
-export const ContactDetailsAddText = styled(Typography)(({ theme }) => ({
- color: theme.palette.info.main,
- textTransform: 'uppercase',
- fontWeight: 'bold',
-}));
-
const ContactEditIconContainer = styled(IconButton)(({ theme }) => ({
margin: theme.spacing(0, 1),
}));
@@ -199,7 +176,7 @@ export const ContactDetailsTabPeople: React.FC = ({
onClick={() => setEditPersonModalOpen(person.id)}
aria-label={t('Edit Icon')}
>
-
+
{/* Phone Number */}
@@ -288,51 +265,42 @@ export const ContactDetailsTabPeople: React.FC = ({
person.id !== primaryPerson?.id ? personView(person) : null,
)}
{!selecting && (
- setCreatePersonModalOpen(true)}>
+ setCreatePersonModalOpen(true)}>
-
-
- {t('Add Person')}
-
+
+ {t('Add Person')}
-
+
)}
{people.nodes.length > 1 &&
(selecting ? (
<>
- setSelecting(false)}>
+ setSelecting(false)}>
-
- {t('Cancel')}
-
+ {t('Cancel')}
-
+
- setMergePeopleModalOpen(true)}
variant="contained"
disabled={selectedPeople.length < 2}
>
-
+
{t('Merge Selected People')}
-
+
-
+
>
) : (
- setSelecting(true)}>
+ setSelecting(true)}>
-
- {t('Merge People')}
-
+ {t('Merge People')}
-
+
))}
{createPersonModalOpen ? (
({
textDecoration: destroyed ? 'line-through' : 'none',
}));
-export const VerticallyCenteredGrid = styled(Grid)(() => ({
- margin: 'auto',
-}));
export const PersonEmailItem: React.FC = ({
emailAddress,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.stories.tsx
index f7b40fb81..14316fb27 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.stories.tsx
@@ -1,7 +1,7 @@
import React, { ReactElement, useState } from 'react';
import { Box, Button } from '@mui/material';
import { ThemeProvider } from '@mui/material/styles';
-import { gqlMock } from '../../../../../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import theme from '../../../../../../../theme';
import { ContactDetailsTabQuery } from '../../../ContactDetailsTab.generated';
import {
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.test.tsx
index ddecca699..274475c25 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.test.tsx
@@ -6,11 +6,8 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { cleanup, render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
+import { GqlMockedProvider, gqlMock } from '__tests__/util/graphqlMocking';
import { ContactDetailProvider } from 'src/components/Contacts/ContactDetails/ContactDetailContext';
-import {
- GqlMockedProvider,
- gqlMock,
-} from '../../../../../../../../__tests__/util/graphqlMocking';
import theme from '../../../../../../../theme';
import {
ContactDetailsTabDocument,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.tsx
index 362a08d47..2d79ab3fb 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModal.tsx
@@ -6,13 +6,10 @@ import {
CircularProgress,
DialogActions,
DialogContent,
- FormControlLabel,
- TextField,
Typography,
} from '@mui/material';
import { styled } from '@mui/material/styles';
import { Formik } from 'formik';
-import _ from 'lodash';
import { useSnackbar } from 'notistack';
import { useTranslation } from 'react-i18next';
import { useUpdateUserMutation } from 'src/components/Settings/preferences/UpdateUser.generated';
@@ -51,18 +48,6 @@ import { PersonShowMore } from './PersonShowMore/PersonShowMore';
import { formatSubmittedFields, getPersonSchema } from './personModalHelper';
import { uploadAvatar, validateAvatar } from './uploadAvatar';
-export const ContactInputField = styled(TextField, {
- shouldForwardProp: (prop) => prop !== 'destroyed',
-})(({ destroyed }: { destroyed: boolean }) => ({
- textDecoration: destroyed ? 'line-through' : 'none',
-}));
-
-export const PrimaryControlLabel = styled(FormControlLabel, {
- shouldForwardProp: (prop) => prop !== 'destroyed',
-})(({ destroyed }: { destroyed: boolean }) => ({
- textDecoration: destroyed ? 'line-through' : 'none',
-}));
-
const ContactPersonContainer = styled(Box)(({ theme }) => ({
margin: theme.spacing(2, 0),
}));
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModalSave.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModalSave.test.tsx
index dcc82cd2c..f4c0ec88d 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModalSave.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonModalSave.test.tsx
@@ -6,11 +6,8 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
+import { GqlMockedProvider, gqlMock } from '__tests__/util/graphqlMocking';
import { ContactDetailProvider } from 'src/components/Contacts/ContactDetails/ContactDetailContext';
-import {
- GqlMockedProvider,
- gqlMock,
-} from '../../../../../../../../__tests__/util/graphqlMocking';
import theme from '../../../../../../../theme';
import {
ContactPeopleFragment,
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonPhoneNumber/PersonPhoneNumberItem.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonPhoneNumber/PersonPhoneNumberItem.tsx
index 4dafbfb09..ccc4f6e93 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonPhoneNumber/PersonPhoneNumberItem.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/PersonPhoneNumber/PersonPhoneNumberItem.tsx
@@ -19,12 +19,12 @@ import {
} from 'src/graphql/types.generated';
import { ModalSectionContainer } from '../ModalSectionContainer/ModalSectionContainer';
import { ModalSectionDeleteIcon } from '../ModalSectionDeleteIcon/ModalSectionDeleteIcon';
-import { VerticallyCenteredGrid } from '../PersonEmail/PersonEmailItem';
+import { NewSocial } from '../PersonModal';
import {
ContactInputField,
- NewSocial,
PrimaryControlLabel,
-} from '../PersonModal';
+ VerticallyCenteredGrid,
+} from '../StyledComponents';
interface Props {
phoneNumber: PersonPhoneNumberInput & { source?: string };
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/StyledComponents.ts b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/StyledComponents.ts
new file mode 100644
index 000000000..bf4e0c176
--- /dev/null
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/People/Items/PersonModal/StyledComponents.ts
@@ -0,0 +1,18 @@
+import { FormControlLabel, Grid, TextField } from '@mui/material';
+import { styled } from '@mui/material/styles';
+
+export const ContactInputField = styled(TextField, {
+ shouldForwardProp: (prop) => prop !== 'destroyed',
+})(({ destroyed }: { destroyed: boolean }) => ({
+ textDecoration: destroyed ? 'line-through' : 'none',
+}));
+
+export const PrimaryControlLabel = styled(FormControlLabel, {
+ shouldForwardProp: (prop) => prop !== 'destroyed',
+})(({ destroyed }: { destroyed: boolean }) => ({
+ textDecoration: destroyed ? 'line-through' : 'none',
+}));
+
+export const VerticallyCenteredGrid = styled(Grid)(() => ({
+ margin: 'auto',
+}));
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/StyledComponents.ts b/src/components/Contacts/ContactDetails/ContactDetailsTab/StyledComponents.ts
new file mode 100644
index 000000000..1f1437701
--- /dev/null
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/StyledComponents.ts
@@ -0,0 +1,25 @@
+import Add from '@mui/icons-material/Add';
+import Create from '@mui/icons-material/Create';
+import { Button, Typography } from '@mui/material';
+import { styled } from '@mui/material/styles';
+
+export const AddIcon = styled(Add)(({ theme }) => ({
+ color: theme.palette.info.main,
+}));
+
+export const EditIcon = styled(Create)(({ theme }) => ({
+ width: '18px',
+ height: '18px',
+ margin: theme.spacing(0),
+ color: theme.palette.cruGrayMedium.main,
+}));
+
+export const AddButton = styled(Button)(({ theme }) => ({
+ margin: theme.spacing(1),
+}));
+
+export const AddText = styled(Typography)(({ theme }) => ({
+ color: theme.palette.info.main,
+ textTransform: 'uppercase',
+ fontWeight: 'bold',
+}));
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.stories.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.stories.tsx
index 73222d6d7..61df6882f 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.stories.tsx
@@ -1,7 +1,7 @@
import React, { ReactElement } from 'react';
import { Box } from '@mui/material';
import { ThemeProvider } from '@mui/material/styles';
-import { GqlMockedProvider } from '../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import theme from '../../../../../theme';
import { ContactTags } from './ContactTags';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.test.tsx
index 13e8aae7c..a7c3f655d 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.test.tsx
@@ -2,11 +2,8 @@ import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
-import { GqlMockedProvider } from '../../../../../../__tests__/util/graphqlMocking';
-import {
- render,
- waitFor,
-} from '../../../../../../__tests__/util/testingLibraryReactMock';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { render, waitFor } from '__tests__/util/testingLibraryReactMock';
import theme from '../../../../../theme';
import { ContactTags } from './ContactTags';
import { UpdateContactTagsMutation } from './ContactTags.generated';
diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.tsx
index 69f52213a..7c2e40183 100644
--- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Tags/ContactTags.tsx
@@ -1,11 +1,11 @@
import React, { ReactElement } from 'react';
-import TagIcon from '@mui/icons-material/LocalOfferOutlined';
-import { Autocomplete, Box, Button, Chip, TextField } from '@mui/material';
+import { Autocomplete, Box, Button, Chip } from '@mui/material';
import { styled } from '@mui/material/styles';
import { Formik, FormikHelpers } from 'formik';
import { useSnackbar } from 'notistack';
import { useTranslation } from 'react-i18next';
import * as yup from 'yup';
+import { ContactTagIcon, ContactTagInput } from 'src/components/Tags/Tags';
import {
useGetContactTagListQuery,
useUpdateContactTagsMutation,
@@ -24,36 +24,6 @@ const ContactTagChip = styled(Chip)(({ theme }) => ({
marginLeft: '0',
}));
-export const ContactTagIcon = styled(TagIcon)(({ theme }) => ({
- color: theme.palette.cruGrayMedium.main,
- marginRight: theme.spacing(1),
-}));
-
-export const ContactTagInput = styled(TextField)(({ theme }) => ({
- '&& .MuiInput-underline:before ': {
- borderBottom: `2px solid ${theme.palette.divider}`,
- },
- '&& .MuiInput-underline:after ': {
- borderBottom: `2px solid ${theme.palette.divider}`,
- },
- '&& .MuiInputBase-input': {
- minWidth: '200px',
- },
- '& ::placeholder': {
- color: theme.palette.info.main,
- opacity: 1,
- },
- '& :hover::placeholder': {
- textDecoration: 'underline',
- },
- '& :focus::placeholder': {
- textDecoration: 'none',
- color: theme.palette.cruGrayMedium.main,
- },
- margin: theme.spacing(1),
- marginLeft: '0',
-}));
-
const SaveButton = styled(Button)(({ theme }) => ({
color: theme.palette.info.main,
height: theme.spacing(4),
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.stories.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.stories.tsx
index a9776bc06..c65561334 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { DateTime } from 'luxon';
-import { GqlMockedProvider } from '../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { ContactDonationsList } from './ContactDonationsList';
import { ContactDonationsListQuery } from './ContactDonationsList.generated';
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.test.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.test.tsx
index c90fd73be..fcb83db67 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.test.tsx
@@ -121,13 +121,13 @@ describe('ContactDonationsList', () => {
});
it('edits donations', async () => {
- const { findAllByRole, getByText } = render();
+ const { findAllByRole, findByText } = render();
const rows = await findAllByRole('row');
expect(rows).toHaveLength(6);
const donationRow = rows[1];
userEvent.click(within(donationRow).getByRole('button'));
- expect(getByText('Edit Donation')).toBeInTheDocument();
+ expect(await findByText('Edit Donation')).toBeInTheDocument();
});
});
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.tsx
index d4c29ce74..0b9cb85bc 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsList/ContactDonationsList.tsx
@@ -3,24 +3,24 @@ import EditIcon from '@mui/icons-material/Edit';
import {
Button,
IconButton,
+ Skeleton,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
} from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
import { styled } from '@mui/material/styles';
import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
-import { EditDonationModal } from 'src/components/EditDonationModal/EditDonationModal';
+import {
+ DynamicEditDonationModal,
+ preloadEditDonationModal,
+} from 'src/components/EditDonationModal/DynamicEditDonationModal';
import { EditDonationModalDonationFragment } from 'src/components/EditDonationModal/EditDonationModal.generated';
import { useGetAccountListCurrencyQuery } from 'src/components/Reports/DonationsReport/GetDonationsTable.generated';
import { useLocale } from 'src/hooks/useLocale';
-import {
- currencyFormat,
- dateFormat,
-} from '../../../../../lib/intlFormat/intlFormat';
+import { currencyFormat, dateFormat } from 'src/lib/intlFormat';
import { useContactDonationsListQuery } from './ContactDonationsList.generated';
interface ContactDonationsListProp {
@@ -123,6 +123,7 @@ export const ContactDonationsList: React.FC = ({
onClick={() => {
setEditingDonation(donation);
}}
+ onMouseEnter={preloadEditDonationModal}
>
@@ -149,7 +150,7 @@ export const ContactDonationsList: React.FC = ({
>
)}
{editingDonation && (
- setEditingDonation(null)}
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.stories.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.stories.tsx
index e93754289..cef938479 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.stories.tsx
@@ -1,7 +1,7 @@
import React, { ReactElement } from 'react';
import { MockedProvider } from '@apollo/client/testing';
import { DateTime } from 'luxon';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { ContactDetailProvider } from '../ContactDetailContext';
import { ContactDonationsTab } from './ContactDonationsTab';
import {
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.test.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.test.tsx
index 38984e339..d7f6c006f 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.test.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { DateTime } from 'luxon';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
-import { render } from '../../../../../__tests__/util/testingLibraryReactMock';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { render } from '__tests__/util/testingLibraryReactMock';
import { ContactDetailProvider } from '../ContactDetailContext';
import { ContactDonationsTab } from './ContactDonationsTab';
import { GetContactDonationsQuery } from './ContactDonationsTab.generated';
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.tsx
index 958f483bf..78ef0b8c9 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/ContactDonationsTab.tsx
@@ -2,8 +2,7 @@ import React from 'react';
import TabContext from '@mui/lab/TabContext';
import TabList from '@mui/lab/TabList';
import TabPanel from '@mui/lab/TabPanel';
-import { Box, Tab } from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
+import { Box, Skeleton, Tab } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next/';
import {
@@ -15,6 +14,7 @@ import {
GetContactDonationsQueryVariables,
useGetContactDonationsQuery,
} from './ContactDonationsTab.generated';
+import { DonationTabKey } from './DonationTabKey';
import { DonationsGraph } from './DonationsGraph/DonationsGraph';
import { PartnershipInfo } from './PartnershipInfo/PartnershipInfo';
@@ -61,11 +61,6 @@ export type ContactDonationsFilter = Omit<
'accountListId'
>;
-export enum DonationTabKey {
- Donations = 'Donations',
- PartnershipInfo = 'Partnership Info',
-}
-
export const ContactDonationsTab: React.FC = ({
accountListId,
contactId,
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationTabKey.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationTabKey.tsx
new file mode 100644
index 000000000..86a689081
--- /dev/null
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationTabKey.tsx
@@ -0,0 +1,4 @@
+export enum DonationTabKey {
+ Donations = 'Donations',
+ PartnershipInfo = 'Partnership Info',
+}
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.stories.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.stories.tsx
index 99eb1037c..8ea13785e 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.stories.tsx
@@ -2,7 +2,7 @@ import React, { ReactElement } from 'react';
import { MockedProvider } from '@apollo/client/testing';
import { Box } from '@mui/material';
import { DateTime } from 'luxon';
-import { GqlMockedProvider } from '../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { GetContactDonationsQuery } from '../ContactDonationsTab.generated';
import { DonationsGraph } from './DonationsGraph';
import { GetDonationsGraphDocument } from './DonationsGraph.generated';
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.test.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.test.tsx
index e6927735c..8938b5b70 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.test.tsx
@@ -1,8 +1,8 @@
import React from 'react';
import { MockedProvider } from '@apollo/client/testing';
import { renderHook } from '@testing-library/react-hooks';
-import { GqlMockedProvider } from '../../../../../../__tests__/util/graphqlMocking';
-import { render } from '../../../../../../__tests__/util/testingLibraryReactMock';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { render } from '__tests__/util/testingLibraryReactMock';
import { DonationsGraph } from './DonationsGraph';
import {
GetDonationsGraphDocument,
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.tsx
index 2168ab0d5..70b09f60e 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/DonationsGraph/DonationsGraph.tsx
@@ -1,7 +1,5 @@
import React, { useMemo } from 'react';
-import Box from '@mui/material/Box';
-import Skeleton from '@mui/material/Skeleton';
-import Typography from '@mui/material/Typography';
+import { Box, Skeleton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/DynamicContactDonationsTab.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/DynamicContactDonationsTab.tsx
new file mode 100644
index 000000000..2421d0538
--- /dev/null
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/DynamicContactDonationsTab.tsx
@@ -0,0 +1,11 @@
+import dynamic from 'next/dynamic';
+import { DynamicComponentPlaceholder } from 'src/components/DynamicPlaceholders/DynamicComponentPlaceholder';
+
+export const preloadContactDonationsTab = () =>
+ import(
+ /* webpackChunkName: "ContactDonationsTab" */ './ContactDonationsTab'
+ ).then(({ ContactDonationsTab }) => ContactDonationsTab);
+
+export const DynamicContactDonationsTab = dynamic(preloadContactDonationsTab, {
+ loading: DynamicComponentPlaceholder,
+});
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.test.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.test.tsx
index ea0333b13..d8b0e3354 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/EditPartnershipInfoModal/EditPartnershipInfoModal.test.tsx
@@ -5,16 +5,13 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
+import { GqlMockedProvider, gqlMock } from '__tests__/util/graphqlMocking';
import {
LikelyToGiveEnum,
PledgeFrequencyEnum,
SendNewsletterEnum,
StatusEnum,
} from 'src/graphql/types.generated';
-import {
- GqlMockedProvider,
- gqlMock,
-} from '../../../../../../../__tests__/util/graphqlMocking';
import theme from '../../../../../../theme';
import {
ContactDonorAccountsFragment,
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.stories.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.stories.tsx
index f7e544205..8701b6cc2 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { DateTime } from 'luxon';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import {
ContactDonorAccountsFragment,
ContactDonorAccountsFragmentDoc,
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.test.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.test.tsx
index c2303fc76..6da1c81f5 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.test.tsx
@@ -6,13 +6,10 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import userEvent from '@testing-library/user-event';
import { DateTime } from 'luxon';
import { SnackbarProvider } from 'notistack';
+import { gqlMock } from '__tests__/util/graphqlMocking';
+import { render, waitFor } from '__tests__/util/testingLibraryReactMock';
import { LoadConstantsDocument } from 'src/components/Constants/LoadConstants.generated';
import { PledgeFrequencyEnum, StatusEnum } from 'src/graphql/types.generated';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
-import {
- render,
- waitFor,
-} from '../../../../../../__tests__/util/testingLibraryReactMock';
import theme from '../../../../../theme';
import {
ContactDonorAccountsFragment,
diff --git a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.tsx b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.tsx
index b1c151596..0b3700b56 100644
--- a/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.tsx
+++ b/src/components/Contacts/ContactDetails/ContactDonationsTab/PartnershipInfo/PartnershipInfo.tsx
@@ -10,7 +10,7 @@ import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
import { useLoadConstantsQuery } from 'src/components/Constants/LoadConstants.generated';
import { useLocale } from 'src/hooks/useLocale';
-import { dateFormat } from 'src/lib/intlFormat/intlFormat';
+import { dateFormat } from 'src/lib/intlFormat';
import { getLocalizedPledgeFrequency } from 'src/utils/functions/getLocalizedPledgeFrequency';
import { currencyFormat } from '../../../../../lib/intlFormat';
import { HandshakeIcon } from '../../ContactDetailsHeader/ContactHeaderSection/HandshakeIcon';
diff --git a/src/components/Contacts/ContactDetails/ContactNotesTab/ContactNotesTab.test.tsx b/src/components/Contacts/ContactDetails/ContactNotesTab/ContactNotesTab.test.tsx
index 4f8c8d805..446d934e0 100644
--- a/src/components/Contacts/ContactDetails/ContactNotesTab/ContactNotesTab.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactNotesTab/ContactNotesTab.test.tsx
@@ -2,7 +2,7 @@ import React from 'react';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { ContactDetailProvider } from '../ContactDetailContext';
import { ContactNotesTab } from './ContactNotesTab';
diff --git a/src/components/Contacts/ContactDetails/ContactNotesTab/ContactNotesTab.tsx b/src/components/Contacts/ContactDetails/ContactNotesTab/ContactNotesTab.tsx
index 31de750e2..fcd038a64 100644
--- a/src/components/Contacts/ContactDetails/ContactNotesTab/ContactNotesTab.tsx
+++ b/src/components/Contacts/ContactDetails/ContactNotesTab/ContactNotesTab.tsx
@@ -1,6 +1,6 @@
import React, { useCallback, useEffect } from 'react';
import { TextField } from '@mui/material';
-import debounce from 'lodash/debounce';
+import { debounce } from 'lodash';
import { DateTime } from 'luxon';
import { useSnackbar } from 'notistack';
import { useTranslation } from 'react-i18next';
diff --git a/src/components/Contacts/ContactDetails/ContactNotesTab/DynamicContactNotesTab.tsx b/src/components/Contacts/ContactDetails/ContactNotesTab/DynamicContactNotesTab.tsx
new file mode 100644
index 000000000..a478b9634
--- /dev/null
+++ b/src/components/Contacts/ContactDetails/ContactNotesTab/DynamicContactNotesTab.tsx
@@ -0,0 +1,11 @@
+import dynamic from 'next/dynamic';
+import { DynamicComponentPlaceholder } from 'src/components/DynamicPlaceholders/DynamicComponentPlaceholder';
+
+export const preloadContactNotesTab = () =>
+ import(/* webpackChunkName: "ContactNotesTab" */ './ContactNotesTab').then(
+ ({ ContactNotesTab }) => ContactNotesTab,
+ );
+
+export const DynamicContactNotesTab = dynamic(preloadContactNotesTab, {
+ loading: DynamicComponentPlaceholder,
+});
diff --git a/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.stories.tsx b/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.stories.tsx
index ac2c189fc..24cf06c8f 100644
--- a/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.stories.tsx
@@ -1,7 +1,7 @@
import React, { ReactElement } from 'react';
import { MockedProvider } from '@apollo/client/testing';
import { Box } from '@mui/material';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { ContactReferralTab } from './ContactReferralTab';
import { ContactReferralTabDocument } from './ContactReferralTab.generated';
diff --git a/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.test.tsx b/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.test.tsx
index cae106f2d..17c6cf4a8 100644
--- a/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.test.tsx
@@ -1,8 +1,8 @@
import React from 'react';
import { renderHook } from '@testing-library/react-hooks';
import userEvent from '@testing-library/user-event';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
-import { render } from '../../../../../__tests__/util/testingLibraryReactMock';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { render } from '__tests__/util/testingLibraryReactMock';
import { ContactReferralTab } from './ContactReferralTab';
import {
ContactReferralTabQuery,
diff --git a/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.tsx b/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.tsx
index 8e08eec2d..906d810d6 100644
--- a/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.tsx
+++ b/src/components/Contacts/ContactDetails/ContactReferralTab/ContactReferralTab.tsx
@@ -4,6 +4,7 @@ import {
Box,
Button,
Paper,
+ Skeleton,
Table,
TableBody,
TableCell,
@@ -12,15 +13,17 @@ import {
TableRow,
Typography,
} from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
import { styled } from '@mui/material/styles';
import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
-import { CreateMultipleContacts } from 'src/components/Layouts/Primary/TopBar/Items/AddMenu/Items/CreateMultipleContacts/CreateMultipleContacts';
+import {
+ DynamicCreateMultipleContacts,
+ preloadCreateMultipleContacts,
+} from 'src/components/Layouts/Primary/TopBar/Items/AddMenu/Items/CreateMultipleContacts/DynamicCreateMultipleContacts';
import Modal from 'src/components/common/Modal/Modal';
import { useFetchAllPages } from 'src/hooks/useFetchAllPages';
import { useLocale } from 'src/hooks/useLocale';
-import { dateFormat } from 'src/lib/intlFormat/intlFormat';
+import { dateFormat } from 'src/lib/intlFormat';
import { useContactReferralTabQuery } from './ContactReferralTab.generated';
const ContactReferralContainer = styled(Box)(({ theme }) => ({
@@ -99,7 +102,10 @@ export const ContactReferralTab: React.FC = ({
) : (
<>
-
+
{t('Add Referrals')}
@@ -149,7 +155,7 @@ export const ContactReferralTab: React.FC = ({
fullWidth
size={'xl'} // TODO: Expand logic as more menu modals are added
>
-
+ import(
+ /* webpackChunkName: "ContactReferralTab" */ './ContactReferralTab'
+ ).then(({ ContactReferralTab }) => ContactReferralTab);
+
+export const DynamicContactReferralTab = dynamic(preloadContactReferralTab, {
+ loading: DynamicComponentPlaceholder,
+});
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.stories.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.stories.tsx
index d25cfb576..ae49c40ed 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
+import { gqlMock } from '__tests__/util/graphqlMocking';
import { ResultEnum } from 'src/graphql/types.generated';
-import { gqlMock } from '../../../../../../__tests__/util/graphqlMocking';
import {
TaskRowFragment,
TaskRowFragmentDoc,
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.test.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.test.tsx
index 3f878a496..ce7e9c185 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.test.tsx
@@ -2,11 +2,8 @@ import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
+import { GqlMockedProvider, gqlMock } from '__tests__/util/graphqlMocking';
import { ActivityTypeEnum, ResultEnum } from 'src/graphql/types.generated';
-import {
- GqlMockedProvider,
- gqlMock,
-} from '../../../../../../__tests__/util/graphqlMocking';
import useTaskModal from '../../../../../hooks/useTaskModal';
import theme from '../../../../../theme';
import {
@@ -26,6 +23,7 @@ const onTaskCheckToggle = jest.fn();
beforeEach(() => {
(useTaskModal as jest.Mock).mockReturnValue({
openTaskModal,
+ preloadTaskModal: jest.fn(),
});
});
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.tsx
index 0f8ca0111..7f36f2ed3 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/ContactTaskRow.tsx
@@ -1,6 +1,5 @@
import React, { useState } from 'react';
-import { Box, Checkbox, Typography } from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
+import { Box, Checkbox, Skeleton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
@@ -101,7 +100,7 @@ export const ContactTaskRow: React.FC = ({
const { t } = useTranslation();
const [hasBeenDeleted, setHasBeenDeleted] = useState(false);
- const { openTaskModal } = useTaskModal();
+ const { openTaskModal, preloadTaskModal } = useTaskModal();
const handleCompleteButtonPressed = () => {
openTaskModal({
@@ -167,9 +166,13 @@ export const ContactTaskRow: React.FC = ({
preloadTaskModal('complete')}
/>
-
+ preloadTaskModal('edit')}
+ >
{getLocalizedTaskType(t, activityType)}
{subject}
@@ -183,6 +186,7 @@ export const ContactTaskRow: React.FC = ({
isComplete={isComplete}
numberOfComments={comments?.totalCount}
onClick={handleCommentButtonPressed}
+ onMouseEnter={() => preloadTaskModal('comments')}
detailsPage
/>
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCommentsButton/TaskCommentsButton.test.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCommentsButton/TaskCommentsButton.test.tsx
index 16beb1df7..a91618d62 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCommentsButton/TaskCommentsButton.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCommentsButton/TaskCommentsButton.test.tsx
@@ -71,6 +71,6 @@ describe('TaskCommentsButton', () => {
userEvent.click(commentsButton);
- expect(onClick).toHaveBeenCalledWith();
+ expect(onClick).toHaveBeenCalled();
});
});
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCommentsButton/TaskCommentsButton.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCommentsButton/TaskCommentsButton.tsx
index 7f53dc4a6..b6efcc7a1 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCommentsButton/TaskCommentsButton.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCommentsButton/TaskCommentsButton.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import ChatBubbleOutline from '@mui/icons-material/ChatBubbleOutline';
-import { Button, Typography } from '@mui/material';
+import { Button, ButtonProps, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import theme from 'src/theme';
@@ -34,10 +34,9 @@ const TaskCommentNumber = styled(Typography, {
margin: theme.spacing(0.5),
}));
-interface TaskCommentsButtonProps {
+interface TaskCommentsButtonProps extends ButtonProps {
isComplete: boolean;
numberOfComments: number;
- onClick: () => void;
small?: boolean;
detailsPage?: boolean;
}
@@ -45,15 +44,15 @@ interface TaskCommentsButtonProps {
export const TaskCommentsButton: React.FC = ({
isComplete,
numberOfComments = 0,
- onClick,
small,
detailsPage,
+ ...props
}) => {
return (
onClick()}
small={small || false}
detailsPage={detailsPage || false}
+ {...props}
>
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCompleteButton/TaskCompleteButton.test.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCompleteButton/TaskCompleteButton.test.tsx
index 7c0144932..c66be3f1e 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCompleteButton/TaskCompleteButton.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCompleteButton/TaskCompleteButton.test.tsx
@@ -73,6 +73,6 @@ describe('TaskCompleteButton', () => {
userEvent.click(completeButton);
- expect(onClick).toHaveBeenCalledWith();
+ expect(onClick).toHaveBeenCalled();
});
});
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCompleteButton/TaskCompleteButton.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCompleteButton/TaskCompleteButton.tsx
index 0b8be1f04..7ea00352a 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCompleteButton/TaskCompleteButton.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTaskRow/TaskCompleteButton/TaskCompleteButton.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import Check from '@mui/icons-material/Check';
-import { Button } from '@mui/material';
+import { Button, ButtonProps } from '@mui/material';
import { styled } from '@mui/material/styles';
import theme from 'src/theme';
@@ -23,17 +23,16 @@ const ButtonWrap = styled(Button, {
},
}));
-interface TaskCompleteButtonProps {
+interface TaskCompleteButtonProps extends ButtonProps {
isComplete: boolean;
- onClick: () => void;
}
export const TaskCompleteButton: React.FC = ({
isComplete,
- onClick,
+ ...props
}) => {
return (
- onClick()}>
+
);
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.stories.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.stories.tsx
index b442e52f5..b220c8bdb 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.stories.tsx
@@ -2,7 +2,7 @@ import React, { ReactElement } from 'react';
import { MockedProvider } from '@apollo/client/testing';
import { CssBaseline } from '@mui/material';
import { ThemeProvider } from '@mui/material/styles';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import theme from '../../../../theme';
import { ContactTasksTab } from './ContactTasksTab';
import { ContactTasksTabDocument } from './ContactTasksTab.generated';
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.test.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.test.tsx
index 4b3c45bae..57bdc55cb 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.test.tsx
@@ -3,8 +3,8 @@ import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { DateTime } from 'luxon';
import { VirtuosoMockContext } from 'react-virtuoso';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { useAccountListId } from 'src/hooks/useAccountListId';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
import useTaskModal from '../../../../hooks/useTaskModal';
import theme from '../../../../theme';
import { TasksMassActionsDropdown } from '../../../Shared/MassActions/TasksMassActionsDropdown';
@@ -31,6 +31,7 @@ const router = {
beforeEach(() => {
(useTaskModal as jest.Mock).mockReturnValue({
openTaskModal,
+ preloadTaskModal: jest.fn(),
});
(useAccountListId as jest.Mock).mockReturnValue(router);
});
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.tsx
index 075348c1a..b48380af5 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/ContactTasksTab.tsx
@@ -143,7 +143,7 @@ export const ContactTasksTab: React.FC = ({
deselectAll,
} = useMassSelection(data?.tasks?.totalCount ?? 0, allTaskIds);
- const { openTaskModal } = useTaskModal();
+ const { openTaskModal, preloadTaskModal } = useTaskModal();
const { t } = useTranslation();
@@ -165,6 +165,7 @@ export const ContactTasksTab: React.FC = ({
defaultValues: { contactIds: [contactId] },
})
}
+ onMouseEnter={() => preloadTaskModal('add')}
>
{t('add task')}
@@ -179,6 +180,7 @@ export const ContactTasksTab: React.FC = ({
},
})
}
+ onMouseEnter={() => preloadTaskModal('log')}
>
{t('log task')}
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/DeleteTaskIconButton/DeleteTaskIconButton.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/DeleteTaskIconButton/DeleteTaskIconButton.tsx
index ca5a6e820..4de903911 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/DeleteTaskIconButton/DeleteTaskIconButton.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/DeleteTaskIconButton/DeleteTaskIconButton.tsx
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
-import { DialogActions, IconButton } from '@mui/material';
+import { IconButton } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { DeletedItemIcon } from '../../../../common/DeleteItemIcon/DeleteItemIcon';
@@ -9,10 +9,6 @@ const DeleteButton = styled(IconButton)(({ theme }) => ({
margin: theme.spacing(1),
}));
-export const StyledDialogActions = styled(DialogActions)(({ theme }) => ({
- padding: `${theme.spacing(2)}px ${theme.spacing(3)}px`,
-}));
-
interface DeleteTaskIconButtonProps {
accountListId: string;
taskId: string;
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/NullState/ContactTasksTabNullState.test.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/NullState/ContactTasksTabNullState.test.tsx
index 349c57fc7..df9bceb55 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/NullState/ContactTasksTabNullState.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/NullState/ContactTasksTabNullState.test.tsx
@@ -2,11 +2,8 @@ import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
-import TestWrapper from '../../../../../../__tests__/util/TestWrapper';
-import {
- render,
- waitFor,
-} from '../../../../../../__tests__/util/testingLibraryReactMock';
+import TestWrapper from '__tests__/util/TestWrapper';
+import { render, waitFor } from '__tests__/util/testingLibraryReactMock';
import useTaskModal from '../../../../../hooks/useTaskModal';
import theme from '../../../../../theme';
import { ContactTasksTabNullState } from './ContactTasksTabNullState';
@@ -14,12 +11,13 @@ import { ContactTasksTabNullState } from './ContactTasksTabNullState';
const contactId = 'abc';
const openTaskModal = jest.fn();
-jest.mock('../../../../../../src/hooks/useTaskModal');
+jest.mock('src/hooks/useTaskModal');
describe('ContactTasksTabNullState', () => {
beforeEach(() => {
(useTaskModal as jest.Mock).mockReturnValue({
openTaskModal,
+ preloadTaskModal: jest.fn(),
});
});
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/NullState/ContactTasksTabNullState.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/NullState/ContactTasksTabNullState.tsx
index 52720464b..14c1be4c5 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/NullState/ContactTasksTabNullState.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/NullState/ContactTasksTabNullState.tsx
@@ -24,7 +24,7 @@ export const ContactTasksTabNullState: React.FC<
ContactTasksTabNullStateProps
> = ({ contactId }) => {
const { t } = useTranslation();
- const { openTaskModal } = useTaskModal();
+ const { openTaskModal, preloadTaskModal } = useTaskModal();
return (
@@ -43,6 +43,7 @@ export const ContactTasksTabNullState: React.FC<
defaultValues: { contactIds: [contactId] },
})
}
+ onMouseEnter={() => preloadTaskModal('add')}
>
{t('Add New Task')}
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.stories.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.stories.tsx
index 868f082d4..8722f15e4 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.stories.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.stories.tsx
@@ -1,5 +1,5 @@
import React, { ReactElement } from 'react';
-import { GqlMockedProvider } from '../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { SetTaskStarredMutation } from './SetTaskStarred.generated';
import { StarTaskIconButton } from './StarTaskIconButton';
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.test.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.test.tsx
index fac8eba49..43529364a 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.test.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.test.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { render } from '@testing-library/react';
-import { GqlMockedProvider } from '../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import theme from '../../../../../theme';
import { StarTaskIconButton } from './StarTaskIconButton';
diff --git a/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.tsx b/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.tsx
index 0edca541b..412527bdf 100644
--- a/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.tsx
+++ b/src/components/Contacts/ContactDetails/ContactTasksTab/StarTaskIconButton/StarTaskIconButton.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import IconButton from '@mui/material/IconButton';
+import { IconButton } from '@mui/material';
import { styled } from '@mui/material/styles';
import { StarredItemIcon } from '../../../../common/StarredItemIcon/StarredItemIcon';
import { useSetTaskStarredMutation } from './SetTaskStarred.generated';
diff --git a/src/components/Contacts/ContactFlow/ContactFlow.tsx b/src/components/Contacts/ContactFlow/ContactFlow.tsx
index 0e4d787cc..13f571d1e 100644
--- a/src/components/Contacts/ContactFlow/ContactFlow.tsx
+++ b/src/components/Contacts/ContactFlow/ContactFlow.tsx
@@ -1,7 +1,10 @@
import React from 'react';
import { Box } from '@mui/material';
import { useSnackbar } from 'notistack';
+import { DndProvider } from 'react-dnd';
+import { HTML5Backend } from 'react-dnd-html5-backend';
import { useTranslation } from 'react-i18next';
+import { ContactsDocument } from 'pages/accountLists/[accountListId]/contacts/Contacts.generated';
import {
ActivityTypeEnum,
ContactFilterSetInput,
@@ -10,11 +13,11 @@ import {
StatusEnum,
} from 'src/graphql/types.generated';
import useTaskModal from 'src/hooks/useTaskModal';
-import { ContactsDocument } from '../../../../pages/accountLists/[accountListId]/contacts/Contacts.generated';
import theme from '../../../theme';
import Loading from '../../Loading';
import { useUpdateContactOtherMutation } from '../ContactDetails/ContactDetailsTab/Other/EditContactOtherModal/EditContactOther.generated';
import { ContactFlowColumn } from './ContactFlowColumn/ContactFlowColumn';
+import { ContactFlowDragLayer } from './ContactFlowDragLayer/ContactFlowDragLayer';
import { useGetUserOptionsQuery } from './GetUserOptions.generated';
interface Props {
@@ -133,40 +136,43 @@ export const ContactFlow: React.FC = ({
) : (
flowOptions && (
-
- {flowOptions.map((column) => (
-
- statusMap[status] as ContactFilterStatusEnum,
- )}
- changeContactStatus={changeContactStatus}
- searchTerm={searchTerm}
- />
-
- ))}
-
+
+
+
+ {flowOptions.map((column) => (
+
+ statusMap[status] as ContactFilterStatusEnum,
+ )}
+ changeContactStatus={changeContactStatus}
+ searchTerm={searchTerm}
+ />
+
+ ))}
+
+
)
);
};
diff --git a/src/components/Contacts/ContactFlow/ContactFlowColumn/ContactFlowColumn.test.tsx b/src/components/Contacts/ContactFlow/ContactFlowColumn/ContactFlowColumn.test.tsx
index 7a18f935f..7eb0add7d 100644
--- a/src/components/Contacts/ContactFlow/ContactFlowColumn/ContactFlowColumn.test.tsx
+++ b/src/components/Contacts/ContactFlow/ContactFlowColumn/ContactFlowColumn.test.tsx
@@ -5,14 +5,14 @@ import { SnackbarProvider } from 'notistack';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import { VirtuosoMockContext } from 'react-virtuoso';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
+import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactsQuery } from 'pages/accountLists/[accountListId]/contacts/Contacts.generated';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import {
ContactFilterStatusEnum,
StatusEnum,
} from 'src/graphql/types.generated';
-import TestRouter from '../../../../../__tests__/util/TestRouter';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
-import { ContactsQuery } from '../../../../../pages/accountLists/[accountListId]/contacts/Contacts.generated';
import theme from '../../../../theme';
import { ContactFlowColumn } from './ContactFlowColumn';
@@ -52,7 +52,7 @@ describe('ContactFlowColumn', () => {
},
}}
>
-
+
@@ -66,7 +66,7 @@ describe('ContactFlowColumn', () => {
statuses={[ContactFilterStatusEnum.PartnerFinancial]}
/>
-
+
diff --git a/src/components/Contacts/ContactFlow/ContactFlowColumn/ContactFlowColumn.tsx b/src/components/Contacts/ContactFlow/ContactFlowColumn/ContactFlowColumn.tsx
index ff0da5061..2e28e0b5b 100644
--- a/src/components/Contacts/ContactFlow/ContactFlowColumn/ContactFlowColumn.tsx
+++ b/src/components/Contacts/ContactFlow/ContactFlowColumn/ContactFlowColumn.tsx
@@ -7,16 +7,16 @@ import {
Typography,
} from '@mui/material';
import { useDrop } from 'react-dnd';
+import { useContactsQuery } from 'pages/accountLists/[accountListId]/contacts/Contacts.generated';
import {
ContactsContext,
ContactsType,
-} from 'pages/accountLists/[accountListId]/contacts/ContactsContext';
+} from 'src/components/Contacts/ContactsContext/ContactsContext';
import {
ContactFilterSetInput,
ContactFilterStatusEnum,
IdValue,
} from 'src/graphql/types.generated';
-import { useContactsQuery } from '../../../../../pages/accountLists/[accountListId]/contacts/Contacts.generated';
import theme from '../../../../theme';
import { useLoadConstantsQuery } from '../../../Constants/LoadConstants.generated';
import { InfiniteList } from '../../../InfiniteList/InfiniteList';
diff --git a/src/components/Contacts/ContactFlow/ContactFlowDropZone/ContactFlowDropZone.tsx b/src/components/Contacts/ContactFlow/ContactFlowDropZone/ContactFlowDropZone.tsx
index df6d68432..6a13a37f8 100644
--- a/src/components/Contacts/ContactFlow/ContactFlowDropZone/ContactFlowDropZone.tsx
+++ b/src/components/Contacts/ContactFlow/ContactFlowDropZone/ContactFlowDropZone.tsx
@@ -1,6 +1,5 @@
import React from 'react';
-import Box from '@mui/material/Box';
-import Typography from '@mui/material/Typography';
+import { Box, Typography } from '@mui/material';
import { useDrop } from 'react-dnd';
import { useTranslation } from 'react-i18next';
import { IdValue } from 'src/graphql/types.generated';
diff --git a/src/components/Contacts/ContactFlow/ContactFlowRow/ContactFlowRow.test.tsx b/src/components/Contacts/ContactFlow/ContactFlowRow/ContactFlowRow.test.tsx
index 711b87cb1..8370adbad 100644
--- a/src/components/Contacts/ContactFlow/ContactFlowRow/ContactFlowRow.test.tsx
+++ b/src/components/Contacts/ContactFlow/ContactFlowRow/ContactFlowRow.test.tsx
@@ -4,8 +4,8 @@ import { render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
+import TestWrapper from '__tests__/util/TestWrapper';
import { StatusEnum } from 'src/graphql/types.generated';
-import TestWrapper from '../../../../../__tests__/util/TestWrapper';
import theme from '../../../../theme';
import { ContactFlowRow } from './ContactFlowRow';
diff --git a/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/ContactFlowSetupColumn.test.tsx b/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/ContactFlowSetupColumn.test.tsx
index ded4a2651..0833a2777 100644
--- a/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/ContactFlowSetupColumn.test.tsx
+++ b/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/ContactFlowSetupColumn.test.tsx
@@ -5,8 +5,8 @@ import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
+import TestRouter from '__tests__/util/TestRouter';
import { ContactFilterStatusEnum } from 'src/graphql/types.generated';
-import TestRouter from '../../../../../../__tests__/util/TestRouter';
import theme from '../../../../../theme';
import { ContactFlowSetupColumn } from './ContactFlowSetupColumn';
diff --git a/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/ContactFlowSetupColumn.tsx b/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/ContactFlowSetupColumn.tsx
index 4ab799cda..1b58e295f 100644
--- a/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/ContactFlowSetupColumn.tsx
+++ b/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/ContactFlowSetupColumn.tsx
@@ -11,7 +11,7 @@ import FiberManualRecord from '@mui/icons-material/FiberManualRecord';
import Menu from '@mui/icons-material/Menu';
import { Box, Card, CardContent, IconButton, TextField } from '@mui/material';
import { styled } from '@mui/material/styles';
-import debounce from 'lodash/fp/debounce';
+import { debounce } from 'lodash';
import { DropTargetMonitor, useDrag, useDrop } from 'react-dnd';
import { ContactFilterStatusEnum } from 'src/graphql/types.generated';
import theme from 'src/theme';
@@ -117,9 +117,9 @@ export const ContactFlowSetupColumn: React.FC = ({
onTitleChange(event, index);
};
const onTitleChange = useCallback(
- debounce(200, (event, index) => {
+ debounce((event, index) => {
changeTitle(event, index);
- }),
+ }, 200),
[flowOptions],
);
diff --git a/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/UnusedStatusesColumn.test.tsx b/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/UnusedStatusesColumn.test.tsx
index b2bb2c5eb..ed104866a 100644
--- a/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/UnusedStatusesColumn.test.tsx
+++ b/src/components/Contacts/ContactFlow/ContactFlowSetup/Column/UnusedStatusesColumn.test.tsx
@@ -4,8 +4,8 @@ import { render, waitFor } from '@testing-library/react';
import { SnackbarProvider } from 'notistack';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
+import TestRouter from '__tests__/util/TestRouter';
import { ContactFilterStatusEnum } from 'src/graphql/types.generated';
-import TestRouter from '../../../../../../__tests__/util/TestRouter';
import theme from '../../../../../theme';
import { UnusedStatusesColumn } from './UnusedStatusesColumn';
diff --git a/src/components/Contacts/ContactFlow/ContactFlowSetup/DropZone/ContactFlowSetupDropZone.test.tsx b/src/components/Contacts/ContactFlow/ContactFlowSetup/DropZone/ContactFlowSetupDropZone.test.tsx
index dcb29c5ee..63394bd7c 100644
--- a/src/components/Contacts/ContactFlow/ContactFlowSetup/DropZone/ContactFlowSetupDropZone.test.tsx
+++ b/src/components/Contacts/ContactFlow/ContactFlowSetup/DropZone/ContactFlowSetupDropZone.test.tsx
@@ -4,8 +4,8 @@ import { fireEvent, render, waitFor } from '@testing-library/react';
import { SnackbarProvider } from 'notistack';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
+import TestRouter from '__tests__/util/TestRouter';
import { ContactFilterStatusEnum } from 'src/graphql/types.generated';
-import TestRouter from '../../../../../../__tests__/util/TestRouter';
import theme from '../../../../../theme';
import { ContactFlowSetupColumn } from '../Column/ContactFlowSetupColumn';
diff --git a/src/components/Contacts/ContactFlow/ContactFlowSetup/Row/ContactFlowSetupStatusRow.test.tsx b/src/components/Contacts/ContactFlow/ContactFlowSetup/Row/ContactFlowSetupStatusRow.test.tsx
index 0a748b562..d66d9697b 100644
--- a/src/components/Contacts/ContactFlow/ContactFlowSetup/Row/ContactFlowSetupStatusRow.test.tsx
+++ b/src/components/Contacts/ContactFlow/ContactFlowSetup/Row/ContactFlowSetupStatusRow.test.tsx
@@ -3,8 +3,8 @@ import { ThemeProvider } from '@mui/material/styles';
import { render } from '@testing-library/react';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
+import TestWrapper from '__tests__/util/TestWrapper';
import { ContactFilterStatusEnum } from 'src/graphql/types.generated';
-import TestWrapper from '../../../../../../__tests__/util/TestWrapper';
import theme from '../../../../../theme';
import { ContactFlowSetupStatusRow } from './ContactFlowSetupStatusRow';
diff --git a/src/components/Contacts/ContactFlow/ContactFlowSetup/Row/ContactFlowSetupStatusRow.tsx b/src/components/Contacts/ContactFlow/ContactFlowSetup/Row/ContactFlowSetupStatusRow.tsx
index 7ebeb69f1..64fdf9345 100644
--- a/src/components/Contacts/ContactFlow/ContactFlowSetup/Row/ContactFlowSetupStatusRow.tsx
+++ b/src/components/Contacts/ContactFlow/ContactFlowSetup/Row/ContactFlowSetupStatusRow.tsx
@@ -1,6 +1,5 @@
import React, { useEffect } from 'react';
-import Box from '@mui/material/Box';
-import Typography from '@mui/material/Typography';
+import { Box, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useDrag } from 'react-dnd';
import { getEmptyImage } from 'react-dnd-html5-backend';
@@ -8,7 +7,7 @@ import { useTranslation } from 'react-i18next';
import { ContactFilterStatusEnum } from 'src/graphql/types.generated';
import theme from '../../../../../theme';
-export const StatusRow = styled(Box)(() => ({
+const StatusRow = styled(Box)(() => ({
padding: theme.spacing(1.5),
borderBottom: `1px solid ${theme.palette.cruGrayMedium.main}`,
'&:hover': {
diff --git a/src/components/Contacts/ContactFlow/ContactsFlow.test.tsx b/src/components/Contacts/ContactFlow/ContactsFlow.test.tsx
index 6da639283..5927f3a66 100644
--- a/src/components/Contacts/ContactFlow/ContactsFlow.test.tsx
+++ b/src/components/Contacts/ContactFlow/ContactsFlow.test.tsx
@@ -5,8 +5,8 @@ import { SnackbarProvider } from 'notistack';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import TestRouter from '__tests__/util/TestRouter';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
-import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import theme from '../../../theme';
import { ContactFlow } from './ContactFlow';
import { GetUserOptionsQuery } from './GetUserOptions.generated';
@@ -43,7 +43,7 @@ describe('ContactFlow', () => {
-
+
{
selectedFilters={{}}
/>
-
+
@@ -69,7 +69,7 @@ describe('ContactFlow', () => {
mocks={mocks}
>
-
+
{
selectedFilters={{}}
/>
-
+
diff --git a/src/components/Contacts/ContactFlow/DynamicContactFlow.tsx b/src/components/Contacts/ContactFlow/DynamicContactFlow.tsx
new file mode 100644
index 000000000..f1920a759
--- /dev/null
+++ b/src/components/Contacts/ContactFlow/DynamicContactFlow.tsx
@@ -0,0 +1,10 @@
+import dynamic from 'next/dynamic';
+import { DynamicComponentPlaceholder } from 'src/components/DynamicPlaceholders/DynamicComponentPlaceholder';
+
+export const DynamicContactFlow = dynamic(
+ () =>
+ import(/* webpackChunkName: "ContactFlow" */ './ContactFlow').then(
+ ({ ContactFlow }) => ContactFlow,
+ ),
+ { loading: DynamicComponentPlaceholder },
+);
diff --git a/src/components/Contacts/ContactPartnershipStatus/ContactLateStatusLabel/ContactLateStatusLabel.tsx b/src/components/Contacts/ContactPartnershipStatus/ContactLateStatusLabel/ContactLateStatusLabel.tsx
index 8b1ee0705..e0cf5451d 100644
--- a/src/components/Contacts/ContactPartnershipStatus/ContactLateStatusLabel/ContactLateStatusLabel.tsx
+++ b/src/components/Contacts/ContactPartnershipStatus/ContactLateStatusLabel/ContactLateStatusLabel.tsx
@@ -1,5 +1,5 @@
import React, { useMemo } from 'react';
-import Typography from '@mui/material/Typography';
+import { Typography } from '@mui/material';
import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import type { Theme } from '@mui/material/styles/createTheme';
diff --git a/src/components/Contacts/ContactRow/ContactRow.stories.tsx b/src/components/Contacts/ContactRow/ContactRow.stories.tsx
index 412c10d98..77f90a2fb 100644
--- a/src/components/Contacts/ContactRow/ContactRow.stories.tsx
+++ b/src/components/Contacts/ContactRow/ContactRow.stories.tsx
@@ -2,8 +2,8 @@ import React from 'react';
import { Meta, Story } from '@storybook/react';
import { DateTime } from 'luxon';
import { withDesign } from 'storybook-addon-designs';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
-import { gqlMock } from '../../../../__tests__/util/graphqlMocking';
+import { gqlMock } from '__tests__/util/graphqlMocking';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import { ContactRow } from './ContactRow';
import {
ContactRowFragment,
@@ -25,9 +25,9 @@ export const Default: Story = () => {
});
return (
-
+
-
+
);
};
diff --git a/src/components/Contacts/ContactRow/ContactRow.test.tsx b/src/components/Contacts/ContactRow/ContactRow.test.tsx
index ef23d2561..81204b97c 100644
--- a/src/components/Contacts/ContactRow/ContactRow.test.tsx
+++ b/src/components/Contacts/ContactRow/ContactRow.test.tsx
@@ -2,13 +2,10 @@ import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
+import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider, gqlMock } from '__tests__/util/graphqlMocking';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import theme from 'src/theme';
-import TestRouter from '../../../../__tests__/util/TestRouter';
-import {
- GqlMockedProvider,
- gqlMock,
-} from '../../../../__tests__/util/graphqlMocking';
import useTaskModal from '../../../hooks/useTaskModal';
import { ContactRow } from './ContactRow';
import {
@@ -64,6 +61,7 @@ const openTaskModal = jest.fn();
beforeEach(() => {
(useTaskModal as jest.Mock).mockReturnValue({
openTaskModal,
+ preloadTaskModal: jest.fn(),
});
});
@@ -73,9 +71,9 @@ describe('ContactsRow', () => {
-
+
-
+
,
@@ -98,9 +96,9 @@ describe('ContactsRow', () => {
-
+
-
+
,
@@ -117,9 +115,9 @@ describe('ContactsRow', () => {
-
+
-
+
,
@@ -141,9 +139,9 @@ describe('ContactsRow', () => {
-
+
-
+
,
diff --git a/src/components/Contacts/ContactRow/ContactRow.tsx b/src/components/Contacts/ContactRow/ContactRow.tsx
index 7e2c6f839..436e0f9de 100644
--- a/src/components/Contacts/ContactRow/ContactRow.tsx
+++ b/src/components/Contacts/ContactRow/ContactRow.tsx
@@ -14,7 +14,7 @@ import { styled } from '@mui/material/styles';
import {
ContactsContext,
ContactsType,
-} from 'pages/accountLists/[accountListId]/contacts/ContactsContext';
+} from 'src/components/Contacts/ContactsContext/ContactsContext';
import { CelebrationIcons } from '../CelebrationIcons/CelebrationIcons';
import { ContactPartnershipStatus } from '../ContactPartnershipStatus/ContactPartnershipStatus';
import { ContactUncompletedTasksCount } from '../ContactUncompletedTasksCount/ContactUncompletedTasksCount';
diff --git a/src/components/Contacts/ContactUncompletedTasksCount/ContactUncompletedTasksCount.tsx b/src/components/Contacts/ContactUncompletedTasksCount/ContactUncompletedTasksCount.tsx
index 6c36d9ad6..9235b3561 100644
--- a/src/components/Contacts/ContactUncompletedTasksCount/ContactUncompletedTasksCount.tsx
+++ b/src/components/Contacts/ContactUncompletedTasksCount/ContactUncompletedTasksCount.tsx
@@ -1,7 +1,6 @@
import React from 'react';
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
-import Box from '@mui/material/Box';
-import Typography from '@mui/material/Typography';
+import { Box, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import useTaskModal from 'src/hooks/useTaskModal';
@@ -22,7 +21,7 @@ export const ContactUncompletedTasksCount: React.FC<
ContactUncompletedTasksCountProps
> = ({ uncompletedTasksCount, contactId }) => {
const { t } = useTranslation();
- const { openTaskModal } = useTaskModal();
+ const { openTaskModal, preloadTaskModal } = useTaskModal();
return (
@@ -36,6 +35,7 @@ export const ContactUncompletedTasksCount: React.FC<
},
})
}
+ onMouseEnter={() => preloadTaskModal('log')}
/>
{
- return (
-
-
-
-
-
- );
-};
diff --git a/src/components/Contacts/ContactsContainer.tsx b/src/components/Contacts/ContactsContainer.tsx
deleted file mode 100644
index 889eac6db..000000000
--- a/src/components/Contacts/ContactsContainer.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import Head from 'next/head';
-import React, { useContext } from 'react';
-import Box from '@mui/material/Box';
-import { styled } from '@mui/material/styles';
-import _ from 'lodash';
-import { DndProvider } from 'react-dnd';
-import { HTML5Backend } from 'react-dnd-html5-backend';
-import { useTranslation } from 'react-i18next';
-import useGetAppSettings from 'src/hooks/useGetAppSettings';
-import {
- ContactsContext,
- ContactsType,
-} from '../../../pages/accountLists/[accountListId]/contacts/ContactsContext';
-import { SidePanelsLayout } from '../Layouts/SidePanelsLayout';
-import Loading from '../Loading';
-import { TableViewModeEnum, headerHeight } from '../Shared/Header/ListHeader';
-import { ContactFlowDragLayer } from './ContactFlow/ContactFlowDragLayer/ContactFlowDragLayer';
-import { ContactsLeftPanel } from './ContactsLeftPanel/ContactsLeftPanel';
-import { ContactsMainPanel } from './ContactsMainPanel/ContactsMainPanel';
-import { ContactsRightPanel } from './ContactsRightPanel/ContactsRightPanel';
-
-const WhiteBackground = styled(Box)(({ theme }) => ({
- backgroundColor: theme.palette.common.white,
-}));
-
-export const ContactsContainer: React.FC = ({}) => {
- const { t } = useTranslation();
- const {
- accountListId,
- filterPanelOpen,
- contactDetailsOpen,
- viewMode,
- setContactFocus,
- } = useContext(ContactsContext) as ContactsType;
- const { appName } = useGetAppSettings();
-
- return (
- <>
-
-
- {appName} |{' '}
- {viewMode === TableViewModeEnum.Flows
- ? t('Contact Flows')
- : viewMode === TableViewModeEnum.Map
- ? t('Contacts Map')
- : t('Contacts')}
-
-
- {accountListId ? (
-
-
-
- }
- leftOpen={filterPanelOpen}
- leftWidth="290px"
- mainContent={}
- rightPanel={
-
- setContactFocus(
- undefined,
- true,
- viewMode === TableViewModeEnum.Flows,
- viewMode === TableViewModeEnum.Map,
- )
- }
- />
- }
- rightOpen={contactDetailsOpen}
- rightWidth="60%"
- headerHeight={headerHeight}
- />
-
-
- ) : (
-
- )}
- >
- );
-};
diff --git a/pages/accountLists/[accountListId]/contacts/ContactsContext.test.tsx b/src/components/Contacts/ContactsContext/ContactsContext.test.tsx
similarity index 91%
rename from pages/accountLists/[accountListId]/contacts/ContactsContext.test.tsx
rename to src/components/Contacts/ContactsContext/ContactsContext.test.tsx
index 008899a7e..107efadda 100644
--- a/pages/accountLists/[accountListId]/contacts/ContactsContext.test.tsx
+++ b/src/components/Contacts/ContactsContext/ContactsContext.test.tsx
@@ -3,28 +3,28 @@ import { Box, Button, Typography } from '@mui/material';
import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
+import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactFiltersQuery } from 'pages/accountLists/[accountListId]/contacts/Contacts.generated';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import { GetUserOptionsQuery } from 'src/components/Contacts/ContactFlow/GetUserOptions.generated';
-import TestRouter from '../../../../__tests__/util/TestRouter';
-import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
+import { useMassSelection } from '../../../hooks/useMassSelection';
+import theme from '../../../theme';
import {
ListHeaderCheckBoxState,
TableViewModeEnum,
-} from '../../../../src/components/Shared/Header/ListHeader';
-import { useMassSelection } from '../../../../src/hooks/useMassSelection';
-import theme from '../../../../src/theme';
-import { ContactFiltersQuery } from './Contacts.generated';
+} from '../../Shared/Header/ListHeader';
import {
ContactsContext,
ContactsContextSavedFilters,
ContactsType,
} from './ContactsContext';
-import { ContactsPage } from './ContactsPage';
const accountListId = 'account-list-1';
const push = jest.fn();
const isReady = true;
-jest.mock('../../../../src/hooks/useMassSelection');
+jest.mock('src/hooks/useMassSelection');
(useMassSelection as jest.Mock).mockReturnValue({
selectionType: ListHeaderCheckBoxState.Unchecked,
@@ -121,9 +121,9 @@ describe('ContactsPageContext', () => {
},
}}
>
-
+
-
+
,
@@ -164,9 +164,9 @@ describe('ContactsPageContext', () => {
},
}}
>
-
+
-
+
,
@@ -215,9 +215,9 @@ describe('ContactsPageContext', () => {
},
}}
>
-
+
-
+
,
@@ -259,9 +259,9 @@ describe('ContactsPageContext', () => {
},
}}
>
-
+
-
+
,
@@ -295,9 +295,9 @@ describe('ContactsPageContext', () => {
},
}}
>
-
+
-
+
,
diff --git a/pages/accountLists/[accountListId]/contacts/ContactsContext.tsx b/src/components/Contacts/ContactsContext/ContactsContext.tsx
similarity index 91%
rename from pages/accountLists/[accountListId]/contacts/ContactsContext.tsx
rename to src/components/Contacts/ContactsContext/ContactsContext.tsx
index e2c40e691..5f930228e 100644
--- a/pages/accountLists/[accountListId]/contacts/ContactsContext.tsx
+++ b/src/components/Contacts/ContactsContext/ContactsContext.tsx
@@ -1,4 +1,4 @@
-import { NextRouter, useRouter } from 'next/router';
+import { useRouter } from 'next/router';
import React, {
Dispatch,
SetStateAction,
@@ -8,34 +8,36 @@ import React, {
useRef,
useState,
} from 'react';
-import _, { debounce } from 'lodash';
+import { type DebouncedFunc, debounce, omit } from 'lodash';
+import {
+ ContactFiltersQuery,
+ useContactFiltersQuery,
+ useContactsQuery,
+} from 'pages/accountLists/[accountListId]/contacts/Contacts.generated';
+import {
+ coordinatesFromContacts,
+ getRedirectPathname,
+} from 'pages/accountLists/[accountListId]/contacts/helpers';
import { ContactFilterSetInput } from 'src/graphql/types.generated';
import { useGetIdsForMassSelectionQuery } from 'src/hooks/GetIdsForMassSelection.generated';
import { useLocale } from 'src/hooks/useLocale';
import { sanitizeFilters } from 'src/lib/sanitizeFilters';
-import { useUpdateUserOptionsMutation } from '../../../../src/components/Contacts/ContactFlow/ContactFlowSetup/UpdateUserOptions.generated';
-import { useGetUserOptionsQuery } from '../../../../src/components/Contacts/ContactFlow/GetUserOptions.generated';
-import { UserOptionFragment } from '../../../../src/components/Shared/Filters/FilterPanel.generated';
+import { useAccountListId } from '../../../hooks/useAccountListId';
+import { useMassSelection } from '../../../hooks/useMassSelection';
+import { UserOptionFragment } from '../../Shared/Filters/FilterPanel.generated';
import {
ListHeaderCheckBoxState,
TableViewModeEnum,
-} from '../../../../src/components/Shared/Header/ListHeader';
-import { useAccountListId } from '../../../../src/hooks/useAccountListId';
-import { useMassSelection } from '../../../../src/hooks/useMassSelection';
-import {
- ContactFiltersQuery,
- useContactFiltersQuery,
- useContactsQuery,
-} from './Contacts.generated';
-import { coordinatesFromContacts, getRedirectPathname } from './helpers';
-import { Coordinates } from './map/map';
+} from '../../Shared/Header/ListHeader';
+import { useUpdateUserOptionsMutation } from '../ContactFlow/ContactFlowSetup/UpdateUserOptions.generated';
+import { useGetUserOptionsQuery } from '../ContactFlow/GetUserOptions.generated';
+import { Coordinates } from '../ContactsMap/coordinates';
export type ContactsType = {
accountListId: string | undefined;
contactId: string | string[] | undefined;
searchTerm: string | string[] | undefined;
- loading: boolean;
- router: NextRouter;
+ contactsQueryResult: ReturnType;
selectionType: ListHeaderCheckBoxState;
isRowChecked: (id: string) => boolean;
toggleSelectAll: () => void;
@@ -51,7 +53,7 @@ export type ContactsType = {
flows?: boolean,
map?: boolean,
) => void;
- setSearchTerm: _.DebouncedFunc<(searchTerm: string) => void>;
+ setSearchTerm: DebouncedFunc<(searchTerm: string) => void>;
handleViewModeChange: (
event: React.MouseEvent,
view: string,
@@ -176,7 +178,7 @@ export const ContactsProvider: React.FC = ({
[sanitizedFilters, starredFilter, searchTerm],
);
- const { data, loading, fetchMore } = useContactsQuery({
+ const contactsQueryResult = useContactsQuery({
variables: {
accountListId: accountListId ?? '',
contactsFilters,
@@ -184,6 +186,7 @@ export const ContactsProvider: React.FC = ({
},
skip: !accountListId,
});
+ const { data, loading, fetchMore } = contactsQueryResult;
//#region Mass Actions
@@ -209,7 +212,7 @@ export const ContactsProvider: React.FC = ({
toggleSelectionById,
deselectAll,
} = useMassSelection(
- data?.contacts?.totalCount ?? 0,
+ contactCount,
allContactIds,
activeFilters,
searchTerm as string,
@@ -295,7 +298,7 @@ export const ContactsProvider: React.FC = ({
filteredQuery.filters = encodeURI(JSON.stringify({ ids }));
}
if (viewMode !== TableViewModeEnum.Map && urlFilters && urlFilters.ids) {
- const newFilters = _.omit(activeFilters, 'ids');
+ const newFilters = omit(activeFilters, 'ids');
if (Object.keys(newFilters).length > 0) {
filteredQuery.filters = encodeURI(JSON.stringify(newFilters));
} else {
@@ -392,8 +395,7 @@ export const ContactsProvider: React.FC = ({
accountListId: accountListId ?? '',
contactId: contactId,
searchTerm: searchTerm,
- loading: loading,
- router: router,
+ contactsQueryResult: contactsQueryResult,
selectionType: selectionType,
isRowChecked: isRowChecked,
toggleSelectAll: toggleSelectAll,
diff --git a/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.stories.tsx b/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.stories.tsx
index 1e59871f0..ae3f2cdf3 100644
--- a/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.stories.tsx
+++ b/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import { ContactsLeftPanel } from './ContactsLeftPanel';
export default {
@@ -10,9 +10,9 @@ export default {
export const Default = (): ReactElement => {
return (
-
+
-
+
);
};
diff --git a/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.test.tsx b/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.test.tsx
index 9942c9074..4cd3baf6e 100644
--- a/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.test.tsx
+++ b/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.test.tsx
@@ -4,11 +4,11 @@ import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import TestRouter from '__tests__/util/TestRouter';
import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import {
ContactsContext,
ContactsType,
-} from 'pages/accountLists/[accountListId]/contacts/ContactsContext';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
+} from 'src/components/Contacts/ContactsContext/ContactsContext';
import theme from 'src/theme';
import { GetUserOptionsQuery } from '../ContactFlow/GetUserOptions.generated';
import { ContactsLeftPanel } from './ContactsLeftPanel';
@@ -82,12 +82,12 @@ describe('ContactsLeftPanel', () => {
mocks={mocks}
>
-
+
<>
>
-
+
,
diff --git a/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.tsx b/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.tsx
index 009bcd0ea..f8854d6fa 100644
--- a/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.tsx
+++ b/src/components/Contacts/ContactsLeftPanel/ContactsLeftPanel.tsx
@@ -1,12 +1,11 @@
import React from 'react';
-import _ from 'lodash';
+import { DynamicFilterPanel } from 'src/components/Shared/Filters/DynamicFilterPanel';
+import { TableViewModeEnum } from '../../Shared/Header/ListHeader';
import {
ContactsContext,
ContactsType,
-} from '../../../../pages/accountLists/[accountListId]/contacts/ContactsContext';
-import { FilterPanel } from '../../Shared/Filters/FilterPanel';
-import { TableViewModeEnum } from '../../Shared/Header/ListHeader';
-import { ContactsMapPanel } from '../ContactsMap/ContactsMapPanel';
+} from '../ContactsContext/ContactsContext';
+import { DynamicContactsMapPanel } from '../ContactsMap/DynamicContactsMapPanel';
export const ContactsLeftPanel: React.FC = () => {
const {
@@ -24,7 +23,7 @@ export const ContactsLeftPanel: React.FC = () => {
} = React.useContext(ContactsContext) as ContactsType;
return viewMode === TableViewModeEnum.Map ? (
- {
onClose={toggleFilterPanel}
/>
) : filterData && !filtersLoading ? (
- {
return (
-
+
-
+
);
};
diff --git a/src/components/Contacts/ContactsList/ContactsList.tsx b/src/components/Contacts/ContactsList/ContactsList.tsx
index 6817a8202..b1553cc88 100644
--- a/src/components/Contacts/ContactsList/ContactsList.tsx
+++ b/src/components/Contacts/ContactsList/ContactsList.tsx
@@ -3,47 +3,21 @@ import { Box } from '@mui/material';
import {
ContactsContext,
ContactsType,
-} from 'pages/accountLists/[accountListId]/contacts/ContactsContext';
+} from 'src/components/Contacts/ContactsContext/ContactsContext';
import { InfiniteList } from 'src/components/InfiniteList/InfiniteList';
import { navBarHeight } from 'src/components/Layouts/Primary/Primary';
import NullState from 'src/components/Shared/Filters/NullState/NullState';
-import {
- TableViewModeEnum,
- headerHeight,
-} from 'src/components/Shared/Header/ListHeader';
-import { useContactsQuery } from '../../../../pages/accountLists/[accountListId]/contacts/Contacts.generated';
+import { headerHeight } from 'src/components/Shared/Header/ListHeader';
import { ContactRow } from '../ContactRow/ContactRow';
export const ContactsList: React.FC = () => {
const {
- contactId,
- accountListId,
- sanitizedFilters,
+ contactsQueryResult: { data, loading, fetchMore },
searchTerm,
- starredFilter,
- viewMode,
- urlFilters,
isFiltered,
setActiveFilters,
} = React.useContext(ContactsContext) as ContactsType;
- const { data, loading, fetchMore } = useContactsQuery({
- variables: {
- accountListId: accountListId ?? '',
- contactsFilters: {
- ...sanitizedFilters,
- wildcardSearch: searchTerm as string,
- ...starredFilter,
- ids:
- viewMode === TableViewModeEnum.Map && urlFilters
- ? urlFilters.ids
- : [],
- },
- first: contactId?.includes('map') ? 20000 : 25,
- },
- skip: !accountListId,
- });
-
return (
+ import(/* webpackChunkName: "ContactsList" */ './ContactsList').then(
+ ({ ContactsList }) => ContactsList,
+ ),
+ { loading: DynamicComponentPlaceholder },
+);
diff --git a/src/components/Contacts/ContactsMainPanel/ContactsMainPanel.stories.tsx b/src/components/Contacts/ContactsMainPanel/ContactsMainPanel.stories.tsx
index 1c73766cf..30160a8cd 100644
--- a/src/components/Contacts/ContactsMainPanel/ContactsMainPanel.stories.tsx
+++ b/src/components/Contacts/ContactsMainPanel/ContactsMainPanel.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import { ContactsMainPanel } from './ContactsMainPanel';
export default {
@@ -10,9 +10,9 @@ export default {
export const Default = (): ReactElement => {
return (
-
+
-
+
);
};
diff --git a/src/components/Contacts/ContactsMainPanel/ContactsMainPanel.tsx b/src/components/Contacts/ContactsMainPanel/ContactsMainPanel.tsx
index e1656ae57..473188f50 100644
--- a/src/components/Contacts/ContactsMainPanel/ContactsMainPanel.tsx
+++ b/src/components/Contacts/ContactsMainPanel/ContactsMainPanel.tsx
@@ -1,13 +1,12 @@
import React from 'react';
-import _ from 'lodash';
import { TableViewModeEnum } from 'src/components/Shared/Header/ListHeader';
+import { DynamicContactFlow } from '../ContactFlow/DynamicContactFlow';
import {
ContactsContext,
ContactsType,
-} from '../../../../pages/accountLists/[accountListId]/contacts/ContactsContext';
-import { ContactsMap } from '../../../../pages/accountLists/[accountListId]/contacts/map/map';
-import { ContactFlow } from '../ContactFlow/ContactFlow';
-import { ContactsList } from '../ContactsList/ContactsList';
+} from '../ContactsContext/ContactsContext';
+import { DynamicContactsList } from '../ContactsList/DynamicContactsList';
+import { DynamicContactsMap } from '../ContactsMap/DynamicContactsMap';
import { ContactsMainPanelHeader } from './ContactsMainPanelHeader';
export const ContactsMainPanel: React.FC = () => {
@@ -26,9 +25,9 @@ export const ContactsMainPanel: React.FC = () => {
{!userOptionsLoading &&
(viewMode === TableViewModeEnum.List ? (
-
+
) : viewMode === TableViewModeEnum.Flows ? (
- {
onContactSelected={setContactFocus}
/>
) : (
-
+
))}
>
);
diff --git a/src/components/Contacts/ContactsMainPanel/ContactsMainPanelHeader.tsx b/src/components/Contacts/ContactsMainPanel/ContactsMainPanelHeader.tsx
index 09ed6eac3..05e9e5f28 100644
--- a/src/components/Contacts/ContactsMainPanel/ContactsMainPanelHeader.tsx
+++ b/src/components/Contacts/ContactsMainPanel/ContactsMainPanelHeader.tsx
@@ -4,15 +4,15 @@ import FormatListBulleted from '@mui/icons-material/FormatListBulleted';
import Map from '@mui/icons-material/Map';
import Settings from '@mui/icons-material/Settings';
import ViewColumn from '@mui/icons-material/ViewColumn';
-import Box from '@mui/material/Box';
-import Button from '@mui/material/Button';
-import Hidden from '@mui/material/Hidden';
-import ToggleButton from '@mui/material/ToggleButton';
-import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
+import {
+ Box,
+ Button,
+ Hidden,
+ ToggleButton,
+ ToggleButtonGroup,
+} from '@mui/material';
import { styled } from '@mui/material/styles';
-import _ from 'lodash';
import { useTranslation } from 'react-i18next';
-import { useContactsQuery } from 'pages/accountLists/[accountListId]/contacts/Contacts.generated';
import {
ListHeader,
TableViewModeEnum,
@@ -20,7 +20,7 @@ import {
import {
ContactsContext,
ContactsType,
-} from '../../../../pages/accountLists/[accountListId]/contacts/ContactsContext';
+} from '../ContactsContext/ContactsContext';
const ViewSettingsButton = styled(Button)(({ theme }) => ({
textTransform: 'none',
@@ -46,7 +46,7 @@ export const ContactsMainPanelHeader: React.FC = () => {
const {
accountListId,
sanitizedFilters,
- contactId,
+ contactsQueryResult,
toggleFilterPanel,
toggleSelectAll,
setSearchTerm,
@@ -57,28 +57,10 @@ export const ContactsMainPanelHeader: React.FC = () => {
filterPanelOpen,
contactDetailsOpen,
viewMode,
- urlFilters,
handleViewModeChange,
selectedIds,
} = React.useContext(ContactsContext) as ContactsType;
- const { data } = useContactsQuery({
- variables: {
- accountListId: accountListId ?? '',
- contactsFilters: {
- ...sanitizedFilters,
- wildcardSearch: searchTerm as string,
- ...starredFilter,
- ids:
- viewMode === TableViewModeEnum.Map && urlFilters
- ? urlFilters.ids
- : [],
- },
- first: contactId?.includes('map') ? 20000 : 25,
- },
- skip: !accountListId,
- });
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (
{
contactsView={viewMode}
onSearchTermChanged={setSearchTerm}
searchTerm={searchTerm}
- totalItems={data?.contacts?.totalCount}
+ totalItems={contactsQueryResult.data?.contacts.totalCount}
starredFilter={starredFilter}
toggleStarredFilter={setStarredFilter}
headerCheckboxState={selectionType}
diff --git a/src/components/Contacts/ContactsMap/ContactsMap.test.tsx b/src/components/Contacts/ContactsMap/ContactsMap.test.tsx
new file mode 100644
index 000000000..a6ad7ef81
--- /dev/null
+++ b/src/components/Contacts/ContactsMap/ContactsMap.test.tsx
@@ -0,0 +1,33 @@
+import { render, waitForElementToBeRemoved } from '@testing-library/react';
+import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactsProvider } from '../ContactsContext/ContactsContext';
+import { ContactsMap } from './ContactsMap';
+
+describe('ContactsMap', () => {
+ it('renders loading spinner until map loads', () => {
+ const { getByRole } = render(
+
+
+
+
+
+
+ ,
+ );
+
+ const loadingSpinner = getByRole('progressbar');
+ expect(loadingSpinner).toBeInTheDocument();
+ waitForElementToBeRemoved(loadingSpinner);
+ });
+});
diff --git a/pages/accountLists/[accountListId]/contacts/map/map.tsx b/src/components/Contacts/ContactsMap/ContactsMap.tsx
similarity index 94%
rename from pages/accountLists/[accountListId]/contacts/map/map.tsx
rename to src/components/Contacts/ContactsMap/ContactsMap.tsx
index 23903eec8..1e148ae82 100644
--- a/pages/accountLists/[accountListId]/contacts/map/map.tsx
+++ b/src/components/Contacts/ContactsMap/ContactsMap.tsx
@@ -12,7 +12,10 @@ import { useTranslation } from 'react-i18next';
import { StatusEnum } from 'src/graphql/types.generated';
import theme from 'src/theme';
import { sourceToStr } from 'src/utils/sourceToStr';
-import { ContactsContext, ContactsType } from '../ContactsContext';
+import {
+ ContactsContext,
+ ContactsType,
+} from '../ContactsContext/ContactsContext';
const ContactLink = styled(Typography)(({ theme }) => ({
color: theme.palette.mpdxBlue.main,
@@ -28,22 +31,6 @@ const MapLoading = styled(CircularProgress)(() => ({
left: '50%',
}));
-export interface Coordinates {
- id: string;
- name: string;
- avatar: string;
- status?: StatusEnum | null;
- lat?: number;
- lng?: number;
- street?: string | null;
- city?: string | null;
- state?: string | null;
- country?: string | null;
- postal?: string | null;
- source?: string;
- date?: string;
-}
-
const mapContainerStyle = {
height: '100%',
width: '100%',
diff --git a/src/components/Contacts/ContactsMap/ContactsMapPanel.test.tsx b/src/components/Contacts/ContactsMap/ContactsMapPanel.test.tsx
index 34a70390f..19062f85a 100644
--- a/src/components/Contacts/ContactsMap/ContactsMapPanel.test.tsx
+++ b/src/components/Contacts/ContactsMap/ContactsMapPanel.test.tsx
@@ -2,10 +2,10 @@ import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
+import TestRouter from '__tests__/util/TestRouter';
import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import { StatusEnum } from 'src/graphql/types.generated';
-import TestRouter from '../../../../__tests__/util/TestRouter';
import theme from '../../../theme';
import { ContactsMapPanel } from './ContactsMapPanel';
@@ -50,7 +50,7 @@ describe('ContactsMapPanel', () => {
-
+
{
panTo={panTo}
onClose={onClose}
/>
-
+
,
@@ -77,7 +77,7 @@ describe('ContactsMapPanel', () => {
-
+
{
panTo={panTo}
onClose={onClose}
/>
-
+
,
diff --git a/src/components/Contacts/ContactsMap/ContactsMapPanel.tsx b/src/components/Contacts/ContactsMap/ContactsMapPanel.tsx
index 205316b0a..f013cee9b 100644
--- a/src/components/Contacts/ContactsMap/ContactsMapPanel.tsx
+++ b/src/components/Contacts/ContactsMap/ContactsMapPanel.tsx
@@ -18,10 +18,10 @@ import {
} from '@mui/material';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
-import { Coordinates } from 'pages/accountLists/[accountListId]/contacts/map/map';
import { StatusEnum } from 'src/graphql/types.generated';
import theme from 'src/theme';
import { sourceToStr } from 'src/utils/sourceToStr';
+import { Coordinates } from './coordinates';
interface ContactMapsPanelProps {
data: Coordinates[] | undefined;
diff --git a/src/components/Contacts/ContactsMap/DynamicContactsMap.tsx b/src/components/Contacts/ContactsMap/DynamicContactsMap.tsx
new file mode 100644
index 000000000..fe764f4a3
--- /dev/null
+++ b/src/components/Contacts/ContactsMap/DynamicContactsMap.tsx
@@ -0,0 +1,10 @@
+import dynamic from 'next/dynamic';
+import { DynamicComponentPlaceholder } from 'src/components/DynamicPlaceholders/DynamicComponentPlaceholder';
+
+export const DynamicContactsMap = dynamic(
+ () =>
+ import(/* webpackChunkName: "ContactsMap" */ './ContactsMap').then(
+ ({ ContactsMap }) => ContactsMap,
+ ),
+ { loading: DynamicComponentPlaceholder },
+);
diff --git a/src/components/Contacts/ContactsMap/DynamicContactsMapPanel.tsx b/src/components/Contacts/ContactsMap/DynamicContactsMapPanel.tsx
new file mode 100644
index 000000000..0ec5050db
--- /dev/null
+++ b/src/components/Contacts/ContactsMap/DynamicContactsMapPanel.tsx
@@ -0,0 +1,10 @@
+import dynamic from 'next/dynamic';
+import { DynamicComponentPlaceholder } from 'src/components/DynamicPlaceholders/DynamicComponentPlaceholder';
+
+export const DynamicContactsMapPanel = dynamic(
+ () =>
+ import(
+ /* webpackChunkName: "ContactsMapPanel" */ './ContactsMapPanel'
+ ).then(({ ContactsMapPanel }) => ContactsMapPanel),
+ { loading: DynamicComponentPlaceholder },
+);
diff --git a/src/components/Contacts/ContactsMap/coordinates.ts b/src/components/Contacts/ContactsMap/coordinates.ts
new file mode 100644
index 000000000..fe6d1d5b7
--- /dev/null
+++ b/src/components/Contacts/ContactsMap/coordinates.ts
@@ -0,0 +1,17 @@
+import { StatusEnum } from 'src/graphql/types.generated';
+
+export interface Coordinates {
+ id: string;
+ name: string;
+ avatar: string;
+ status?: StatusEnum | null;
+ lat?: number;
+ lng?: number;
+ street?: string | null;
+ city?: string | null;
+ state?: string | null;
+ country?: string | null;
+ postal?: string | null;
+ source?: string;
+ date?: string;
+}
diff --git a/src/components/Contacts/ContactsRightPanel/ContactsRightPanel.stories.tsx b/src/components/Contacts/ContactsRightPanel/ContactsRightPanel.stories.tsx
index 80df53b76..4df45420d 100644
--- a/src/components/Contacts/ContactsRightPanel/ContactsRightPanel.stories.tsx
+++ b/src/components/Contacts/ContactsRightPanel/ContactsRightPanel.stories.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { ContactsPage } from 'pages/accountLists/[accountListId]/contacts/ContactsPage';
+import { ContactsWrapper } from 'pages/accountLists/[accountListId]/contacts/ContactsWrapper';
import { ContactDetailProvider } from '../ContactDetails/ContactDetailContext';
import { ContactsRightPanel } from './ContactsRightPanel';
@@ -9,10 +9,10 @@ export default {
export const Default = (): React.ReactElement => {
return (
-
+
{}} />
-
+
);
};
diff --git a/src/components/Contacts/ContactsRightPanel/DynamicContactsRightPanel.tsx b/src/components/Contacts/ContactsRightPanel/DynamicContactsRightPanel.tsx
new file mode 100644
index 000000000..665bb0e74
--- /dev/null
+++ b/src/components/Contacts/ContactsRightPanel/DynamicContactsRightPanel.tsx
@@ -0,0 +1,10 @@
+import dynamic from 'next/dynamic';
+import { DynamicComponentPlaceholder } from 'src/components/DynamicPlaceholders/DynamicComponentPlaceholder';
+
+export const DynamicContactsRightPanel = dynamic(
+ () =>
+ import(
+ /* webpackChunkName: "ContactsRightPanel" */ './ContactsRightPanel'
+ ).then(({ ContactsRightPanel }) => ContactsRightPanel),
+ { loading: DynamicComponentPlaceholder },
+);
diff --git a/src/components/Contacts/MassActions/AddTags/DynamicMassActionsAddTagsModal.tsx b/src/components/Contacts/MassActions/AddTags/DynamicMassActionsAddTagsModal.tsx
new file mode 100644
index 000000000..96d86c449
--- /dev/null
+++ b/src/components/Contacts/MassActions/AddTags/DynamicMassActionsAddTagsModal.tsx
@@ -0,0 +1,12 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadMassActionsAddTagsModal = () =>
+ import(
+ /* webpackChunkName: "MassActionsAddTagsModal" */ './MassActionsAddTagsModal'
+ ).then(({ MassActionsAddTagsModal }) => MassActionsAddTagsModal);
+
+export const DynamicMassActionsAddTagsModal = dynamic(
+ preloadMassActionsAddTagsModal,
+ { loading: DynamicModalPlaceholder },
+);
diff --git a/src/components/Contacts/MassActions/AddTags/MassActionsAddTagsModal.tsx b/src/components/Contacts/MassActions/AddTags/MassActionsAddTagsModal.tsx
index d3ee96902..84005beca 100644
--- a/src/components/Contacts/MassActions/AddTags/MassActionsAddTagsModal.tsx
+++ b/src/components/Contacts/MassActions/AddTags/MassActionsAddTagsModal.tsx
@@ -15,6 +15,7 @@ import { useSnackbar } from 'notistack';
import { useTranslation } from 'react-i18next';
import * as yup from 'yup';
import { ContactsDocument } from 'pages/accountLists/[accountListId]/contacts/Contacts.generated';
+import { ContactTagIcon, ContactTagInput } from 'src/components/Tags/Tags';
import {
CancelButton,
SubmitButton,
@@ -22,10 +23,6 @@ import {
import { ContactUpdateInput } from 'src/graphql/types.generated';
import theme from 'src/theme';
import Modal from '../../../common/Modal/Modal';
-import {
- ContactTagIcon,
- ContactTagInput,
-} from '../../ContactDetails/ContactDetailsTab/Tags/ContactTags';
import { useGetContactTagListQuery } from '../../ContactDetails/ContactDetailsTab/Tags/ContactTags.generated';
import {
useContactsAddTagsMutation,
diff --git a/src/components/Contacts/MassActions/AddToAppeal/DynamicMassActionsAddToAppealModal.tsx b/src/components/Contacts/MassActions/AddToAppeal/DynamicMassActionsAddToAppealModal.tsx
new file mode 100644
index 000000000..2d16052f6
--- /dev/null
+++ b/src/components/Contacts/MassActions/AddToAppeal/DynamicMassActionsAddToAppealModal.tsx
@@ -0,0 +1,12 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadMassActionsAddToAppealModal = () =>
+ import(
+ /* webpackChunkName: "MassActionsAddToAppealModal" */ './MassActionsAddToAppealModal'
+ ).then(({ MassActionsAddToAppealModal }) => MassActionsAddToAppealModal);
+
+export const DynamicMassActionsAddToAppealModal = dynamic(
+ preloadMassActionsAddToAppealModal,
+ { loading: DynamicModalPlaceholder },
+);
diff --git a/src/components/Contacts/MassActions/AddToAppeal/DynamicMassActionsCreateAppealModal.tsx b/src/components/Contacts/MassActions/AddToAppeal/DynamicMassActionsCreateAppealModal.tsx
new file mode 100644
index 000000000..9bb99f3f1
--- /dev/null
+++ b/src/components/Contacts/MassActions/AddToAppeal/DynamicMassActionsCreateAppealModal.tsx
@@ -0,0 +1,12 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadMassActionsCreateAppealModal = () =>
+ import(
+ /* webpackChunkName: "MassActionsCreateAppealModal" */ './MassActionsCreateAppealModal'
+ ).then(({ MassActionsCreateAppealModal }) => MassActionsCreateAppealModal);
+
+export const DynamicMassActionsCreateAppealModal = dynamic(
+ preloadMassActionsCreateAppealModal,
+ { loading: DynamicModalPlaceholder },
+);
diff --git a/src/components/Contacts/MassActions/EditFields/DynamicMassActionsEditFieldsModal.tsx b/src/components/Contacts/MassActions/EditFields/DynamicMassActionsEditFieldsModal.tsx
new file mode 100644
index 000000000..2af618bf4
--- /dev/null
+++ b/src/components/Contacts/MassActions/EditFields/DynamicMassActionsEditFieldsModal.tsx
@@ -0,0 +1,12 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadMassActionsEditFieldsModal = () =>
+ import(
+ /* webpackChunkName: "MassActionsEditFieldsModal" */ './MassActionsEditFieldsModal'
+ ).then(({ MassActionsEditFieldsModal }) => MassActionsEditFieldsModal);
+
+export const DynamicMassActionsEditFieldsModal = dynamic(
+ preloadMassActionsEditFieldsModal,
+ { loading: DynamicModalPlaceholder },
+);
diff --git a/src/components/Contacts/MassActions/Exports/DynamicExportsModal.tsx b/src/components/Contacts/MassActions/Exports/DynamicExportsModal.tsx
new file mode 100644
index 000000000..4af38e809
--- /dev/null
+++ b/src/components/Contacts/MassActions/Exports/DynamicExportsModal.tsx
@@ -0,0 +1,11 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadExportsModal = () =>
+ import(/* webpackChunkName: "ExportsModal" */ './ExportsModal').then(
+ ({ ExportsModal }) => ExportsModal,
+ );
+
+export const DynamicExportsModal = dynamic(preloadExportsModal, {
+ loading: DynamicModalPlaceholder,
+});
diff --git a/src/components/Contacts/MassActions/Exports/Emails/DynamicMassActionsExportEmailsModal.tsx b/src/components/Contacts/MassActions/Exports/Emails/DynamicMassActionsExportEmailsModal.tsx
new file mode 100644
index 000000000..f0260010e
--- /dev/null
+++ b/src/components/Contacts/MassActions/Exports/Emails/DynamicMassActionsExportEmailsModal.tsx
@@ -0,0 +1,12 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadMassActionsExportEmailsModal = () =>
+ import(
+ /* webpackChunkName: "MassActionsExportEmailsModal" */ './MassActionsExportEmailsModal'
+ ).then(({ MassActionsExportEmailsModal }) => MassActionsExportEmailsModal);
+
+export const DynamicMassActionsExportEmailsModal = dynamic(
+ preloadMassActionsExportEmailsModal,
+ { loading: DynamicModalPlaceholder },
+);
diff --git a/src/components/Contacts/MassActions/Exports/MailMergedLabelModal/DynamicMailMergedLabelModal.tsx b/src/components/Contacts/MassActions/Exports/MailMergedLabelModal/DynamicMailMergedLabelModal.tsx
new file mode 100644
index 000000000..8e7ef9331
--- /dev/null
+++ b/src/components/Contacts/MassActions/Exports/MailMergedLabelModal/DynamicMailMergedLabelModal.tsx
@@ -0,0 +1,12 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadMailMergedLabelModal = () =>
+ import(
+ /* webpackChunkName: "MailMergedLabelModal" */ './MailMergedLabelModal'
+ ).then(({ MailMergedLabelModal }) => MailMergedLabelModal);
+
+export const DynamicMailMergedLabelModal = dynamic(
+ preloadMailMergedLabelModal,
+ { loading: DynamicModalPlaceholder },
+);
diff --git a/src/components/Contacts/MassActions/Merge/DynamicMassActionsMergeModal.tsx b/src/components/Contacts/MassActions/Merge/DynamicMassActionsMergeModal.tsx
new file mode 100644
index 000000000..0fd9e3360
--- /dev/null
+++ b/src/components/Contacts/MassActions/Merge/DynamicMassActionsMergeModal.tsx
@@ -0,0 +1,12 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadMassActionsMergeModal = () =>
+ import(
+ /* webpackChunkName: "MassActionsMergeModal" */ './MassActionsMergeModal'
+ ).then(({ MassActionsMergeModal }) => MassActionsMergeModal);
+
+export const DynamicMassActionsMergeModal = dynamic(
+ preloadMassActionsMergeModal,
+ { loading: DynamicModalPlaceholder },
+);
diff --git a/src/components/Contacts/MassActions/Merge/MassActionsMergeModal.test.tsx b/src/components/Contacts/MassActions/Merge/MassActionsMergeModal.test.tsx
index 8604374bc..1cb8f151a 100644
--- a/src/components/Contacts/MassActions/Merge/MassActionsMergeModal.test.tsx
+++ b/src/components/Contacts/MassActions/Merge/MassActionsMergeModal.test.tsx
@@ -4,13 +4,13 @@ import { queryByText, render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import {
ContactsContext,
ContactsProvider,
ContactsType,
-} from 'pages/accountLists/[accountListId]/contacts/ContactsContext';
+} from 'src/components/Contacts/ContactsContext/ContactsContext';
import { StatusEnum } from 'src/graphql/types.generated';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
import theme from '../../../../theme';
import { GetContactsForMergingQuery } from './MassActionsMerge.generated';
import { MassActionsMergeModal } from './MassActionsMergeModal';
diff --git a/src/components/Contacts/MassActions/Merge/MassActionsMergeModal.tsx b/src/components/Contacts/MassActions/Merge/MassActionsMergeModal.tsx
index 51efb45bd..06c9b8e9f 100644
--- a/src/components/Contacts/MassActions/Merge/MassActionsMergeModal.tsx
+++ b/src/components/Contacts/MassActions/Merge/MassActionsMergeModal.tsx
@@ -17,14 +17,14 @@ import {
SubmitButton,
} from 'src/components/common/Modal/ActionButtons/ActionButtons';
import { useLocale } from 'src/hooks/useLocale';
-import { dateFormatShort } from 'src/lib/intlFormat/intlFormat';
+import { dateFormatShort } from 'src/lib/intlFormat';
import theme from 'src/theme';
import { getLocalizedContactStatus } from 'src/utils/functions/getLocalizedContactStatus';
+import Modal from '../../../common/Modal/Modal';
import {
ContactsContext,
ContactsType,
-} from '../../../../../pages/accountLists/[accountListId]/contacts/ContactsContext';
-import Modal from '../../../common/Modal/Modal';
+} from '../../ContactsContext/ContactsContext';
import {
useGetContactsForMergingQuery,
useMassActionsMergeMutation,
diff --git a/src/components/Contacts/MassActions/MergePeople/MergePeopleModal.test.tsx b/src/components/Contacts/MassActions/MergePeople/MergePeopleModal.test.tsx
index 1dc8bf13b..2a4966a74 100644
--- a/src/components/Contacts/MassActions/MergePeople/MergePeopleModal.test.tsx
+++ b/src/components/Contacts/MassActions/MergePeople/MergePeopleModal.test.tsx
@@ -3,7 +3,7 @@ import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import theme from '../../../../theme';
import { MergePeopleModal } from './MergePeopleModal';
diff --git a/src/components/Contacts/MassActions/RemoveTags/DynamicMassActionsRemoveTagsModal.tsx b/src/components/Contacts/MassActions/RemoveTags/DynamicMassActionsRemoveTagsModal.tsx
new file mode 100644
index 000000000..78f1b4823
--- /dev/null
+++ b/src/components/Contacts/MassActions/RemoveTags/DynamicMassActionsRemoveTagsModal.tsx
@@ -0,0 +1,12 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadMassActionsRemoveTagsModal = () =>
+ import(
+ /* webpackChunkName: "MassActionsRemoveTagsModal" */ './MassActionsRemoveTagsModal'
+ ).then(({ MassActionsRemoveTagsModal }) => MassActionsRemoveTagsModal);
+
+export const DynamicMassActionsRemoveTagsModal = dynamic(
+ preloadMassActionsRemoveTagsModal,
+ { loading: DynamicModalPlaceholder },
+);
diff --git a/src/components/Contacts/MassActions/RemoveTags/MassActionsRemoveTagsModal.test.tsx b/src/components/Contacts/MassActions/RemoveTags/MassActionsRemoveTagsModal.test.tsx
index 225e2b4e4..414930275 100644
--- a/src/components/Contacts/MassActions/RemoveTags/MassActionsRemoveTagsModal.test.tsx
+++ b/src/components/Contacts/MassActions/RemoveTags/MassActionsRemoveTagsModal.test.tsx
@@ -5,7 +5,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import theme from '../../../../theme';
import { MassActionsRemoveTagsModal } from './MassActionsRemoveTagsModal';
diff --git a/src/components/Contacts/StarContactIconButton/StarContactIconButton.stories.tsx b/src/components/Contacts/StarContactIconButton/StarContactIconButton.stories.tsx
index 26ac27c94..6918f41a7 100644
--- a/src/components/Contacts/StarContactIconButton/StarContactIconButton.stories.tsx
+++ b/src/components/Contacts/StarContactIconButton/StarContactIconButton.stories.tsx
@@ -1,5 +1,5 @@
import React, { ReactElement } from 'react';
-import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { SetContactStarredMutation } from './SetContactStarred.generated';
import { StarContactIconButton } from './StarContactIconButton';
diff --git a/src/components/Contacts/StarContactIconButton/StarContactIconButton.test.tsx b/src/components/Contacts/StarContactIconButton/StarContactIconButton.test.tsx
index dd51460d9..05129ac39 100644
--- a/src/components/Contacts/StarContactIconButton/StarContactIconButton.test.tsx
+++ b/src/components/Contacts/StarContactIconButton/StarContactIconButton.test.tsx
@@ -3,7 +3,7 @@ import { ThemeProvider } from '@mui/material/styles';
import { waitFor } from '@testing-library/dom';
import { render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
-import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import theme from '../../../theme';
import { StarContactIconButton } from './StarContactIconButton';
diff --git a/src/components/Dashboard/Balance/Balance.test.tsx b/src/components/Dashboard/Balance/Balance.test.tsx
index 3b0d34bf1..b60911100 100644
--- a/src/components/Dashboard/Balance/Balance.test.tsx
+++ b/src/components/Dashboard/Balance/Balance.test.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from '@testing-library/react';
-import { GqlMockedProvider } from '../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import Balance from '.';
jest.mock('next/router', () => ({
diff --git a/src/components/Dashboard/Balance/Balance.tsx b/src/components/Dashboard/Balance/Balance.tsx
index d7010a1da..207986cf7 100644
--- a/src/components/Dashboard/Balance/Balance.tsx
+++ b/src/components/Dashboard/Balance/Balance.tsx
@@ -5,10 +5,10 @@ import {
Button,
CardActions,
CardContent,
+ Skeleton,
Theme,
Typography,
} from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
import { useTranslation } from 'react-i18next';
import { makeStyles } from 'tss-react/mui';
import { useAccountListId } from 'src/hooks/useAccountListId';
diff --git a/src/components/Dashboard/Dashboard.stories.tsx b/src/components/Dashboard/Dashboard.stories.tsx
index decc4cc5e..67f1a5180 100644
--- a/src/components/Dashboard/Dashboard.stories.tsx
+++ b/src/components/Dashboard/Dashboard.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { MockedProvider } from '@apollo/client/testing';
-import { GetDashboardQuery } from '../../../pages/accountLists/GetDashboard.generated';
+import { GetDashboardQuery } from 'pages/accountLists/GetDashboard.generated';
import { GetThisWeekDefaultMocks } from './ThisWeek/ThisWeek.mock';
import Dashboard from '.';
diff --git a/src/components/Dashboard/Dashboard.test.tsx b/src/components/Dashboard/Dashboard.test.tsx
index f7b6bce86..de12a92a2 100644
--- a/src/components/Dashboard/Dashboard.test.tsx
+++ b/src/components/Dashboard/Dashboard.test.tsx
@@ -3,12 +3,12 @@ import { MockedProvider } from '@apollo/client/testing';
import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
import { SnackbarProvider } from 'notistack';
-import matchMediaMock from '../../../__tests__/util/matchMediaMock';
+import matchMediaMock from '__tests__/util/matchMediaMock';
import {
afterTestResizeObserver,
beforeTestResizeObserver,
-} from '../../../__tests__/util/windowResizeObserver';
-import { GetDashboardQuery } from '../../../pages/accountLists/GetDashboard.generated';
+} from '__tests__/util/windowResizeObserver';
+import { GetDashboardQuery } from 'pages/accountLists/GetDashboard.generated';
import useTaskModal from '../../hooks/useTaskModal';
import theme from '../../theme';
import { GetThisWeekDefaultMocks } from './ThisWeek/ThisWeek.mock';
@@ -27,6 +27,7 @@ jest.mock('next/router', () => ({
beforeEach(() => {
(useTaskModal as jest.Mock).mockReturnValue({
openTaskModal: jest.fn(),
+ preloadTaskModal: jest.fn(),
});
});
diff --git a/src/components/Dashboard/Dashboard.tsx b/src/components/Dashboard/Dashboard.tsx
index 8a09c7fe3..a0abbdf05 100644
--- a/src/components/Dashboard/Dashboard.tsx
+++ b/src/components/Dashboard/Dashboard.tsx
@@ -1,7 +1,7 @@
import React, { ReactElement } from 'react';
import { Box, Container, Grid } from '@mui/material';
import { motion } from 'framer-motion';
-import { GetDashboardQuery } from '../../../pages/accountLists/GetDashboard.generated';
+import { GetDashboardQuery } from 'pages/accountLists/GetDashboard.generated';
import Balance from './Balance';
import DonationHistories from './DonationHistories';
import MonthlyGoal from './MonthlyGoal/MonthlyGoal';
diff --git a/src/components/Dashboard/DonationHistories/DonationHistories.tsx b/src/components/Dashboard/DonationHistories/DonationHistories.tsx
index bdc779424..581685c8b 100644
--- a/src/components/Dashboard/DonationHistories/DonationHistories.tsx
+++ b/src/components/Dashboard/DonationHistories/DonationHistories.tsx
@@ -5,10 +5,10 @@ import {
CardContent,
CardHeader,
Grid,
+ Skeleton,
Theme,
Typography,
} from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
import {
diff --git a/src/components/Dashboard/MonthlyGoal/MonthlyGoal.test.tsx b/src/components/Dashboard/MonthlyGoal/MonthlyGoal.test.tsx
index 8fe63bc1f..ca2f2c32b 100644
--- a/src/components/Dashboard/MonthlyGoal/MonthlyGoal.test.tsx
+++ b/src/components/Dashboard/MonthlyGoal/MonthlyGoal.test.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from '@testing-library/react';
-import matchMediaMock from '../../../../__tests__/util/matchMediaMock';
+import matchMediaMock from '__tests__/util/matchMediaMock';
import MonthlyGoal from './MonthlyGoal';
describe('MonthlyGoal', () => {
diff --git a/src/components/Dashboard/MonthlyGoal/MonthlyGoal.tsx b/src/components/Dashboard/MonthlyGoal/MonthlyGoal.tsx
index c8e06e74f..ffe4040c3 100644
--- a/src/components/Dashboard/MonthlyGoal/MonthlyGoal.tsx
+++ b/src/components/Dashboard/MonthlyGoal/MonthlyGoal.tsx
@@ -5,10 +5,10 @@ import {
CardContent,
Grid,
Hidden,
+ Skeleton,
Theme,
Typography,
} from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
import { useTranslation } from 'react-i18next';
import { makeStyles } from 'tss-react/mui';
import {
diff --git a/src/components/Dashboard/ThisWeek/Appeals/Appeals.test.tsx b/src/components/Dashboard/ThisWeek/Appeals/Appeals.test.tsx
index e3e810e18..d43edf7f8 100644
--- a/src/components/Dashboard/ThisWeek/Appeals/Appeals.test.tsx
+++ b/src/components/Dashboard/ThisWeek/Appeals/Appeals.test.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from '@testing-library/react';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import Appeals from '.';
jest.mock('next/router', () => ({
diff --git a/src/components/Dashboard/ThisWeek/Appeals/Appeals.tsx b/src/components/Dashboard/ThisWeek/Appeals/Appeals.tsx
index 962fd90bd..1c2d2f55e 100644
--- a/src/components/Dashboard/ThisWeek/Appeals/Appeals.tsx
+++ b/src/components/Dashboard/ThisWeek/Appeals/Appeals.tsx
@@ -7,10 +7,10 @@ import {
CardHeader,
Grid,
Link,
+ Skeleton,
Theme,
Typography,
} from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
import { motion } from 'framer-motion';
import { useTranslation } from 'react-i18next';
import { makeStyles } from 'tss-react/mui';
diff --git a/src/components/Dashboard/ThisWeek/LateCommitments/LateCommitments.test.tsx b/src/components/Dashboard/ThisWeek/LateCommitments/LateCommitments.test.tsx
index 9148e18bc..a533e7dff 100644
--- a/src/components/Dashboard/ThisWeek/LateCommitments/LateCommitments.test.tsx
+++ b/src/components/Dashboard/ThisWeek/LateCommitments/LateCommitments.test.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
-import { render } from '../../../../../__tests__/util/testingLibraryReactMock';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { render } from '__tests__/util/testingLibraryReactMock';
import LateCommitments from './LateCommitments';
jest.mock('next/router', () => ({
diff --git a/src/components/Dashboard/ThisWeek/LateCommitments/LateCommitments.tsx b/src/components/Dashboard/ThisWeek/LateCommitments/LateCommitments.tsx
index 06ebdc141..94afa4d42 100644
--- a/src/components/Dashboard/ThisWeek/LateCommitments/LateCommitments.tsx
+++ b/src/components/Dashboard/ThisWeek/LateCommitments/LateCommitments.tsx
@@ -8,8 +8,8 @@ import {
List,
ListItem,
ListItemText,
+ Skeleton,
} from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
import { styled } from '@mui/material/styles';
import { motion } from 'framer-motion';
import { DateTime } from 'luxon';
@@ -23,7 +23,7 @@ import {
} from 'src/graphql/types.generated';
import { useAccountListId } from 'src/hooks/useAccountListId';
import { useLocale } from 'src/hooks/useLocale';
-import { numberFormat } from 'src/lib/intlFormat/intlFormat';
+import { numberFormat } from 'src/lib/intlFormat';
import illustration14 from '../../../../images/drawkit/grape/drawkit-grape-pack-illustration-14.svg';
import AnimatedCard from '../../../AnimatedCard';
import { GetThisWeekQuery } from '../GetThisWeek.generated';
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/DynamicExportEmail.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/DynamicExportEmail.tsx
new file mode 100644
index 000000000..9a542182d
--- /dev/null
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/DynamicExportEmail.tsx
@@ -0,0 +1,9 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadExportEmail = () =>
+ import(/* webpackChunkName: "ExportEmail" */ './ExportEmail');
+
+export const DynamicExportEmail = dynamic(preloadExportEmail, {
+ loading: DynamicModalPlaceholder,
+});
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.stories.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.stories.tsx
index 84f491fa8..b8dbee590 100644
--- a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.stories.tsx
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { MockedProvider } from '@apollo/client/testing';
-import { GqlMockedProvider } from '../../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import ExportEmail from './ExportEmail';
import {
GetEmailNewsletterContactsDocument,
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.test.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.test.tsx
index eee07fa87..12847e786 100644
--- a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.test.tsx
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.test.tsx
@@ -2,7 +2,7 @@ import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
-import { GqlMockedProvider } from '../../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import theme from '../../../../../../theme';
import ExportEmail from './ExportEmail';
import { GetEmailNewsletterContactsQuery } from './GetNewsletterContacts.generated';
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.tsx
index d744e178e..75ea51492 100644
--- a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.tsx
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportEmail/ExportEmail.tsx
@@ -7,9 +7,9 @@ import {
DialogContentText,
DialogTitle,
IconButton,
+ Skeleton,
TextareaAutosize,
} from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { useFetchAllPages } from 'src/hooks/useFetchAllPages';
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportPhysical/DynamicExportPhysical.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportPhysical/DynamicExportPhysical.tsx
new file mode 100644
index 000000000..6893c29f1
--- /dev/null
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportPhysical/DynamicExportPhysical.tsx
@@ -0,0 +1,9 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadExportPhysical = () =>
+ import(/* webpackChunkName: "ExportPhysical" */ './ExportPhysical');
+
+export const DynamicExportPhysical = dynamic(preloadExportPhysical, {
+ loading: DynamicModalPlaceholder,
+});
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportPhysical/ExportPhysical.stories.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportPhysical/ExportPhysical.stories.tsx
index bf132f94b..ff828397d 100644
--- a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportPhysical/ExportPhysical.stories.tsx
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportPhysical/ExportPhysical.stories.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { SessionProvider } from 'next-auth/react';
-import { GqlMockedProvider } from '../../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import ExportPhysical from './ExportPhysical';
export default {
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportPhysical/ExportPhysical.test.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportPhysical/ExportPhysical.test.tsx
index 9f76e94b8..0d789f81c 100644
--- a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportPhysical/ExportPhysical.test.tsx
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/ExportPhysical/ExportPhysical.test.tsx
@@ -2,12 +2,12 @@ import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import {
ExportFormatEnum,
ExportLabelTypeEnum,
ExportSortEnum,
} from 'src/graphql/types.generated';
-import { GqlMockedProvider } from '../../../../../../../__tests__/util/graphqlMocking';
import theme from '../../../../../../theme';
import ExportPhysical from './ExportPhysical';
import { CreateExportedContactsMutation } from './ExportPhysical.generated';
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/LogNewsLetter/DynamicLogNewsletter.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/LogNewsLetter/DynamicLogNewsletter.tsx
new file mode 100644
index 000000000..5cccf7ffb
--- /dev/null
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/LogNewsLetter/DynamicLogNewsletter.tsx
@@ -0,0 +1,9 @@
+import dynamic from 'next/dynamic';
+import { DynamicModalPlaceholder } from 'src/components/DynamicPlaceholders/DynamicModalPlaceholder';
+
+export const preloadLogNewsletter = () =>
+ import(/* webpackChunkName: "LogNewsletter" */ './LogNewsletter');
+
+export const DynamicLogNewsletter = dynamic(preloadLogNewsletter, {
+ loading: DynamicModalPlaceholder,
+});
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/LogNewsLetter/LogNewsletter.stories.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/LogNewsLetter/LogNewsletter.stories.tsx
index 31bbc570c..560d20994 100644
--- a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/LogNewsLetter/LogNewsletter.stories.tsx
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/LogNewsLetter/LogNewsletter.stories.tsx
@@ -1,5 +1,5 @@
import React, { ReactElement } from 'react';
-import { GqlMockedProvider } from '../../../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import LogNewsletter from './LogNewsletter';
export default {
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/LogNewsLetter/LogNewsletter.test.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/LogNewsLetter/LogNewsletter.test.tsx
index 4d57ba2c2..4f7fd08d3 100644
--- a/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/LogNewsLetter/LogNewsletter.test.tsx
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/MenuItems/LogNewsLetter/LogNewsletter.test.tsx
@@ -6,9 +6,9 @@ import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { Settings } from 'luxon';
import { SnackbarProvider } from 'notistack';
+import TestWrapper from '__tests__/util/TestWrapper';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import { ActivityTypeEnum } from 'src/graphql/types.generated';
-import TestWrapper from '../../../../../../../__tests__/util/TestWrapper';
-import { GqlMockedProvider } from '../../../../../../../__tests__/util/graphqlMocking';
import theme from '../../../../../../theme';
import { createNewsletterTaskMutationMock } from './LogNewsLetter.mock';
import LogNewsletter from './LogNewsletter';
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.stories.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.stories.tsx
index 0395b4b4b..10e020edc 100644
--- a/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.stories.tsx
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.stories.tsx
@@ -1,7 +1,7 @@
import React, { ReactElement } from 'react';
import { MockedProvider } from '@apollo/client/testing';
import { GraphQLError } from 'graphql';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import {
GetEmailNewsletterContactsDocument,
GetEmailNewsletterContactsQuery,
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.test.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.test.tsx
index 6bbc6307a..49ae4b3c2 100644
--- a/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.test.tsx
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.test.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
-import { GqlMockedProvider } from '../../../../../__tests__/util/graphqlMocking';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import NewsletterMenu from './NewsletterMenu';
import { GetTaskAnalyticsQuery } from './NewsletterMenu.generated';
diff --git a/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.tsx b/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.tsx
index f0807ce84..e16c5b85c 100644
--- a/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.tsx
+++ b/src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.tsx
@@ -1,15 +1,30 @@
import React, { ReactElement, useState } from 'react';
import ArrowDropDown from '@mui/icons-material/ArrowDropDown';
-import { Button, Dialog, ListItemText, Menu, MenuItem } from '@mui/material';
-import Skeleton from '@mui/material/Skeleton';
+import {
+ Button,
+ Dialog,
+ ListItemText,
+ Menu,
+ MenuItem,
+ Skeleton,
+} from '@mui/material';
import { styled } from '@mui/material/styles';
import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
import { useLocale } from 'src/hooks/useLocale';
-import { dateFormat } from 'src/lib/intlFormat/intlFormat';
-import ExportEmail from './MenuItems/ExportEmail/ExportEmail';
-import ExportPhysical from './MenuItems/ExportPhysical/ExportPhysical';
-import LogNewsletter from './MenuItems/LogNewsLetter/LogNewsletter';
+import { dateFormat } from 'src/lib/intlFormat';
+import {
+ DynamicExportEmail,
+ preloadExportEmail,
+} from './MenuItems/ExportEmail/DynamicExportEmail';
+import {
+ DynamicExportPhysical,
+ preloadExportPhysical,
+} from './MenuItems/ExportPhysical/DynamicExportPhysical';
+import {
+ DynamicLogNewsletter,
+ preloadLogNewsletter,
+} from './MenuItems/LogNewsLetter/DynamicLogNewsletter';
import { useGetTaskAnalyticsQuery } from './NewsletterMenu.generated';
interface Props {
@@ -85,21 +100,21 @@ const NewsletterMenu = ({ accountListId }: Props): ReactElement => {
switch (selectedMenuItem) {
case 0:
return (
-
);
case 1:
return (
-
);
case 2:
return (
-
@@ -153,13 +168,22 @@ const NewsletterMenu = ({ accountListId }: Props): ReactElement => {
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
transformOrigin={{ vertical: 'top', horizontal: 'center' }}
>
-