-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #895 from CruGlobal/lazy-components
[no-Jira] Reduce initial client bundle size
- Loading branch information
Showing
463 changed files
with
2,946 additions
and
2,442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...[accountListId]/contacts/ContactsPage.tsx → ...countListId]/contacts/ContactsWrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 74 additions & 10 deletions
84
pages/accountLists/[accountListId]/contacts/[[...contactId]].page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<ContactsPage> | ||
<ContactsContainer /> | ||
</ContactsPage> | ||
<> | ||
<Head> | ||
<title> | ||
{appName} |{' '} | ||
{viewMode === TableViewModeEnum.Flows | ||
? t('Contact Flows') | ||
: viewMode === TableViewModeEnum.Map | ||
? t('Contacts Map') | ||
: t('Contacts')} | ||
</title> | ||
</Head> | ||
{accountListId ? ( | ||
<SidePanelsLayout | ||
leftPanel={<ContactsLeftPanel />} | ||
leftOpen={filterPanelOpen} | ||
leftWidth="290px" | ||
mainContent={<ContactsMainPanel />} | ||
rightPanel={ | ||
<DynamicContactsRightPanel | ||
onClose={() => | ||
setContactFocus( | ||
undefined, | ||
true, | ||
viewMode === TableViewModeEnum.Flows, | ||
viewMode === TableViewModeEnum.Map, | ||
) | ||
} | ||
/> | ||
} | ||
rightOpen={contactDetailsOpen} | ||
rightWidth="60%" | ||
headerHeight={headerHeight} | ||
/> | ||
) : ( | ||
<Loading loading /> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export const getServerSideProps = loadSession; | ||
const ContactsPage: React.FC = () => ( | ||
<ContactsWrapper> | ||
<Contacts /> | ||
</ContactsWrapper> | ||
); | ||
|
||
export default Contacts; | ||
export default ContactsPage; | ||
|
||
export const getServerSideProps = loadSession; |
15 changes: 15 additions & 0 deletions
15
pages/accountLists/[accountListId]/contacts/[[...contactId]].stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<GqlMockedProvider> | ||
<ContactsPage /> | ||
</GqlMockedProvider> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.